@font-face { font-family: 'Space Grotesk'; src: url('/fonts/space-grotesk.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #09090b; --surface: #141418; --surface-2: #1c1c22; --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --text: #f4f4f5; --muted: #a1a1aa; --dim: #6b6b75; --accent: #c8ff3d; --accent-ink: #0b1000; --rec: #ff4d4f;
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --radius: 26px; --gutter: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
body::before {
  content: ''; position: fixed; inset: -12%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 34vmax at 14% 4%, rgba(200,255,61,.26), transparent 62%),
    radial-gradient(38vmax 30vmax at 96% 16%, rgba(255,77,150,.22), transparent 60%),
    radial-gradient(46vmax 38vmax at 0% 62%, rgba(56,189,248,.18), transparent 60%),
    radial-gradient(52vmax 42vmax at 104% 96%, rgba(124,92,255,.3), transparent 60%),
    radial-gradient(34vmax 26vmax at 50% 48%, rgba(200,255,61,.08), transparent 70%),
    radial-gradient(30vmax 24vmax at 30% 100%, rgba(255,160,60,.14), transparent 65%);
  animation: drift 36s ease-in-out infinite alternate;
}
button, input, a { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { max-width: 460px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(env(safe-area-inset-top), 12px) calc(var(--gutter) + env(safe-area-inset-right)) max(env(safe-area-inset-bottom), 16px) calc(var(--gutter) + env(safe-area-inset-left)); }
main { flex: 1; }

.top { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 600 19px/1 var(--display); letter-spacing: -.02em; }
.brand svg { width: 30px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; }
.brand b { color: var(--accent); font-weight: 700; }
.badge { font: 500 11px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 99px; padding: 5px 9px; }

h1, h2 { font-family: var(--display); letter-spacing: -.035em; margin: 0; }
h1 { font-size: clamp(38px, 11.5vw, 54px); line-height: .98; font-weight: 700; margin-top: 18px; }
h1 span { color: var(--accent); }
h2 { font-size: 24px; line-height: 1.1; font-weight: 600; }
.lede { color: var(--muted); margin: 12px 0 0; font-size: 15.5px; }
.dim { color: var(--dim); }

.btn { border: 0; border-radius: 99px; padding: 13px 22px; font-weight: 600; font-size: 15.5px; transition: transform .15s, background .15s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: transparent; border: 1px solid var(--line-strong); }
.btn.wide { width: 100%; margin-top: 18px; }
.btn.wide + .btn.wide { margin-top: 10px; }
.surprise { display: flex; align-items: center; justify-content: center; gap: 9px; }
.surprise svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.surprise circle { fill: currentColor; stroke: none; }
.surprise:disabled { opacity: .5; }

/* Record */
.stage { position: relative; margin-top: 18px; height: clamp(260px, 47dvh, 560px); border-radius: var(--radius); overflow: hidden;
  background: rgba(20,20,24,.7) linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px; border: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.stage-off { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
/* A barely-there drum kit behind the camera-off card; it gently plays itself. */
.kit { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); width: min(94%, 380px); height: auto; pointer-events: none;
  fill: none; stroke: rgba(244,244,245,.13); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kit .accent { stroke: rgba(200,255,61,.5); }
.kit .crash { transform-origin: 362px 72px; transform: rotate(-10deg); animation: wobble 2.4s ease-in-out infinite; }
.kit .hat-top { animation: hat 1.2s ease-in-out infinite; }
.kit .kick { transform-origin: 200px 196px; animation: thump 1.2s ease-out infinite; }
.kit .hits { animation: hit 1.2s ease-out .6s infinite; opacity: 0; }
.stage-off > :not(.kit) { position: relative; }
.stage-off p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 240px; }
.stage-icon { width: 44px; height: 44px; fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linejoin: round; }
[data-camera="on"] .stage-off, [data-camera="recording"] .stage-off { display: none; }
[data-camera="off"] #preview { visibility: hidden; }
.hud { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; align-items: center; padding: 7px 11px; border-radius: 99px;
  background: rgba(9,9,11,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font: 500 14px/1 var(--display); font-variant-numeric: tabular-nums; }
[data-camera="off"] .hud { display: none; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
[data-camera="recording"] .rec-dot { background: var(--rec); animation: pulse 1s infinite; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 22px; }
.side-btn { justify-self: start; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; cursor: pointer; padding: 6px; }
.side-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side-btn.ghost { visibility: hidden; }
.rec-wrap { position: relative; display: grid; place-items: center; }
.cue { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 9px 14px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font: 600 14px/1 var(--display); box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .25s; animation: bob 1.6s ease-in-out infinite; z-index: 3; }
.cue::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--accent); }
[data-camera="on"] .cue { opacity: 1; }
[data-camera="on"] .ring-bg { animation: glow 1.6s ease-in-out infinite; }
.rec { position: relative; width: 84px; height: 84px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.rec svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.rec circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: rgba(255,255,255,.22); }
.ring { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 289.03; stroke-dashoffset: 289.03; }
.core { width: 62px; height: 62px; border-radius: 50%; background: var(--rec); transition: all .2s ease; }
.rec:disabled { opacity: .35; cursor: default; }
[data-camera="recording"] .core { width: 30px; height: 30px; border-radius: 8px; }
.hint { text-align: center; color: var(--dim); font-size: 13px; margin: 16px 0 0; }

/* Working */
.draft { position: relative; width: 132px; aspect-ratio: 3 / 4; margin: 26px auto 22px; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.draft video { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .8; }
.scan { position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(200,255,61,.28) 50%, transparent 60%) 0 0 / 100% 250%; animation: scan 2.2s linear infinite; }
#working h2 { text-align: center; }
.steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 4px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; align-items: center; padding: 11px 14px; border-radius: 16px; color: var(--dim); transition: color .3s, background .3s; }
.steps li em { grid-column: 2; font-style: normal; font-size: 12.5px; color: var(--dim); display: none; }
.steps li i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); position: relative; }
.steps li.done { color: var(--muted); }
.steps li.done i { border-color: var(--accent); background: var(--accent); }
.steps li.done i::after { content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.steps li.active { color: var(--text); background: var(--surface); }
.steps li.active em { display: block; }
.steps li.active i { border: 0; background: linear-gradient(var(--accent), var(--accent)) 2px 100% / 3px 40% no-repeat, linear-gradient(var(--accent), var(--accent)) 7.5px 100% / 3px 80% no-repeat, linear-gradient(var(--accent), var(--accent)) 13px 100% / 3px 55% no-repeat; animation: eq .9s ease-in-out infinite alternate; border-radius: 2px; }

/* Results */
.player { position: relative; margin-top: 14px; border-radius: var(--radius); overflow: hidden; background: #000 var(--poster, none) center / contain no-repeat; border: 1px solid var(--line); aspect-ratio: var(--aspect, 3 / 4); max-height: 62dvh; margin-inline: auto; }
/* One element per source: the previous picture stays underneath until the next paints, so switching never flashes black. */
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.player video.back { opacity: 1; z-index: 0; }
.player video.front { opacity: 1; z-index: 1; }
.play-overlay, .now, .scrub { z-index: 2; }
.play-overlay { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.18); display: grid; place-items: center; transition: opacity .2s; }
.play-overlay svg { width: 74px; height: 74px; padding: 20px 18px 20px 22px; border-radius: 50%; background: rgba(9,9,11,.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); fill: var(--text); }
.playing .play-overlay { opacity: 0; }
.now { position: absolute; left: 12px; top: 12px; display: flex; gap: 7px; align-items: baseline; padding: 7px 12px; border-radius: 99px; background: rgba(9,9,11,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px; pointer-events: none; }
.now b { font: 600 14px/1 var(--display); color: var(--accent); }
.now span { color: var(--muted); }
.scrub { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; align-items: flex-end; cursor: pointer; }
.scrub i { height: 3px; width: 0; background: var(--accent); }

.original { width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--muted); font-size: 14px; }
.original svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.original b { color: var(--text); font-weight: 600; margin-right: 4px; }
.original.current { border-color: var(--accent); color: var(--text); }
.original.current svg { stroke: var(--accent); }

.takes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.legend { font-size: 12px; color: var(--dim); text-align: right; }
.takes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.take { border-radius: 20px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: border-color .2s, background .2s; }
.take.current { border-color: var(--accent); background: var(--surface-2); }
.take-play { width: 100%; border: 0; background: none; padding: 14px 14px 12px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; text-align: left; gap: 4px 8px; }
.take-n { font: 600 30px/1 var(--display); letter-spacing: -.04em; color: var(--dim); }
.take.current .take-n { color: var(--accent); }
.take-name { grid-column: 1; font-weight: 600; font-size: 15px; }
.take-state { grid-column: 2; grid-row: 2; justify-self: end; width: 26px; height: 26px; border-radius: 50%; background: var(--text); display: grid; place-items: center; }
.take-state svg { width: 12px; height: 12px; fill: var(--bg); margin-left: 2px; }
.take.current.on-air .take-state { background: var(--accent); }
.take.current.on-air .take-state svg { display: none; }
.take.current.on-air .take-state::before { content: ''; width: 10px; height: 10px; background: linear-gradient(var(--accent-ink), var(--accent-ink)) 0 0 / 3.5px 100% no-repeat, linear-gradient(var(--accent-ink), var(--accent-ink)) 100% 0 / 3.5px 100% no-repeat; }
.take-dl { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.take-dl a { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 0; text-decoration: none; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.take-dl a + a { border-left: 1px solid var(--line); }
.take-dl a:active { background: var(--surface-2); color: var(--text); }
.take-dl svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Error */
#error { text-align: center; padding-top: 60px; }
.oops { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font: 700 30px/1 var(--display); color: var(--rec); background: rgba(255,77,79,.12); }

footer { text-align: center; color: var(--dim); font-size: 12px; padding-top: 28px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: rise .25s ease; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
@keyframes drift { 50% { transform: translate3d(3%, -2%, 0) rotate(4deg); } 100% { transform: translate3d(-3%, 3%, 0) scale(1.08); } }
@keyframes wobble { 50% { transform: rotate(-4deg); } }
@keyframes hat { 50% { transform: translateY(-3px); } }
@keyframes thump { 0%, 100% { transform: scale(1); } 8% { transform: scale(1.035); } }
@keyframes hit { 0% { opacity: .9; } 60%, 100% { opacity: 0; } }
@keyframes glow { 50% { stroke: rgba(200,255,61,.6); } }
@keyframes scan { from { background-position: 0 100%; } to { background-position: 0 -150%; } }
@keyframes eq { from { background-size: 3px 30%, 3px 90%, 3px 45%; } to { background-size: 3px 85%, 3px 35%, 3px 100%; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { .shell { padding-top: 28px; } h1 { margin-top: 28px; } }
