/* Layout: a fixed left rail (navigation + plan usage) beside one left-aligned working column.
   The request form sits next to a production slate that fills in as you type; review splits into
   the video stage and an inspector. The slate is the one loud element, everything else stays quiet. */
:root {
  --bg: #ECEEEA;
  --panel: #FFFFFF;
  --panel-2: #F5F6F3;
  --ink: #15191B;
  --ink-2: #48514F;
  --ink-3: #7A8380;
  --line: #D8DCD6;
  --line-2: #C3C9C2;
  --accent: #0A6670;
  --accent-hover: #08545C;
  --accent-ink: #FFFFFF;
  --accent-soft: #DAECEC;
  --ok: #1B7A3D;
  --ok-soft: #DDF0E3;
  --warn: #965A00;
  --warn-soft: #F8E9CF;
  --bad: #B3261E;
  --bad-soft: #FAE1DD;
  --tally: #D7362B;
  --slate: #1A1E1D;
  --slate-ink: #F2F4F1;
  --slate-dim: #9AA39F;
  --stage: #0D1112;
  --focus: #0A6670;

  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-md: 0.9375rem;
  --t-lg: 1.125rem;
  --t-xl: 1.5rem;
  --t-2xl: 2rem;

  --r-field: 8px;
  --r-panel: 12px;
  --rail: 248px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111514;
    --panel: #181D1C;
    --panel-2: #1D2321;
    --ink: #E8ECE9;
    --ink-2: #AAB4B0;
    --ink-3: #7B8682;
    --line: #29312F;
    --line-2: #36403D;
    --accent: #45B3BC;
    --accent-hover: #63C4CC;
    --accent-ink: #04272B;
    --accent-soft: #143538;
    --ok: #57C47F;
    --ok-soft: #15301F;
    --warn: #E5A645;
    --warn-soft: #3A2B12;
    --bad: #F0776C;
    --bad-soft: #3D1B18;
    --tally: #F0574C;
    --slate: #0A0D0C;
    --slate-ink: #F2F4F1;
    --slate-dim: #8C9692;
    --stage: #070909;
    --focus: #63C4CC;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111514;
  --panel: #181D1C;
  --panel-2: #1D2321;
  --ink: #E8ECE9;
  --ink-2: #AAB4B0;
  --ink-3: #7B8682;
  --line: #29312F;
  --line-2: #36403D;
  --accent: #45B3BC;
  --accent-hover: #63C4CC;
  --accent-ink: #04272B;
  --accent-soft: #143538;
  --ok: #57C47F;
  --ok-soft: #15301F;
  --warn: #E5A645;
  --warn-soft: #3A2B12;
  --bad: #F0776C;
  --bad-soft: #3D1B18;
  --tally: #F0574C;
  --slate: #0A0D0C;
  --slate-ink: #F2F4F1;
  --slate-dim: #8C9692;
  --stage: #070909;
  --focus: #63C4CC;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-stretch: 108%; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: var(--t-2xl); font-weight: 750; line-height: 1.1; }
h2 { font-size: var(--t-xl); font-weight: 700; line-height: 1.2; }
h3 { font-size: var(--t-lg); font-weight: 650; line-height: 1.3; }
p { margin: 0; }
.tc { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 22px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--panel-2);
}
.brand { display: flex; align-items: center; gap: 10px; padding-inline: 8px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--f-display); font-stretch: 118%; font-weight: 780; font-size: 1.0625rem; letter-spacing: -0.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-field);
  background: transparent; color: var(--ink-2); text-align: left; font-weight: 500;
}
.nav button:hover { background: var(--panel); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.live {
  display: none; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-field);
  background: var(--panel); text-align: left;
}
.live.on { display: flex; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); flex: none; animation: blink 1.4s steps(2, start) infinite; }
.live .what { font-size: var(--t-sm); font-weight: 600; }
.live .pct { margin-left: auto; font-size: var(--t-sm); color: var(--ink-2); }
.usage { margin-top: auto; padding: 14px 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.usage .plan { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--t-sm); }
.usage .plan strong { font-weight: 650; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.usage small { color: var(--ink-3); font-size: var(--t-xs); }

.main { min-width: 0; padding-block: 0 72px; }
.linkbtn { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.view { padding-inline: clamp(16px, 4vw, 44px); padding-block: 32px 0; max-width: 1240px; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.head p { color: var(--ink-2); margin-top: 6px; max-width: 60ch; }

/* ---------- buttons, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-field);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.big { min-height: 52px; padding: 0 24px; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 7px; }
.field > label, .legend { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.field .hint { font-size: var(--t-sm); color: var(--ink-3); }
.field .err { font-size: var(--t-sm); color: var(--bad); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 13px;
  border: 1px solid var(--line-2); border-radius: var(--r-field);
  background: var(--panel); color: var(--ink);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2); font-size: var(--t-sm); font-weight: 500;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

/* ---------- new video ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.form { display: grid; gap: 26px; }
.formats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 0; padding: 0; margin: 0; }
.formats legend { margin-bottom: 7px; }
.format { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r-field); background: var(--panel); cursor: pointer; }
.format input { position: absolute; opacity: 0; pointer-events: none; }
.format:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.format:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.frame { flex: none; border: 2px solid var(--ink-2); border-radius: 3px; display: grid; place-items: center; }
.frame.v { width: 22px; height: 38px; }
.frame.h { width: 44px; height: 26px; }
.format b { display: block; font-weight: 650; }
.format span { display: block; font-size: var(--t-sm); color: var(--ink-2); }
.submit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding-top: 4px; }
.submit small { color: var(--ink-3); font-size: var(--t-sm); }
.busy-note { padding: 12px 14px; border-radius: var(--r-field); background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); }

/* The slate: the product's one loud object. */
.slate { background: var(--slate); color: var(--slate-ink); border-radius: var(--r-panel); overflow: hidden; position: sticky; top: 24px; }
.clapper {
  height: 26px;
  background: repeating-linear-gradient(-45deg, var(--slate-ink) 0 18px, var(--slate) 18px 36px);
  border-bottom: 3px solid var(--slate);
  transform-origin: 0 100%;
}
.slate.snap .clapper { animation: clap .42s cubic-bezier(.3, 1.6, .5, 1); }
.slate-body { padding: 18px 20px 20px; display: grid; gap: 16px; }
.slate-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.slate-title span { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; }
.slate-title .tc { color: var(--slate-dim); font-size: var(--t-sm); }
.slate-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(242, 244, 241, .22); border-radius: 6px; }
.slate-cell { padding: 10px 12px; min-width: 0; border-bottom: 1px solid rgba(242, 244, 241, .22); }
.slate-cell:nth-child(odd) { border-right: 1px solid rgba(242, 244, 241, .22); }
.slate-cell.wide { grid-column: 1 / -1; border-right: 0; }
.slate-cell:nth-last-child(-n+2) { border-bottom: 0; }
.slate-cell small { display: block; color: var(--slate-dim); font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; }
.slate-cell output { display: block; margin-top: 2px; font-family: var(--f-display); font-stretch: 112%; font-weight: 650; font-size: 1.0625rem; line-height: 1.25; overflow-wrap: anywhere; }
.slate-cell output.empty { color: var(--slate-dim); font-weight: 500; }
.slate-foot { font-size: var(--t-sm); color: var(--slate-dim); }

.steps { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; font-size: var(--t-sm); color: var(--ink-2); counter-increment: s; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-weight: 650; color: var(--ink); font-size: var(--t-xs); }
.steps b { color: var(--ink); font-weight: 600; }

/* ---------- generating ---------- */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.status { display: grid; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--panel); position: sticky; top: 24px; }
.status-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.status-top b { font-family: var(--f-display); font-stretch: 112%; font-size: 2.25rem; font-weight: 780; line-height: 1; }
.status-top span { color: var(--ink-3); font-size: var(--t-sm); }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .25s linear; }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.pipeline li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pipeline li:first-child { border-top: 0; }
.pipeline .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; }
.pipeline .mark svg { width: 12px; height: 12px; display: none; }
.pipeline li.done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.pipeline li.done .mark svg { display: block; }
.pipeline li.active .mark { border-color: var(--accent); border-right-color: transparent; animation: spin .9s linear infinite; }
.pipeline .name { font-weight: 600; font-size: var(--t-sm); }
.pipeline li.todo .name { color: var(--ink-3); font-weight: 500; }
.pipeline .detail { font-size: var(--t-sm); color: var(--ink-2); }
.status .meta { font-size: var(--t-sm); color: var(--ink-2); display: grid; gap: 4px; }
.status .leave { font-size: var(--t-sm); color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 14px; }

.arcade { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--panel); overflow: hidden; }
.arcade-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.arcade-head p { font-size: var(--t-sm); color: var(--ink-2); }
.tabs { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; font-weight: 600; font-size: var(--t-sm); color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }
.ready-banner { display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 12px 18px; background: var(--ok-soft); color: var(--ok); border-bottom: 1px solid var(--line); font-weight: 600; }
.ready-banner.on { display: flex; }
.game { padding: 18px; display: grid; gap: 14px; justify-items: center; }
.score { display: flex; gap: 22px; font-size: var(--t-sm); color: var(--ink-2); width: 100%; max-width: 440px; justify-content: space-between; }
.score b { color: var(--ink); font-variant-numeric: tabular-nums; }
.board-wrap { position: relative; width: 100%; max-width: 440px; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); touch-action: none; }
.board-wrap canvas { display: block; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; padding: 20px; background: color-mix(in srgb, var(--panel) 82%, transparent); }
.overlay p { color: var(--ink-2); font-size: var(--t-sm); max-width: 30ch; }
.overlay strong { font-family: var(--f-display); font-stretch: 112%; font-size: var(--t-xl); font-weight: 750; }
.dpad { display: none; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 46px); gap: 6px; }
.dpad button { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; display: grid; place-items: center; }
.dpad button svg { width: 18px; height: 18px; }
.dpad [data-d="up"] { grid-column: 2; grid-row: 1; }
.dpad [data-d="left"] { grid-column: 1; grid-row: 2; }
.dpad [data-d="down"] { grid-column: 2; grid-row: 2; }
.dpad [data-d="right"] { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) { .dpad { display: grid; } }
.keys { font-size: var(--t-xs); color: var(--ink-3); }
kbd { font-family: var(--f-mono); font-size: .7rem; padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); }
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 330px; aspect-ratio: 1; }
.ttt button { border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; padding: 18%; }
.ttt button:not([disabled]):hover { border-color: var(--accent); }
.ttt button[disabled] { cursor: default; }
.ttt button.win { background: var(--accent-soft); border-color: var(--accent); }
.ttt svg { width: 100%; height: 100%; }
.ttt-status { font-weight: 600; min-height: 1.5em; }

/* ---------- review ---------- */
.review { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: start; }
.review.landscape { grid-template-columns: minmax(0, 1fr); }
.player { display: grid; gap: 10px; width: min(340px, 100%); }
.review.landscape .player { width: 100%; max-width: 860px; }
.screen { position: relative; aspect-ratio: 9 / 16; max-width: 100%; background: var(--stage); border-radius: 10px; overflow: hidden; }
.review.landscape .screen { aspect-ratio: 16 / 9; }
.screen canvas { display: block; width: 100%; height: 100%; }
.controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel); display: grid; place-items: center; }
.play svg { width: 16px; height: 16px; }
.scrub { width: 100%; accent-color: var(--accent); }
.controls .tc { font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; }
.inspector { display: grid; gap: 22px; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.review { background: var(--warn-soft); color: var(--warn); }
.pill.generating { background: var(--accent-soft); color: var(--accent); }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.uploaded { background: var(--ok-soft); color: var(--ok); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill.plain { background: var(--panel-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.pill.plain::before { display: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--t-xs); color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.script { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--panel); }
.script summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.script summary::-webkit-details-marker { display: none; }
.script summary span { color: var(--ink-3); font-weight: 500; font-size: var(--t-sm); }
.script ol { list-style: none; margin: 0; padding: 0 16px 8px; max-height: 300px; overflow: auto; }
.script li { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: var(--t-sm); }
.script li .tc { color: var(--ink-3); font-size: var(--t-xs); padding-top: 2px; }
.script li.now { color: var(--accent); }
.script li.now .tc { color: var(--accent); }
.decide { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-panel); background: var(--panel); border: 1px solid var(--line); }
.decide-row { display: flex; flex-wrap: wrap; gap: 10px; }
.decide p { font-size: var(--t-sm); color: var(--ink-2); }
.redo { display: grid; gap: 14px; padding-top: 6px; border-top: 1px solid var(--line); }

/* ---------- approved ---------- */
.done-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.card { padding: 22px; border-radius: var(--r-panel); background: var(--panel); border: 1px solid var(--line); display: grid; gap: 16px; }
.file { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-field); background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.file .frame { border-color: var(--ink-3); }
.file div { min-width: 0; }
.file b { display: block; font-size: var(--t-sm); overflow-wrap: anywhere; }
.file span { font-size: var(--t-xs); color: var(--ink-3); }
.file-note { margin: 0; font-size: var(--t-sm); color: var(--ink-3); }
.file-note.gone { color: var(--ink-2); }
.privacy { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.privacy legend { margin-bottom: 7px; }
.privacy label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r-field); font-size: var(--t-sm); font-weight: 500; cursor: pointer; }
.privacy label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.privacy input { accent-color: var(--accent); }
.channel { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-field); border: 1px solid var(--line); background: var(--panel-2); }
.channel .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--panel); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: var(--t-sm); flex: none; }
.channel b { display: block; font-size: var(--t-sm); }
.channel span { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.upload-progress { display: grid; gap: 8px; font-size: var(--t-sm); color: var(--ink-2); }
.success { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-field); background: var(--ok-soft); color: var(--ok); font-size: var(--t-sm); font-weight: 500; }
.success svg { width: 20px; height: 20px; flex: none; }

/* ---------- library ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.table { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--panel); overflow: hidden; }
.row { display: grid; grid-template-columns: 44px minmax(0, 2.2fr) 0.8fr 0.9fr 1.1fr 0.9fr 120px; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.th { font-size: var(--t-xs); font-weight: 650; color: var(--ink-3); background: var(--panel-2); padding-block: 9px; }
.row .thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.row .thumb .frame { border-color: var(--ink-3); border-width: 1.5px; }
.row .thumb .frame.v { width: 14px; height: 24px; }
.row .thumb .frame.h { width: 26px; height: 15px; }
.row .t b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row .t span { font-size: var(--t-sm); color: var(--ink-3); }
.row .cell { font-size: var(--t-sm); color: var(--ink-2); }
.row .act { justify-self: end; }
.row .act .btn { min-height: 36px; padding: 0 12px; font-size: var(--t-sm); }
.example { font-size: var(--t-xs); color: var(--ink-3); font-weight: 500; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--ink-2); }

/* ---------- billing ---------- */
.billing { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; max-width: 900px; }
.big-num { font-family: var(--f-display); font-stretch: 112%; font-size: 2.5rem; font-weight: 780; line-height: 1; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--ink-2); font-size: var(--t-sm); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 12px 14px 12px 18px; border-radius: 10px; background: var(--ink); color: var(--panel);
  font-size: var(--t-sm); font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; border-radius: 6px; padding: 6px 12px; background: var(--panel); color: var(--ink); font-weight: 650; font-size: var(--t-sm); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { to { opacity: .25; } }
@keyframes clap { 0% { transform: rotate(-9deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .compose { grid-template-columns: minmax(0, 1fr); }
  .slate { position: static; }
  .gen { grid-template-columns: minmax(0, 1fr); }
  .status { position: static; order: -1; }
  .done-grid { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .row.th { display: none; }
  .row .cell { display: none; }
  .row .cell.st { display: block; grid-column: 2; grid-row: 2; }
  .row .thumb { grid-row: span 2; }
  .row .act { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky; top: 0; z-index: 10; height: auto;
    flex-direction: row; align-items: center; gap: 10px; padding: 10px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto;
  }
  .brand-name { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav button { padding: 8px 10px; }
  .nav .count { display: none; }
  .live { width: auto; padding: 7px 10px; }
  .live .what { display: none; }
  .app { grid-template-rows: auto 1fr; align-content: start; }
  .usage { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; }
  .usage > :not(.account) { display: none; }
  .account { padding: 0; }
  .rail .account b { display: none; }
  .review { grid-template-columns: minmax(0, 1fr); }
  .player { margin-inline: auto; }
}
@media (max-width: 520px) {
  .nav button span { display: none; }
  .formats { grid-template-columns: 1fr; }
  h1 { font-size: 1.625rem; }
}

/* ================= app additions ================= */
.screen video { display: block; width: 100%; height: 100%; background: var(--stage); object-fit: contain; }
.player .video-note { font-size: var(--t-xs); color: var(--ink-3); }

/* account box in the rail */
.account { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.account .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--panel); display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: var(--t-xs); flex: none; }
.account div { min-width: 0; flex: 1; }
.account b { display: block; font-size: var(--t-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account button { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: var(--t-xs); text-decoration: underline; text-underline-offset: 2px; }
.account button:hover { color: var(--ink); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 9px clamp(16px, 4vw, 44px); background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); border-bottom: 1px solid var(--line); }
.banner strong { font-weight: 650; }

/* sign in */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--slate); color: var(--slate-ink); padding: clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-side .brand-name { color: var(--slate-ink); }
.auth-side h1 { font-size: clamp(2rem, 4vw, 3.1rem); font-stretch: 118%; font-weight: 800; line-height: 1.02; max-width: 14ch; }
.auth-side p { color: var(--slate-dim); max-width: 44ch; margin-top: 16px; }
.auth-side .slate { position: static; max-width: 420px; border: 1px solid rgba(242, 244, 241, .18); }
.auth-main { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px) 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 22px; }
.auth-card form { display: grid; gap: 18px; }
.auth-card .switch { font-size: var(--t-sm); color: var(--ink-2); }
.form-error { padding: 10px 12px; border-radius: var(--r-field); background: var(--bad-soft); color: var(--bad); font-size: var(--t-sm); font-weight: 500; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { gap: 20px; }
  .auth-side .slate { display: none; }
}

/* generating: queue and failure */
.queue-note { font-size: var(--t-sm); color: var(--ink-2); }
.failed-card { display: grid; gap: 14px; padding: 18px; border-radius: var(--r-panel); background: var(--bad-soft); color: var(--bad); border: 1px solid var(--line); }
.failed-card p { color: var(--ink); font-size: var(--t-sm); }
.notice { padding: 12px 14px; border-radius: var(--r-field); background: var(--warn-soft); color: var(--warn); font-size: var(--t-sm); }
.script .cap { display: block; color: var(--ink-3); font-size: var(--t-xs); margin-top: 2px; }
.script li { cursor: pointer; }
.script li:hover span:last-child { color: var(--ink); }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; max-width: 900px; margin-top: 20px; }
.plan-card { display: grid; gap: 12px; align-content: start; padding: 22px; border-radius: var(--r-panel); background: var(--panel); border: 1px solid var(--line); }
.plan-card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-card .price { font-family: var(--f-display); font-stretch: 112%; font-size: 1.5rem; font-weight: 750; }
.plan-card .sub { color: var(--ink-2); font-size: var(--t-sm); }

.row .thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; background: var(--stage); }
.row .thumb { overflow: hidden; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.thumb-preview { position: relative; border-radius: var(--r-field); overflow: hidden; background: var(--stage); border: 1px solid var(--line); aspect-ratio: 16 / 9; display: grid; place-items: center; }
.thumb-preview.v { aspect-ratio: 9 / 16; max-height: 300px; justify-self: start; }
.thumb-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-preview span { padding: 12px; font-size: var(--t-sm); color: #C9D1CE; text-align: center; }
.thumb-preview.busy img { opacity: .45; transition: opacity .2s; }
.thumb-edit { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-edit .btn { flex: 0 0 auto; }
.thumb-busy { position: absolute; inset: auto 12px 12px auto; padding: 6px 10px !important; border-radius: 999px; background: rgba(0,0,0,.65); color: #fff !important; font-weight: 600; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tag { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; }
.tag:empty { display: none; }
.btn-text { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: var(--t-sm); cursor: pointer; }
.btn-text:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-text[disabled] { opacity: .5; cursor: not-allowed; text-decoration: none; }
.textarea.desc { min-height: 220px; }
.thumb-edit .input { flex: 1 1 180px; min-width: 0; }
.link { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-right-color: transparent; animation: spin .8s linear infinite; }
.loading { display: grid; place-items: center; min-height: 60vh; }
html, body { margin: 0; }
a.btn { text-decoration: none; }
