:root {
  --bg: #07060d;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .09);
  --text: #f6f4ff;
  --muted: #9b95b8;
  --accent: #ff4fa3;
  --accent-2: #8b5cff;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --hl: #ffd447;           /* lyric highlight colour (setting) */
  --lyric-font: Outfit, system-ui, sans-serif;
  --scale: 1;              /* lyric size (setting) */
  --dim: .15;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 Outfit, system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 1em; height: 1em; display: block; }

/* Blurred cover art of the current song behind everything. */
#ambient {
  position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 20% 10%, rgba(139, 92, 255, .22), transparent 70%),
    radial-gradient(50% 45% at 85% 20%, rgba(255, 79, 163, .16), transparent 70%),
    var(--art, none) center / cover no-repeat;
  filter: blur(60px) saturate(1.3); opacity: .55; transition: background .6s;
}
#ambient::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(7,6,13,.35), var(--bg) 85%); }

.view { max-width: 1180px; margin: 0 auto; padding: 24px 28px 48px; }

/* ------------------------------------------------------------ buttons & inputs */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; letter-spacing: .01em;
  transition: transform .15s, filter .15s, background .15s;
}
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 28px -8px rgba(255, 79, 163, .65); }
.btn.primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn.ghost { background: var(--surface-2); border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.small { padding: 7px 14px; font-size: 13px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: grid; place-items: center; font-size: 20px; color: var(--text); transition: background .15s;
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.play { width: 46px; height: 46px; border-radius: 50%; background: var(--grad); font-size: 20px; box-shadow: 0 6px 20px -6px rgba(255,79,163,.7); }
.icon-btn.play:hover { filter: brightness(1.1); }
.chip {
  margin-top: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-size: 13px;
}
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip:hover { background: var(--surface-2); }
.chip select {
  border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; outline: 0;
}
.chip select option { background: #15121f; }
.error { margin-top: 14px; color: #ff8fa8; font-weight: 500; }
.demo-hint { margin: 18px 0 0 !important; font-size: 14px !important; }
.demo-hint a { color: var(--text); font-weight: 600; text-decoration-color: var(--accent); text-underline-offset: 3px; }

.range { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; width: 100%; cursor: pointer; }
.range::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), rgba(255,255,255,.14) var(--fill, 0%));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 4px rgba(255, 79, 163, .25); transition: transform .12s;
}
.range:hover::-webkit-slider-thumb { transform: scale(1.15); }
.range::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.14); }
.range::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
.range::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #fff; }

/* ------------------------------------------------------------ home */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: .01em; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); position: relative; box-shadow: 0 0 24px rgba(255,79,163,.5); }
.logo::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.hero { text-align: center; padding: 11vh 0 8vh; }
.hero h1 { font-size: clamp(44px, 8vw, 92px); line-height: .95; margin: 0 0 18px; font-weight: 900; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 18px; max-width: 520px; margin: 0 auto 32px; }
.search {
  display: flex; gap: 8px; max-width: 640px; margin: 0 auto; padding: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.6); backdrop-filter: blur(12px);
}
.search:focus-within { border-color: rgba(255, 79, 163, .55); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 0 16px;
}
.search input::placeholder { color: #6d6789; }

#library h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; margin: 0; }
#libCount { color: #6d6789; margin-left: 4px; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
#libSearch {
  width: min(320px, 100%); padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b95b8' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 13px center / 15px no-repeat;
  color: var(--text); font: inherit; font-size: 14px; outline: 0;
}
#libSearch:focus { border-color: rgba(255, 79, 163, .55); }
#libSearch::placeholder { color: #6d6789; }
.lib-empty { color: var(--muted); text-align: center; padding: 30px 0; }
.card mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 0; overflow: hidden; transition: transform .2s, border-color .2s, background .2s;
}
.card:hover { transform: translateY(-3px); border-color: rgba(255,79,163,.45); background: var(--surface-2); }
.card .thumb { aspect-ratio: 16/9; background: #111 center / cover; position: relative; }
.card .thumb::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.55));
}
.card .meta { padding: 12px 14px 14px; }
.card .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .a { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--muted); }

/* built-in songs: a stage-light card with the title, no video thumbnail */
.card .thumb.bundled {
  display: grid; place-items: center; padding: 16px; text-align: center;
  font-weight: 900; font-size: 22px; letter-spacing: -.01em; line-height: 1.1;
  background:
    radial-gradient(60% 80% at 25% 30%, rgba(255, 79, 163, .75), transparent 70%),
    radial-gradient(60% 80% at 80% 70%, rgba(139, 92, 255, .8), transparent 70%), #150f26;
}
.card .thumb.bundled::after { display: none; }
.credit { color: var(--muted); font-size: 12.5px; text-align: center; margin: 12px 0 0; }

/* ------------------------------------------------------------ search results */
#results { margin-bottom: 44px; }
.card .dur {
  position: absolute; right: 8px; bottom: 8px; z-index: 1; font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.72);
}
.card .badge-in {
  position: absolute; left: 8px; top: 8px; z-index: 1; font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; background: var(--grad);
}
.result { cursor: default; }
.result:hover { transform: none; }
.result .actions { display: flex; gap: 6px; margin-top: 10px; }
.result .actions .btn { padding: 7px 13px; font-size: 13px; }
.result .actions .btn.primary { box-shadow: none; }
.result .state { font-size: 12.5px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.result .state .mini-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.result .state .mini-bar i { display: block; height: 100%; background: var(--grad); }
.skeleton .thumb { animation: shimmer 1.2s infinite linear; background: linear-gradient(90deg, #15121f, #221c33, #15121f) 0 0 / 200% 100%; }
.skeleton .t, .skeleton .a { height: 12px; border-radius: 4px; background: rgba(255,255,255,.07); margin: 6px 0; }
.skeleton .a { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ queue dock */
#queue {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(340px, calc(100vw - 32px));
  background: rgba(16, 13, 26, .92); backdrop-filter: blur(18px); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.8); overflow: hidden;
}
.queue-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 0; background: transparent;
  font-weight: 700; font-size: 14px; text-align: left;
}
.queue-head .chev { margin-left: auto; transform: rotate(-90deg); color: var(--muted); transition: transform .2s; }
#queue.collapsed .chev { transform: rotate(90deg); }
#queue.collapsed #queueList { display: none; }
.queue-dot { width: 9px; height: 9px; border-radius: 50%; background: #8dff6a; box-shadow: 0 0 10px #8dff6a; }
#queue.busy .queue-dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.2s infinite; }
#queueList { list-style: none; margin: 0; padding: 0 8px 8px; max-height: 50vh; overflow-y: auto; }
.q-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; }
.q-item:hover { background: rgba(255,255,255,.04); }
.q-item img { width: 56px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; background: #15121f; }
.q-item .q-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .q-status { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item .q-bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.1); margin-top: 5px; overflow: hidden; }
.q-item .q-bar i { display: block; height: 100%; background: var(--grad); transition: width .4s; }
.q-item.ready .q-status { color: #8dff6a; }
.q-item.failed .q-status { color: #ff8fa8; }
.q-item .btn { padding: 5px 12px; font-size: 12px; }
.q-item .x { width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 14px; }
.q-item .x:hover { background: rgba(255,255,255,.08); color: var(--text); }
/* while singing, the queue shrinks to its header so it doesn't cover the video; gone in fullscreen */
body.singing #queue:not(.expanded-in-player) #queueList { display: none; }
body:has(#player:fullscreen) #queue, body:has(#player.fake-fs) #queue { display: none; }
@media (max-width: 760px) { #queue { right: 16px; bottom: 16px; } }

/* ------------------------------------------------------------ processing */
#processing { display: grid; place-items: center; min-height: 100vh; }
.proc-card {
  width: min(760px, 100%); display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7);
}
#procThumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px; background: #15121f; align-self: start; }
.eyebrow { color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
.proc-body h2 { margin: 6px 0 18px; font-size: 22px; line-height: 1.2; }
.steps { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; color: var(--muted); }
.steps li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.18); display: grid; place-items: center; }
.steps li small { font-variant-numeric: tabular-nums; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active i { border-color: var(--accent); border-top-color: transparent; animation: spin .9s linear infinite; }
.steps li.done i { background: var(--grad); border: 0; }
.steps li.done i::after { content: "✓"; font-size: 12px; font-weight: 900; color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
#barFill { height: 100%; width: 0; background: var(--grad); border-radius: 3px; transition: width .4s; }
#barFill.indeterminate { width: 30% !important; animation: slide 1.3s infinite ease-in-out; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
.proc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 13px; gap: 12px; }

/* ------------------------------------------------------------ player */
#playerView { padding-top: 16px; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.now-title { font-weight: 800; font-size: 18px; line-height: 1.2; }
.now-sub { color: var(--muted); font-size: 13px; }

#player { position: relative; border-radius: var(--radius); background: #000; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 40px 100px -40px rgba(0,0,0,.9); }
#stage { position: relative; aspect-ratio: 16/9; max-height: 74vh; width: 100%; overflow: hidden; cursor: pointer; }
#video, #video iframe { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border: 0; }
#video { transition: filter .3s, transform .3s; }
/* YouTube wouldn't play the video: its cover photo, gently dimmed and slowly zooming, so the stage stays alive */
#video.fallback { background: center / cover no-repeat; filter: blur(1.5px) brightness(.55) saturate(1.1); animation: kenburns 28s ease-in-out infinite alternate; }
#video.fallback iframe { display: none; } /* hide YouTube's own "sign in" / error screen */
@keyframes kenburns { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.16) translate(-2%, -1.5%); } }
#toast .btn { margin: 10px auto 0; display: block; }
/* demo backdrop: slow drifting stage lights instead of a music video */
#video.demo-bg {
  background:
    radial-gradient(30% 45% at 50% 50%, rgba(255, 79, 163, .75), transparent 70%),
    radial-gradient(32% 48% at 50% 50%, rgba(139, 92, 255, .8), transparent 70%),
    radial-gradient(36% 40% at 50% 50%, rgba(56, 225, 255, .45), transparent 70%),
    #120c24;
  background-size: 140% 140%, 130% 130%, 150% 150%, auto;
  animation: lights 14s ease-in-out infinite alternate;
}
#video.demo-bg iframe { display: none; }
@keyframes lights {
  0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  50% { background-position: 60% 40%, 30% 60%, 20% 40%, 0 0; }
  100% { background-position: 100% 100%, 0% 100%, 80% 0%, 0 0; }
}
#stage.blur #video { filter: blur(14px) saturate(1.2); transform: scale(1.08); }
#dim { position: absolute; inset: 0; background: rgba(0, 0, 0, var(--dim)); pointer-events: none; transition: background .2s; }

#bigPlay {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
#bigPlay svg { width: 84px; height: 84px; padding: 24px 22px 24px 26px; border-radius: 50%; background: rgba(255,255,255,.14); backdrop-filter: blur(10px); }
#player.paused #bigPlay { opacity: 1; }

/* lyrics */
#lyrics {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 6% 30px; text-align: center; pointer-events: none;
  background: linear-gradient(transparent, rgba(0,0,0,.55) 40%, rgba(0,0,0,.8));
  font-family: var(--lyric-font);
}
#stage.center #lyrics { top: 0; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(ellipse 80% 55% at 50% 50%, rgba(0,0,0,.6), transparent); padding: 6%; }
.line { font-weight: 800; line-height: 1.18; min-height: 1.2em; filter: drop-shadow(0 2px 6px rgba(0,0,0,.85)); }
.line.prev { font-size: calc(clamp(13px, 1.8vw, 21px) * var(--scale)); opacity: .4; }
.line.next { font-size: calc(clamp(15px, 2.2vw, 27px) * var(--scale)); opacity: .62; }
/* the extra top margin leaves room for the bouncing ball's arc above the current line */
.line.cur { font-size: calc(clamp(22px, 3.9vw, 50px) * var(--scale)); margin: .6em 0 .18em; position: relative; }
#stage.lines-1 .line.prev, #stage.lines-1 .line.next, #stage.lines-2 .line.prev { display: none; }
.font-poster .line { font-weight: 400; letter-spacing: .03em; line-height: 1.05; }
.font-poster .line.cur { font-size: calc(clamp(28px, 4.9vw, 64px) * var(--scale)); }

/* words: --p goes 0..1 while the word is being sung */
.w { display: inline-block; color: var(--text); transition: color .12s, transform .16s cubic-bezier(.3, 1.6, .5, 1), filter .2s; }
.anim-wipe .w, .anim-glow .w {
  background: linear-gradient(90deg, var(--hl) calc(var(--p, 0) * 100% - 3%), var(--text) calc(var(--p, 0) * 100% + 3%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.anim-glow .w.active { filter: drop-shadow(0 0 .22em var(--hl)) drop-shadow(0 0 .5em var(--hl)); }
.anim-glow .w.sung { filter: drop-shadow(0 0 .12em color-mix(in srgb, var(--hl) 60%, transparent)); }
.anim-pop .w.sung, .anim-pop .w.active { color: var(--hl); }
.anim-pop .w.active { transform: translateY(-.1em) scale(1.16); }
.anim-line .line.cur .w { color: var(--hl); animation: lineIn .35s ease-out; }
@keyframes lineIn { from { transform: scale(.94); opacity: .3; } }

#ball, #previewBall {
  position: absolute; left: 0; top: 0; width: .3em; height: .3em; margin-left: -.15em;
  border-radius: 50%; pointer-events: none; will-change: transform;
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, var(--hl) 55%, color-mix(in srgb, var(--hl) 60%, #000));
  box-shadow: 0 0 14px var(--hl);
}
#ball.squash { border-radius: 50% 50% 42% 42%; transform-origin: bottom; }
#countdown { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; }
#countdown i { width: 14px; height: 14px; border-radius: 50%; background: var(--hl); box-shadow: 0 0 14px var(--hl); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(.75); opacity: .7; } }

/* controls */
#controls {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: linear-gradient(rgba(16, 13, 26, .92), rgba(10, 8, 18, .96)); border-top: 1px solid var(--border);
}
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 36px; text-align: center; }
.seek { flex: 1; min-width: 100px; }
.ctl-group { display: flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.ctl-ico { font-size: 17px; color: var(--muted); }
.ctl-label { color: var(--muted); font-size: 13px; }
.ctl-val { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 40px; text-align: center; font-weight: 600; }
.range.small { width: 84px; }
.mini { width: 24px; height: 24px; border-radius: 8px; border: 0; background: var(--surface-2); line-height: 1; font-size: 16px; }
.mini:hover { background: rgba(255,255,255,.16); }

/* fullscreen (real or window-filling fallback): controls float over the video and auto-hide */
#player:fullscreen, #player.fake-fs { border-radius: 0; border: 0; }
#player.fake-fs { position: fixed; inset: 0; z-index: 50; }
#player:fullscreen #stage, #player.fake-fs #stage { aspect-ratio: auto; max-height: none; height: 100vh; }
#player:fullscreen #controls, #player.fake-fs #controls {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(1100px, calc(100% - 40px));
  border-radius: 20px; border: 1px solid var(--border); backdrop-filter: blur(16px);
  background: rgba(14, 11, 24, .72); transition: opacity .35s, transform .35s;
}
#player:fullscreen .line.cur, #player.fake-fs .line.cur { font-size: calc(clamp(32px, 5.4vw, 92px) * var(--scale)); }
#player:fullscreen .line.next, #player.fake-fs .line.next { font-size: calc(clamp(20px, 2.9vw, 46px) * var(--scale)); }
#player:fullscreen .line.prev, #player.fake-fs .line.prev { font-size: calc(clamp(16px, 2.3vw, 34px) * var(--scale)); }
#player:fullscreen #lyrics, #player.fake-fs #lyrics { padding-bottom: 120px; }
#player.idle #controls { opacity: 0; transform: translateX(-50%) translateY(16px); pointer-events: none; }
#player.idle { cursor: none; }

/* ------------------------------------------------------------ settings (full-page panel) */
/* Covers the whole window so every option is visible at once; a live preview at the top shows
   what the lyrics will look like. Lives in <body>, or inside #player while in real fullscreen. */
#settings {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: rgba(9, 7, 16, .95); backdrop-filter: blur(18px);
  opacity: 0; pointer-events: none; transform: scale(1.015); transition: opacity .2s, transform .2s;
}
#settings.open { opacity: 1; pointer-events: auto; transform: none; }
.brand #homeSettings { margin-left: auto; color: var(--muted); }
.brand #homeSettings:hover { color: var(--text); }
.set-head, .set-body { width: 100%; max-width: 1180px; margin: 0 auto; }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 28px 4px; }
.set-head h3 { margin: 0; font-size: 22px; font-weight: 800; }
.set-body {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding: 6px 28px 26px;
  display: grid; gap: 0 40px; align-content: start;
  grid-template-columns: 1.25fr 1fr 1fr;
  /* three independent columns: rows only size the short middle stack */
  grid-template-areas: "preview preview preview" "lyrics video sep" "lyrics audio sep" "lyrics keys sep";
  grid-template-rows: auto auto auto 1fr;
}
.set-body section { padding: 10px 0; }
.set-body .row { margin: 8px 0 6px; }
.set-body .toggle { margin-top: 10px; }
.set-body .hint { margin-bottom: 8px; }
.set-preview { grid-area: preview; }
.set-lyrics { grid-area: lyrics; }
.set-video { grid-area: video; }
.set-audio { grid-area: audio; }
.set-sep { grid-area: sep; }
.set-keys { grid-area: keys; }
.set-body h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); }
/* live preview of the lyric style */
.preview-stage {
  position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); text-align: center;
  padding: 12px 16px 12px; font-family: var(--lyric-font);
  background:
    radial-gradient(50% 120% at 25% 20%, rgba(255, 79, 163, .35), transparent 70%),
    radial-gradient(50% 120% at 80% 80%, rgba(139, 92, 255, .4), transparent 70%), #120c24;
}
.preview-stage .line { filter: drop-shadow(0 2px 6px rgba(0,0,0,.85)); }
.preview-stage .line.cur { font-size: calc(clamp(20px, 2.6vw, 34px) * var(--scale)); margin: .5em 0 .1em; }
.preview-stage .line.next { font-size: calc(clamp(13px, 1.5vw, 19px) * var(--scale)); opacity: .62; }
.preview-stage.lines-1 .line.next { display: none; }
.preview-stage #previewBall { position: absolute; left: 0; top: 0; }
@media (max-width: 1000px) {
  .set-body { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-template-areas: "preview preview" "lyrics video" "lyrics audio" "lyrics keys" "sep sep"; }
}
@media (max-width: 640px) {
  .set-head { padding: 16px 16px 4px; }
  .set-body { padding: 6px 16px 24px; grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "preview" "lyrics" "video" "audio" "sep" "keys"; }
}
.row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 12px 0 7px; }
.row output { color: var(--text); font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.05); }
.seg button { border: 0; background: transparent; padding: 7px 4px; border-radius: 9px; font-size: 13px; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.seg.fonts button { font-size: 15px; }
.swatches { display: flex; gap: 9px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--c); box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s, transform .15s; }
.swatches button:hover { transform: scale(1.1); }
.swatches button.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.toggle { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 14px; cursor: pointer; }
/* visually hidden but still focusable, so the switches work from the keyboard */
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle i { width: 38px; height: 22px; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; transition: background .2s; flex: none; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(16px); }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.models { display: grid; gap: 8px; }
.model {
  text-align: left; padding: 11px 12px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  display: grid; grid-template-columns: 18px 1fr auto; gap: 4px 10px; align-items: start;
}
.model:hover { background: var(--surface-2); }
.model .radio { width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }
.model.on { border-color: rgba(255,79,163,.6); background: rgba(255,79,163,.08); }
.model.on .radio { border: 5px solid var(--accent); }
.model .name { font-weight: 700; font-size: 14px; }
.model .speed { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--muted); }
.model .speed.fast { color: #8dff6a; background: rgba(141,255,106,.1); }
.model .desc { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; }
.model .act { grid-column: 2 / 4; display: flex; gap: 6px; margin-top: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.model .act .btn { padding: 4px 11px; font-size: 12px; }
.model .act .playing { color: #8dff6a; font-weight: 600; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0 0 16px; font-size: 13px; }
.keys dd { margin: 0; color: var(--muted); }
kbd { font: 600 11px/1 Outfit, sans-serif; padding: 4px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; }

/* ------------------------------------------------------------ arcade mode */
.arcade-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; flex: none;
}
.arcade-btn:hover { color: var(--text); background: var(--surface-2); }
.arcade-btn.on { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 6px 20px -6px rgba(255,79,163,.7); }
#lane { position: absolute; left: 4%; right: 4%; top: 5%; width: 92%; height: 26%; pointer-events: none; }
#stage.center #lane { top: 4%; height: 22%; }
#arcadeHud { position: absolute; right: 4%; top: calc(5% + 26% + 10px); text-align: right; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.8)); }
#score { font-size: clamp(22px, 3vw, 40px); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
#combo { font-size: clamp(12px, 1.4vw, 16px); font-weight: 700; color: var(--hl); min-height: 1.2em; }
#rating {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none;
  font-size: clamp(28px, 5vw, 64px); font-weight: 900; letter-spacing: -.02em; filter: drop-shadow(0 4px 14px rgba(0,0,0,.7));
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
#rating.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#rating.r-perfect { background: linear-gradient(90deg, var(--gold, #ffd447), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#rating.r-great { color: #8dff6a; }
#rating.r-good { color: #38e1ff; }
#rating.r-miss { color: rgba(255,255,255,.55); font-size: clamp(20px, 3vw, 40px); }
#results { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(7, 6, 13, .78); backdrop-filter: blur(10px); }
.results-card { text-align: center; padding: 30px 40px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); min-width: min(420px, 90%); }
.results-card h2 { margin: 6px 0 4px; font-size: 22px; }
.stars { font-size: 40px; letter-spacing: 6px; color: var(--hl); filter: drop-shadow(0 0 10px var(--hl)); margin: 6px 0; }
.res-score b { display: block; font-size: 56px; font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.res-score span { color: var(--accent); font-weight: 700; font-size: 14px; }
.res-stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; max-width: 240px; margin: 18px auto 22px; font-size: 14px; text-align: left; }
.res-stats dt { color: var(--muted); }
.res-stats dd { margin: 0; font-weight: 700; text-align: right; }
.cta-row { display: flex; gap: 10px; justify-content: center; }
@media (prefers-reduced-motion: reduce) { #rating { transition: none; } }

/* short notices (e.g. "the video couldn't play here") */
#toast {
  position: fixed; left: 50%; top: 18px; z-index: 90; max-width: min(560px, calc(100vw - 32px));
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  padding: 11px 18px; border-radius: 14px; background: rgba(16, 13, 26, .95); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; } /* clickable once shown (action button) */

/* website demo: invitation to download, under the player */
.static-cta {
  display: table; margin: 18px auto 0; padding: 11px 20px; border-radius: 999px; background: var(--surface);
  border: 1px solid rgba(255, 79, 163, .45); color: var(--muted); text-decoration: none; font-size: 14px;
}
.static-cta b { color: var(--text); }
.static-cta:hover { border-color: var(--accent); color: var(--text); }

/* ------------------------------------------------------------ states & accessibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search:focus-within { box-shadow: 0 0 0 3px rgba(255, 79, 163, .25), 0 20px 60px -20px rgba(0,0,0,.6); }
.line.cur { transition: opacity .6s; }
.line.cur.resting { opacity: .32; }
.line.cur.intro { font-size: calc(clamp(16px, 2.2vw, 26px) * var(--scale)); opacity: .7; font-weight: 600; }
.steps li.failed { color: #ff8fa8; }
.steps li.failed i { border-color: #ff8fa8; animation: none; }
.steps li.failed i::after { content: "!"; font-size: 12px; font-weight: 900; }
#procError .btn { margin-top: 10px; }
/* unsung words a bit dimmer than sung ones, so the current position reads even over bright video */
.w { color: rgba(246, 244, 255, .8); }
.anim-wipe .w, .anim-glow .w {
  background-image: linear-gradient(90deg, var(--hl) calc(var(--p, 0) * 106% - 3%), rgba(246,244,255,.8) calc(var(--p, 0) * 106% + 3%));
}
body:has(#player.fake-fs) { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .anim-pop .w.active { transform: none; }
  #ball { display: none !important; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 760px) {
  .view { padding: 16px 16px 40px; }
  .proc-card { grid-template-columns: 1fr; }
  #controls { flex-wrap: wrap; gap: 10px; }
  .seek { order: -1; flex-basis: calc(100% - 110px); }
  #time { order: -2; }
  #dur { order: -1; }
  #play { margin-right: auto; }
  .ctl-group { padding: 3px 8px; }
  .search { flex-direction: column; border-radius: 22px; }
  .search input { padding: 10px 12px; }
}
