/* Reset & Variables */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --card: #212121;
  --card-hover: #2a2a2a;
  --border: #2e2e2e;
  --accent: #c0392b;
  --accent-h: #e74c3c;
  --accent-dim: rgba(192, 57, 43, 0.15);
  --text: #e2e2e2;
  --text-dim: #888;
  --text-faint: #4a4a4a;
  --player-h: 72px;
  --header-h: 56px;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + 16px);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* Header */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

#site-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

#site-title span { color: var(--accent); }

#search-wrap {
  flex: 1;
  max-width: 380px;
  position: relative;
}

#search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px 7px 36px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text-faint); }

#search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  font-size: 14px;
}

#header-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-link {
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.header-link:hover { color: var(--text); border-color: #555; }

/* Main container */
#main { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-h); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--text); }

/* Page title */
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

/* Stats bar */
#stats-bar {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 28px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat { text-align: center; }
.stat-num { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); }

/* Scroll-to-top */
#scroll-top {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, background 0.15s, color 0.15s;
  z-index: 150;
}

#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover { background: var(--card-hover); color: var(--text); }

/* Letter section */
.letter-section { margin-bottom: 32px; }

.letter-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* Artist grid */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.artist-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  display: block;
}

.artist-card:hover {
  background: var(--card-hover);
  border-color: #444;
  transform: translateY(-1px);
}

.artist-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* Unknown section */
#unknown-notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

#unknown-notice a { color: var(--accent-h); text-decoration: none; }
#unknown-notice a:hover { text-decoration: underline; }

/* Album grid */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.album-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  display: block;
}

.album-card:hover {
  background: var(--card-hover);
  border-color: #444;
  transform: translateY(-2px);
}

.album-art-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--text-faint);
  overflow: hidden;
}

.album-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.art-note { font-size: 40px; color: var(--text-faint); }

.album-info { padding: 12px 14px; }
.album-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.album-meta { font-size: 12px; color: var(--text-dim); }

/* Album view header */
.album-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.album-art-display {
  width: 180px;
  min-width: 180px;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.album-header-info { flex: 1; min-width: 0; }

/* Track list */
#album-view .page-title { margin-bottom: 2px; }
#album-artist-name { font-size: 14px; color: var(--accent); margin-bottom: 4px; }

.track-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.12s, border-color 0.12s;
  font-family: var(--font);
}

.btn-play-all {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-play-all:hover { background: var(--accent-h); border-color: var(--accent-h); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
}
.btn-ghost:hover { background: var(--card-hover); border-color: #444; }

.track-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.track-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.track-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.track-stats {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
}

.track-row:last-child { border-bottom: none; }
.track-row:hover { background: var(--card); }
.track-row.playing { background: var(--accent-dim); }
.track-row.playing .track-title { color: var(--accent-h); }

.track-num {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
  text-align: right;
}

.track-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
}

.track-dl {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.12s;
  display: flex;
  align-items: center;
}
.track-dl:hover { color: var(--accent-h); }

/* Player bar */
#player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--player-h);
  background: rgba(20, 20, 20, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 200;
}

#player.visible { display: flex; }

#player-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}

#player-close:hover { color: var(--text); background: var(--card); }

#player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#player-track {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

#player-artist-album {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  font-size: 16px;
  transition: color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

.ctrl-btn:hover { color: var(--text); background: var(--card); }

#play-pause-btn {
  background: var(--accent);
  color: #fff;
  width: 40px;
  height: 40px;
  font-size: 18px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

#play-pause-btn:hover { background: var(--accent-h); }

#player-progress-wrap {
  flex: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

#player-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: nowrap;
}

#progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

#progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width 0.25s linear;
}

#progress-bar:hover #progress-fill { background: var(--accent-h); }

/* Empty / loading states */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state p { margin-bottom: 8px; }

/* No-results */
#no-results {
  display: none;
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* Hit counter */
#hit-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}

.counter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}

#hit-counter-val {
  background: #0a0a0a;
  color: #00cc44;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 2px 8px 2px 6px;
  border: 1px solid #00cc44;
  border-radius: 3px;
  min-width: 72px;
  text-align: center;
  box-shadow: 0 0 6px rgba(0, 204, 68, 0.25);
}

/* Footer */
#site-footer {
  max-width: 1100px;
  margin: 40px auto 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Responsive */
@media (max-width: 640px) {
  #stats-bar { gap: 12px; overflow-x: auto; }
  .artist-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  #player-progress-wrap { display: none; }
  #header-links { display: none; }
  #search-wrap { max-width: none; }
  .track-row { grid-template-columns: 28px 1fr auto; }
  .track-duration { display: none; }
  .album-header { flex-direction: column; }
  .album-art-display { width: 100%; min-width: unset; aspect-ratio: 1; max-width: 240px; }
  #hit-counter { display: none; }
}