:root {
  --bg: #121012;
  --surface: #1c191b;
  --line: #2e292c;
  --text: #f1ece6;
  --muted: #a39a95;
  --accent: #e0434d;
  --chord: #ff6b6b;
  --linen: #efe8dc;
  --fs: 22px;
  --serif: 'Lora', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #faf7f2;
  --surface: #ffffff;
  --line: #e6dfd5;
  --text: #1a1414;
  --muted: #6d6460;
  --accent: #b3141f;
  --chord: #b3141f;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Вишивка: смуга «полотна» з хрестиками */
.band {
  height: 44px;
  background: var(--linen) url('embroidery.svg') center / auto 30px repeat-x;
  border-block: 2px solid #c41e2a;
  flex: none;
}
.band-top { border-top: 0; }
.band-bottom { margin-top: auto; border-bottom: 0; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 0;
}
.topbar-spacer { flex: 1; }
.back {
  text-decoration: none; color: var(--muted); font-size: 17px;
  padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center;
}
.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font-size: 15px; color: var(--muted); cursor: pointer;
}
.theme-ico {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(90deg, var(--text) 50%, transparent 50%);
  border: 1.5px solid var(--text);
}

.loading, .error { color: var(--muted); padding: 40px 0; text-align: center; font-size: 18px; }

/* Головна */
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(44px, 13vw, 64px); line-height: 1.05; margin: 0;
  letter-spacing: -0.01em;
}
.hero .date {
  margin: 10px 0 0; color: var(--accent);
  font-size: 18px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
}

.section { margin-top: 36px; }
.section h2 {
  font-family: var(--serif); font-weight: 500; font-size: 24px;
  margin: 0 0 6px; display: flex; align-items: center; gap: 12px;
}
.section h2::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.songs { list-style: none; margin: 0; padding: 0; }
.songs a {
  display: flex; gap: 14px; align-items: baseline;
  padding: 14px 4px; min-height: 56px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.songs a:active { background: var(--surface); }
.songs .num {
  flex: none; width: 1.6em; text-align: right;
  color: var(--accent); font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums;
}
.songs .dot { flex: none; width: 1.6em; text-align: right; color: var(--accent); font-size: 19px; }
.songs .t { display: block; font-size: 20px; font-weight: 500; line-height: 1.3; }
.songs .a { display: block; color: var(--muted); font-size: 15px; margin-top: 2px; }

/* Пісня */
.song-head { padding: 18px 0 6px; }
.song-head .kicker { color: var(--accent); font-size: 14px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.song-head h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 8vw, 42px); line-height: 1.15; margin: 6px 0 4px; }
.song-head .artist { color: var(--muted); font-size: 17px; margin: 0; }

.lyrics { font-size: var(--fs); line-height: 1.35; padding: 18px 0 8px; }
.lyrics .stanza { margin: 0 0 1.1em; }
.lyrics .chorus { border-left: 3px solid var(--accent); padding-left: 0.6em; }
.lyrics .label { font-size: 0.68em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.3em; }
.lyrics .line { margin: 0 0 0.15em; }
.lyrics .seg { display: inline-flex; flex-direction: column; vertical-align: top; }
.lyrics .ch {
  color: var(--chord); font-weight: 700; font-size: 0.8em; line-height: 1.2;
  padding-right: 0.35em; white-space: pre; min-height: 1.2em;
}
.lyrics .tx { white-space: pre; }
.lyrics .tx:empty::after { content: '\00a0'; }
.lyrics .line.chords-only .tx { display: none; }
.lyrics .line.chords-only .ch { padding-right: 0.9em; }
.lyrics.no-chords .ch { display: none; }
.lyrics.no-chords .line.chords-only { display: none; }
.lyrics.plain .ch { display: none; }

.empty {
  margin: 24px 0; padding: 28px 20px; text-align: center;
  color: var(--muted); font-size: 19px;
  border: 1px dashed var(--line); border-radius: 14px;
}

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 0; }
.pager a, .pager span {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px; min-height: 64px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none;
}
.pager .next { text-align: right; align-items: flex-end; }
.pager small { color: var(--muted); font-size: 13px; }
.pager b { font-weight: 500; font-size: 16px; line-height: 1.25; }
.pager span { visibility: hidden; }

/* Нижня панель */
.toolbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tgroup { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tgroup button, .chords-btn {
  min-width: 42px; min-height: 46px; padding: 0 8px;
  background: transparent; border: 0; cursor: pointer; font-size: 20px; font-weight: 500;
}
.tgroup button small { font-size: 0.65em; }
.tval { min-width: 54px; text-align: center; font-size: 14px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.tval.on { color: var(--chord); font-weight: 700; }
.chords-btn { font-size: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 12px; white-space: nowrap; }
.chords-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.toolbar.no-chords .tgroup:first-child { opacity: 0.35; pointer-events: none; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 700px) {
  .band { height: 52px; background-size: auto 36px; }
}
