:root {
  --bg: #0f1020;
  --bg-soft: #17182e;
  --card: #1c1d36;
  --card-2: #24264a;
  --text: #eef0fb;
  --muted: #a6aace;
  --line: #2e3060;
  --accent: #6d5efc;
  --accent-2: #c45ffc;
  --good: #3fd99b;
  --warn: #ffcf6b;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(196, 95, 252, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(109, 94, 252, 0.22), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* Top warning banner ------------------------------------------------------ */
.topbar {
  background: linear-gradient(90deg, rgba(109, 94, 252, 0.16), rgba(196, 95, 252, 0.16));
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  padding: 14px 16px;
  line-height: 1.5;
}
.topbar strong { color: var(--text); }

/* Nav --------------------------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
  gap: 16px;
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.brand span { color: var(--accent-2); }
.navlinks { display: flex; align-items: center; gap: 14px; font-size: 15px; }
.navlinks a:hover { color: #fff; }
/* Plan status pill: Free vs Premium. */
.plan-pill {
  padding: 7px 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.plan-pill.is-premium {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.plan-pill.is-free {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.plan-pill.is-free:hover { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.inline { display: inline; margin: 0; }
.link {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; padding: 0;
}
.link:hover { color: #fff; }

/* Layout ------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 8px clamp(16px, 4vw, 24px) 48px;
  flex: 1;
}
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 22px 16px 30px;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  box-shadow: 0 10px 24px rgba(109, 94, 252, 0.35);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(109, 94, 252, 0.45); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }

/* Cards ------------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* Hero -------------------------------------------------------------------- */
.hero { text-align: center; padding: 40px 0 10px; }
.hero h1 {
  font-size: clamp(34px, 7vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.grad {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto 26px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.steps {
  list-style: none;
  counter-reset: s;
  padding: 0;
  margin: 40px auto 0;
  max-width: 700px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  text-align: left;
}
.steps li {
  counter-increment: s;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  font-size: 14px;
  color: var(--muted);
}
.steps li::before {
  content: counter(s);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  margin-bottom: 10px;
}

/* Forms / capture --------------------------------------------------------- */
h1.page, h2.page { letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.field { margin: 16px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  font: inherit;
}
input:focus { outline: none; border-color: var(--accent); }

.subject {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 4px 0 18px;
}
.toggle { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.toggle input { display: none; }
.toggle label {
  flex: 1; text-align: center; padding: 10px; border-radius: 9px;
  cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: all 0.12s ease;
}
.toggle input:checked + label {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: var(--card-2); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer; border: 3px solid #fff2;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff2;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); cursor: pointer;
}
.age-out {
  min-width: 38px; text-align: center; font-weight: 800;
  background: var(--card-2); border-radius: 8px; padding: 4px 8px; font-size: 14px;
}
.mode-toggle { max-width: 300px; }
.toggle-3 label { font-size: 13px; padding: 9px 6px; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.swatch-row input { display: none; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--sw); cursor: pointer; border: 2px solid var(--line); display: block;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.swatch-row input:checked + .swatch {
  border-color: #fff; transform: scale(1.12); box-shadow: 0 0 0 2px var(--accent);
}

.capture-stage {
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 16px;
  text-align: center;
}
#cam, #vid {
  width: 100%;
  max-height: 320px;
  border-radius: 12px;
  background: #000;
  display: none;
  object-fit: cover;
}
.capture-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* Result ------------------------------------------------------------------ */
#result, #results { margin-top: 20px; }
.result-card { display: grid; gap: 16px; }

/* Multi-capture: featured player that crossfades to each new clip */
.capture-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--warn);
  font-weight: 700;
  font-size: 13px;
  margin-top: 16px;
}
.capture-status[hidden] { display: none; }  /* class display would otherwise win */
.result-stack { display: grid; margin-top: 16px; }
.result-stack > .fade {
  grid-area: 1 / 1;        /* stack children in one cell for a true crossfade */
  transition: opacity 0.4s ease;
}

/* Contextual capture bar — appears only while a source is running (phone-first) */
.runbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 16, 32, 0.96);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.runbar[hidden] { display: none; }
.runbar-capture { width: 100%; max-width: 420px; padding: 15px; font-size: 16px; }
.runbar .capture-status { margin-top: 0; }
.bottombar-spacer { height: 150px; }
.bottombar-spacer[hidden] { display: none; }

/* Fullscreen result modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: rgba(8, 8, 18, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 64px 16px 132px;
}
.modal[hidden] { display: none; }
.modal-inner { width: 100%; max-width: 560px; margin: 0 auto; }
.modal-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--accent); }
.clip { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #000; }
/* Double-buffered player: stack both videos in one cell; cross-fade by opacity so swaps
   between the movement clip and the idle loop never flicker. */
.player { display: grid; }
.player > .clip { grid-area: 1 / 1; opacity: 0; transition: opacity 150ms linear; }
.player > .clip.is-front { opacity: 1; }

/* Gallery + tap-pad (freemium front door) ---------------------------------- */
.section-h { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 26px 0 12px; }
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.dorian-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; cursor: pointer; color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.dorian-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.dorian-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.dorian-thumb { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: #000; }
.dorian-name { font-size: 14px; font-weight: 600; }
.dorian-card.locked { opacity: 0.55; }
.dorian-card.locked:hover { transform: none; }
.lock { position: absolute; top: 8px; right: 8px; font-size: 15px;
  background: rgba(0,0,0,0.55); border-radius: 999px; padding: 2px 6px; }

/* Inline (non-theatre) stage: keep the portrait a sensible preview size, centered.
   Theatre mode moves #stage-player into .focus-stage, which has its own full-bleed sizing. */
.stage { margin-top: 16px; max-width: 340px; margin-left: auto; margin-right: auto; }
.tappad-wrap { margin-top: 4px; }
.tappad { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.tap-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 8px; cursor: pointer; color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.tap-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.tap-btn:disabled { opacity: 0.6; cursor: progress; }
.tap-icon { font-size: 22px; line-height: 1; }
.tap-label { font-size: 13px; color: var(--muted); }
.tap-btn.locked { opacity: 0.55; }
.tap-btn.locked:hover { transform: none; }
.capture-locked { text-align: left; }

.lighting-toggle, .backdrop-toggle { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.light-btn, .backdrop-btn {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.light-btn:hover, .backdrop-btn:hover { border-color: var(--accent); }
.light-btn.selected, .backdrop-btn.selected { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.light-btn.locked { opacity: 0.6; }
/* The Match-Dorian swatch: tints the button border/background to the sampled colour. */
.backdrop-btn .backdrop-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4); margin-left: 7px; vertical-align: -1px; background: var(--matched-bg, transparent); }

/* Stage controls + toast + theater mode -------------------------------------- */
.stage-controls-wrap { margin-top: 14px; display: grid; gap: 12px; }
.stage-controls-wrap[hidden] { display: none; }
/* Movement panel — its own block (pulled out of the controls box) so it can sit directly
   under the portrait in theater mode and stay visible. */
.movement-wrap { margin-top: 14px; }
.movement-wrap[hidden] { display: none; }
.stage-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
/* Pause button lit up while playback is frozen (matches the selected-toggle look). */
#pause-btn.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.queue-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
  color: var(--muted); cursor: pointer; user-select: none; }
.queue-toggle input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.lighting-wrap, .backdrop-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tappad-wrap { display: grid; gap: 8px; }
/* position:relative + overflow:hidden so the camera-FX overlays anchor to the player and the
   jittered/scaled clip stays inside its frame — inline as well as in theatre. */
#stage-player { cursor: zoom-in; transition: filter 0.9s ease; position: relative; overflow: hidden; border-radius: 12px; }
/* Crossfade between stage clips. Both layers sit stacked; the incoming clip is only
   revealed once its first frame is painted (rVFC), then this opacity transition blends
   it over the outgoing layer — and since both ends are the boomerang's matching center
   frame, the blend hides any 1-frame/1-px seam. Keep in sync with FADE_MS in stage.js. */
#stage-player > .clip { transition: opacity 200ms ease; }

/* Camera-realism FX (theatre mode, camerafx.js) — overlays + a clip filter/transform, ALL
   gated behind .cam-fx-on so the player is byte-for-byte unchanged when off. The --cam-* vars
   live on #stage-player and are inherited by both .clip layers, keeping the crossfade buffers
   in pixel lockstep (no double-image at a seam). */
#stage-player {
  --cam-exp: 1; --cam-con: 1; --cam-sat: 1;
  --cam-jx: 0px; --cam-jy: 0px; --cam-scale: 1;
  --cam-grain-op: 0; --cam-scan-op: 0; --cam-vig-op: 0;
}
#stage-player.cam-fx-on > .clip {
  filter: brightness(var(--cam-exp, 1)) contrast(var(--cam-con, 1)) saturate(var(--cam-sat, 1));
  transform: translate3d(var(--cam-jx, 0px), var(--cam-jy, 0px), 0) scale(var(--cam-scale, 1));
  transform-origin: center;
}
/* Overlay layers: pointer-events:none so clicks still reach the player (tap-to-exit theatre);
   display:none until .cam-fx-on (which is only set in focus, where #stage-player is positioned). */
.cam-fx { position: absolute; inset: 0; pointer-events: none; display: none; }
#stage-player.cam-fx-on .cam-fx { display: block; }
.cam-vignette { z-index: 4; opacity: var(--cam-vig-op, 0);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(0,0,0,0.85) 100%); }
.cam-scan { z-index: 5; opacity: var(--cam-scan-op, 0); mix-blend-mode: overlay; overflow: hidden;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.08) 0px, rgba(0,0,0,0.5) 1.5px, rgba(0,0,0,0) 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.22) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.22) 3px, rgba(0,0,0,0) 5px); }
/* Rolling-shutter refresh bar sweeping down the frame. */
.cam-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0) 100%);
  animation: cam-roll 4s linear infinite; }
/* Sensor grain: a static SVG feTurbulence tile (rasterized once) whose position JUMPS in
   discrete steps — boiling digital noise, not a sliding film texture. NEVER animate the SVG.
   feComponentTransfer (slope 3 / intercept -1) stretches it to high-contrast, punchy noise. */
.cam-grain { z-index: 6; opacity: var(--cam-grain-op, 0); mix-blend-mode: overlay;
  background-size: 120px 120px; animation: cam-boil 0.7s steps(1, end) infinite;
  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='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='3' intercept='-1'/%3E%3CfeFuncG type='linear' slope='3' intercept='-1'/%3E%3CfeFuncB type='linear' slope='3' intercept='-1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes cam-boil {
  0%   { background-position:   0px   0px; }
  12%  { background-position: -27px  19px; }
  25%  { background-position:  33px -12px; }
  37%  { background-position: -15px -31px; }
  50%  { background-position:  41px  27px; }
  62%  { background-position: -38px   8px; }
  75%  { background-position:  12px -22px; }
  87%  { background-position: -21px  34px; }
  100% { background-position:   0px   0px; }
}
@keyframes cam-roll { 0% { top: -25%; } 100% { top: 100%; } }
/* Accessibility backstop to the JS guard: kill all camera-FX motion, keep a still grain. */
@media (prefers-reduced-motion: reduce) {
  #stage-player.cam-fx-on > .clip { transform: none; }
  .cam-grain { animation: none; }
  .cam-scan::after { animation: none; display: none; }
}

/* Camera-look controls: pills reuse the lighting-pill look; sliders reuse the crossfade slider. */
.camerafx-wrap { display: grid; gap: 10px; }
.camerafx-toggle { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.camfx-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease; }
.camfx-btn:hover { border-color: var(--accent); }
.camfx-btn.selected { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.camfx-btn.locked { opacity: 0.6; }
.camfx-btn.camfx-custom[hidden] { display: none; }
.camerafx-sliders { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 8px 16px; }
.camfx-slider { display: inline-flex; align-items: center; gap: 8px; }
.camfx-slider .speed-label { min-width: 60px; }
.camfx-range { max-width: 120px; }
.camfx-seed { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camfx-seed .speed-label { min-width: 60px; }
.camfx-seed-input { width: 110px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 6px 9px; font-size: 13px; }
/* Camera-look fine-tune is Premium: the sliders/seed render but are disabled for free users. */
.camerafx-sliders.locked, .camfx-seed.locked { opacity: 0.55; }
.camfx-lock-note { display: inline-block; color: var(--muted); font-size: 13px;
  text-decoration: none; margin: 2px 0; }
.camfx-lock-note:hover { color: var(--accent); text-decoration: underline; }

.speed-toggle { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.speed-label { font-size: 13px; color: var(--muted); }
.speed-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.speed-btn:hover { border-color: var(--accent); }
.speed-btn.selected { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.speed-btn.locked { opacity: 0.6; }

/* Crossfade duration slider (live tuning of the stage cross-dissolve). */
.fade-toggle { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fade-range { accent-color: var(--accent); cursor: pointer; max-width: 180px; }
#fade-value { min-width: 52px; }

.stage-toast { margin-top: 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.stage-toast[hidden] { display: none; }

/* Live queue strip (header + chips, hidden together when the queue is empty) */
.queue-wrap { display: grid; gap: 8px; margin-top: 12px; }
.queue-wrap[hidden] { display: none; }
.queue-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.queue-list[hidden] { display: none; }
.queue-chip { padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.queue-chip.now { color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* Theater / focus mode: reuse .modal (dim backdrop) + .runbar (bottom bar) */
/* Plan + cooldown status, surfaced inside the overlay (the header pill is hidden behind it). */
.focus-status { position: fixed; left: 14px; z-index: 70; display: flex; align-items: center; gap: 8px;
  top: calc(14px + env(safe-area-inset-top, 0px)); }
.focus-cooldown { font-size: 13px; font-weight: 700; color: #fff; padding: 6px 11px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.22); }
.focus-cooldown[hidden] { display: none; }
/* While the free-tier cooldown is active, dim the tap pad to signal "wait". */
.movement-wrap.cooling .tappad { opacity: 0.45; transition: opacity 0.15s; }
/* Theater mode is a viewport-height column that never scrolls the page: the portrait takes
   the leftover height and SHRINKS (object-fit) so the movement panel below it — and the
   config controls under that — always stay in view. */
.stage-focus { display: flex; flex-direction: column; align-items: center; gap: 12px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;   /* SCROLLABLE: the config panel lives below the fold, not pinned in view */
  padding: calc(56px + env(safe-area-inset-top, 0px)) 12px calc(24px + env(safe-area-inset-bottom, 0px));
  /* Theater backdrop: the portrait floats on this colour (the clip letterbox is transparent),
     so the "Backdrop" control sets --theater-bg to recolour the whole stage. Default = the
     original dim .modal backdrop. "Match Dorian" sets it to the portrait's own background. */
  background: var(--theater-bg, rgba(8, 8, 18, 0.94)); }
/* Portrait: GROWS to fill the leftover height (so short panels below don't leave a gap),
   with a 60dvh floor so expanding the config panel can never squash it below that. */
.stage-focus .modal-inner { flex: 1 1 auto; min-height: 60dvh; width: 100%; display: flex; }
.focus-stage { flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; display: flex; }
/* The player is the flex-sized box; clips are absolutely positioned to FILL it (percentage
   height on a flex child doesn't reliably resolve, so the video would otherwise overflow). */
.focus-stage #stage-player { flex: 1 1 auto; min-height: 0; min-width: 0; position: relative;
  overflow: hidden; cursor: zoom-out; border-radius: 0; }   /* full-bleed in theatre (overrides the inline rounding) */
.focus-stage .clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: transparent; border: none; border-radius: 0; }   /* portrait floats on the backdrop — no hard black letterbox bars */
/* Movement panel — its own CARD directly under the portrait, ALWAYS visible (never scrolls away). */
.focus-movement { flex: 0 0 auto; width: 100%; max-width: 560px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 14px; padding: 9px; }
.focus-movement .section-h { display: none; }
.focus-movement .tappad-wrap { margin: 0; }
.focus-movement .tappad { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.focus-movement .tap-btn { flex-direction: row; gap: 6px; padding: 8px 12px; }
.focus-movement .tap-icon { font-size: 20px; }
.focus-movement .tap-label { font-size: 12px; }
/* Compact movement panel: emoji-only, tighter targets. Auto on genuinely short screens, OR
   forced on any height by the Theater "Compact" toggle (.stage-focus.compact). */
@media (max-height: 760px) {
  .focus-movement .tap-label { display: none; }
  .focus-movement .tap-btn { padding: 9px 11px; }
  .focus-movement .tap-icon { font-size: 22px; }
}
.stage-focus.compact .focus-movement .tap-label { display: none; }
.stage-focus.compact .focus-movement .tap-btn { padding: 9px 11px; }
.stage-focus.compact .focus-movement .tap-icon { font-size: 22px; }
/* "Controls" toggle sits IN-FLOW between the two panels (not floating over them). */
.stage-focus .bottombar-toggle { position: static; right: auto; bottom: auto; z-index: auto;
  flex: 0 0 auto; align-self: center; padding: 5px 16px; font-size: 13px; }
/* Config controls: an in-flow card that flows BELOW the video + movement panel — scroll the
   overlay down to reach it, so it never squashes the portrait. Collapsible via "Controls". */
.focus-bottombar { position: static; width: 100%; max-width: 560px; flex: 0 0 auto;
  flex-direction: column; align-items: stretch; max-height: none; overflow-y: visible;
  border: 1px solid var(--line); border-radius: 14px; }
.focus-bottombar[hidden] { display: none; }
.bottombar-toggle { position: fixed; right: 14px; z-index: 70;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.loop-toggle {
  display: inline-flex; align-items: center; gap: 7px; margin-top: -6px;
  font-size: 14px; color: var(--muted); cursor: pointer; user-select: none;
}
.loop-toggle input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.badge.hit { background: rgba(63, 217, 155, 0.16); color: var(--good); }
.badge.fresh { background: rgba(255, 207, 107, 0.16); color: var(--warn); }
.kv { font-size: 13px; color: var(--muted); }
.box {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.box h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.box p { margin: 0; }
.prompt { font-style: italic; color: #dfe2ff; }
.statline { font-size: 13px; color: var(--muted); }

/* Dev OCR debug panel ----------------------------------------------------- */
.ocr-debug { margin-top: 16px; border-style: dashed; }
.ocr-debug h4 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.ocr-raw {
  margin: 6px 0 0; padding: 10px 12px; max-height: 180px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
  color: #dfe2ff; white-space: pre-wrap; word-break: break-word;
}

/* Pricing ----------------------------------------------------------------- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.price { display: flex; flex-direction: column; }
.price.featured { border-color: var(--accent); box-shadow: 0 18px 50px rgba(109, 94, 252, 0.3); }
.price h3 { margin: 0 0 4px; }
.price .amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.price .amount small { font-size: 15px; color: var(--muted); font-weight: 600; }
.price ul { list-style: none; padding: 0; margin: 14px 0 18px; color: var(--muted); font-size: 14px; display: grid; gap: 8px; }
.price li::before { content: "✓ "; color: var(--good); font-weight: 800; }
.price form { margin-top: auto; }
.tag { font-size: 12px; color: var(--accent-2); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }

/* Account ----------------------------------------------------------------- */
.bignum { font-size: 56px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.notice { background: rgba(63, 217, 155, 0.12); border: 1px solid rgba(63,217,155,0.3); color: var(--good); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.error { background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255,107,107,0.35); color: #ff9b9b; border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.warn { background: rgba(255, 207, 107, 0.12); border: 1px solid rgba(255,207,107,0.4); color: var(--warn); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-size: 14px; }
.foot a { text-decoration: underline; }

/* HTMX spinner ------------------------------------------------------------ */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.spin-host { pointer-events: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #fff4; border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .steps, .price-grid, .grid2, .subject { grid-template-columns: 1fr; }
}

/* Free-emote counter on the tap-pad */
.plays-left {
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgba(196, 95, 252, 0.12);
  border: 1px solid rgba(196, 95, 252, 0.25);
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
  vertical-align: middle;
}
.plays-left:hover { border-color: var(--accent-2); }
.plays-left[data-plays="0"] { color: var(--warn); border-color: rgba(255, 207, 107, 0.4); background: rgba(255, 207, 107, 0.12); }
.plays-left.unlimited { color: var(--good); border-color: rgba(63, 217, 155, 0.35); background: rgba(63, 217, 155, 0.12); cursor: default; }

/* Landing page ------------------------------------------------------------ */
.lp-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 34px;
  align-items: center;
  padding: 26px 0 8px;
}
.lp-hero-text h1 {
  font-size: clamp(32px, 5.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 14px 0 14px;
}
.lp-hero-art img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 24px 60px rgba(109, 94, 252, 0.28));
}
.lp-hero-art video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(109, 94, 252, 0.28);
  background: #000;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(196, 95, 252, 0.12);
  border: 1px solid rgba(196, 95, 252, 0.25);
  padding: 5px 11px;
  border-radius: 999px;
}
.tiny { font-size: 13px; margin-top: 10px; }
.lp-section { margin-top: 50px; }
.section-title {
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 6px;
}
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 8px; max-width: 540px; }
/* How-to-use steps: step number + heading + description on top, then a media row with
   the result clip on the LEFT and a screenshot of the real UI ("the main picture") on the
   right. The media row stacks on narrow screens (see media query). */
.how-steps { display: grid; gap: 16px; margin-top: 22px; }
.how-step {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px;
}
.how-step-body { display: flex; flex-direction: column; gap: 6px; }
.how-step-num {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-2);
}
.how-step-body h3 { margin: 0; font-size: 20px; }
.how-step-body p { margin: 0; color: var(--muted); font-size: 14px; }
/* --media-h drives BOTH the clip and the UI screenshot, so they're the same height. */
.how-step-media { display: flex; align-items: flex-start; gap: 22px; --media-h: 267px; }
.how-step-result {
  margin: 0; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.how-step-result video {
  height: var(--media-h); width: auto; aspect-ratio: 9 / 16; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: 10px; background: #000;
}
.how-step-result figcaption { max-width: 150px; text-align: center; font-size: 12px; color: var(--muted); }
.how-step-ui img {
  height: var(--media-h); width: auto; max-width: 100%; display: block;
  border: 1px solid var(--line); border-radius: 12px;
}
.showcase { display: flex; justify-content: center; padding: 18px; margin-top: 14px; }
.showcase img { width: 100%; max-width: 620px; height: auto; }

/* "Why movement" — copy beside a looping clip */
.why {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 34px;
  align-items: center;
}
.why-title { font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.02em; margin: 12px 0 12px; }
.why-text p { color: var(--muted); margin: 0 0 14px; font-size: 16px; line-height: 1.6; }
.why-text strong { color: var(--text); }
.why-media video,
.why-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(109, 94, 252, 0.22);
  background: #000;
}

/* Real dorian faces row */
.faces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.face {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

/* Two-up plan compare on the landing */
.lp-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 22px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.cta-band {
  margin-top: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.cta-band h2 { margin: 0 0 4px; font-size: clamp(20px, 3vw, 26px); letter-spacing: -0.02em; }
.responsible { max-width: 720px; margin: 0 auto; }
.responsible h3 { margin: 0 0 8px; }

@media (max-width: 760px) {
  .lp-hero { grid-template-columns: 1fr; }
  .lp-hero-art { order: -1; }
  .how-step-media { flex-direction: column; align-items: center; gap: 14px; }
  .how-step-media .how-step-ui img { height: auto; width: 100%; }  /* full-width UI on mobile */
  .why { grid-template-columns: 1fr; }
  .why-media { order: -1; }
  .lp-plan-grid { grid-template-columns: 1fr; }
}
