/* Framekar components. All values come from tokens.css. */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--c-bg); color: var(--c-text); font: var(--fw-regular) var(--fs-md)/var(--lh-body) var(--font); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-sm); }
.sprite { position: absolute; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s-2); top: var(--s-2); z-index: 100; background: var(--c-focus); color: #000; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; vertical-align: -3px; }
.ic.lg { width: 28px; height: 28px; }
.meta { color: var(--c-text-2); font-size: var(--fs-sm); }
.center { text-align: center; }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .08em; text-transform: uppercase; color: var(--c-brand-soft); }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; max-width: 520px; margin-inline: auto; padding-top: env(safe-area-inset-top); }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-3); }
.topbar-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app:not([data-step="home"]) .topbar-title { font-size: var(--fs-md); }
.app[data-step="home"] .topbar-title { background: var(--g-brand); -webkit-background-clip: text; background-clip: text; color: transparent; filter: brightness(1.35); }
.topbar-actions { display: flex; align-items: center; gap: var(--s-1); }
.xp-chip { display: flex; align-items: center; gap: var(--s-2); padding: 4px var(--s-3) 4px 4px; background: var(--c-surface); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.lvl-ring { --p: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: var(--fw-black);
  background: radial-gradient(closest-side, var(--c-surface) 76%, transparent 78% 100%), conic-gradient(var(--c-xp) calc(var(--p) * 1%), var(--c-surface-3) 0); }
main { min-height: 0; display: flex; flex-direction: column; overflow: hidden; outline: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--touch); padding: 0 var(--s-5); border-radius: var(--r-pill); border: 1px solid var(--c-line);
  background: var(--c-surface-2); font-weight: var(--fw-semibold); cursor: pointer; text-decoration: none; color: var(--c-text);
  transition: transform var(--d-fast) var(--ease-out), background var(--d-med); user-select: none; }
.btn:active:not(:disabled), .tool:active, .tab:active, .chip:active, .icon-btn:active:not(:disabled) { transform: scale(.96); }
.btn.primary { background: var(--g-brand); border: 0; color: var(--c-text-on-brand); box-shadow: var(--e-glow); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--c-text-2); }
.btn.block { display: flex; width: 100%; margin-top: var(--s-3); }
.btn.sm { min-height: var(--touch); padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn:disabled, .icon-btn:disabled, .tool:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn[aria-busy="true"]::before, .tool[aria-busy="true"] .ic { animation: spin 0.8s linear infinite; }
.icon-btn { width: var(--touch); height: var(--touch); display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; cursor: pointer; transition: transform var(--d-fast); }
.icon-btn:hover:not(:disabled) { background: var(--c-surface-2); }
.tool { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: var(--r-md); background: var(--c-surface-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer; transition: transform var(--d-fast); }
.tool.wide { flex-direction: row; gap: var(--s-2); width: 100%; font-size: var(--fs-sm); min-height: var(--touch); margin-top: var(--s-3); }
.badge { font-size: 10px; font-weight: var(--fw-bold); padding: 2px 6px; border-radius: var(--r-pill); background: var(--c-surface-3); color: var(--c-xp); }

/* ---------- Home ---------- */
.screen.page { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-4) var(--s-8); animation: fade-up var(--d-med) var(--ease-out); }
.hero { padding: var(--s-2) 0 var(--s-4); }
.hero-title { font-size: var(--fs-2xl); font-weight: var(--fw-black); line-height: var(--lh-tight); margin-top: var(--s-1); letter-spacing: -.02em; }
.mission-card { position: relative; padding: var(--s-5); border-radius: var(--r-xl); background: linear-gradient(160deg, #2a1330 0%, var(--c-surface) 55%); border: 1px solid #3d2347; box-shadow: var(--e-2); overflow: hidden; }
.mission-card::after { content: ""; position: absolute; inset: -40% -30% auto auto; width: 220px; height: 220px; background: radial-gradient(circle, rgb(139 107 255 / .35), transparent 70%); pointer-events: none; }
.mission-top { display: flex; gap: var(--s-4); align-items: center; }
.mission-title { font-size: var(--fs-xl); font-weight: var(--fw-black); }
.mission-desc { color: var(--c-text-2); margin: var(--s-3) 0; }
.mission-goals { list-style: none; padding: 0; margin: 0 0 var(--s-2); display: flex; gap: var(--s-2); flex-wrap: wrap; }
.mission-goals li { display: flex; gap: 6px; align-items: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 6px 10px; background: rgb(255 255 255 / .06); border-radius: var(--r-pill); }
.ring { --p: 0; width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: var(--fw-black); font-size: var(--fs-sm);
  background: radial-gradient(closest-side, var(--c-surface) 78%, transparent 80% 100%), conic-gradient(var(--c-brand-soft) calc(var(--p) * 1%), var(--c-surface-3) 0); transition: --p var(--d-slow); }
.stars-mini { color: var(--c-xp); letter-spacing: 2px; min-height: 1.2em; }
.section-label { font-size: var(--fs-sm); color: var(--c-text-2); font-weight: var(--fw-semibold); margin: var(--s-6) 0 var(--s-2); }
.path { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.path-item { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); background: var(--c-surface); border-radius: var(--r-lg); color: var(--c-text-2); }
.path-item strong { display: block; color: var(--c-text); font-weight: var(--fw-semibold); }
.path-item span { font-size: var(--fs-sm); }

/* ---------- Capture ---------- */
.screen-title { font-size: var(--fs-xl); font-weight: var(--fw-black); letter-spacing: -.01em; }
.screen-sub { color: var(--c-text-2); margin: var(--s-1) 0 var(--s-4); }
.choice-grid { display: grid; gap: var(--s-3); }
.choice { padding: var(--s-5); background: var(--c-surface); border-radius: var(--r-xl); border: 1px solid var(--c-line); }
.choice h3 { font-size: var(--fs-lg); margin: var(--s-3) 0 var(--s-1); }
.choice p { color: var(--c-text-2); font-size: var(--fs-sm); }
.choice-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--g-brand); }
.choice-icon.alt { background: var(--c-surface-3); }
.recorder { position: relative; margin-top: var(--s-3); border-radius: var(--r-xl); overflow: hidden; background: #000; aspect-ratio: 9 / 16; max-height: 64dvh; margin-inline: auto; }
.recorder video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.rec-timer { position: absolute; top: var(--s-3); left: 50%; transform: translateX(-50%); padding: 4px var(--s-3); border-radius: var(--r-pill); background: var(--c-scrim); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.rec-timer:empty { display: none; }
.rec-btn { position: absolute; bottom: var(--s-5); left: 50%; translate: -50% 0; width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: grid; place-items: center; cursor: pointer; }
.rec-btn span { width: 58px; height: 58px; border-radius: 50%; background: #ff3355; transition: all var(--d-med) var(--ease-spring); }
.rec-btn[aria-pressed="true"] span { width: 30px; height: 30px; border-radius: var(--r-sm); }
.state-card { margin-top: var(--s-3); padding: var(--s-4); border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-line); }
.state-card.error { border-color: rgb(255 107 107 / .5); background: linear-gradient(0deg, rgb(255 107 107 / .08), rgb(255 107 107 / .08)), var(--c-surface); }
.state-card.error h3 { color: var(--c-danger); margin-bottom: var(--s-1); }
.state-card ol { padding-left: var(--s-5); color: var(--c-text-2); font-size: var(--fs-sm); }
.loading-card { margin-top: var(--s-3); display: flex; gap: var(--s-3); align-items: center; padding: var(--s-4); background: var(--c-surface); border-radius: var(--r-lg); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--c-surface-3); border-top-color: var(--c-brand-soft); animation: spin .8s linear infinite; }

/* ---------- Stage (full-height vertical preview) ---------- */
.stage { flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; padding: var(--s-1) var(--s-4) var(--s-3); }
.stage-frame { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; border-radius: var(--r-lg); overflow: hidden; background: #000; box-shadow: var(--e-3); }
.stage-frame canvas { width: 100%; height: 100%; display: block; }
.play-fab { position: absolute; right: var(--s-2); bottom: var(--s-2); width: var(--touch); height: var(--touch); border-radius: 50%; border: 0; background: var(--c-scrim); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); }
.stage-time { position: absolute; left: var(--s-2); bottom: var(--s-3); padding: 2px var(--s-2); border-radius: var(--r-pill); background: var(--c-scrim); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.stage-skeleton { position: absolute; inset: 0; }
.safe-zone { position: absolute; inset: 0; pointer-events: none; font-size: 9px; font-weight: var(--fw-bold); color: var(--c-xp); text-transform: uppercase; letter-spacing: .06em; }
.safe-zone span { position: absolute; display: flex; align-items: center; justify-content: center; background: rgb(255 197 61 / .14); border: 1px dashed rgb(255 197 61 / .8); }
.sz-top { inset: 0 0 auto 0; height: 12%; }
.sz-bottom { inset: auto 0 0 0; height: 22%; }
.sz-right { right: 0; top: 40%; width: 14%; height: 38%; writing-mode: vertical-rl; }

/* ---------- Bottom sheet ---------- */
.screen.sheet { flex: 0 0 auto; max-height: 56%; overflow-y: auto; overscroll-behavior: contain; background: var(--c-surface); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 0 var(--s-4) var(--s-4); box-shadow: 0 -10px 30px rgb(0 0 0 / .45); animation: sheet-in var(--d-med) var(--ease-out); transition: max-height var(--d-med) var(--ease-out); }
.screen.sheet.collapsed { max-height: 64px; overflow: hidden; }
.grabber { display: block; width: 100%; height: 24px; border: 0; background: transparent; cursor: grab; position: sticky; top: 0; z-index: 2; background: var(--c-surface); }
.grabber::after { content: ""; display: block; width: 40px; height: 5px; margin: 0 auto; border-radius: var(--r-pill); background: var(--c-surface-3); }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); }
.sheet-head h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.sheet-head .meta { text-align: right; font-size: var(--fs-xs); }
.tools { margin: var(--s-3) 0; flex-wrap: nowrap; }

/* Filmstrip timeline */
.filmstrip { background: var(--c-bg); border-radius: var(--r-md); padding: var(--s-2); }
.fs-tools { display: flex; justify-content: space-between; align-items: center; padding: 0 var(--s-1); }
.fs-tools .meta { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); color: var(--c-text); }
.fs-zoom { display: flex; }
.fs-scroll { overflow: hidden; padding: 0 10px; border-radius: var(--r-sm); touch-action: none; cursor: crosshair; }
.fs-track { position: relative; height: 92px; width: 100%; }
.fs-thumbs { position: absolute; left: 0; right: 0; top: 18px; height: 48px; display: flex; overflow: hidden; border-radius: var(--r-sm); background: var(--c-surface-2); }
.fs-thumbs canvas { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; display: block; }
.fs-thumbs.loading { background: linear-gradient(90deg, var(--c-surface-2) 0, var(--c-surface-3) 40%, var(--c-surface-2) 80%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
.fs-track .beat { position: absolute; top: 4px; height: 10px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--c-text-2); opacity: .5; pointer-events: none; }
.fs-track .beat.onset { background: var(--c-brand-soft); opacity: 1; height: 12px; top: 3px; }
.fs-track .cut { position: absolute; top: 14px; height: 56px; width: 3px; margin-left: -1.5px; background: #fff; border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 1px #000; }
.fs-track .cut.flash { animation: snap-flash var(--d-slow) var(--ease-out); }
.fs-track .seg { position: absolute; top: 68px; height: 24px; min-width: 24px; border: 0; padding: 0; border-radius: 5px; background: var(--c-success); color: #062b1b; font-size: 11px; font-weight: var(--fw-black); cursor: pointer; }
.fs-track .seg::before { content: ""; position: absolute; inset: -12px 0 -2px; } /* 44px-ish hit area incl. thumb overlap */
.fs-track .seg[aria-pressed="false"] { background: repeating-linear-gradient(45deg, var(--c-surface-3) 0 5px, var(--c-surface-2) 5px 10px); color: var(--c-text-2); }
.fs-track .dropped-shade { position: absolute; top: 18px; height: 48px; background: rgb(11 11 18 / .72); pointer-events: none; }
.fs-track .ph { position: absolute; top: 0; height: 70px; width: 2px; margin-left: -1px; background: var(--c-xp); pointer-events: none; z-index: 3; }
.fs-track .ph::before { content: ""; position: absolute; top: -2px; left: -7px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-xp); box-shadow: var(--e-1); }
.fs-track .ph-hit { position: absolute; top: 0; width: 44px; height: 30px; margin-left: -22px; z-index: 4; cursor: ew-resize; border: 0; background: transparent; touch-action: none; }
.playhead-range { width: 100%; margin: var(--s-2) 0 0; accent-color: var(--c-xp); height: 24px; }

/* Fields */
.field { margin-top: var(--s-3); }
.field-head { display: flex; justify-content: space-between; align-items: baseline; }
.field-head label, legend { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-2); }
.value { font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; min-height: var(--touch); accent-color: var(--c-brand-soft); margin: 0; }
.chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; }
.chip { min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--c-line); background: var(--c-surface-2); font-size: var(--fs-sm); white-space: nowrap; cursor: pointer; position: relative; }
.chip::after { content: ""; position: absolute; inset: -4px 0; } /* 44px hit target */
.chip[aria-pressed="true"] { background: var(--c-text); color: var(--c-bg); border-color: var(--c-text); font-weight: var(--fw-semibold); }
.segmented { display: flex; gap: 4px; border: 0; padding: 4px; margin: var(--s-4) 0 0; background: var(--c-surface-2); border-radius: var(--r-pill); }
.segmented legend { float: left; width: 100%; margin-bottom: var(--s-2); }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 40px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-2); transition: background var(--d-med); }
.segmented input:checked + span { background: var(--c-surface-3); color: var(--c-text); box-shadow: var(--e-1); }
.segmented input:focus-visible + span { outline: 3px solid var(--c-focus); }
.segmented { flex-wrap: wrap; }

/* Captions */
.caption-form input[type="text"], .num input { width: 100%; min-height: var(--touch); padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--c-line); background: var(--c-surface-2); }
.caption-form input[aria-invalid="true"] { border-color: var(--c-danger); }
.caption-form .row { margin-top: var(--s-2); flex-wrap: nowrap; align-items: end; }
.num { flex: 1; }
.num label { font-size: var(--fs-xs); color: var(--c-text-2); }
.field-error { color: var(--c-danger); font-size: var(--fs-sm); min-height: 0; }
.field-error:empty { display: none; }
.cap-list { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-2); }
.cap-list li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); background: var(--c-surface-2); border-radius: var(--r-md); animation: pop-in var(--d-med) var(--ease-spring); }
.cap-list .cap-text { flex: 1; min-width: 0; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-list .cap-time { font-size: var(--fs-xs); color: var(--c-text-2); font-variant-numeric: tabular-nums; }
.empty { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-4); margin-top: var(--s-3); border: 1px dashed var(--c-line); border-radius: var(--r-md); color: var(--c-text-2); font-size: var(--fs-sm); }
.empty strong { color: var(--c-text); }

/* Score */
.gauge-wrap { position: relative; width: 196px; margin: var(--s-4) auto 0; }
.gauge { width: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 10; }
.gauge-bg { stroke: var(--c-surface-3); }
.gauge-fg { stroke: url(#g-brand); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.1s var(--ease-out); }
.gauge-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: var(--fs-3xl); font-weight: var(--fw-black); font-variant-numeric: tabular-nums; line-height: 1; }
.gauge-label .unit { font-size: var(--fs-sm); color: var(--c-text-2); font-weight: var(--fw-semibold); }
.xp-pop { position: absolute; left: 50%; top: 10%; translate: -50% 0; font-weight: var(--fw-black); color: var(--c-xp); font-size: var(--fs-xl); opacity: 0; pointer-events: none; text-shadow: 0 2px 12px rgb(255 197 61 / .5); }
.xp-pop.go { animation: xp-pop 1.4s var(--ease-out) forwards; }
.stars { display: flex; justify-content: center; gap: var(--s-2); margin-top: var(--s-2); }
.stars .star { width: 40px; height: 40px; stroke: var(--c-surface-3); fill: var(--c-surface-2); }
.stars .star.on { stroke: var(--c-xp); fill: var(--c-xp); animation: star-in var(--d-slow) var(--ease-spring) backwards; filter: drop-shadow(0 0 8px rgb(255 197 61 / .5)); }
.stars .star.on:nth-child(2) { animation-delay: 180ms; }
.stars .star.on:nth-child(3) { animation-delay: 360ms; }
.score-xp { text-align: center; font-weight: var(--fw-semibold); color: var(--c-xp); margin-top: var(--s-1); }
.metrics { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.metric { width: 100%; text-align: left; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); border: 1px solid var(--c-line); background: var(--c-surface); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 6px var(--s-2); }
.metric:disabled { cursor: default; opacity: 1; }
.metric-name { font-weight: var(--fw-semibold); }
.metric-val { font-variant-numeric: tabular-nums; font-weight: var(--fw-bold); }
.metric-bar { grid-column: 1 / -1; height: 6px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.metric-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c-success); transition: width .9s var(--ease-out); }
.metric.warn .metric-bar span { background: var(--c-warn); }
.metric.bad .metric-bar span { background: var(--c-danger); }
.metric-tip { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--c-text-2); }
.metric-tip strong { color: var(--c-brand-soft); white-space: nowrap; }
.sticky-cta { position: sticky; bottom: calc(-1 * var(--s-8)); padding: var(--s-4) 0; margin-top: var(--s-2); background: linear-gradient(transparent, var(--c-bg) 30%); flex-wrap: nowrap; }

/* Export */
.switch { display: flex; align-items: center; gap: var(--s-3); min-height: var(--touch); cursor: pointer; font-weight: var(--fw-semibold); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 28px; border-radius: var(--r-pill); background: var(--c-surface-3); position: relative; transition: background var(--d-med); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--d-med) var(--ease-spring); }
.switch input:checked + .track { background: var(--c-brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.export-progress { margin: var(--s-2) 0; }
.bar { height: 10px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--g-brand); border-radius: inherit; transition: width 300ms linear; position: relative; overflow: hidden; }
.bar span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .35), transparent); animation: shimmer-x 1.2s linear infinite; }
.export-progress .row { margin-top: var(--s-1); font-variant-numeric: tabular-nums; }

/* Share */
.final { display: block; width: auto; height: 48dvh; max-width: 100%; aspect-ratio: 9/16; margin: var(--s-4) auto 0; border-radius: var(--r-lg); background: #000; box-shadow: var(--e-3); }
.links { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: flex; gap: var(--s-2); flex-wrap: wrap; }
.links a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 var(--s-4); border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-brand-soft); font-weight: var(--fw-semibold); text-decoration: none; }

/* ---------- Bottom toolbar ---------- */
.toolbar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--c-bg); border-top: 1px solid var(--c-surface-2); padding-bottom: env(safe-area-inset-bottom); }
.tab { min-height: var(--toolbar-h); border: 0; background: transparent; color: var(--c-text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); cursor: pointer; position: relative; transition: color var(--d-med), transform var(--d-fast); }
.tab[aria-current="page"] { color: var(--c-text); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--g-brand); }
.tab[aria-current="page"] .ic { stroke: var(--c-brand-soft); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; translate: -50% 0; top: calc(var(--topbar-h) + var(--s-2) + env(safe-area-inset-top)); width: max-content; max-width: 92vw; display: grid; justify-items: center; gap: var(--s-2); z-index: 60; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-2); padding: 4px 4px 4px var(--s-4); min-height: 44px; border-radius: var(--r-pill); background: #f5f5fa; color: #14141c; font-size: var(--fs-sm); font-weight: var(--fw-semibold); box-shadow: var(--e-3); animation: toast-in var(--d-med) var(--ease-spring); }
.toast.out { animation: toast-out var(--d-med) var(--ease-out) forwards; }
.toast .msg { flex: 1; }
.toast button { min-height: 36px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-pill); background: transparent; color: #b0124b; font-weight: var(--fw-bold); cursor: pointer; position: relative; }
.toast button::after { content: ""; position: absolute; inset: -4px 0; }
.toast.error { background: #ffe3e3; }
.toast:not(:has(button)) { padding-right: var(--s-4); }
.toast.success::before { content: "✓"; color: #0d7a4f; font-weight: var(--fw-black); }

/* ---------- Coach marks ---------- */
.coach { position: fixed; inset: 0; z-index: 80; }
.coach-spot { position: fixed; border-radius: var(--r-md); box-shadow: 0 0 0 9999px var(--c-scrim); transition: all var(--d-med) var(--ease-out); pointer-events: none; outline: 2px solid var(--c-xp); outline-offset: 4px; }
.coach-tip { position: fixed; left: var(--s-4); right: var(--s-4); max-width: 420px; margin-inline: auto; padding: var(--s-4); border-radius: var(--r-lg); background: var(--c-text); color: var(--c-bg); box-shadow: var(--e-3); animation: pop-in var(--d-med) var(--ease-spring); }
.coach-tip .eyebrow { color: #b0124b; }
.coach-tip h3 { font-size: var(--fs-lg); margin: var(--s-1) 0; }
.coach-tip p { font-size: var(--fs-sm); }
.coach-tip .row { margin-top: var(--s-3); }
.coach-tip .btn.ghost { color: #4a4a5c; }

/* ---------- Confetti / skeleton ---------- */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }
.skeleton { background: linear-gradient(90deg, var(--c-surface) 0, var(--c-surface-2) 40%, var(--c-surface) 80%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }

/* ---------- Motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shimmer-x { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .4; } }
@keyframes pop-in { from { transform: scale(.92); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(-12px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-8px); opacity: 0; } }
@keyframes snap-flash { 0% { background: var(--c-xp); box-shadow: 0 0 0 6px rgb(255 197 61 / .5); } 100% { background: #fff; box-shadow: 0 0 0 1px #000; } }
@keyframes star-in { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes xp-pop { 0% { opacity: 0; transform: translateY(10px) scale(.6); } 25% { opacity: 1; transform: translateY(-6px) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-36px) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 380px) { .app:not([data-step="home"]) #hud-xp { display: none; } .app:not([data-step="home"]) .xp-chip { padding-right: 4px; } }

/* ---------- 404 page ---------- */
.notfound { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: var(--s-3); padding: var(--s-6); text-align: center; }
.notfound h1 { font-size: var(--fs-2xl); font-weight: var(--fw-black); letter-spacing: -.02em; margin: 0; }
.notfound img { border-radius: var(--r-xl); box-shadow: var(--e-glow); }
.notfound .btn { margin-top: var(--s-3); }

/* ---------- v3: Mix ---------- */
.mix { border: 0; padding: var(--s-3); margin: var(--s-4) 0 0; background: var(--c-bg); border-radius: var(--r-md); }
.mix legend { float: left; width: 100%; padding: 0; }
.mix > .field, .mix > .switch, .mix > .duck-meter { clear: both; }
.mix > .field:first-of-type { margin-top: 0; padding-top: var(--s-2); }
.mix input[type="range"] { width: 100%; accent-color: var(--c-brand-soft); }
.duck-meter { min-height: 1.4em; font-variant-numeric: tabular-nums; }
.duck-meter[data-ducking="true"] { color: var(--c-xp); }

/* ---------- v3: Mission 2 ---------- */
.mission-card.m2 { margin-top: var(--s-4); background: linear-gradient(160deg, #13233a 0%, var(--c-surface) 55%); border-color: #23405e; }
.mission-card[data-locked="true"] { opacity: .78; }
.lock-note { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-sm); color: var(--c-text-2); }
.hook-panel { margin-bottom: var(--s-3); }
.hook-panel .segmented { margin-top: 0; }
.hook-chips { flex-wrap: wrap; overflow: visible; margin-top: var(--s-3); }
.hook-chips .chip { min-height: var(--touch); white-space: normal; text-align: left; }
.hook-chips .chip::after { content: none; }
.hook-checklist { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-1); font-size: var(--fs-sm); }
.hook-checklist li { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-2) var(--s-3); background: var(--c-surface-2); border-radius: var(--r-md); }
.hc-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: var(--fw-black); background: var(--c-surface-3); }
.hook-checklist [data-ok="true"] .hc-mark { background: var(--c-success); color: #062b1b; }
.hook-checklist [data-ok="false"] .hc-mark { background: var(--c-danger); color: #2b0606; }

/* ---------- v3: Keyboard shortcuts overlay ---------- */
.desktop-only { display: none; }
.shortcuts { width: min(440px, 92vw); padding: var(--s-5); border: 1px solid var(--c-line); border-radius: var(--r-xl); background: var(--c-surface); color: var(--c-text); box-shadow: var(--e-3); }
.shortcuts::backdrop { background: var(--c-scrim); }
.shortcuts h2 { font-size: var(--fs-lg); }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-4); margin: var(--s-4) 0 0; align-items: center; }
.shortcut-list dd { margin: 0; color: var(--c-text-2); font-size: var(--fs-sm); }
kbd { display: inline-block; min-width: 28px; padding: 2px 8px; border: 1px solid var(--c-line); border-bottom-width: 3px; border-radius: var(--r-sm); background: var(--c-surface-2); font: var(--fw-semibold) var(--fs-sm)/1.4 var(--font); text-align: center; }
/* Layout by aspect ratio and height (v4) lives in css/v4.css. */
