/* Kyoruva Caption Studio 1.5 — app shell, dark + purple, touch-first */
:root {
  --bg: #0f0d1a; --bg2: #161226; --panel: #1c1730; --panel2: #231d3d;
  --line: #332a55; --text: #efeaff; --muted: #b9aee0;
  --accent: #8b5cf6; --accent2: #a78bfa; --accent-dim: #4c348f;
  --good: #34d399; --warn: #fbbf24; --bad: #f87171;
  --radius: 12px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --tap: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #241b4d 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  text-align: left; font-size: 16px; line-height: 1.45;
  height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  padding-top: var(--sat);
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
input[type="text"], textarea, select { font-size: 16px; }

/* App bar */
.appbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: rgba(22, 18, 38, 0.96); z-index: 30; position: relative;
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; min-width: 0; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; flex: none;
  background: linear-gradient(135deg, var(--accent), #5b21b6); box-shadow: 0 0 16px rgba(139,92,246,.5); }
.brand-t { min-width: 0; display: grid; }
.brand-t strong { font-size: 14px; white-space: nowrap; }
.brand-t span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.menu-btn { min-height: var(--tap); min-width: var(--tap); display: inline-flex; align-items: center; gap: 6px; }
.menu-pop {
  position: absolute; right: 8px; top: calc(100% + 6px); z-index: 40;
  display: grid; gap: 8px; padding: 10px; min-width: 220px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.menu-pop .btn { min-height: var(--tap); text-align: left; }

/* Kyoruva brand identity: parent brand + product tag. The mark is the
   official master logo vendored byte-exact from
   https://kyoruva.com/assets/logo.png (single variant published on the
   main site — no separate light/dark/transparent assets exist there). */
.logo-img { width: 32px; height: 32px; flex: none; display: block; object-fit: contain; }
.logo-img.big { width: 64px; height: 64px; margin-inline: auto; }
.logo-img.small { width: 20px; height: 20px; }
.product-id { font-size: 11px; font-weight: 600; color: var(--accent2); border: 1px solid var(--accent-dim); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.brandfoot { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px calc(6px + var(--sab)); border-top: 1px solid var(--line);
  background: rgba(22, 18, 38, 0.96); font-size: 12px; color: var(--muted); }
.brandfoot a { color: var(--accent2); }

/* Workspace + views */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; overflow: hidden; }
.view { min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 10px 10px 16px; display: none; overscroll-behavior: contain; }
.workspace[data-view="preview"] .view-preview, .workspace[data-view="captions"] .view-captions,
.workspace[data-view="style"] .view-style, .workspace[data-view="export"] .view-export { display: block; }
.viewhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.viewhead h2 { margin: 2px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.toolbar { margin-bottom: 4px; }

.panel { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.panel h2 { margin: 2px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
/* Stage 3.5 — the stage box follows the real video frame (see updateVideoDims):
   --stageCap bounds its height so transport + timeline stay visible; portrait
   boxes additionally cap width by the same cap, centered. */
.stage-panel { --stageCap: 42dvh; }
.stage { position: relative; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); aspect-ratio: 16/9; max-height: var(--stageCap); }
.workspace[data-vor="portrait"] .stage-panel { --stageCap: 56dvh; }
.workspace[data-vor="portrait"] .stage, .workspace[data-vor="square"] .stage { margin-inline: auto; max-height: none; }
.stage video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.empty-note { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; background: rgba(15,13,26,.6); font-size: 14px; }
.caption-layer { position: absolute; left: 0; right: 0; pointer-events: none; display: flex; justify-content: center; padding: 0 4%; }
.caption-layer.pos-top { top: 4%; } .caption-layer.pos-center { top: 50%; transform: translateY(-50%); } .caption-layer.pos-bottom { bottom: 4%; }
.caption-text { max-width: 92%; text-align: center; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
.caption-text.draggable { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.caption-text.dragging { cursor: grabbing; }
/* Kinetic Captions (Stage K-B): segmented mode switch + word spans.
   Simple Captions styles above are untouched. */
.seg-row { align-items: center; }
.btn.small.seg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.caption-layer.kinetic .caption-text { white-space: normal; }
.kw { display: inline-block; will-change: transform, opacity; }
/* NOTE (Stage K-H): estimated words are intentionally NOT marked in the
   overlay — an earlier `underline dotted` rule painted dotted marks under
   every estimated word in preview but never in exports. Measured-vs-
   estimated stays disclosed in the status UI, not on the words. */
/* Kinetic word timings (Stage K-C): per-cue status + focused word editor. */
.kinfo { margin-top: 6px; }
#wordList { display: flex; flex-direction: column; gap: 8px; max-height: 46dvh; overflow-y: auto; margin: 8px 0; }
.wrow { display: flex; align-items: center; gap: 8px; }
.wrow .wtext { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.wrow input.ws, .wrow input.we { width: 76px; flex: none; }
.wrow .wplay { flex: none; min-height: var(--tap); }
.west { flex: none; font-size: 12px; color: var(--muted); min-width: 70px; text-align: right; }

.transport { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.transport input[type="range"] { flex: 1 1 120px; min-width: 110px; accent-color: var(--accent); min-height: 32px; }
.transport .btn.small.tbtn, .toolbar .btn.small, #tlAddBtn, .menu-pop .btn.small { min-height: var(--tap); }
.transport .btn.small.tbtn { min-width: 60px; }
#volBar { max-width: 90px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; white-space: nowrap; }
.dim { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dim[hidden] { display: none; }
.transport select { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 8px; min-height: var(--tap); }

.timeline-wrap { margin-top: 10px; }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tl-head .hint { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-head > span:first-child { flex: none; }
.tl-time { flex: none; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; background: #0c0918; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; white-space: nowrap; }
.tl-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.tl-zoom { display: flex; gap: 8px; flex-wrap: nowrap; }
.tl-zoom .btn.small { min-width: 52px; }
/* Stage 3.6 — one scroll container, one px/sec scale shared by ruler, video
   strip, caption blocks and playhead, so everything stays aligned. */
.timeline { position: relative; margin-top: 6px; background: #0c0918; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; overflow-y: hidden; touch-action: pan-x pan-y; }
.tl-inner { position: relative; min-width: 100%; }
.tl-ruler { position: relative; height: 30px; border-bottom: 1px solid var(--line); touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; }
.tl-tick { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--line); pointer-events: none; }
.tl-tick span { position: absolute; top: 3px; left: 5px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-tick.minor { top: auto; height: 9px; opacity: .45; }
.tl-track.tl-video { position: relative; height: 26px; border-bottom: 1px solid var(--line); }
.tl-vbar { position: absolute; top: 4px; bottom: 4px; left: 0; background: #1b1533; border: 1px solid var(--accent-dim); border-radius: 6px; pointer-events: none; }
.tl-vlabel { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; pointer-events: none; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; }
.tl-captrack { position: relative; min-height: 68px; }
#tlBlocks { position: absolute; inset: 0; }
.tl-block { position: absolute; top: 12px; height: 44px; background: #2a2148; border: 1px solid var(--accent-dim); border-radius: 8px; color: var(--text); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 12px 26px; cursor: pointer; touch-action: pan-x pan-y; min-width: 48px; box-sizing: border-box; }
.tl-block.sel { background: var(--accent); border-color: transparent; font-weight: 700; }
.tl-block .hd { position: absolute; top: 0; bottom: 0; width: 24px; cursor: ew-resize; touch-action: none; display: grid; place-items: center; color: #fff; opacity: .9; z-index: 2; }
.tl-block .hd.l { left: 0; } .tl-block .hd.r { right: 0; }
#tlPlayhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-left: 2px solid var(--accent2); pointer-events: none; z-index: 5; }
#tlPlayhead::before { content: ""; position: absolute; top: 0; left: -7px; border: 6px solid transparent; border-top: 8px solid var(--accent2); }
.tl-ph-time { position: absolute; top: 12px; left: 4px; font-size: 10px; color: var(--accent2); background: rgba(12,9,24,.85); border-radius: 4px; padding: 1px 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#tlEmpty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; padding: 0 12px; text-align: center; }

.nowcard { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #141024; }
.now-t { min-width: 0; } .now-t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }

.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6d28d9); border-color: transparent; font-weight: 700; }
.btn.danger { border-color: #5b2b31; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 9px; min-height: 44px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.checkrow label { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 4px 8px 4px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 5px; margin: 8px 0; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input, .field select, .field textarea { background: #120e22; border: 1px solid var(--line); border-radius: 9px; padding: 10px; min-height: 44px; }
.field input[type="color"] { padding: 2px; height: 48px; }
.field input[type="range"] { accent-color: var(--accent); }
details { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: #141024; }
details summary { cursor: pointer; padding: 12px; min-height: var(--tap); font-weight: 700; font-size: 14px; touch-action: manipulation; }
details > :not(summary) { padding: 0 10px; } details > :last-child { padding-bottom: 10px; }
.cue { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin: 8px 0; background: #141024; }
.cue.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cue.overlap { border-color: var(--warn); }
.cue-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.cue-top .idx { background: var(--accent-dim); border-radius: 7px; padding: 4px 9px; font-size: 12px; min-height: 28px; display: inline-flex; align-items: center; }
.cue-top .cue-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cue-more { margin-top: 6px; }
.cue-more summary { min-height: 44px; padding: 8px 4px; color: var(--muted); font-size: 13px; }
.cue textarea { width: 100%; min-height: 52px; resize: vertical; background: #0e0a1d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.cue-times { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.cue-times input { width: 100%; background: #0e0a1d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-variant-numeric: tabular-nums; min-height: 44px; }
.cue-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.warnbox, .errbox, .okbox { border-radius: 10px; padding: 9px 11px; font-size: 13px; margin: 8px 0; line-height: 1.5; border: 1px solid var(--line); background: #141024; }
.warnbox { border-color: #6b5416; background: #231a08; } .errbox { border-color: #6e2b2b; background: #241011; } .okbox { border-color: #14532d; background: #0b1f14; }
.sample { border-radius: 10px; background: #000; border: 1px solid var(--line); min-height: 110px; display: grid; place-items: center; padding: 16px; overflow: hidden; position: sticky; top: 0; z-index: 2; }
/* Stage 4.0 — format picker */
.fmt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fmt-card { display: flex; gap: 10px; align-items: center; background: #120e22; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 52px; font-size: 14px; cursor: pointer; }
.fmt-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fmt-card input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.fmt-card input:disabled + span { opacity: .5; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset-grid .btn.small.active { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.progress { height: 10px; background: #0c0918; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.progress.indet > div { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* Bottom nav */
.bottomnav { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(18,14,34,.98); padding-bottom: var(--sab); z-index: 30; }
.bottomnav button { background: none; border: 0; display: grid; place-items: center; gap: 2px; padding: 8px 4px 10px; color: var(--muted); min-height: 60px; font-size: 12px; }
.bottomnav button .ico { font-size: 19px; line-height: 1; }
.bottomnav button.active { color: #fff; } .bottomnav button.active .ico { color: var(--accent2); }

#toastCtn { position: fixed; right: 10px; left: 10px; bottom: calc(72px + var(--sab)); display: grid; gap: 8px; z-index: 60; justify-items: center; pointer-events: none; }
.toast { background: #1e1836; border: 1px solid var(--accent-dim); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 520px; width: 100%; }
.toast.err { border-left-color: var(--bad); } .toast.ok { border-left-color: var(--good); }
.confirm-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(5,3,12,.7); }
.confirm-backdrop[hidden] { display: none; }
.confirm-card { width: 100%; max-width: 380px; background: var(--panel2); border: 1px solid var(--accent-dim); border-radius: 14px; padding: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.confirm-card p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; }
.confirm-btns { justify-content: flex-end; }
.confirm-btns .btn { min-height: var(--tap); min-width: 96px; }
/* Stage 3.3 — projects + relink */
.relinkbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border: 1px solid #6b5416; background: #231a08; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.relinkbar[hidden] { display: none; }
.relinkbar .row { margin-left: auto; }
.proj-card { max-width: 560px; }
.proj-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin: 8px 0; background: #141024; display: grid; gap: 6px; }
.proj-row.active { border-color: var(--accent); }
.proj-row .proj-meta { color: var(--muted); font-size: 12px; }
.proj-row .row { gap: 6px; }
.proj-row input[name="rename"] { width: 100%; background: #0e0a1d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 44px; }
#projNameInput { flex: 1 1 160px; background: #0e0a1d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 44px; }
.edit-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(5,3,12,.72); }
.edit-backdrop[hidden] { display: none; }
.edit-card { width: 100%; max-width: 460px; max-height: 92dvh; overflow-y: auto; background: var(--panel2); border: 1px solid var(--accent-dim); border-radius: 14px; padding: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.55); display: grid; gap: 8px; }
.edit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.edit-head strong { font-size: 16px; }
.edit-card textarea { width: 100%; min-height: 96px; resize: vertical; background: #0e0a1d; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 17px; line-height: 1.5; }
.edit-card .cue-times { margin-top: 0; }
.edit-btns { justify-content: flex-end; }
.edit-btns .btn { min-height: var(--tap); min-width: 110px; }
.edit-card .hint { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dot { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 5px; }
.dot.g { background: var(--good); } .dot.r { background: var(--bad); }

/* Side tool tabs + expand (two-pane mode only; phones use the bottom nav) */
.sidetabs { display: none; }
.sideexpand { display: none; }

/* Narrow tablets: single focused view, keep bottom nav */
@media (min-width: 861px) and (max-width: 899px) {
  .view { padding: 14px; }
  .stage-panel { --stageCap: 52dvh; }
  .now-t strong { max-width: 40vw; }
}
/* Preview-first two-pane: tablets landscape, laptops, desktops.
   The video preview is always visible in the flexible column; one tool
   (Subtitles/Style/Export) lives in the collapsible side panel. */
@media (min-width: 900px) {
  body[data-app="editor"] .bottomnav { display: none; }
  body[data-app="editor"] .menu-pop { min-width: 260px; }
  .workspace {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: minmax(0, 1fr);
    gap: 12px; padding: 12px 14px; overflow: hidden;
  }
  .workspace[data-side="off"] { grid-template-columns: minmax(0, 1fr); }
  .workspace .view { display: none; padding: 0; overflow-y: auto; min-height: 0; min-width: 0; }
  /* Preview is permanent in two-pane (beats the single-view rules above). */
  .workspace[data-view="preview"] .view-preview,
  .workspace[data-view="captions"] .view-preview,
  .workspace[data-view="style"] .view-preview,
  .workspace[data-view="export"] .view-preview { display: block; grid-column: 1; grid-row: 1; }
  .workspace[data-view="captions"] .view-captions,
  .workspace[data-view="style"] .view-style,
  .workspace[data-view="export"] .view-export { display: block; grid-column: 2; grid-row: 1; }
  .workspace[data-side="off"] .view-captions,
  .workspace[data-side="off"] .view-style,
  .workspace[data-side="off"] .view-export { display: none; }
  .view-preview .stage-panel { position: sticky; top: 0; }
  .stage { max-height: none; }
  .stage-panel { --stageCap: calc(100dvh - 360px); }
  .view-style .panel, .view-export .panel { margin-bottom: 0; }
  .sidetabs { display: flex; gap: 6px; margin-bottom: 8px; position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 2px 0 8px; }
  .sidetabs .btn.small { flex: 1; min-height: 44px; padding: 8px 4px; }
  .sidetabs .btn.small.active { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
  .workspace[data-side="off"] .sideexpand { display: block; margin-top: 10px; }
  #toastCtn { left: auto; right: 14px; justify-items: end; }
}
@media (min-width: 1101px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 350px; }
  .stage-panel { --stageCap: calc(100dvh - 320px); }
}
@media (min-width: 1600px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 390px; max-width: 1800px; margin: 0 auto; width: 100%; }
}
@media (max-width: 380px) {
  .grid2 { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-t span { max-width: 38vw; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .progress > div { transition: none; }
}

/* Welcome-first state: editor chrome hidden until a video is chosen */
.appbar, .workspace, .bottomnav { display: none; }
body[data-app="editor"] .appbar { display: flex; }
body[data-app="editor"] .workspace { display: grid; }
body[data-app="editor"] .bottomnav { display: grid; }
body[data-app="editor"] .welcome { display: none; }
.welcome { flex: 1; min-height: 0; overflow-y: auto; display: grid; place-items: center; padding: 20px; }
.welcome-card { width: 100%; max-width: 430px; display: grid; gap: 12px; justify-items: center; text-align: center; background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 18px; padding: 30px 24px; }
.logo.big { width: 56px; height: 56px; font-size: 28px; }
.welcome-card h1 { margin: 0; font-size: 22px; }
.tagline { color: var(--text); font-size: 15px; line-height: 1.55; margin: 0; }
.privacy { font-size: 13px; color: var(--muted); margin: 0; }
.big-cta { min-height: 56px; font-size: 17px; padding: 12px 28px; border-radius: 14px; width: 100%; max-width: 320px; }
.welcome-card details { width: 100%; }
@media (min-width: 900px) {
  body[data-app="editor"] .bottomnav { display: none; }
}
