:root {
  --bg: #f4eee3;
  --bg-2: #ece4d5;
  --surface: #fffaf2;
  --surface-2: #f7efe2;
  --ink: #1f2430;
  --ink-2: #3a4150;
  --muted: #6d6f76;
  --line: #e3d7c4;
  --accent: #b4532a;
  --accent-ink: #fffaf2;
  --accent-soft: rgba(180, 83, 42, .11);
  --river: #2c6b6d;
  --river-soft: rgba(44, 107, 109, .11);
  --gold: #a87a22;
  --shadow: 0 1px 2px rgba(48, 34, 14, .06), 0 10px 28px rgba(48, 34, 14, .08);
  --radius: 14px;
  --f-display: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --f-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-ph: 'Charis SIL', 'Gentium Plus', 'Noto Serif', Georgia, serif;
  --player-h: 84px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11171c;
    --bg-2: #151d23;
    --surface: #182128;
    --surface-2: #1d2830;
    --ink: #ece6da;
    --ink-2: #d1cabd;
    --muted: #98a1a9;
    --line: #2a3640;
    --accent: #e48a5c;
    --accent-ink: #1b120a;
    --accent-soft: rgba(228, 138, 92, .15);
    --river: #72c3bf;
    --river-soft: rgba(114, 195, 191, .13);
    --gold: #d9b15f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #11171c;
  --bg-2: #151d23;
  --surface: #182128;
  --surface-2: #1d2830;
  --ink: #ece6da;
  --ink-2: #d1cabd;
  --muted: #98a1a9;
  --line: #2a3640;
  --accent: #e48a5c;
  --accent-ink: #1b120a;
  --accent-soft: rgba(228, 138, 92, .15);
  --river: #72c3bf;
  --river-soft: rgba(114, 195, 191, .13);
  --gold: #d9b15f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--f-ui);
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-underline-offset: 3px; }
b, strong { font-weight: 600; }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 600 1.35rem/1 var(--f-display); letter-spacing: .01em; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; padding: 7px 11px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { background: var(--accent-soft); color: var(--accent); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.hero { position: relative; padding: 56px 0 96px; overflow: hidden; background: radial-gradient(1200px 400px at 85% -10%, var(--river-soft), transparent 60%), radial-gradient(900px 380px at -5% 10%, var(--accent-soft), transparent 60%); }
.hero-in { display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: center; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; color: var(--river); font-weight: 600; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font: 600 clamp(3.1rem, 8vw, 5.4rem)/.95 var(--f-display); letter-spacing: -.01em; }
.h1-sub { display: block; margin-top: 10px; font: italic 500 clamp(1.4rem, 3vw, 2rem)/1.1 var(--f-display); color: var(--accent); }
.lead { max-width: 54ch; font-size: 1.08rem; color: var(--ink-2); margin: 20px 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .98rem; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px var(--accent-soft); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.facts-title { margin: 0 0 12px; font: 600 1.35rem/1.2 var(--f-display); }
.facts dl { margin: 0; display: grid; gap: 0; }
.facts dl > div { display: grid; grid-template-columns: 118px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dl > div:first-child { border-top: 0; }
.facts dt { color: var(--muted); font-size: .86rem; padding-top: 1px; }
.facts dd { margin: 0; font-size: .95rem; }
.hero-waves { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 90px; }
.hero-waves path { fill: var(--river); opacity: .10; }
.hero-waves path.w2 { fill: var(--bg); opacity: 1; }

.section { padding: 64px 0 24px; }
.sec-head { max-width: 760px; margin-bottom: 26px; }
.sec-head h2 { margin: 0 0 8px; font: 600 clamp(2rem, 4.4vw, 2.7rem)/1.05 var(--f-display); }
.sec-head p { margin: 0; color: var(--ink-2); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--river-soft); color: var(--river); font-size: .8rem; font-weight: 600; letter-spacing: .02em; }

.karaoke {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 24px 18px; margin-bottom: 18px; min-height: 196px;
}
.k-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.k-pos { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.k-line { font: 600 clamp(1.55rem, 3.6vw, 2.35rem)/1.25 var(--f-display); min-height: 1.3em; }
.k-line .syl { color: var(--muted); transition: color .12s; }
.k-line .syl.past { color: var(--ink); }
.k-line .syl.now { color: var(--accent); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.k-line .hy { color: var(--line); font-weight: 500; }
.k-line .wait { color: var(--muted); font: italic 500 clamp(1.2rem, 2.6vw, 1.6rem)/1.3 var(--f-display); }
.k-line .wait b { color: var(--accent); font-style: normal; }
.k-ph { font: 400 1.12rem/1.5 var(--f-ph); color: var(--river); margin-top: 6px; min-height: 1.5em; }
.k-ph .syl.now { background: var(--river-soft); border-radius: 4px; box-shadow: 0 0 0 2px var(--river-soft); }
.k-tr { font-style: italic; color: var(--ink-2); margin-top: 4px; min-height: 1.6em; }
.k-next { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .9rem; min-height: 1.6em; }
.k-next b { color: var(--ink-2); font-weight: 600; font-family: var(--f-display); font-size: 1.05rem; }

.score-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.score-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.score-bar h3 { margin: 0; font: 600 1.25rem/1.2 var(--f-display); }
.toggles, .text-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tgl { position: relative; display: inline-flex; cursor: pointer; user-select: none; }
.tgl input { position: absolute; opacity: 0; pointer-events: none; }
.tgl span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 500; color: var(--muted); }
.tgl input:checked + span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.tgl input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.score-scroll { max-height: min(64vh, 620px); overflow-y: auto; overscroll-behavior: contain; position: relative; padding: 6px 4px 10px; }
.score { color: var(--ink); min-height: 200px; }
.score svg { display: block; }
.score .abcjs-note, .score .abcjs-rest { cursor: pointer; }
.score .abcjs-annotation { fill: var(--river); font-weight: 600; }
.score .hl, .score .hl path, .score .hl text { fill: var(--accent) !important; color: var(--accent); }
.score .hl path[stroke], .score .hl[stroke] { stroke: var(--accent) !important; }
.score-loading { color: var(--muted); text-align: center; margin: 40px 0; }

.text-tools { margin-bottom: 18px; }
.tts-note { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); font-size: .92rem; }

.strophe { margin-bottom: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.st-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.st-num { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 700 1.3rem/1 var(--f-display); }
.st-head h3 { margin: 0; font: 600 1.5rem/1.15 var(--f-display); }
.st-head p { margin: 2px 0 0; color: var(--ink-2); font-size: .95rem; }
.st-actions { margin-left: auto; display: flex; gap: 6px; }

.line { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 14px; padding: 14px 20px; border-top: 1px solid var(--line); transition: background .15s; }
.line:first-of-type { border-top: 0; }
.line.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.ln { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; padding-top: 7px; }
.l-main { min-width: 0; }
.l-de { font: 600 1.42rem/1.35 var(--f-display); margin: 0; }
.w { all: unset; cursor: pointer; border-radius: 4px; padding: 0 1px; background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .15s, color .15s; }
.w:hover, .w:focus-visible { color: var(--accent); background-size: 100% 1px; }
.w:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.l-ipa { font: 400 1rem/1.45 var(--f-ph); color: var(--muted); }
.l-ph { font: 400 1.08rem/1.45 var(--f-ph); color: var(--river); }
.l-ro { font-style: italic; color: var(--ink-2); }
.l-en { color: var(--muted); font-size: .95rem; }
.l-note { margin-top: 6px; font-size: .86rem; color: var(--muted); display: flex; gap: 8px; }
.l-note::before { content: "i"; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--muted); display: grid; place-items: center; font: italic 600 .72rem/1 var(--f-ph); margin-top: 1px; }
.rep { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--river-soft); color: var(--river); font: 600 .7rem/1.7 var(--f-ui); letter-spacing: .03em; vertical-align: middle; text-transform: uppercase; }
.l-act { display: flex; gap: 6px; align-items: flex-start; }
.act { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: .8rem; font-weight: 600; }
.act svg { width: 16px; height: 16px; }
.act:hover { border-color: var(--accent); color: var(--accent); }
.act.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
body.hide-ipa .l-ipa, body.hide-ph .l-ph, body.hide-ro .l-ro, body:not(.show-en) .l-en { display: none; }

.ph-c, .ph-x { color: var(--accent); font-weight: 700; border-bottom: 1px dotted currentColor; }
.ph-ng, .ph-u { font-weight: 700; color: var(--gold); }

.legend-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 22px; }
.legend-card h3 { margin: 0 0 8px; font: 600 1.35rem/1.2 var(--f-display); }
.legend { width: 100%; border-collapse: collapse; }
.legend td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.legend tr:first-child td { border-top: 0; }
.legend td:first-child { width: 150px; font: 700 1.05rem/1.4 var(--f-ph); color: var(--river); white-space: nowrap; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.g-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.g-card h4 { margin: 0 0 6px; font: 600 1.2rem/1.25 var(--f-display); }
.g-card p { margin: 0 0 10px; font-size: .93rem; color: var(--ink-2); }
.ex { display: flex; flex-wrap: wrap; gap: 6px; }
.ex button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font: 600 .98rem/1.2 var(--f-display); }
.ex button small { font: 400 .8rem/1 var(--f-ph); color: var(--river); }
.ex button svg { width: 14px; height: 14px; color: var(--muted); }
.ex button:hover { border-color: var(--accent); }

.poem { display: grid; gap: 18px; }
.stanza { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stanza > div { padding: 16px 20px; border-left: 1px solid var(--line); }
.stanza > div:first-child { border-left: 0; }
.stanza h4 { margin: 0 0 8px; font: 600 .78rem/1 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stanza p { margin: 0; line-height: 1.75; }
.stanza .de p { font: 500 1.18rem/1.6 var(--f-display); }
.stanza.omitted { opacity: .9; background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 12px, var(--surface-2) 12px, var(--surface-2) 24px); }
.omit-note { grid-column: 1 / -1; padding: 12px 20px !important; border-left: 0 !important; border-bottom: 1px solid var(--line); font-size: .92rem; color: var(--ink-2); background: var(--accent-soft); }

.prose-wrap { max-width: 860px; }
.prose h3 { font: 600 1.55rem/1.2 var(--f-display); margin: 28px 0 8px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.practice { margin-top: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); }
.practice h3 { margin: 0 0 10px; font: 600 1.45rem/1.2 var(--f-display); }
.practice ol { margin: 0; padding-left: 22px; }
.practice li { margin-bottom: 8px; color: var(--ink-2); }

.footer { margin-top: 48px; padding: 28px 0 36px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--ink-2); }
.footer p { max-width: 900px; }

.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .08);
  padding-bottom: env(safe-area-inset-bottom);
}
.player-in { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px; }
.p-buttons { display: flex; align-items: center; gap: 8px; }
.play-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px var(--accent-soft); }
.play-btn svg { width: 24px; height: 24px; }
.play-btn:hover { filter: brightness(1.07); }
.p-track { min-width: 0; }
.p-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 7px; font-variant-numeric: tabular-nums; }
.p-meta span:first-child { color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 12px; border-radius: 999px; background: var(--bg-2); cursor: pointer; touch-action: none; }
.track-sections { position: absolute; inset: 0; border-radius: 999px; overflow: hidden; }
.track-sections i { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--surface); }
.track-sections i.voc { background: color-mix(in srgb, var(--river) 16%, transparent); }
.track-loop { position: absolute; top: -3px; bottom: -3px; border-radius: 6px; background: color-mix(in srgb, var(--gold) 30%, transparent); border: 1px solid var(--gold); pointer-events: none; }
.track-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: var(--accent); opacity: .85; pointer-events: none; }
.track-head { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: var(--shadow); pointer-events: none; }
.p-tempo { display: flex; align-items: center; gap: 6px; }
.p-tempo input[type="range"] { width: 110px; accent-color: var(--accent); }
.tempo-val { min-width: 74px; text-align: center; font-size: .92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tempo-val b { font-size: 1.05rem; }
.mini-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.05rem; line-height: 1; }
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.p-extra { display: flex; align-items: center; gap: 6px; }
.pill { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pill[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.pill:hover { border-color: var(--accent); }
.settings { max-width: 1120px; margin: 0 auto; padding: 4px 20px 16px; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 22px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.set-row { display: grid; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.set-row.chk { display: flex; align-items: center; gap: 8px; }
.set-row select, .set-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.set-row select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.set-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.set-note { margin: 8px 2px 0; font-size: .8rem; color: var(--muted); }
kbd { font: 600 .74rem/1 var(--f-ui); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); }
.loadbar { position: absolute; left: 0; right: 0; top: -26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: .8rem; color: var(--ink-2); background: var(--surface-2); border-top: 1px solid var(--line); overflow: hidden; }
.loadbar span { position: relative; z-index: 1; }
.loadbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-soft); transition: width .2s; }

.popover { position: fixed; z-index: 70; width: min(340px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .22); padding: 16px 18px; }
.popover h4 { margin: 0; font: 600 1.7rem/1.1 var(--f-display); }
.pop-ipa { font: 400 1.05rem/1.4 var(--f-ph); color: var(--muted); margin-top: 4px; }
.pop-ph { font: 400 1.12rem/1.4 var(--f-ph); color: var(--river); }
.pop-ro { margin-top: 8px; font-weight: 600; }
.pop-g { margin-top: 4px; font-size: .88rem; color: var(--ink-2); }
.pop-act { display: flex; gap: 6px; margin-top: 12px; }
.pop-x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.pop-x:hover { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: .9rem; box-shadow: var(--shadow); }

@media (max-width: 960px) {
  .player-in { grid-template-columns: auto 1fr auto; grid-template-areas: "btn track track" "tempo tempo extra"; gap: 10px 14px; padding: 10px 16px; }
  .p-buttons { grid-area: btn; }
  .p-track { grid-area: track; }
  .p-tempo { grid-area: tempo; }
  .p-extra { grid-area: extra; justify-content: flex-end; }
  .p-tempo input[type="range"] { width: 120px; }
}

@media (max-width: 820px) {
  .hero { padding: 36px 0 84px; }
  .hero-in { grid-template-columns: 1fr; gap: 28px; }
  .stanza { grid-template-columns: 1fr; }
  .stanza > div { border-left: 0; border-top: 1px solid var(--line); }
  .stanza > div:first-child { border-top: 0; }
  .omit-note { border-top: 0 !important; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .topbar-in { gap: 8px; }
  .nav { margin-left: 4px; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .nav a { padding: 7px 9px; font-size: .84rem; }
  .section { padding-top: 44px; }
  .sec-head { margin-bottom: 18px; }
  .karaoke { padding: 14px 16px; min-height: 172px; }
  .k-ph { font-size: 1.02rem; }
  .score-bar { padding: 10px 12px; }
  .score-scroll { max-height: 58vh; padding: 2px 0 8px; }
  .line { grid-template-columns: 1fr; padding: 14px 16px; }
  .ln { display: none; }
  .l-de { font-size: 1.3rem; }
  .l-act { order: 3; margin-top: 6px; }
  .act { height: 36px; padding: 0 12px; }
  .st-head { padding: 14px 16px; }
  .st-actions { display: none; }
  .facts { padding: 18px; }
  .facts dl > div { grid-template-columns: 96px 1fr; }
  .legend td:first-child { width: 92px; white-space: normal; }
  .player-in { grid-template-columns: auto 1fr auto; grid-template-areas: "btn track track" "tempo tempo extra"; gap: 8px 10px; padding: 8px 12px 10px; }
  .p-buttons { grid-area: btn; gap: 6px; }
  .p-track { grid-area: track; }
  .p-tempo { grid-area: tempo; gap: 4px; }
  .p-extra { grid-area: extra; gap: 5px; }
  .p-tempo input[type="range"] { display: none; }
  .tempo-val { min-width: 58px; font-size: .86rem; }
  .mini-btn { width: 30px; height: 30px; }
  .pill { height: 30px; padding: 0 8px; font-size: .74rem; }
  .icon-btn { width: 34px; height: 34px; }
  .play-btn { width: 46px; height: 46px; }
  .p-meta { font-size: .74rem; margin-bottom: 5px; }
  .settings { padding: 0 12px 12px; }
}

@media (max-width: 400px) {
  .brand span { display: none; }
  .p-buttons .icon-btn { width: 32px; height: 32px; }
  .pill { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
