/* Shotmoo — the interface lives in the same grey as the blockout renders.
   Colour comes only from the character palette; white marks what you are facing (selection, pending edits).
   Layout: library first (2 rows at a time), then the chosen shot: header, editable parameter strip + Apply, status, preview. */
:root {
  --wall: #474747;      /* page */
  --panel: #505050;
  --raise: #5A5A5A;
  --rule: #636363;
  --stage: #5E5E5E;     /* blockout background */
  --ink: #F4F4F4;
  --ink2: #CFCFCF;
  --ink3: #ADADAD;
  --onfront: #2A2A2A;   /* text on white */
  --mark: #D62828;      /* character 01 */
  --mark-hi: #E23434;
  --ok: #2E9E44;        /* character 03, used for "done" */
  --front: #FFFFFF;     /* front-face white */
  --r: 3px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --maxw: 1360px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--wall); }
body { margin: 0; font: 400 15px/1.55 var(--font); color: var(--ink); background: var(--wall); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--front); outline-offset: 2px; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }

/* ---------------------------------------------------------------- top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--wall); border-bottom: 1px solid var(--rule); }
.topin { max-width: var(--maxw); margin-inline: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center;
  padding-block: 14px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
.mark { width: 20px; height: 30px; }
.search { display: flex; align-items: center; gap: 10px; max-width: 760px; height: 44px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); }
.search:focus-within { border-color: var(--front); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink3); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 15px; }
.search input::placeholder { color: var(--ink3); }
.topr { display: flex; align-items: center; gap: 10px; }
.wallet { display: flex; align-items: baseline; gap: 6px; padding: 4px 8px; white-space: nowrap; background: none; border: 0; border-radius: var(--r); cursor: pointer; }
.wallet:hover { background: var(--panel); }
.wallet b { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.wallet span { color: var(--ink2); font-size: 13px; }
.lang { height: 34px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--r); background: transparent; color: var(--ink2); font-weight: 700; font-size: 13px; letter-spacing: .04em; cursor: pointer; }
.lang:hover { color: var(--ink); border-color: var(--ink3); }
.acct { position: relative; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); font-weight: 800; cursor: pointer; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; right: 0; top: 48px; min-width: 240px; padding: 8px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.4); z-index: 30; display: grid; gap: 2px; }
.menu .who { margin: 4px 8px 2px; display: grid; }
.menu .who b { font-size: 14px; }
.menu .who span { color: var(--ink3); font-size: 12.5px; word-break: break-all; }
.menu .plan { margin: 0 8px 8px; color: var(--ink2); font-size: 12.5px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.mi { text-align: left; padding: 9px 10px; border: 0; border-radius: var(--r); background: none; cursor: pointer; font-weight: 600; font-size: 14px; }
.mi:hover { background: var(--raise); }
.bin h2 .sub { font-weight: 400; color: var(--ink3); font-size: 16px; margin-left: 8px; letter-spacing: 0; }
.google { justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; }
.google:hover { background: #f1f1f1; }
.google svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--ink3); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan { display: grid; gap: 6px; padding: 16px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; align-content: start; }
.plan h3 { margin: 0; font-size: 16px; font-weight: 800; }
.plan .amt { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.plan .amt small { font-size: 13px; font-weight: 400; color: var(--ink3); margin-left: 4px; }
.plan .pc { margin: 0 0 6px; color: var(--ink2); font-size: 13.5px; }
.plan .btn { justify-content: center; }
#cvList { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
#cvList li { display: flex; gap: 10px; align-items: center; }
#cvList li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cvList b { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 2px; background: var(--raise); color: var(--ink2); }
#cvList b[data-s="done"] { background: var(--ok); color: #fff; }
#cvList a { color: var(--ink); }
html[data-mode="cloud"] #cmpWrap { display: none; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--raise); cursor: pointer; font-weight: 600; text-align: left; }
.btn:hover { border-color: var(--ink3); }
.btn span { font-weight: 400; font-size: 13px; color: var(--ink2); white-space: nowrap; }
.btn.primary { background: var(--mark); border-color: var(--mark); color: #fff; }
.btn.primary span { color: #FFD9D9; }
.btn.primary:hover:not(:disabled) { background: var(--mark-hi); }
.btn.quiet { background: none; min-height: 36px; padding: 6px 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--raise); cursor: pointer; font-size: 20px; line-height: 1; }
.icon svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 2; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--rule); background: transparent; cursor: pointer; font-size: 14px; color: var(--ink2); }
.chip:hover { color: var(--ink); border-color: var(--ink3); }
.chip[aria-pressed="true"] { background: var(--front); border-color: var(--front); color: var(--onfront); font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--ink); font-weight: 600; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--front); }
.hint { color: var(--ink3); font-size: 13px; margin: 0; }
.lbl { font-size: 14px; font-weight: 600; }

/* the cube marker: a block seen in 3/4, side in the given colour, front in white */
.cube { --c: var(--mark); display: inline-block; flex: none; width: 13px; height: 13px;
  background: linear-gradient(90deg, #fff 0 55%, var(--c) 55% 100%); clip-path: polygon(0 18%, 55% 18%, 100% 0, 100% 82%, 55% 100%, 0 100%); }

/* ---------------------------------------------------------------- library */
.libzone { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding-block: 22px 26px; }
.bin { min-width: 0; }
.binhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bin h2 { margin: 0; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.count { margin: 0 0 12px; color: var(--ink2); font-size: 14px; }
.count:empty { display: none; }
.filters { display: grid; gap: 8px; margin: 14px 0 18px; }
.frow { display: flex; flex-wrap: wrap; gap: 6px; }
.grid { --ar: 16 / 9; --min: 196px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr)); gap: 20px 16px; }
.grid[data-ar="9x16"] { --ar: 9 / 16; --min: 122px; }
.grid[data-ar="1x1"] { --ar: 1 / 1; --min: 150px; }
.grid[data-ar="4x5"] { --ar: 4 / 5; --min: 136px; }
.card { position: relative; min-width: 0; }
.copen { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 9px; align-content: start; width: 100%; border-radius: var(--r); }
.copen:focus-visible { outline: 2px solid var(--front); outline-offset: 4px; }
.thumb { position: relative; display: block; aspect-ratio: var(--ar); max-width: 100%; border-radius: var(--r); overflow: hidden; background: var(--stage); outline: 2px solid transparent; }
.fav, .rm { position: absolute; top: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(40,40,40,.55); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s; }
.fav { right: 6px; } .rm { left: 6px; }
.fav svg, .rm svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.card:hover .fav, .card:focus-within .fav, .fav[aria-pressed="true"], .card:hover .rm, .card:focus-within .rm { opacity: 1; }
.fav:hover, .rm:hover { background: rgba(30,30,30,.85); }
.fav[aria-pressed="true"] svg { fill: var(--mark); stroke: var(--mark); }
@media (hover: none) { .fav, .rm { opacity: 1; } }
.ebadge { position: absolute; left: 8px; bottom: 8px; font-size: 11.5px; font-weight: 700; color: var(--onfront); background: var(--front); padding: 2px 7px; border-radius: 2px; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb video { opacity: 0; }
.card.live .thumb video { opacity: 1; }
.card[aria-current="true"] .thumb { outline-color: var(--front); }
.noposter { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink3); font-size: 13px; }
.meta { display: grid; gap: 2px; min-width: 0; }
.meta .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.meta .sub { display: flex; align-items: center; gap: 7px; color: var(--ink3); font-size: 13px; }
.meta .spec { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.more { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }
.more .btn { min-width: 160px; justify-content: center; }
.empty { grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--rule); border-radius: var(--r); color: var(--ink2); max-width: 70ch; }
.empty p { margin: 0 0 6px; }

/* aspect ratio pickers: library head (row) and next to the preview (rail) */
.aspects { display: inline-flex; gap: 0; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.asp { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 13px; border: 0; border-right: 1px solid var(--rule); background: transparent;
  color: var(--ink2); cursor: pointer; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.asp:last-child { border-right: 0; }
.asp:hover { color: var(--ink); background: var(--panel); }
.asp[aria-checked="true"] { background: var(--front); color: var(--onfront); }
.asp i { display: block; border: 1.6px solid currentColor; border-radius: 1.5px; flex: none; }
.rail { display: grid; align-content: start; gap: 8px; }
.rail .asp { flex-direction: column; justify-content: center; gap: 6px; width: 84px; height: 84px; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); }
.rail .asp:last-child { border-right: 1px solid var(--rule); }
.rail .asp small { font-size: 11px; font-weight: 400; color: inherit; opacity: .8; }
.rail .asp[aria-checked="true"] { border-color: var(--front); }
.coll .chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.coll .chip.addp { border-style: dashed; }
.coll .chip b { font-weight: 600; color: inherit; opacity: .75; font-variant-numeric: tabular-nums; }
.coll form { display: inline-flex; gap: 6px; }
.coll input { height: 34px; width: 220px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--front); background: var(--panel); }
.coll input:focus { outline: none; }
.collhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border-radius: var(--r); }
.collhead h3 { margin: 0; font-size: 17px; font-weight: 800; }
.collhead h3 span { font-weight: 400; color: var(--ink3); font-size: 14px; margin-left: 6px; }
.collhead .sp { flex: 1; }
.collhead input { height: 34px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--front); background: var(--wall); font-weight: 700; }

/* convert panel: as important as the library, always beside it */
.convert { position: sticky; top: 84px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; }
.cvin { padding: 20px; display: grid; gap: 12px; }
.cvkicker { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); }
.convert h2 { margin: -6px 0 0; font-weight: 800; font-size: 22px; letter-spacing: -0.02em; line-height: 1.15; }
.convert .drop { position: relative; display: grid; justify-items: center; gap: 6px; min-height: 170px; align-content: center; background: var(--wall); }
.convert .drop svg { width: 30px; height: 30px; fill: none; stroke: var(--ink2); stroke-width: 1.8; }
.convert .drop span { color: var(--ink); line-height: 1.4; }
.convert .drop small { color: var(--ink3); font-size: 12.5px; }
.cvgo { justify-content: space-between; }
.convert .steps { font-size: 13.5px; }

/* ---------------------------------------------------------------- chosen shot */
.shot { padding-block: 26px 10px; border-top: 1px solid var(--rule); scroll-margin-top: 80px; display: grid; gap: 18px; }
.shothead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.sh-text { min-width: 0; }
.cat { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--ink2); font-size: 14px; font-weight: 600; }
.shothead h1 { margin: 8px 0 2px; font-weight: 800; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; letter-spacing: -0.025em; text-wrap: balance; }
.en { margin: 0 0 10px; color: var(--ink3); font-size: 15px; }
.badge { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--onfront); background: var(--front); padding: 2px 7px; border-radius: 2px; margin-left: 6px; }
.desc { margin: 0 0 12px; color: var(--ink2); max-width: 70ch; }
.moves { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.moves span { font-size: 13px; padding: 3px 9px; border-radius: 2px; background: var(--panel); color: var(--ink2); }
.sh-actions { display: grid; gap: 8px; min-width: 330px; }
.sh-row { display: flex; gap: 8px; justify-content: flex-end; }
.sh-keep { display: flex; gap: 8px; }
.sh-keep .btn { flex: 1; justify-content: center; gap: 8px; white-space: nowrap; padding-inline: 12px; }
.sh-keep svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.sh-keep [aria-pressed="true"] svg { fill: var(--mark); stroke: var(--mark); }
.btn small { font-weight: 400; font-size: 12px; color: inherit; opacity: .85; display: block; }

/* editor: parameter strip + specific request | Apply */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); }
.edmain { min-width: 0; padding: 16px 18px; display: grid; gap: 12px; }
.edlabel { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.edlabel h2 { margin: 0; font-size: 16px; font-weight: 800; }
.params { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.param { all: unset; box-sizing: border-box; display: grid; gap: 1px; min-width: 116px; padding: 8px 12px; border-radius: var(--r);
  background: var(--wall); border: 1px solid var(--rule); cursor: pointer; }
.param:hover { border-color: var(--ink3); }
.param:focus-visible { outline: 2px solid var(--front); outline-offset: 2px; }
.param .pl, .param label.pl { font-size: 12px; color: var(--ink3); }
.param .pv { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.param.wide .pv { white-space: normal; max-width: 34ch; }
.param.pending { background: var(--front); border-color: var(--front); color: var(--onfront); }
.param.pending .pl, .param.pending .pold { color: #5C5C5C; }
.pold { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.edside .apply { margin-top: 0; }
.param.editing { cursor: default; border-color: var(--front); background: var(--wall); }
.param.editing.wide { flex-basis: 100%; }
.pinput { width: 150px; height: 32px; margin-top: 3px; padding: 0 8px; border-radius: 2px; border: 1px solid var(--ink3); background: var(--panel); font-weight: 700; font-variant-numeric: tabular-nums; }
.pinput:focus { outline: none; border-color: var(--front); }
.ph { font-size: 11.5px; color: var(--ink3); margin-top: 3px; }
.objpick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.objfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.reqbox { display: grid; gap: 6px; }
.reqbox textarea { width: 100%; min-height: 64px; resize: vertical; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--wall); line-height: 1.45; }
.reqbox textarea:focus { outline: none; border-color: var(--front); }
.reqfoot { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reqfoot .hint { flex: 1 1 320px; }
.edside { border-left: 1px solid var(--rule); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; justify-content: flex-start; padding-top: 50px; }
.apply { justify-content: center; min-height: 52px; font-size: 16px; }

/* status line: estimate + seconds counter */
.status { display: grid; gap: 8px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--panel); }
.strow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.strow p { margin: 0; }
#stText { flex: 1 1 320px; min-width: 0; color: var(--ink); }
.sttime { color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sttime b { color: var(--ink); font-size: 17px; }
.bar { height: 4px; background: var(--wall); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--front); transition: width .2s linear; }
.status[data-state="done"] { border-color: var(--ok); }
.status[data-state="done"] .bar i { background: var(--ok); }
.status[data-state="error"] { border-color: var(--mark); }
.status[data-state="error"] .bar i, .status[data-state="stopped"] .bar i { background: var(--ink3); }

/* preview */
.monitor { min-width: 0; }
.monrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.stagebox { display: grid; place-items: center; min-width: 0; background: #3E3E3E; border-radius: var(--r); overflow: hidden; }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--stage); border-radius: var(--r); overflow: hidden; user-select: none; -webkit-user-select: none; }
.screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity .2s; }
.screen.busy canvas { opacity: .45; }
.wm { position: absolute; inset: 0; pointer-events: none; opacity: .2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='170'><text x='30' y='105' transform='rotate(-18 160 85)' font-family='Montserrat,Arial,sans-serif' font-size='22' font-weight='800' fill='white' letter-spacing='3'>SHOTMOO  PREVIEW</text></svg>"); }
.working { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; pointer-events: none; }
.working span { font-weight: 600; background: rgba(40,40,40,.75); padding: 6px 12px; border-radius: 2px; }
.working b { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
#srcPip { position: absolute; right: 12px; bottom: 12px; width: 32%; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--front);
  border-radius: 2px; background: #000; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.dofnote { position: absolute; left: 12px; bottom: 10px; margin: 0; max-width: 60%; padding: 6px 10px; font-size: 12.5px; background: rgba(40,40,40,.72); border-radius: 2px; }
.transport { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; margin-top: 12px; }
.play .i-pause { display: none; }
.play[data-state="playing"] .i-play { display: none; }
.play[data-state="playing"] .i-pause { display: block; }
.play svg { stroke: none; }
#scrub { width: 100%; accent-color: var(--front); height: 28px; }
.tc { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 88px; text-align: right; }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--ink2); font-size: 14px; white-space: nowrap; }
.switch input { accent-color: var(--mark); width: 16px; height: 16px; }
.readout { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0 0; border-top: 1px solid var(--rule); }
.readout div { padding: 8px 14px 0 0; }
.readout dt { color: var(--ink3); font-size: 12px; }
.readout dd { margin: 1px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.below { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 28px; align-items: start; padding-top: 8px; }
.castbox h2 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.cast { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cast li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cast b { font-variant-numeric: tabular-nums; }
.cast span { color: var(--ink3); margin-left: auto; font-size: 13px; }
.prompt summary { cursor: pointer; font-weight: 700; }
.prompt .hint { margin: 8px 0; }
.prompt pre { white-space: pre-wrap; font: 400 13px/1.55 var(--font); background: var(--panel); padding: 12px; border-radius: var(--r); margin: 0 0 10px; color: var(--ink2); }
.foot { padding-block: 22px 40px; color: var(--ink3); font-size: 13px; }

/* ---------------------------------------------------------------- dialogs */
dialog { border: 1px solid var(--rule); border-radius: 6px; padding: 0; background: var(--wall); color: var(--ink); width: min(620px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(30,30,30,.7); }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg h2 { margin: 0; font-weight: 800; font-size: 19px; letter-spacing: -0.015em; }
.dlghead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drop { display: grid; place-items: center; min-height: 150px; padding: 20px; text-align: center; border: 1.5px dashed var(--ink3); border-radius: var(--r); cursor: pointer; color: var(--ink2); }
.drop.over { border-color: var(--front); background: var(--panel); }
.drop input { position: absolute; opacity: 0; pointer-events: none; }
#upVideo { width: 100%; border-radius: var(--r); background: #000; }
.steps { margin: 0; padding-left: 22px; color: var(--ink2); font-size: 14px; display: grid; gap: 4px; }
.note { background: var(--panel); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; justify-items: start; }
.note p { margin: 0; font-size: 14px; color: var(--ink2); }
code { font-family: inherit; font-weight: 600; color: var(--ink); }
.field { display: grid; gap: 6px; }
.field input, .field select { height: 42px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--panel); }
.field input:focus, .field select:focus { outline: none; border-color: var(--front); }
.dlgactions { display: flex; gap: 10px; flex-wrap: wrap; }
.plist { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.plist label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--panel); cursor: pointer; }
.plist input { width: 18px; height: 18px; accent-color: var(--mark); }
.plist span { flex: 1; font-weight: 600; }
.plist small { color: var(--ink3); font-size: 12.5px; }
.plist .empty { padding: 12px; font-size: 14px; }
.newproj { display: flex; gap: 8px; }
.newproj input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--panel); }
.newproj input:focus { outline: none; border-color: var(--front); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; background: var(--front); color: var(--onfront); font-weight: 600; font-size: 14px; border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: opacity .2s, transform .2s; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */
#openUpload { display: none; }
@media (max-width: 1100px) { .libzone { grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; } }
@media (max-width: 980px) {
  .libzone { grid-template-columns: 1fr; }
  .convert { position: static; scroll-margin-top: 90px; }
  #openUpload { display: inline-flex; }
  .monrow { grid-template-columns: 1fr; }
  .rail { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .rail .asp { width: auto; height: 56px; flex-direction: row; }
  .shothead { grid-template-columns: 1fr; }
  .sh-actions { min-width: 0; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .sh-row { justify-content: flex-start; }
  .editor { grid-template-columns: 1fr; }
  .edside { border-left: 0; border-top: 1px solid var(--rule); padding-top: 16px; }
  .below { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .topin { grid-template-columns: auto 1fr auto; gap: 12px; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .search { grid-column: 1 / -1; grid-row: 2; }
  #openUpload { grid-column: 3; grid-row: 1; min-height: 38px; padding: 6px 12px; font-size: 14px; }
  .aspects { width: 100%; }
  .aspects .asp { flex: 1; justify-content: center; padding: 0 6px; }
  .rail .asp small { display: none; }
  .wallet { display: none; }
  .shot { scroll-margin-top: 136px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .grid[data-ar="9x16"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meta .spec { gap: 10px; }
  .edmain, .edside { padding: 14px; }
  .param { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
  .param.wide, .param.editing.wide { flex-basis: 100%; }
  .pinput { width: 100%; }
  .transport { grid-template-columns: auto minmax(0, 1fr) auto; }
  .transport .switch { grid-row: 2; }
  .readout { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .readout div:nth-child(n+4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toast, .bar i, .screen canvas { transition: none; } }

/* key setup steps in the Claude dialog */
.ksteps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.ksteps a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* two-line button label: action + format */
.btn .bl { display: grid; gap: 1px; font-weight: 600; font-size: inherit; color: inherit; white-space: normal; }
.btn .bl small { font-weight: 400; font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }
.btn.primary .bl { color: #fff; }
.sh-keep .btn .bl { display: inline; white-space: nowrap; }
