/* Greenlight Clips Studio. Brand version 2, "paper and stage": colours, fonts and radii come
   from ../brand/tokens.css. Everything is on paper except the one dark zone (.gl-stage) that
   holds video, the heat graph and clip previews. */

/* Clip-template fonts. Used inside clips only, never in the interface. */
@font-face { font-family: "Anton"; src: url("vendor/fonts/anton-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bangers"; src: url("vendor/fonts/bangers-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* Field outlines need 3:1 against the surface (WCAG 1.4.11); the line tokens are for dividers. Same rule as the website. */
  --field-line: var(--gl-faint);
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root { --field-line: color-mix(in srgb, var(--gl-faint) 80%, var(--gl-panel)); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; min-height: 100vh; background: var(--gl-bg); color: var(--gl-text); font: 15px/1.5 var(--gl-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, p, ol, ul, fieldset, figure, pre { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gl-text); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--gl-display); font-stretch: var(--gl-display-stretch); letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
code { font: 0.92em var(--gl-mono); background: var(--gl-panel-2); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--gl-mono); font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gl-info); outline-offset: 2px; border-radius: 4px; }
.gl-stage :focus-visible { outline-color: var(--gl-lit); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gl-ink); color: var(--gl-ink-text); padding: 8px 14px; border-radius: 6px; z-index: 60; font-weight: 600; }
.skip:focus { left: 8px; }
.lede { color: var(--gl-muted); font-size: 16px; max-width: 70ch; margin-top: 8px; }

/* ── Shell ── */
.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; border-right: 1px solid var(--gl-line); background: var(--gl-bg); }
.rail-brand, .topbar-brand, .wz-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 800 15px/1 var(--gl-display); font-stretch: var(--gl-display-stretch); padding: 4px 8px; }
.rail-list { display: grid; gap: 2px; }
.rail-list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; text-decoration: none; color: var(--gl-muted); font-weight: 600; }
.rail-list a:hover { background: var(--gl-panel-2); color: var(--gl-text); }
.rail-list a[aria-current="page"] { background: var(--gl-panel); color: var(--gl-text); box-shadow: inset 0 0 0 1px var(--gl-line); }
.rail-list svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rail-note { margin-top: auto; font-size: 12.5px; color: var(--gl-faint); padding: 0 8px; display: flex; gap: 8px; align-items: flex-start; }
.rail-note .lamp { margin-top: 5px; }
.col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 52px; padding: 8px clamp(14px, 3vw, 32px); background: var(--gl-bg); border-bottom: 1px solid var(--gl-line); }
.topbar-brand { display: none; margin-right: auto; padding-left: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border-radius: var(--gl-radius-sm); border: 1px solid var(--gl-line-strong); background: var(--gl-panel); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--gl-text); }
button.status { cursor: pointer; }
button.status:hover, a.status:hover { background: var(--gl-panel-2); }
.status.is-out { border-color: var(--gl-wait); color: var(--gl-wait); }
.status.is-done { color: var(--gl-go); border-color: var(--gl-go); }
.save-state { font-size: 12.5px; color: var(--gl-faint); }
.save-state.is-bad { color: var(--gl-wait); }
.lamp { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--gl-line-strong); display: inline-block; }
.lamp-go { background: var(--gl-go); } .lamp-wait { background: var(--gl-wait); } .lamp-stop { background: var(--gl-stop); }
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(18px, 2.6vw, 32px) clamp(14px, 3vw, 32px) 40px; }
.view { display: grid; gap: 24px; align-content: start; }
/* Spacing scale: 4, 8, 12, 16, 24, 32. 16 inside a surface, 24 between surfaces. */
/* Every view opens the same way: a title, one line on what the place is for, at most one main action. */
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: end; }
.page-head > h1, .page-head > .lede { grid-column: 1; }
.page-head .lede { margin-top: 0; max-width: 100ch; }
.page-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }

/* ── Buttons and form bits ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--gl-radius-sm); border: 1px solid var(--gl-line-strong); background: var(--gl-panel); color: var(--gl-text); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--gl-panel-2); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-go { background: var(--gl-go); border-color: var(--gl-go); color: var(--gl-go-ink); }
.btn-go:hover { background: var(--gl-go-hover); border-color: var(--gl-go-hover); }
.btn-ink { background: var(--gl-ink); border-color: var(--gl-ink); color: var(--gl-ink-text); }
.btn-ink:hover { background: var(--gl-muted); border-color: var(--gl-muted); }
.btn-big { min-height: 48px; padding: 0 24px; font-size: 16px; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--gl-muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13.5px; }
.link:hover { color: var(--gl-text); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--gl-muted); cursor: pointer; }
.icon-btn:hover { color: var(--gl-text); border-color: var(--gl-line); }
.icon-btn svg { width: 18px; height: 18px; fill: none; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .ctl legend, .slider { font-size: 14px; font-weight: 600; }
.opt { font-weight: 400; color: var(--gl-faint); margin-left: 4px; }
input[type="text"], input[type="url"], input[type="date"], input[type="number"], input[type="email"], input[type="password"], select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; background: var(--gl-panel); border: 1px solid var(--field-line); border-radius: var(--gl-radius-sm); color: var(--gl-text); }
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--gl-faint); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--gl-info); }
.hint { font-size: 13px; color: var(--gl-faint); }
.hint.is-off { color: var(--gl-wait); font-size: 14px; }
.err { font-size: 13.5px; color: var(--gl-stop); }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--gl-ink); flex: none; }
.check small { display: block; color: var(--gl-faint); font-size: 13px; }
.ctl { display: grid; gap: 9px; }
.ctl legend { margin-bottom: 8px; padding: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.notice { font-size: 14px; background: var(--gl-wait-soft); border-radius: var(--gl-radius-sm); padding: 10px 12px; }
.notice a { font-weight: 600; }
.row-actions { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; }
.more summary { cursor: pointer; font-size: 13.5px; color: var(--gl-muted); text-decoration: underline; text-underline-offset: 3px; width: max-content; }
.more[open] summary { margin-bottom: 9px; }

/* Toggle groups: plain rectangles; the chosen one is outlined in ink. */
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggles label { position: relative; cursor: pointer; }
.toggles input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.toggles span { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: var(--gl-radius-sm); border: 1px solid var(--gl-line-strong); background: var(--gl-panel); font-size: 14px; font-weight: 500; }
.toggles input:checked + span { box-shadow: inset 0 0 0 1px var(--gl-ink); border-color: var(--gl-ink); font-weight: 700; }
.toggles input:focus-visible + span { outline: 2px solid var(--gl-info); outline-offset: 2px; }
.seg, .src-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.seg label, .src-grid label, .route { position: relative; cursor: pointer; }
.seg input, .src-grid input, .route > input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span, .src-grid span { display: grid; gap: 2px; height: 100%; padding: 10px 12px; border: 1px solid var(--gl-line-strong); border-radius: var(--gl-radius-sm); background: var(--gl-panel); }
.seg b, .src-grid b { font-size: 14.5px; font-weight: 700; }
.seg small, .src-grid small { font-size: 13px; color: var(--gl-faint); line-height: 1.35; }
.seg input:checked + span, .src-grid input:checked + span { border-color: var(--gl-ink); box-shadow: inset 0 0 0 1px var(--gl-ink); }
.seg input:focus-visible + span, .src-grid input:focus-visible + span { outline: 2px solid var(--gl-info); outline-offset: 2px; }

/* ── Surfaces and rows ── */
.surface { background: var(--gl-panel); border: 1px solid var(--gl-line); border-radius: var(--gl-radius); min-width: 0; }
.surface-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; border-bottom: 1px solid var(--gl-line); flex-wrap: wrap; }
.surface-note { margin-left: auto; font-size: 13px; color: var(--gl-faint); }
.surface-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.surface-head > .btn { margin-left: auto; }
.surface-text { padding: 12px 16px; color: var(--gl-muted); font-size: 14.5px; }
.rows > * + * { border-top: 1px solid var(--gl-line); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 16px; align-items: center; }
.row-main { min-width: 0; display: grid; gap: 2px; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { font-size: 13.5px; color: var(--gl-muted); overflow-wrap: anywhere; }
.row-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-extra { grid-column: 1 / -1; font-size: 13.5px; color: var(--gl-muted); display: grid; gap: 3px; overflow-wrap: anywhere; padding-top: 6px; }
.row-extra b { color: var(--gl-text); }
/* Empty state, everywhere: a bold line, one sentence, at most one button. */
.empty, .moment-empty { padding: 24px 16px; color: var(--gl-muted); font-size: 14.5px; display: grid; gap: 8px; justify-items: start; }
.empty b, .moment-empty b { color: var(--gl-text); font-size: 15.5px; }
/* Status pill: the traffic light. Green = cleared or done, amber = waiting, red = stop. Only for status. */
.state { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--gl-panel-2); color: var(--gl-muted); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.state.green { background: var(--gl-go-soft); color: var(--gl-go); } .state.amber { background: var(--gl-wait-soft); color: var(--gl-wait); } .state.red { background: var(--gl-stop-soft); color: var(--gl-stop); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--gl-panel-2); color: var(--gl-muted); margin-left: 8px; vertical-align: 1px; }

/* ── Home ── */
.setup-block { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; padding: 16px; align-items: center; }
.ring { position: relative; width: 104px; height: 104px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .ring-track { stroke: var(--gl-panel-2); }
.ring .ring-fill { stroke: var(--gl-go); stroke-linecap: butt; transition: stroke-dashoffset 0.4s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 24px var(--gl-display); font-stretch: var(--gl-display-stretch); }
.setup-next { display: grid; gap: 8px; justify-items: start; }
.setup-next p { color: var(--gl-muted); }
.steps-list .row { grid-template-columns: auto minmax(0, 1fr) auto; }
.step-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gl-line-strong); font-size: 12.5px; font-weight: 700; color: var(--gl-muted); }
.step-n.is-done { background: var(--gl-go); border-color: var(--gl-go); color: var(--gl-go-ink); }
.stat { font: 800 22px var(--gl-display); font-stretch: var(--gl-display-stretch); min-width: 2ch; text-align: right; }

/* ── Studio: permission and recording ── */
.setup { display: grid; gap: 24px; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* The little traffic light: a dark housing in both themes, like the logo. */
.lights { display: inline-flex; gap: 4px; padding: 4px 6px; border-radius: 999px; background: var(--gl-stage); flex: none; }
.lights i { width: 8px; height: 8px; border-radius: 50%; background: var(--gl-stage-line-strong); }
.lights.red i:nth-child(1) { background: var(--gl-lit-stop); }
.lights.amber i:nth-child(2) { background: var(--gl-lit-wait); }
.lights.green i:nth-child(3) { background: var(--gl-lit); }
.perm { position: relative; display: block; }
.perm > input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.perm-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 16px; }
.perm input:checked ~ .perm-body { background: var(--gl-panel-2); box-shadow: inset 3px 0 0 var(--gl-ink); }
.perm input:focus-visible ~ .perm-body { outline: 2px solid var(--gl-info); outline-offset: -2px; }
.perm-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-detail { grid-column: 2 / -1; font-size: 13.5px; color: var(--gl-muted); min-width: 0; overflow-wrap: anywhere; }
.perm-tools { grid-column: 2 / -1; display: flex; gap: 12px; position: relative; z-index: 1; flex-wrap: wrap; }
.perm-money { padding: 12px 16px; border-top: 1px solid var(--gl-line); }
.perm-evidence { grid-column: 1 / -1; margin-top: 6px; font-size: 13.5px; color: var(--gl-muted); display: grid; gap: 4px; overflow-wrap: anywhere; position: relative; z-index: 1; border-left: 2px solid var(--gl-line-strong); padding-left: 12px; }
.perm-evidence b { color: var(--gl-text); }
.drop { margin: 16px 16px 0; border: 1.5px dashed var(--gl-line-strong); border-radius: var(--gl-radius-sm); }
.drop.is-over { border-color: var(--gl-ink); background: var(--gl-panel-2); }
.drop-empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 24px 16px; }
.drop-title { font: 700 17px var(--gl-display); font-stretch: var(--gl-display-stretch); }
.drop-sub { font-size: 13.5px; color: var(--gl-muted); max-width: 44ch; }
.drop-empty .btn { margin-top: 6px; }
.drop-phone { display: none; font-size: 13px; color: var(--gl-wait); margin-top: 4px; }
.drop-file { padding: 14px; display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-name { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.file-meta { font-size: 13px; color: var(--gl-muted); min-width: 0; overflow-wrap: anywhere; }
.file-row .link { margin-left: auto; }
.sample-flag { font-size: 13px; color: var(--gl-wait); background: var(--gl-wait-soft); border-radius: var(--gl-radius-sm); padding: 6px 10px; }
.fields { display: grid; gap: 16px; padding: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.fields .field:first-child { grid-column: 1 / -1; }
.file-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.go-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.go-note { color: var(--gl-faint); font-size: 14px; }
.block { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; background: var(--gl-stop-soft); border-radius: var(--gl-radius-sm); max-width: 780px; }
.block .lamp { margin-top: 6px; }
.block-title { font-weight: 700; }
.block-fix { font-size: 14.5px; margin-top: 2px; }
.block .btn { margin-top: 10px; }
.block.is-wait { background: var(--gl-wait-soft); }
.block.is-wait .lamp { background: var(--gl-wait); }

/* ── Studio: the stage ── */
.studio { display: grid; gap: 24px; }
.studio-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.studio-what { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; flex: 1; }
.clear-chip { display: inline-flex; align-items: center; gap: 4px 9px; flex-wrap: wrap; font-size: 14px; min-width: 0; }
.clear-chip b { font-weight: 700; }
.clear-chip span:last-child { color: var(--gl-muted); }
.studio-file { color: var(--gl-faint); font-size: 13.5px; overflow-wrap: anywhere; min-width: 0; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.stage { display: grid; gap: 12px; min-width: 0; padding: 12px; border-radius: var(--gl-radius); }
.player { position: relative; background: var(--gl-stage); border-radius: var(--gl-radius-sm); overflow: hidden; aspect-ratio: 16 / 9; max-height: max(250px, calc(100vh - 470px)); width: 100%; }
.player video { width: 100%; height: 100%; display: block; object-fit: contain; background: var(--gl-stage); }
.player-note { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--gl-stage-panel); color: var(--gl-muted); font-size: 14px; }
.player-note b { color: var(--gl-text); font: 700 17px var(--gl-display); font-stretch: var(--gl-display-stretch); }
.player-note p { max-width: 52ch; margin: 0 auto; }
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.stages { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--gl-faint); }
.stages li { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.st-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--gl-faint); }
.stages li.is-on { color: var(--gl-text); }
.stages li.is-on .st-dot { border-color: var(--gl-wait); background: var(--gl-wait); animation: blink 1s steps(2) infinite; }
.stages li.is-done { color: var(--gl-muted); }
.stages li.is-done .st-dot { border-color: var(--gl-go); background: var(--gl-go); }
.stages li.is-skip { text-decoration: line-through; }
.tl-status { font-size: 13px; color: var(--gl-muted); min-height: 18px; }
.graph { position: relative; height: 212px; border-radius: var(--gl-radius-sm); background: var(--gl-bg); border: 1px solid var(--gl-line); cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; overflow: hidden; }
.graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.graph-overlay { position: absolute; inset: 0; pointer-events: none; }
.peak { position: absolute; transform: translate(-50%, 0); top: 6px; pointer-events: auto; cursor: pointer; border: 0; padding: 0; background: none; display: grid; justify-items: center; }
.peak i { font: 700 12px/1 var(--gl-mono); font-style: normal; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; background: var(--gl-text); color: var(--gl-bg); }
.peak.is-sel i { background: var(--gl-go); color: var(--gl-go-ink); }
.peak.is-false i { background: var(--gl-faint); }
.peak::after { content: ""; width: 1.5px; height: 10px; background: var(--gl-muted); }
.peak.pop { animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.pip { position: absolute; top: 12px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--gl-heat-1); animation: pip 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.flag { position: absolute; top: 4px; padding: 3px 8px; border-radius: 4px; background: var(--gl-panel); border: 1px solid var(--gl-line-strong); font: 500 11.5px var(--gl-mono); white-space: nowrap; animation: flag 2.6s ease both; }
@keyframes pop { from { transform: translate(-50%, 6px) scale(0.3); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes pip { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes flag { 0% { opacity: 0; transform: translateY(4px); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes blink { 50% { opacity: 0.35; } }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--gl-text); }
.playhead::before { content: ""; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: var(--gl-text); }
.handle { position: absolute; top: 34px; bottom: 0; width: 18px; margin-left: -9px; pointer-events: auto; cursor: ew-resize; touch-action: none; border: 0; background: none; padding: 0; }
.handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 8px; width: 2px; background: var(--gl-go); }
.handle::after { content: ""; position: absolute; top: 50%; left: 4px; width: 10px; height: 26px; margin-top: -4px; border-radius: 3px; background: var(--gl-go); box-shadow: 0 0 0 2px var(--gl-bg); }
.handle:focus-visible { outline: none; }
.handle:focus-visible::after { box-shadow: 0 0 0 2px var(--gl-bg), 0 0 0 4px var(--gl-text); }
.graph-tip { position: absolute; top: 34px; padding: 5px 9px; border-radius: 4px; background: var(--gl-panel); border: 1px solid var(--gl-line-strong); font-size: 11.5px; line-height: 1.5; pointer-events: none; white-space: nowrap; z-index: 3; }
.tl-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.legend { font-size: 12.5px; color: var(--gl-muted); display: inline-flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
.lg-heat { background: var(--gl-heat-2); }
.lg-line { height: 0; border-top: 1.5px dashed var(--gl-muted); }
.lg-audio { background: var(--gl-heat-0); }
.lg-chat { background: var(--gl-info); }
.tl-time { font-size: 12.5px; color: var(--gl-muted); }

/* Moments: rows on paper */
.moments { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 96px); position: sticky; top: 68px; }
.moment-list { overflow-y: auto; }
.moment-list > * + * { border-top: 1px solid var(--gl-line); }
.ghost { width: 100%; display: grid; gap: 8px; }
.ghost i { height: 46px; border-radius: 6px; background: var(--gl-panel-2); animation: blink 1.4s ease-in-out infinite; }
.ghost i:nth-child(2) { opacity: 0.7; } .ghost i:nth-child(3) { opacity: 0.4; }
.list-label { padding: 12px 16px 4px; font-size: 13px; color: var(--gl-faint); }
.found { display: flex; gap: 12px; align-items: baseline; padding: 8px 16px; font-size: 13.5px; animation: rise 0.3s ease both; }
.found .mono { font-size: 12.5px; font-weight: 600; }
.found span:last-child { color: var(--gl-muted); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.moment { cursor: pointer; }
.moment.is-new { animation: rise 0.3s ease both; }
.moment.is-sel { background: var(--gl-panel-2); box-shadow: inset 3px 0 0 var(--gl-ink); }
.moment-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; width: 100%; text-align: left; padding: 12px 16px; background: none; border: 0; cursor: pointer; align-items: center; }
.rank { grid-row: span 2; width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font: 700 14px var(--gl-mono); border: 1px solid var(--gl-line-strong); background: var(--gl-panel); }
.moment.is-sel .rank { background: var(--gl-ink); border-color: var(--gl-ink); color: var(--gl-ink-text); }
.m-time { font: 600 14px var(--gl-mono); font-variant-numeric: tabular-nums; }
.m-time small { color: var(--gl-muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.m-score { grid-row: span 2; text-align: right; }
.m-score b { display: block; font: 800 18px/1 var(--gl-display); font-stretch: var(--gl-display-stretch); font-variant-numeric: tabular-nums; }
.m-score small { font-size: 12px; color: var(--gl-muted); }
.m-why { font-size: 13.5px; color: var(--gl-muted); min-width: 0; }
.meter { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--gl-line); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gl-heat-2); }
.m-false { grid-column: 1 / -1; margin-top: 8px; font-size: 13px; color: var(--gl-wait); background: var(--gl-wait-soft); border-radius: 4px; padding: 6px 9px; }
.m-ai { grid-column: 1 / -1; margin-top: 6px; font-size: 13px; color: var(--gl-muted); }
.m-trim { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 16px; }
.nudge { display: grid; grid-template-columns: auto 1fr auto; align-items: center; border: 1px solid var(--field-line); border-radius: 6px; background: var(--gl-panel); overflow: hidden; }
.nudge button { width: 34px; height: 36px; border: 0; background: none; cursor: pointer; font: 600 15px var(--gl-mono); }
.nudge button:hover { background: var(--gl-panel-2); }
.nudge span { text-align: center; font: 500 12.5px var(--gl-mono); font-variant-numeric: tabular-nums; }
.nudge span small { display: block; font: 400 12px var(--gl-body); color: var(--gl-faint); }
.m-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.m-actions .btn { flex: 1; }

/* ── Clip maker ── */
.maker { scroll-margin-top: 70px; }
.maker-grid { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 24px; padding: 16px; align-items: start; }
.phone-col { display: grid; gap: 12px; position: sticky; top: 70px; }
.phone { position: relative; aspect-ratio: 9 / 16; border-radius: 22px; padding: 7px; }
.phone canvas { width: 100%; height: 100%; display: block; border-radius: 16px; background: var(--gl-stage); }
.phone-rec { position: absolute; top: 22px; left: 20px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 4px; background: color-mix(in srgb, var(--gl-stage) 70%, transparent); color: var(--gl-stage-text); font-size: 12px; font-weight: 600; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gl-lit-stop); animation: blink 1s steps(2) infinite; }
.render-bar { display: grid; gap: 6px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--gl-panel-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; width: 0%; background: var(--gl-go); transition: width 0.2s linear; }
.render-text { font-size: 13.5px; color: var(--gl-muted); }
.controls { display: grid; gap: 24px; min-width: 0; }
.ai-result { font-size: 14px; background: var(--gl-panel-2); border-radius: 6px; padding: 8px 11px; }
.ai-result.is-quiet { color: var(--gl-muted); }
.hook-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.hook-ideas button { border: 1px solid var(--gl-line-strong); background: var(--gl-panel); border-radius: 6px; padding: 6px 10px; font-size: 13.5px; cursor: pointer; text-align: left; }
.hook-ideas button:hover { background: var(--gl-panel-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gl-line); }
.tabs button { background: none; border: 0; padding: 9px 12px; color: var(--gl-muted); font-weight: 600; font-size: 14.5px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--gl-text); border-bottom-color: var(--gl-ink); }
.tabpane { display: grid; gap: 9px; justify-items: start; }
.tabpane textarea { justify-self: stretch; }
.radio-line { display: grid; gap: 4px; font-size: 14px; color: var(--gl-muted); }
.radio-line input { accent-color: var(--gl-ink); margin-right: 6px; }
.cap-status { font-size: 13.5px; color: var(--gl-muted); }
.cap-status:empty { display: none; }
.cap-status.is-bad { color: var(--gl-wait); }
.cues { display: grid; gap: 6px; }
.cue { display: grid; grid-template-columns: 74px 74px minmax(0, 1fr) 34px; gap: 6px; align-items: center; }
.cue input { min-height: 36px; padding: 6px 8px; font-size: 14px; }
.cue input[type="number"] { font-family: var(--gl-mono); font-size: 12.5px; }
.cue-head { font-size: 13px; color: var(--gl-faint); }
.cues-foot { display: flex; gap: 14px; }
.slider { display: grid; grid-template-columns: auto minmax(120px, 260px) auto; gap: 12px; align-items: center; }
.slider input { accent-color: var(--gl-ink); }
.slider output { font: 500 13px var(--gl-mono); }
.music-opts { display: grid; gap: 10px; }
.make-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--gl-line); padding-top: 16px; }
.make-note { font-size: 13.5px; color: var(--gl-muted); max-width: 52ch; }

/* ── Finished clips ── */
.clip-list { display: grid; gap: 16px; }
.clip { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 0 24px; scroll-margin-top: 70px; background: var(--gl-panel); border: 1px solid var(--gl-line); border-radius: var(--gl-radius); padding: 16px; }
.clip-video { display: grid; gap: 10px; align-content: start; grid-row: span 3; }
.clip-video .frame { position: relative; aspect-ratio: 9 / 16; border-radius: var(--gl-radius-sm); overflow: hidden; background: var(--gl-stage); padding: 0; }
.clip-video video { width: 100%; height: 100%; display: block; object-fit: cover; }
.clip-video .hover-hint { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 4px; background: color-mix(in srgb, var(--gl-stage) 70%, transparent); font-size: 12px; color: var(--gl-stage-text); pointer-events: none; }
.clip-video .frame.is-playing .hover-hint { opacity: 0; }
.clip-meta { font-size: 13px; color: var(--gl-muted); }
.clip-note { font-size: 13px; color: var(--gl-wait); }
.clip-part { padding: 4px 0 16px; min-width: 0; }
.clip-part + .clip-part { border-top: 1px solid var(--gl-line); padding-top: 16px; }
.clip h3 { margin-bottom: 10px; }
.checks { display: grid; gap: 10px; }
.checks li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; }
.checks .mark { grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; margin-top: 1px; display: grid; place-items: center; }
.checks .mark svg { width: 12px; height: 12px; }
.checks .ok .mark { background: var(--gl-go-soft); color: var(--gl-go); }
.checks .warn .mark { background: var(--gl-wait-soft); color: var(--gl-wait); }
.checks .stop .mark { background: var(--gl-stop-soft); color: var(--gl-stop); }
.checks b { font-size: 14.5px; font-weight: 700; }
.checks p { font-size: 13.5px; color: var(--gl-muted); grid-column: 2; overflow-wrap: anywhere; }
.pack { display: grid; gap: 0; align-content: start; }
.pack-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 9px 0; }
.pack-item + .pack-item, .pack-label + .pack-item { border-top: 1px solid var(--gl-line); }
.pack-item p { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pack-label { font-size: 13px; color: var(--gl-faint); padding: 8px 0 4px; }
.copy.is-done { color: var(--gl-go); border-color: var(--gl-go); }
.post { display: grid; gap: 12px; }
.post-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--gl-panel-2); border-radius: 6px; padding: 10px 12px; max-height: 220px; overflow: auto; font-family: var(--gl-body); }
.post-how { font-size: 13.5px; color: var(--gl-muted); }
.post-done { font-size: 14px; color: var(--gl-go); font-weight: 600; }
.post-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post-form input { flex: 1; min-width: 180px; }

/* ── Templates ── */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tpl { position: relative; display: grid; gap: 8px; cursor: pointer; align-content: start; }
.tpl > input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tpl-shot { aspect-ratio: 9 / 16; border-radius: var(--gl-radius-sm); overflow: hidden; padding: 0; display: block; border: 1px solid var(--gl-line); }
.tpl-shot canvas { width: 100%; height: 100%; display: block; }
.tpl input:checked ~ .tpl-shot { outline: 3px solid var(--gl-ink); outline-offset: 2px; }
.tpl input:focus-visible ~ .tpl-shot { outline: 3px solid var(--gl-info); outline-offset: 2px; }
.tpl-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-name .state { font-weight: 600; }
.tpl-blurb { font-size: 13.5px; color: var(--gl-muted); }

/* ── Creators ── */
.ask { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; padding: 16px; }
.ask-fields, .ask-out { display: grid; gap: 12px; align-content: start; }
.msg { background: var(--gl-panel-2); border-radius: 6px; padding: 10px 12px; display: grid; gap: 6px; }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; }
.msg pre { font: 14px/1.5 var(--gl-body); white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row select { width: auto; min-height: 34px; padding: 4px 8px; }

/* ── Account ── */
.form { display: grid; gap: 16px; padding: 16px; max-width: 760px; }
.form-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.facts { display: grid; gap: 6px; color: var(--gl-muted); font-size: 14.5px; padding: 0 16px 16px; max-width: 80ch; }
.facts li { padding-left: 14px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--gl-line-strong); }
.plan-count { font: 800 30px/1 var(--gl-display); font-stretch: var(--gl-display-stretch); }
.plan-count small { font: 400 14px var(--gl-body); color: var(--gl-muted); margin-left: 8px; }
.plan-list { display: grid; gap: 6px; color: var(--gl-muted); font-size: 14.5px; }
.plan-list li { padding-left: 14px; position: relative; }
.plan-list li::before { content: ""; position: absolute; left: 0; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--gl-line-strong); }

/* ── Guided setup ── */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-width: 0; }
.wz-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px clamp(14px, 3vw, 32px); background: var(--gl-bg); border-bottom: 1px solid var(--gl-line); min-height: 56px; }
.wz-brand { padding: 0; flex: none; }
.wz-rail { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.wz-rail li { flex: 1 1 0; min-width: 0; }
.wz-rail button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; background: none; border-bottom: 3px solid var(--gl-line); font-size: 13.5px; font-weight: 600; color: var(--gl-faint); cursor: pointer; white-space: nowrap; text-align: left; }
.wz-rail button[disabled] { cursor: default; }
.wz-rail li.is-done button { color: var(--gl-text); border-bottom-color: var(--gl-go); }
.wz-rail li.is-now button { color: var(--gl-text); border-bottom-color: var(--gl-ink); }
.wz-step { display: grid; min-width: 0; line-height: 1.2; }
.wz-step small { font-size: 11.5px; font-weight: 500; color: var(--gl-faint); overflow: hidden; text-overflow: ellipsis; }
.wz-rail .step-n { width: 22px; height: 22px; font-size: 12px; flex: none; }
.wz-rail li.is-now .step-n { background: var(--gl-ink); border-color: var(--gl-ink); color: var(--gl-ink-text); }
.wz-intro { width: 100%; max-width: 920px; margin: 0 auto; padding: clamp(18px, 3vw, 30px) clamp(14px, 3vw, 32px) 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.wz-where { font-size: 14px; color: var(--gl-faint); font-weight: 600; }
.wz-intro h1:focus { outline: none; }
.wz-plan { font-size: 13.5px; color: var(--gl-muted); }
.wz-body { width: 100%; max-width: 920px; margin: 0 auto; padding: 16px clamp(14px, 3vw, 32px) 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.wz-body:empty { display: none; }
.wz-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px clamp(14px, 3vw, 32px); background: var(--gl-panel); border-top: 1px solid var(--gl-line); }
.wz-note { flex: 1; min-width: 0; font-size: 13.5px; color: var(--gl-muted); text-align: right; }
.wz-note.is-bad { color: var(--gl-stop); font-weight: 600; }
.routes { display: grid; gap: 0; }
.route { display: block; }
.route-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 12px 16px; }
.route-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--field-line); margin-top: 2px; grid-row: span 2; background: var(--gl-panel); }
.route > input:checked ~ .route-body { background: var(--gl-panel-2); box-shadow: inset 3px 0 0 var(--gl-ink); }
.route > input:checked ~ .route-body .route-dot { border: 5.5px solid var(--gl-ink); }
.route > input:focus-visible ~ .route-body { outline: 2px solid var(--gl-info); outline-offset: -2px; }
.route-title { font-weight: 700; }
.route-sub { font-size: 14px; color: var(--gl-muted); grid-column: 2; }
.route-note { font-size: 14px; color: var(--gl-muted); }
.route-form { display: grid; gap: 12px; padding: 4px 16px 16px 46px; position: relative; z-index: 1; background: var(--gl-panel-2); box-shadow: inset 3px 0 0 var(--gl-ink); }
.guide { padding: 16px; display: grid; gap: 12px; }
.guide ol { display: grid; gap: 6px; padding-left: 20px; list-style: decimal; font-size: 14.5px; }
.guide ul { display: grid; gap: 4px; padding-left: 18px; list-style: disc; font-size: 14.5px; color: var(--gl-muted); }
.post-screen { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 16px; align-items: start; }

body.wizard-on .rail, body.wizard-on .topbar, body.wizard-on .foot { display: none; }
body.wizard-on .app { grid-template-columns: minmax(0, 1fr); }
body.wizard-on main { padding-top: 10px; padding-bottom: 96px; max-width: 1240px; }
body.wizard-on:not(.wz-studio) main { display: none; }
body.wizard-on:not(.wz-studio) .wz-body { padding-bottom: 96px; }
body.wizard-on .setup-head, body.wizard-on #perm-panel, body.wizard-on .go-row, body.wizard-on #make-btn, body.wizard-on #sample-btn { display: none; }
body.wizard-on .setup-grid { grid-template-columns: minmax(0, 1fr); max-width: calc(920px - 2 * clamp(14px, 3vw, 32px)); margin: 0 auto; width: 100%; }
body.wizard-on .block { max-width: calc(920px - 2 * clamp(14px, 3vw, 32px)); margin: 0 auto; width: 100%; }
body.wizard-on .make-row { border-top: 0; padding-top: 0; }
body[data-wz="recording"] #maker { display: none; }
body[data-wz="clip"] #setup { display: none; }

/* ── Dialogs, toast, footer ── */
dialog { border: 1px solid var(--gl-line-strong); border-radius: var(--gl-radius); background: var(--gl-panel); color: var(--gl-text); padding: 0; width: min(720px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); box-shadow: var(--gl-shadow); }
dialog::backdrop { background: color-mix(in srgb, var(--gl-stage) 55%, transparent); }
dialog[open] { display: flex; flex-direction: column; }
dialog form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--gl-line); flex: none; }
.dlg-head h2 { font-size: 20px; }
.dlg-body { padding: 16px 20px; display: grid; gap: 16px; overflow-y: auto; }
.dlg-lede { color: var(--gl-muted); font-size: 14.5px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--gl-line); flex: none; }
#plan-dialog { width: min(500px, calc(100vw - 20px)); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 70; background: var(--gl-ink); color: var(--gl-ink-text); border-radius: 6px; padding: 10px 16px; font-size: 14.5px; max-width: calc(100vw - 24px); }
.foot { max-width: 1240px; width: 100%; margin: 0 auto; padding: 18px clamp(14px, 3vw, 32px) 36px; border-top: 1px solid var(--gl-line); color: var(--gl-faint); font-size: 13px; display: grid; gap: 6px; }
.foot b { color: var(--gl-muted); }
.noscript { max-width: 720px; margin: 20px auto; padding: 14px; background: var(--gl-wait-soft); border-radius: 6px; }

/* ── Theme ── */
.theme-btn { width: 34px; height: 34px; border-color: var(--gl-line-strong); background: var(--gl-panel); color: var(--gl-text); }
.theme-btn:hover { background: var(--gl-panel-2); border-color: var(--gl-line-strong); }
.ask + .rows:not(:empty) { border-top: 1px solid var(--gl-line); }
.theme-btn svg { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun, :root[data-theme="dark"] .theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
/* Shadows don't read on a dark page: the stage, dialogs and the little light get a 1px line instead. */
:root[data-theme="dark"] .stage, :root[data-theme="dark"] .phone { box-shadow: inset 0 0 0 1px var(--gl-line); }
:root[data-theme="dark"] .lights { box-shadow: inset 0 0 0 1px var(--gl-line-strong); }
:root[data-theme="dark"] dialog { box-shadow: none; }

/* ── Tap-to-explain: a word a beginner may not know, opened in place ── */
.explain { font-size: 14px; color: var(--gl-muted); }
.explain summary { cursor: pointer; width: max-content; max-width: 100%; color: var(--gl-muted); text-decoration: underline dotted; text-underline-offset: 3px; list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::before { content: "?"; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 6px; border: 1px solid var(--gl-line-strong); border-radius: 50%; font-size: 11px; font-weight: 700; text-decoration: none; vertical-align: 1px; }
.explain summary:hover { color: var(--gl-text); }
.explain[open] summary { color: var(--gl-text); }
.explain p { margin-top: 6px; max-width: 64ch; color: var(--gl-text); }
.explains { display: grid; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--gl-line); }
.page-head > .explain { grid-column: 1; }
.ctl > .explain { margin: -2px 0 2px; }
.src-grid + .err + .explains, fieldset > .explains { padding: 4px 0 0; border-top: 0; }

/* ── Practice with the sample, captions nudge, plain file note ── */
.setup-practice, .practice-note { color: var(--gl-muted); font-weight: 600; }
.wz-rail li.is-practice button { color: var(--gl-text); border-bottom-color: var(--gl-line-strong); border-bottom-style: dashed; }
.perm-money-sample { padding: 0 16px 12px 44px; color: var(--gl-muted); }
.cap-nudge { flex-basis: 100%; font-size: 14px; color: var(--gl-text); background: var(--gl-panel-2); border-radius: var(--gl-radius-sm); padding: 8px 12px; }
.cap-nudge .link { font-size: 14px; color: var(--gl-text); font-weight: 600; margin-left: 4px; }
.make-detail { display: block; font-size: 12.5px; color: var(--gl-faint); margin-top: 2px; }
.guide-h { font-size: 16px; }

/* ── Campaigns, when nothing checked is listed ── */
.camp-steps { display: grid; gap: 6px; padding-left: 22px; list-style: decimal; color: var(--gl-text); max-width: 70ch; }
.camp-steps b { font-size: inherit; }
.camp-rule { color: var(--gl-text); font-weight: 600; }

/* ── Smaller screens ── */
@media (max-width: 1080px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .moments { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 25; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--gl-line); background: var(--gl-panel); }
  .rail-brand, .rail-note { display: none; }
  .rail-list { display: flex; flex: 1; gap: 0; overflow-x: auto; scrollbar-width: none; }
  .rail-list li { flex: 1 1 0; min-width: 0; }
  .rail-list a { flex-direction: column; gap: 2px; padding: 6px 1px; font-size: 10.5px; letter-spacing: -0.01em; font-weight: 600; align-items: center; min-width: 0; }
  .rail-list a[aria-current="page"] { box-shadow: none; background: var(--gl-panel-2); }
  .topbar-brand { display: inline-flex; }
  .col { padding-bottom: 64px; }
  body.wizard-on .col { padding-bottom: 0; }
  .setup-grid, .maker-grid, .fields, .two, .ask, .post-screen { grid-template-columns: minmax(0, 1fr); }
  .phone-col { position: static; width: min(250px, 70vw); margin: 0 auto; }
  .clip { grid-template-columns: minmax(0, 1fr); }
  .clip-video { width: min(230px, 70vw); margin: 0 auto 14px; grid-row: auto; }
  .wz-rail button .wz-step { display: none; }
  .wz-rail button { justify-content: center; padding: 7px 2px; }
  .setup-block { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .route-form { padding-left: 16px; }
  .toast { bottom: 76px; }
}
@media (max-width: 640px) {
  .topbar-brand span { display: none; }
  .topbar-right { flex-wrap: nowrap; min-width: 0; }
  .topbar #acct-chip { display: none; }
  .save-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .drop-phone { display: block; }
  .graph { height: 186px; }
  .btn-big { width: 100%; }
  .wz-foot .btn-big { width: auto; flex: 1; }
  .wz-note { display: none; }
  .wz-note.is-bad { display: block; position: absolute; left: 14px; right: 14px; bottom: 100%; background: var(--gl-stop-soft); padding: 8px 10px; border-radius: 6px 6px 0 0; text-align: left; }
  .cue { grid-template-columns: 62px 62px minmax(0, 1fr) 30px; gap: 4px; }
  .surface-head { padding: 12px; }
  .row, .perm-body, .moment-main, .empty, .moment-empty, .surface-text, .perm-money, .list-label, .found { padding-left: 12px; padding-right: 12px; }
  .form, .fields, .ask, .maker-grid, .post-screen, .guide { padding: 12px; }
  .drop { margin: 12px 12px 0; }
  .page-head { grid-template-columns: minmax(0, 1fr); }
  /* On a phone a row's buttons go under its text, so the text keeps the full width. */
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-side { justify-content: flex-start; }
  #home-dash .row { grid-template-columns: minmax(0, 1fr) auto; } /* Home: a count and one button, short enough to stay beside */
  .page-actions { grid-column: 1; grid-row: auto; }
  .legend { font-size: 12px; }
  .slider { grid-template-columns: minmax(0, 1fr) auto; }
  .slider input { grid-column: 1 / -1; grid-row: 2; }
  .wz-close-long { display: none; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

/* Phones and touch screens: everything that is tapped is at least 44px tall. */
@media (max-width: 860px), (pointer: coarse) {
  .wz-rail button { min-height: 44px; }
  #wz-close { min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
  .btn, .btn-small, .toggles span, .tabs button, .row select { min-height: 44px; }
  .theme-btn, .dlg-head .icon-btn { min-width: 44px; min-height: 44px; }
  .link, .hint a, .clip-meta a, .row-sub a, .post-how a, .explain summary, .more summary { min-height: 44px; display: inline-flex; align-items: center; }
  .link-a, a.upgrade { min-height: 44px; display: inline-flex; align-items: center; }
  .post .btn, .post-form input { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .flag { animation: none; }
}
