:root {
  --bg: #050508;
  --ink: #f5efe4;
  --muted: rgba(245, 239, 228, .56);
  --faint: rgba(245, 239, 228, .14);
  --glass: rgba(18, 17, 24, .46);
  --glass-hi: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .09);
  --gold: #e9c47e;
  --a1: #e9c47e;
  --a2: #8f7cff;
  --good: #7ef2c4;
  --bad: #ff6b7d;
  --ui: "Manrope", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--ui); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font-family: var(--ui); font-size: 11px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--muted); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.72) 100%); }
.grain { position: fixed; inset: -50%; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite; }
@keyframes grain { 0%{transform:translate(0,0)} 33%{transform:translate(-3%,2%)} 66%{transform:translate(2%,-3%)} 100%{transform:translate(0,0)} }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; opacity: 0; visibility: hidden; transform: scale(1.015); filter: blur(10px);
  transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s var(--ease), visibility 0s .7s; overflow-y: auto; }
.screen.active { opacity: 1; visibility: visible; transform: none; filter: none; transition: opacity .7s var(--ease), transform .9s var(--ease), filter .7s var(--ease); }
#home, #setup, #results { padding: 0 clamp(16px, 5vw, 72px) 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 30px; letter-spacing: .01em; }
.brand .mark { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 200deg, var(--a1), var(--a2), var(--a1));
  box-shadow: 0 0 24px var(--a1); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px);
  display: grid; place-items: center; transition: all .3s var(--ease); }
.icon-btn:hover { background: var(--glass-hi); transform: rotate(30deg); }
.back-btn, .ghost-btn { background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; backdrop-filter: blur(14px); transition: all .3s var(--ease); }
.back-btn:hover, .ghost-btn:hover { background: var(--glass-hi); }

.eyebrow { text-transform: uppercase; letter-spacing: .32em; font-size: 11px; color: var(--muted); margin: 0 0 18px; font-weight: 600; }

/* ------------------------------------------------------------ home */
.hero { max-width: 880px; margin: 7vh auto 8vh; text-align: center; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(44px, 7.5vw, 104px); line-height: .95; margin: 0 0 42px; letter-spacing: -.01em; }
.hero h1 em { background: linear-gradient(100deg, var(--a1), var(--ink) 45%, var(--a2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.link-box { display: flex; align-items: center; gap: 12px; max-width: 680px; margin: 0 auto; padding: 8px 8px 8px 20px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06); transition: box-shadow .4s var(--ease), border-color .4s; }
.link-box:focus-within { border-color: color-mix(in srgb, var(--a1) 55%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--a1) 12%, transparent), 0 30px 80px -30px rgba(0,0,0,.8); }
.link-box .yt { color: #ff4d5e; flex: none; }
.link-box input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: 500 16px var(--ui); padding: 12px 0; }
.link-box input::placeholder { color: var(--muted); }
.link-box button { border: 0; border-radius: 999px; padding: 13px 24px; font-weight: 700; color: #120f08;
  background: linear-gradient(120deg, var(--gold), #fff3d6); transition: transform .3s var(--ease), box-shadow .3s; }
.link-box button:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -8px var(--gold); }
.hint { color: var(--muted); font-size: 13px; margin-top: 18px; min-height: 18px; }
.hint.err { color: var(--bad); }

.library-head { display: flex; align-items: baseline; gap: 14px; max-width: 1240px; margin: 0 auto 18px; }
.library-head h2 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 0; }
.library-head span { color: var(--muted); font-size: 13px; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; max-width: 1240px; margin: 0 auto; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 50px 0; border: 1px dashed var(--line); border-radius: 22px; }

.card { position: relative; border-radius: 22px; overflow: hidden; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px);
  cursor: pointer; transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .5s; animation: rise .8s var(--ease) both; }
.card:hover { transform: translateY(-6px); border-color: rgba(255,255,255,.18); box-shadow: 0 30px 60px -25px rgba(0,0,0,.9), 0 0 40px -20px var(--a1); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.card .thumb { aspect-ratio: 16 / 9; background-size: cover; background-position: center; position: relative; }
.card .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(5,5,8,.85)); }
.card .body { padding: 14px 18px 18px; }
.card .t { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .a { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--muted); }
.chip.ok { color: var(--good); }
.chip.warn { color: #ffcf7a; }
.card .grade-mini { position: absolute; top: 12px; right: 14px; z-index: 1; font-family: var(--display); font-size: 34px; text-shadow: 0 4px 20px rgba(0,0,0,.7); }
.card .del { position: absolute; top: 10px; left: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.5);
  color: var(--muted); opacity: 0; transition: opacity .3s; }
.card:hover .del { opacity: 1; }
.card.busy { cursor: default; }
.card .job { margin-top: 12px; }
.card .job .stage { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.card .job .bar { height: 3px; border-radius: 3px; background: var(--faint); margin-top: 8px; overflow: hidden; }
.card .job .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--a1), var(--a2)); transition: width .5s var(--ease); box-shadow: 0 0 12px var(--a1); }
.card .job.err .stage { color: var(--bad); }
.shimmer { background: linear-gradient(100deg, rgba(255,255,255,.03) 20%, rgba(255,255,255,.09) 40%, rgba(255,255,255,.03) 60%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ setup */
.setup { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: clamp(28px, 5vw, 80px); max-width: 1180px; margin: 3vh auto 0; align-items: start; }
.art-frame { border-radius: 26px; overflow: hidden; aspect-ratio: 16 / 10; box-shadow: 0 40px 100px -30px rgba(0,0,0,.9), 0 0 80px -30px var(--a1); border: 1px solid var(--line); }
.art-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.setup-art h2 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 4vw, 54px); margin: 26px 0 4px; line-height: 1; }
.setup-art p { color: var(--muted); margin: 0; font-size: 16px; }
.badges { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.best { margin-top: 22px; color: var(--muted); font-size: 14px; }
.best b { color: var(--ink); font-family: var(--display); font-size: 28px; font-weight: 400; margin-right: 8px; }
.retime { margin-top: 18px; font-size: 13px; color: var(--muted); }
.retime[hidden] { display: none; }
.opt-group { margin-bottom: 26px; }
.opt-group > label { display: block; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.seg button { text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px);
  font-weight: 700; font-size: 15px; transition: all .35s var(--ease); }
.seg button small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 3px; }
.seg button:hover { background: var(--glass-hi); }
.seg button.on { border-color: color-mix(in srgb, var(--a1) 70%, transparent); background: color-mix(in srgb, var(--a1) 14%, var(--glass));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--a1) 40%, transparent), 0 14px 40px -18px var(--a1); }
.opt-group.disabled { opacity: .35; pointer-events: none; }
.fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fonts button { padding: 14px 10px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); transition: all .35s var(--ease); }
.fonts button .sample { font-size: 30px; line-height: 1.1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fonts button small { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.fonts button.on { border-color: color-mix(in srgb, var(--a1) 70%, transparent); background: color-mix(in srgb, var(--a1) 14%, var(--glass)); }
.play-btn { display: inline-flex; align-items: center; gap: 16px; border: 0; border-radius: 999px; padding: 18px 34px; margin-top: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: .04em; color: #120f08; background: linear-gradient(120deg, var(--gold), #fff4dc 60%, var(--gold));
  background-size: 200% 100%; box-shadow: 0 20px 50px -18px var(--gold); transition: transform .35s var(--ease), background-position .8s var(--ease); }
.play-btn:hover { transform: translateY(-2px) scale(1.02); background-position: 100% 0; }
.play-btn kbd { background: rgba(0,0,0,.1); color: rgba(18,15,8,.6); border-color: rgba(0,0,0,.15); }

/* ------------------------------------------------------------ game hud */
#game { overflow: hidden; }
.progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.06); }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--a2), var(--a1)); box-shadow: 0 0 14px var(--a1); }
.hud-left { position: absolute; top: 26px; left: 30px; display: flex; gap: 14px; align-items: center; }
.hud-left img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
#hud-title { font-weight: 700; font-size: 15px; }
#hud-artist { color: var(--muted); font-size: 13px; }
.hud-right { position: absolute; top: 22px; right: 34px; text-align: right; }
#hud-score { font-family: var(--display); font-size: 54px; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 30px color-mix(in srgb, var(--a1) 50%, transparent); }
.hud-sub { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .08em; display: flex; gap: 12px; justify-content: flex-end; margin-top: 6px; }
#hud-combo b { color: var(--ink); font-size: 18px; }
#hud-mult { color: var(--a1); }
#hud-combo.pop { animation: pop .35s var(--ease); }
@keyframes pop { 40% { transform: scale(1.25); } }

#judge-layer { position: absolute; inset: 0; pointer-events: none; }
.judge { position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%); font-family: var(--display); font-style: italic; font-size: 46px;
  letter-spacing: .02em; animation: judge .9s var(--ease) forwards; white-space: nowrap; }
.judge.perfect { background: linear-gradient(90deg, var(--gold), #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(233,196,126,.6)); }
.judge.great { color: var(--good); filter: drop-shadow(0 0 14px rgba(126,242,196,.5)); }
.judge.good { color: #a8c8ff; }
.judge.miss { color: var(--bad); font-size: 34px; }
@keyframes judge { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  60% { opacity: 1; transform: translate(-50%, -55%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -75%) scale(.96); } }

#lyric-dock { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; padding: 50px 6vw 46px; transition: opacity .5s;
  background: linear-gradient(180deg, transparent, rgba(5,5,8,.55) 45%, rgba(5,5,8,.8)); }
#lyric-dock.hidden { opacity: 0; }
.lyric-line { font-size: clamp(26px, 3.2vw, 44px); line-height: 1.35; min-height: 1.4em; text-shadow: 0 2px 30px rgba(0,0,0,.8); }
.lyric-line .w { display: inline-block; margin: 0 .16em; position: relative; color: rgba(245,239,228,.38); transition: color .25s, transform .3s var(--ease), opacity .3s; }
.lyric-line .w.sung { color: rgba(245,239,228,.7); }
.lyric-line .w.auto { opacity: .55; }
.lyric-line .w.active { color: var(--ink); transform: translateY(-3px); }
.lyric-line .w.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; border-radius: 2px; background: var(--a1); box-shadow: 0 0 12px var(--a1); }
.lyric-line .w .ty { color: var(--a1); text-shadow: 0 0 18px color-mix(in srgb, var(--a1) 70%, transparent); }
.lyric-line .w.done { color: var(--a1); }
.lyric-line .w.perfect { color: var(--gold); }
.lyric-line .w.miss { color: color-mix(in srgb, var(--bad) 70%, transparent); text-decoration: line-through; text-decoration-thickness: 1px; }
.lyric-line .w.skip { opacity: .25; }
.lyric-line .w.shake { animation: shake .28s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
#lyric-dock.no-ctx .lyric-line { display: none; }
.lyric-line { font-size: clamp(18px, 2.1vw, 28px) !important; opacity: .85; }

/* the typing panel: exactly what you're typing, what's next, and when to finish */
.typer { margin-top: 10px; display: grid; justify-items: center; gap: 10px; }
.typer-status { height: 16px; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); font-weight: 700; transition: color .2s; }
.typer-status.wait { color: #ffcf7a; }
.typer-status.go { color: var(--good); }
.typer-word { position: relative; min-height: 1.2em; font-size: clamp(40px, 5.2vw, 76px); line-height: 1.15; letter-spacing: .02em;
  padding: 2px 26px 6px; border-radius: 20px; background: rgba(8,8,12,.55); border: 1px solid var(--line); backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.9); transition: border-color .2s, box-shadow .2s; white-space: nowrap; }
.typer-word:empty { visibility: hidden; }
.typer-word .c { color: rgba(245,239,228,.42); transition: color .12s; }
.typer-word .c.ty { color: var(--a1); text-shadow: 0 0 24px color-mix(in srgb, var(--a1) 70%, transparent); }
.typer-word .c.cur { color: var(--ink); position: relative; }
.typer-word .c.cur::after { content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: 3px; border-radius: 3px; background: var(--a1);
  box-shadow: 0 0 12px var(--a1); animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: .25; } }
.typer-word.locked { opacity: .6; }
.typer-word.err { border-color: color-mix(in srgb, var(--bad) 80%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent), 0 20px 60px -20px rgba(0,0,0,.9);
  animation: shake .28s; }
.typer-word .ghost { position: absolute; top: -.55em; font-size: .5em; color: var(--bad); font-family: var(--ui); font-weight: 800;
  text-shadow: 0 0 14px rgba(255,107,125,.7); animation: ghost .7s var(--ease) forwards; pointer-events: none; }
@keyframes ghost { from { opacity: 1; transform: translate(-50%, 0) scale(1.2); } to { opacity: 0; transform: translate(-50%, -18px) scale(1); } }
.typer-meter { position: relative; width: min(420px, 70vw); height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: visible; }
.typer-meter.hide { visibility: hidden; }
.typer-meter .zone { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--good), var(--a1));
  box-shadow: 0 0 14px color-mix(in srgb, var(--a1) 60%, transparent); opacity: .75; }
.typer-meter i { position: absolute; top: -5px; width: 3px; height: 16px; border-radius: 2px; background: #fff; box-shadow: 0 0 10px #fff; transform: translateX(-50%); }
.typer-next { color: var(--muted); font-size: 14px; letter-spacing: .04em; min-height: 18px; }
.typer-next b { color: rgba(245,239,228,.75); font-weight: 600; margin: 0 .35em; }
.calib-btn { margin-top: 12px; font-size: 13px; }
.calib { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.calib .dots { display: flex; gap: 6px; margin-top: 8px; }
.calib .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); transition: background .1s, transform .1s; }
.calib .dots i.on { background: var(--a1); transform: scale(1.3); }
.next-line { margin-top: 12px; color: rgba(245,239,228,.3); font-size: clamp(15px, 1.5vw, 20px); min-height: 1.3em; }
.keys-hint { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; opacity: .55; }
.keys-hint kbd + kbd { margin-left: -2px; }

.intro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity 1s var(--ease); }
.intro.show { opacity: 1; }
.intro h1 { font-family: var(--display); font-weight: 400; font-size: clamp(56px, 9vw, 140px); margin: 0; line-height: .95; letter-spacing: -.01em; }
.intro.show h1 { animation: intro-in 1.6s var(--ease) both; }
.intro p { color: var(--muted); font-size: 18px; margin: 14px 0 0; }
.intro .intro-hint { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; margin-top: 40px; }
@keyframes intro-in { from { opacity: 0; letter-spacing: .12em; filter: blur(12px); } }

.pause { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,5,8,.5); backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden; transition: all .4s var(--ease); }
.pause.show { opacity: 1; visibility: visible; }
.pause-card { display: grid; gap: 10px; min-width: 280px; text-align: center; }
.pause-card h2 { font-family: var(--display); font-weight: 400; font-size: 56px; margin: 0 0 14px; }
.pause-card button { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); font-weight: 600; transition: all .3s var(--ease); }
.pause-card button:hover, .pause-card button.sel { background: color-mix(in srgb, var(--a1) 16%, var(--glass)); border-color: color-mix(in srgb, var(--a1) 50%, transparent); }

/* ------------------------------------------------------------ results */
.results { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(30px, 6vw, 100px); max-width: 1150px; margin: 12vh auto 0; align-items: center; }
.grade { font-family: var(--display); font-size: clamp(160px, 22vw, 300px); line-height: .8; margin: 0 0 18px -6px;
  background: linear-gradient(160deg, #fff, var(--a1) 50%, var(--a2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 60px color-mix(in srgb, var(--a1) 40%, transparent)); }
#results.active .grade { animation: grade-in 1.4s var(--ease) both .2s; }
@keyframes grade-in { from { opacity: 0; transform: scale(1.5); filter: blur(30px); } }
.res-left h2 { font-family: var(--display); font-weight: 400; font-size: 40px; margin: 0; }
.res-left p { color: var(--muted); margin: 6px 0 0; }
.res-best { margin-top: 20px !important; font-size: 14px; }
.res-best.new { color: var(--gold) !important; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { padding: 18px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); }
#results.active .stat, #results.active .bar-row { animation: rise .8s var(--ease) both; }
.stat .v { font-family: var(--display); font-size: 40px; line-height: 1; }
.stat .l { color: var(--muted); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-top: 8px; }
.bars { margin-top: 22px; display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 80px 1fr 44px; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.bar-row .track { height: 6px; border-radius: 6px; background: var(--faint); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 6px; width: 0; transition: width 1.4s var(--ease) .4s; }
.bar-row b { color: var(--ink); text-align: right; }
.res-actions { display: flex; gap: 12px; align-items: center; margin-top: 30px; }
.res-actions .play-btn { margin: 0; }

/* ------------------------------------------------------------ settings + toast */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); padding: 26px; background: rgba(12,11,16,.82); backdrop-filter: blur(30px);
  border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .6s var(--ease); z-index: 20; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.drawer-head h2 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: 0; }
.setting { padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting label { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; }
.setting label span { color: var(--a1); font-variant-numeric: tabular-nums; }
.setting small { display: block; color: var(--muted); margin-top: 8px; font-size: 12px; line-height: 1.6; }
.setting.row { display: flex; justify-content: space-between; align-items: center; }
.setting input[type=range] { width: 100%; margin-top: 12px; accent-color: var(--a1); }
.setting input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--a1); }
#toast { position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 20px); padding: 12px 20px; border-radius: 999px; background: rgba(20,19,26,.85);
  border: 1px solid var(--line); backdrop-filter: blur(20px); font-size: 14px; opacity: 0; transition: all .4s var(--ease); pointer-events: none; z-index: 30; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* web version: YouTube's player must stay visible, so it's the "now playing" window */
.yt-frame { display: none; }
body.web .yt-frame { display: block; position: absolute; left: 30px; bottom: 30px; width: 356px; height: 200px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 20px 60px -20px rgba(0,0,0,.9), 0 0 40px -20px var(--a1); background: #000; z-index: 2; }
body.web .yt-frame iframe { width: 356px; height: 200px; display: block; pointer-events: none; }
body.yt-click .yt-frame { outline: 3px solid var(--a1); animation: pop 1s var(--ease) infinite; }
body.yt-click .yt-frame iframe { pointer-events: auto; }
body.web #hud-thumb { display: none; }
.site-back { display: none; }
body.web .site-back { display: inline-flex; color: var(--muted); text-decoration: none; font: 500 13px var(--ui); margin-left: 18px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; transition: color .3s, background .3s; }
body.web .site-back:hover { color: var(--ink); background: var(--glass-hi); }

@media (max-width: 820px) {
  .setup, .results { grid-template-columns: 1fr; }
  .seg { grid-auto-flow: row; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
