:root {
  --bg: #0f0d0b;
  --bg-elev: #171310;
  --bg-elev-2: #201b17;
  --border: #322a22;
  --text: #f2ece2;
  --text-dim: #a89a8a;
  --text-faint: #6f6255;
  --accent: #f2a93b;
  --accent-dim: #b97f24;
  --accent-text: #1a1208;
  --chord: #f2a93b;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --header-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(242, 169, 59, 0.10), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 0%, rgba(242, 169, 59, 0.06), transparent 60%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--accent-text); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(15, 13, 11, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand .pick { color: var(--accent); }
.brand-sub {
  display: none;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-faint);
}
@media (min-width: 640px) {
  .brand-sub { display: inline; }
}

.site-nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
}
.site-nav a:hover, .site-nav a.active {
  color: var(--text);
  background: var(--bg-elev-2);
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin-left: auto;
}

/* ---------- Search box ---------- */
.search-box {
  position: relative;
  width: 100%;
}
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus {
  border-color: var(--accent-dim);
  background: var(--bg-elev-2);
}
.search-box .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-box.big input {
  padding: 18px 20px 18px 50px;
  font-size: 1.05rem;
  border-radius: 14px;
}
.search-box.big .icon { left: 18px; }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: none;
  z-index: 60;
}
.search-results.open { display: block; }
.search-results .group-label {
  padding: 10px 14px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 700;
}
.search-results .result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.search-results .result:hover, .search-results .result.active {
  background: var(--bg-elev-2);
}
.search-results .result .title { font-weight: 600; font-size: 0.92rem; }
.search-results .result .sub { color: var(--text-faint); font-size: 0.8rem; }
.search-results .empty { padding: 18px 14px; color: var(--text-faint); font-size: 0.88rem; }

/* ---------- Layout ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}
.page.wide { max-width: 1240px; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 72px 24px 48px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.hero h1 .pick { color: var(--accent); }
.hero p {
  color: var(--text-dim);
  font-size: 1.08rem;
  margin: 0 0 34px;
}
.hero .search-box { max-width: 640px; margin: 0 auto; }
.stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 30px;
  color: var(--text-faint);
  font-size: 0.88rem;
}
.stats b { color: var(--accent); font-size: 1rem; }

/* ---------- Section ---------- */
.section { margin-top: 56px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-head h2 { font-size: 1.3rem; margin: 0; letter-spacing: -0.01em; }
.section-head a { color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }
.section-head a:hover { color: var(--accent); }

/* ---------- Artist grid / cards ---------- */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.artist-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.artist-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-elev-2);
  transform: translateY(-2px);
}
.artist-card .name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.artist-card .count { color: var(--text-faint); font-size: 0.8rem; }

/* ---------- Letter nav ---------- */
.letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: sticky;
  top: calc(var(--header-h) + 1px);
  z-index: 30;
  background: rgba(15, 13, 11, 0.92);
  backdrop-filter: blur(10px);
  padding: 12px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.letter-nav a {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.letter-nav a:hover { color: var(--accent); border-color: var(--accent-dim); }
.letter-nav a.disabled { opacity: 0.3; pointer-events: none; }

.letter-group { margin-top: 30px; scroll-margin-top: calc(var(--header-h) + 70px); }
.letter-group h3 {
  font-size: 1.6rem;
  color: var(--accent);
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

/* ---------- Breadcrumb / back ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.back-link:hover { color: var(--accent); }

/* ---------- Artist page ---------- */
.artist-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.artist-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0;
  letter-spacing: -0.02em;
}
.artist-header .count-pill {
  color: var(--text-faint);
  font-size: 0.9rem;
}

.song-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.song-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}
.song-item:hover { border-color: var(--accent-dim); background: var(--bg-elev-2); }
.song-item .num { color: var(--text-faint); font-weight: 500; font-size: 0.82rem; min-width: 22px; }

.filter-bar { margin-bottom: 22px; max-width: 420px; }

/* ---------- Song page ---------- */
.song-header {
  margin-bottom: 8px;
}
.song-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.song-header .by { color: var(--text-dim); font-size: 1.05rem; }
.song-header .by a { color: var(--accent); font-weight: 600; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 24px 0 20px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.toolbar .group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}
.toolbar .group:last-child { border-right: none; padding-right: 0; }
.toolbar label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-right: 4px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
}
.btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn:active { transform: scale(0.96); }
.btn.icon-only { padding: 7px 10px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { color: var(--accent-text); opacity: 0.9; }
.transpose-val {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chord-sheet-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  overflow-x: auto;
}
.chord-sheet {
  font-family: var(--mono);
  font-size: var(--sheet-size, 16px);
  line-height: 1.65;
  white-space: pre;
  min-width: max-content;
}
.chord-sheet .line { min-height: 1.65em; }
.chord-sheet .chord {
  color: var(--chord);
  font-weight: 700;
}
.no-chords-note {
  color: var(--text-faint);
  font-size: 0.82rem;
  margin-top: 10px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state h2 { color: var(--text); margin-bottom: 8px; }

footer.site-footer {
  text-align: center;
  padding: 40px 24px 60px;
  color: var(--text-faint);
  font-size: 0.8rem;
}

@media print {
  .site-header, .toolbar, .back-link, footer.site-footer { display: none !important; }
  body { background: white; color: black; }
  .chord-sheet-wrap { border: none; padding: 0; background: white; }
  .chord-sheet .chord { color: #c0392b; }
}

@media (max-width: 640px) {
  .site-header { padding: 0 14px; gap: 10px; }
  .site-nav { display: none; }
  .page { padding: 24px 14px 80px; }
  .chord-sheet-wrap { padding: 20px 16px; }
}
