:root {
  --bg: #fff8ef; --card: #ffffff; --ink: #2b2118; --soft: #7a6a5c; --line: #eadfd2;
  --accent: #e8590c; --accent-ink: #fff; --err: #c92a2a;
  --glass: rgba(255, 255, 255, .62); --glass-line: rgba(0, 0, 0, .08); --glass-ink: #2b2118;
  --lift: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .08);
  color-scheme: light;
}
:root[data-theme="dark"] { --bg: #17130f; --card: #231d17; --ink: #f3ebe2; --soft: #b3a596; --line: #3a3028;
          --accent: #ff7a2e; --accent-ink: #1a0e05; --err: #ff6b6b; color-scheme: dark;
          --glass: rgba(40, 34, 28, .55); --glass-line: rgba(255, 255, 255, .10); --glass-ink: #f3ebe2;
          --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button { transition-property: transform, background-color, opacity, box-shadow; transition-duration: 150ms;
  transition-timing-function: ease-out; -webkit-tap-highlight-color: transparent; }
button:not(:disabled):active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { button:not(:disabled):active { transform: none; } }
button, textarea, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand span { color: var(--accent); }
.back { border: 0; background: none; font-size: 30px; line-height: 1; padding: 0 0 4px; cursor: pointer;
  min-width: 44px; min-height: 44px; margin-left: -10px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }

.new { display: grid; gap: 10px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 12px 14px; resize: vertical; }
#vline { min-height: 4.6em; max-height: 40vh; overflow-y: auto; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.primary { border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; padding: 13px 16px; cursor: pointer; }
.primary:disabled { opacity: .55; cursor: default; }
.primary.small, .second.small { padding: 8px 14px; margin-bottom: 12px; min-height: 44px; }
.hint { color: var(--soft); font-size: 14px; margin: 0; }
.row { display: flex; gap: 8px; }
.row .primary { flex: 1; }
.second { border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600;
  padding: 12px 14px; cursor: pointer; white-space: nowrap; }
.second:disabled { opacity: .55; cursor: default; }
.enh { display: grid; gap: 8px; padding: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.enh label { font-size: 13px; color: var(--soft); }
#vprompt { min-height: 6em; max-height: 45vh; overflow-y: auto; }

.list { display: grid; gap: 12px; margin-top: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; color: inherit; text-decoration: none; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; aspect-ratio: 4 / 1.78;
  background: var(--line); place-items: center; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.ct { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.ct b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct small { color: var(--soft); white-space: nowrap; }

h1 { font-size: 22px; margin: 0 0 4px; }
.status { color: var(--soft); margin: 0 0 12px; font-size: 14px; }
.status.err { color: var(--err); }

.cast { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.who { margin: 0; flex: 0 0 auto; width: 150px; cursor: pointer; }
.who img, .who .ph { width: 150px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; }
.who figcaption { font-size: 13px; color: var(--soft); text-align: center; margin-top: 2px; }

.strip { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .strip { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .strip { grid-template-columns: repeat(5, 1fr); } }
.frame { margin: 0; cursor: pointer; }
.pic { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); }
.pic img, .pic .ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.n { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff;
  font-size: 13px; font-weight: 700; border-radius: 999px; min-width: 24px; padding: 2px 7px; text-align: center; }
.tk { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px;
  border-radius: 999px; padding: 2px 7px; }
.frame figcaption { font-size: 14px; margin-top: 6px; line-height: 1.3; }
.frame .nar { margin: 3px 0 0; font-style: italic; color: var(--soft); font-size: 13px; line-height: 1.3; }
.frame .meta { margin: 3px 0 0; color: var(--soft); font-size: 12px; }
#edits ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; color: var(--soft); }
.wait { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,248,239,.45); }
.fail { position: absolute; inset: auto 0 0 0; padding: 8px; background: var(--err); color: #fff;
  font-size: 13px; text-align: center; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--accent); animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.viewer { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.75); display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px); }
.vbox { position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; background: var(--bg);
  border-radius: 18px; padding: 62px 12px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.vclose { position: absolute; top: 9px; right: 12px; z-index: 2; border: 0; border-radius: 999px; width: 44px; height: 44px;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.vpic { position: relative; min-height: 120px; border-radius: 12px; overflow: hidden; background: #000; }
.vpic img { display: block; width: 100%; max-height: 62vh; object-fit: contain; }
.takes { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--soft); font-size: 14px; }
.takes { font-variant-numeric: tabular-nums; }
.takes button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; width: 44px; height: 44px;
  font-size: 22px; cursor: pointer; }
.takes button:disabled { opacity: .35; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); }
.fade { opacity: 0; transition: opacity .45s ease; }
.fade.in { opacity: 1; }
.wait.now { background: rgba(255,248,239,.25); box-shadow: inset 0 0 0 3px var(--accent); border-radius: 12px; }
.status.working::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px;
  border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite;
  vertical-align: -1px; }

.bal { display: block; margin: 0 0 12px auto; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--soft); font-size: 13px; padding: 6px 12px; cursor: pointer; }
.bal.low { color: var(--err); border-color: var(--err); }
body.admin .bal-cap { text-decoration: underline dotted; }   /* the admin taps it to change the daily limit (11-16) */

/* Section 2: the shot page (box → first frame → video) */
.step { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 14px;
  display: grid; gap: 10px; max-width: 520px; }
.step h2 { font-size: 17px; margin: 0; }
.step h2 small { color: var(--soft); font-weight: 400; font-size: 13px; margin-left: 6px; }
.stepbody { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.step.locked .stepbody { opacity: .45; pointer-events: none; }
.vid { border-radius: 12px; overflow: hidden; background: #000; }
.vid video, .vid img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.und { margin: 0; font-size: 15px; }
.link { border: 0; background: none; color: var(--soft); text-decoration: underline; font-size: 14px;
  cursor: pointer; justify-self: start; padding: 4px 0; }
#sh-fprompt, #sh-vprompt { min-height: 6em; max-height: 45vh; overflow-y: auto; font-size: 14px; }

/* the box step, phone first: the clip on a stage with see-through controls on it, then your words and the box's
   reply, then the composer. Glass = translucent card + blur, the same in light and dark. */
.glass { background: var(--glass); color: var(--glass-ink); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--lift); }
.stage { position: relative; }
.stage video { transition-property: max-height, transform; transition-duration: 200ms; transition-timing-function: ease-out; }
.typing .stage video { max-height: 24vh; }               /* keyboard up: the box stays in sight above your words */
.vers { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center;
  border-radius: 999px; padding: 0 2px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vers button { border: 0; background: none; color: inherit; width: 44px; height: 40px; font-size: 22px; cursor: pointer; }
.vers button:disabled { opacity: .35; }
.vers span { min-width: 3.2em; text-align: center; }
.round { border-radius: 999px; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 0 2px; }
.more { position: absolute; top: 8px; right: 8px; }
.cannot { margin: 6px 0 0; font-size: 14px; color: var(--err); text-wrap: pretty; }
.more:disabled { opacity: .45; }
.menu { position: absolute; top: 58px; right: 8px; z-index: 6; min-width: 220px; border-radius: 16px; padding: 6px;
  display: grid; animation: pop 160ms ease-out; }
.menu a, .menu button { display: block; text-align: left; border: 0; background: none; color: inherit; font: inherit;
  text-decoration: none; padding: 12px 12px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.menu a:active, .menu button:active { background: var(--glass-line); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.said { display: grid; gap: 2px; }
.said p { margin: 0; text-wrap: pretty; }
.you { color: var(--soft); font-size: 13px; overflow-wrap: anywhere; }
.now { font-size: 15px; }
.pending { gap: 6px; animation: pop 180ms ease-out; }
.pending .you { font-size: 13px; }
.und { text-wrap: pretty; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 4px;
  padding: 10px 8px 8px 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--lift); }
.composer label { grid-column: 1 / -1; }
.composer textarea { align-self: center; }
.composer:focus-within { border-color: var(--accent); }
.composer label { font-size: 13px; color: var(--soft); }
.composer textarea { border: 0; padding: 0; background: none; border-radius: 0; resize: none; min-height: 66px;
  font-size: 16px; line-height: 22px; overflow-y: auto; }
.composer textarea:focus { outline: none; }
.cbar { display: grid; justify-items: center; gap: 4px; align-self: end; }
.count { color: var(--soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.send { width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg);
  font-size: 22px; font-weight: 700; cursor: pointer; display: grid; place-items: center; }
.send:disabled { opacity: .4; cursor: default; }
.send.reading { color: transparent; position: relative; }
.send.reading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--bg); border-top-color: transparent; animation: spin .8s linear infinite; }

/* the strip's boxes: one button for all, a badge per frame */
.boxes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.boxes .primary.small { margin: 0; }
.boxes .hint { text-wrap: pretty; }
.bx { position: absolute; left: 6px; bottom: 6px; font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 3px 8px; background: rgba(0, 0, 0, .55); color: #fff; -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px); }
.bx.approved { background: rgba(31, 122, 61, .85); }
.bx.ready { background: rgba(232, 89, 12, .85); }
.bx.failed { background: var(--err); }
.bx.writing, .bx.rendering { background: rgba(232, 89, 12, .92); animation: breathe 1.6s ease-in-out infinite; }
.bx.queued { background: rgba(0, 0, 0, .4); font-weight: 500; }
.boxbar { flex-basis: 100%; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.boxbar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent);
  transition: width .6s ease-out; }
#boxsay { font-variant-numeric: tabular-nums; }
/* the audit row and the composer holding the box's words */
.audit .primary, .audit .second { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
.audit .second { flex: 0 0 auto; }
.oked { margin: 0; font-size: 14px; font-weight: 600; color: #1f7a3d; }
:root[data-theme="dark"] .oked { color: #5fd38a; }
.warn { margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; text-wrap: pretty;
  background: rgba(232, 89, 12, .12); border: 1px solid rgba(232, 89, 12, .45); }
.fixcard .path { font-weight: 600; }
.fixform .hint { font-size: 12px; }

/* the strip's frame popup once its shot has made something: the latest result first, the storyboard tools folded */
.vlabel { position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; pointer-events: none;
  font-variant-numeric: tabular-nums; }
#vlatest video, #vlatest img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
#openshot { width: 100%; margin-top: 12px; }
#addafter, #sh-addafter, #delframe { width: 100%; margin-top: 12px; min-height: 48px; }
.danger { color: #c0392b; }
#addsheet { z-index: 30; }                         /* above the frame screen it opens from */
.addbox h2 { margin: 4px 0 0; font-size: 20px; }
.bigbox { min-height: 120px; font-size: 17px; border: 2px solid var(--accent); padding: 12px; }
.vtools > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center;
  justify-content: center; margin-top: 8px; color: var(--soft); font-size: 15px; border-radius: 12px; }
.vtools > summary::-webkit-details-marker { display: none; }
.vtools > summary:hover { background: var(--card); }
.vtools[open] > summary:not([hidden]) { margin-bottom: 8px; }
/* a <details> is not a grid: its body is, so the popup keeps one column with even gaps and full-width buttons */
.vtbody { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.fix input { flex: 1; min-width: 0; min-height: 46px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); padding: 12px 14px; }
.fix input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.bx.video, .bx.picture { background: rgba(31, 122, 61, .85); }
.send.labelled { width: auto; padding: 0 16px; font-size: 15px; white-space: nowrap; }
.held { opacity: .45; }
.holdnote { margin: 0; text-wrap: pretty; }

/* while something is made: the step doing it glows, a light runs along its top, its picture shimmers and its
   heading says what is happening; the other steps rest dimmed; every text box is read-only */
.step { position: relative; overflow: hidden; transition-property: border-color, box-shadow, opacity;
  transition-duration: .25s; transition-timing-function: ease-out; }
.step.working { border-color: var(--accent); animation: breathe 2.4s ease-in-out infinite; }
.step.working::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat;
  background-size: 40% 100%; animation: runlight 1.6s ease-in-out infinite; }
.step.resting { opacity: .55; }
.step.working .vid { position: relative; }
.step.working .vid::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; animation: sheen 2s linear infinite; }
.busytag { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 2px 9px 2px 7px;
  border-radius: 999px; font-size: 12px; font-weight: 600; vertical-align: 2px; color: var(--accent-ink);
  background: var(--accent); }
.busytag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: blink 1.2s ease-in-out infinite; }
textarea[readonly] { opacity: .6; cursor: not-allowed; }
@keyframes breathe { 50% { box-shadow: 0 0 0 4px rgba(232, 89, 12, .16), 0 8px 24px rgba(232, 89, 12, .14); } }
@keyframes runlight { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes blink { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .step.working, .step.working::before, .step.working .vid::after, .busytag::before { animation: none; }
}

/* the shot page as steps: a bar of three, one step open, the rest folded to a line with a thumbnail */
.shotnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 520px;
  margin: 0 0 6px; }
.shotnav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; color: var(--accent);
  font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.shotnav a.off { visibility: hidden; }
.shotnav.bottom { margin: 4px 0 24px; padding-top: 6px; border-top: 1px solid var(--line); }
.shotnav .sback { color: var(--soft); font-weight: 500; }
#sh-n { font-variant-numeric: tabular-nums; }
.stepsbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 520px; margin: 8px 0 12px; }
.stepsbar button { min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--soft); font-size: 14px; font-weight: 600; cursor: pointer; transition-property: background-color,
  color, border-color, transform; transition-duration: .15s; transition-timing-function: ease-out; }
.stepsbar button:active { transform: scale(.96); }
.stepsbar button.done { color: #1f7a3d; border-color: rgba(31, 122, 61, .45); }
.stepsbar button.done::after { content: " ✓"; }
.stepsbar button.now { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepsbar button.off { opacity: .45; cursor: default; }
:root[data-theme="dark"] .stepsbar button.done { color: #5fd38a; }
.step.folded { gap: 6px; padding-bottom: 8px; }
.step.folded > :not(h2):not(.foldrow) { display: none !important; }
.step.folded.resting { opacity: .55; }
.step h2 { cursor: default; }
.foldrow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 4px; border: 0;
  border-radius: 10px; background: transparent; color: var(--soft); font-size: 14px; text-align: left; cursor: pointer;
  transition-property: background-color; transition-duration: .15s; }
.foldrow:hover:not(:disabled) { background: var(--bg); }
.foldrow:disabled { cursor: default; opacity: .7; }
.foldrow .foldsay { flex: 1; text-wrap: pretty; }
.foldrow .chev { font-size: 22px; line-height: 1; }
.foldrow:disabled .chev { visibility: hidden; }
.thumb { width: 40px; height: 56px; flex: none; object-fit: cover; border-radius: 6px; background: #000;
  outline: 1px solid rgba(0, 0, 0, .1); outline-offset: -1px; }
.step.locked .foldrow { opacity: .8; }

/* continuity with the shot before */
.cont { margin: 0; font-size: 14px; color: var(--soft); text-wrap: pretty; }
.contbtn { display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px 12px 6px 6px; min-height: 64px; }
.contbtn span { display: grid; gap: 2px; }
.contbtn small { color: var(--soft); font-weight: 400; font-size: 12px; }

/* home: what to type, examples to try; the project keeps the idea that started it */
.howto { font-size: 15px; line-height: 1.45; text-wrap: pretty; }
.tries { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tries::-webkit-scrollbar { display: none; }
.tries button { flex: 0 0 auto; max-width: 260px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; text-align: left;
  line-height: 1.35; cursor: pointer; transition-property: transform, border-color; transition-duration: .15s; }
.tries button:active { transform: scale(.96); }
.seed { margin: 0 0 6px; font-size: 14px; color: var(--soft); }
.seed summary { cursor: pointer; list-style: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-wrap: pretty; }
.seed summary::-webkit-details-marker { display: none; }
.seed summary span { font-weight: 600; }
.seed[open] summary q { display: none; }
.seed p { margin: 2px 0 0; white-space: pre-wrap; }
.seedline { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--soft); font-size: 13px; font-style: normal; }
.fixcard .tells { margin: 0; font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--bg);
  border: 1px dashed var(--line); text-wrap: pretty; }
.linkbtn { justify-self: center; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--accent);
  font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:disabled { opacity: .45; cursor: default; }

/* ⓘ on each version / take: what you asked, what changed, the words or prompt it was made from */
.info { position: absolute; top: 8px; left: 8px; font-size: 20px; z-index: 2; }
#sh-firstbox, #sh-videobox { position: relative; }
#sh-firstbox .info, #sh-videobox .info { left: auto; right: 8px; }
.swipe, .stage { touch-action: pan-y; }             /* sideways swipe = the next / last version, up-down still scrolls */
.useone { width: 100%; margin-top: 8px; }
.vtag { color: var(--ok, #2f8f46); font-weight: 600; }
#infosheet { z-index: 30; }
#infosheet .vbox { max-height: 86vh; overflow-y: auto; }
#infobody h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); margin: 14px 0 4px; }
#infobody p { margin: 0; white-space: pre-wrap; }
#infobody .sheetpic { display: block; width: 100%; border-radius: 12px; }
#infobody .pre { font-size: 14px; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
#infobody del { color: #c92a2a; background: #fde8e8; border-radius: 4px; }
#infobody ins { color: #1f7a3a; background: #e3f6e8; text-decoration: none; font-weight: 600; border-radius: 4px; }
#infosheet .row { position: sticky; bottom: -1px; background: var(--bg); padding: 10px 0 2px; margin-top: 10px; }
.endrow { display: grid; gap: 6px; }
.endrow .vid { width: 62%; justify-self: center; }

/* move library (#moves) */
.movesln { display: flex; align-items: center; gap: 8px; min-height: 52px; margin-top: 22px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: inherit; text-decoration: none; font-weight: 600; }
.movesln small { color: var(--soft); font-weight: 400; flex: 1; }
#moves h2 { font-size: 18px; margin: 26px 0 8px; }
.mvnew { display: grid; gap: 14px; margin-top: 16px; }
.mvcard, .mvrule { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mvcard img, .mvrule img { display: block; width: 100%; height: auto; }
.mvcard p, .mvrule figcaption { margin: 0; padding: 10px 14px; font-size: 14px; line-height: 1.4; }
.mvrule { margin-top: 14px; }
.mvbodies { display: grid; gap: 10px; }
.mvbody { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; }
.mvbody summary { min-height: 48px; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.mvbody summary small { color: var(--soft); font-weight: 400; flex: 1; }
.mvlist { display: grid; gap: 12px; padding-bottom: 14px; }
.mvrow { margin: 0; }
.mvrow img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.mvrow figcaption { font-size: 14px; padding-top: 4px; }
.mvrow.own b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tag { display: inline-block; font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg, transparent); }
.tag.own { border-color: currentColor; font-weight: 600; }
.mvadd { padding-left: 18px; margin: 0; display: grid; gap: 8px; font-size: 14px; line-height: 1.4; }
.mvsrc { margin-top: 22px; font-size: 12px; }

.vnum { display: inline-block; max-width: calc(100% - 60px); margin: 4px 0 8px; font-weight: 600; font-size: 15px; }
.vnum small { font-weight: 400; color: var(--soft); }
.pair { margin: 10px 0; }
.pairrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pairrow figure { position: relative; margin: 0; border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: var(--card, #0000); }
.pairrow figure.inuse { border-color: var(--accent, #3b82f6); }
.pairrow video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; background: #000; }
.pairrow figcaption { padding: 6px; font-size: 13px; line-height: 1.3; }
.pairrow figcaption b { display: block; }
.pairrow button { width: 100%; margin-top: 6px; min-height: 44px; }

.film { margin: 12px 0; display: grid; gap: 10px; }
.fcheck { border-radius: 12px; padding: 10px 12px; background: rgba(245, 158, 11, .12); }
.fcheck.ok { background: rgba(34, 197, 94, .12); }
.fchead { margin: 0; font-weight: 600; }
.fcheck ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fcheck li { font-size: 14px; line-height: 1.35; display: grid; gap: 6px; }
.fcheck li button { justify-self: start; min-height: 40px; }
#filmvid { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.pairrow figure .info { position: absolute; top: 6px; right: 6px; }
.filmall { display: grid; gap: 8px; justify-items: start; }
.filmall button { min-height: 44px; }

/* test log (#tests) */
.tlsum { font-weight: 600; }
.tlentry { margin: 16px 0; padding: 14px 16px; border-radius: 14px; background: var(--card, #fff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tlentry.bad { border-left: 4px solid #d9822b; }
.tlentry h2 { margin: 2px 0 6px; font-size: 1.05rem; }
.tlentry ul { margin: 6px 0; padding-left: 20px; }
.tlentry li { margin: 3px 0; }
.tlres { margin: 4px 0; font-weight: 600; }
.tlwhen, .tlmeta { margin: 0; font-size: .85rem; }
.tlpics figure { margin: 10px 0; }
.tlpics img { display: block; width: 100%; height: auto; border-radius: 10px; }
.tlpics figcaption { font-size: .85rem; color: var(--soft); margin-top: 4px; }

/* models page (#models) */
.mdfind { display: flex; gap: 8px; margin: 8px 0; }
.mdfind input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #ccc; font-size: 16px; }
.mdfind select { flex: 0 0 auto; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--line, #c9ced4); font-size: 16px; background: var(--card, #fff); color: var(--ink, #1d1b19); }
.mdgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.mdcard { background: var(--card, #fff); border-radius: 12px; padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); min-width: 0; }
.mdpic { aspect-ratio: 4 / 3; border-radius: 8px; background: #eef0f2; display: flex; align-items: center;
  justify-content: center; font-size: 2rem; overflow: hidden; }
.mdpic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mdcard h3 { margin: 6px 0 2px; font-size: .95rem; text-transform: capitalize; overflow-wrap: anywhere; }
.mdlines p { margin: 2px 0; font-size: .78rem; color: var(--soft, #555); overflow-wrap: anywhere; }
.mdbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0; font-size: .85rem; }
.mdget { padding: 6px 8px; border-radius: 8px; font-size: .8rem; }
.mdfilter { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid #ccc; font-size: 16px; margin: 6px 0; }
.mdtap { cursor: pointer; }
.mdtap:active { transform: scale(.98); }
.mdview { position: fixed; inset: 0; z-index: 50; background: var(--bg, #f6f7f9); display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); overflow-y: auto; }
.mdview[hidden] { display: none; }
body.mdopen { overflow: hidden; }
.mdvbar { display: flex; align-items: center; gap: 10px; }
.mdvbar h2 { margin: 0; text-transform: capitalize; }
.mdvbar button { width: 40px; height: 40px; border-radius: 20px; font-size: 1.1rem; flex: none; }
#md-3d { width: 100%; height: min(55vh, 460px); flex: none; background: #e9ecef; border-radius: 14px; margin: 10px 0 4px; }
.mdvhint { text-align: center; margin: 2px 0 8px; }
.mdchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.mdchips button { padding: 9px 12px; border-radius: 18px; border: 1px solid var(--line, #c9ced4); background: var(--card, #fff);
  color: var(--ink, #1d1b19); font-size: .9rem; }
.mdchips button.on { background: #2b6cb0; color: #fff; border-color: #2b6cb0; }
.animals { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: #fff7e6; border: 1px solid #f0d9a8; }
.animals p { margin: 4px 0; }
.animalrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mdshare { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.mdshare p { flex-basis: 100%; margin: 4px 0 0; }
.mdgive { padding: 8px 12px; border-radius: 18px; border: 1px dashed #4a8fd9; background: var(--card, #fff); color: #4a8fd9; font-size: .88rem; }
.mdasks p { margin: 3px 0; font-size: .85rem; color: var(--soft, #555); }
.mdtest video { width: 100%; max-height: 50vh; border-radius: 12px; background: #000; display: block; }
.mdloading { text-align: center; margin: -44px 0 24px; position: relative; color: var(--soft, #555); font-size: .9rem; }
.mdretry { color: var(--accent, #e8590c) !important; font-weight: 600; }
.mdview .mdfind button, .mdfind button { color: var(--ink, #1d1b19); background: var(--card, #fff); border: 1px solid var(--line, #c9ced4); border-radius: 10px; padding: 0 14px; }
:root[data-theme="dark"] .animals { background: rgba(255, 170, 60, .10); border-color: rgba(255, 170, 60, .35); }
#md-3d.mdwait { visibility: hidden; }

/* ☑ marking frames to redraw: a tick on each marked one */
#strip.marking .frame .pic { outline: 2px dashed rgba(232, 89, 12, .5); outline-offset: -2px; }
#strip.marking .frame.marked .pic { outline: 3px solid var(--accent, #e8590c); }
#strip.marking .frame.marked .pic::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  border-radius: 50%; background: var(--accent, #e8590c); color: #fff; font-weight: 700; display: grid; place-items: center; }
#md-mk, .mdstack { flex-wrap: wrap; }                      /* Meshy / your file: each field on its own line */
#md-mk input, .mdstack input { flex: 1 1 100%; padding: 12px; }
#md-mk button, .mdstack button { flex: 1 1 auto; padding: 12px 14px; font-size: 16px; }
.mdmkfull:not([hidden]) { flex: 1 1 100%; display: flex; flex-direction: column; gap: 4px; }
.mdmkfull label { font-size: 14px; color: var(--muted, #6b655e); }
.mdmkfull textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #c9ced4); background: var(--card, #fff); color: var(--ink, #1d1b19); }

/* the box's floor plan from above, under the box video */
.map { margin: 10px 0 0; }
.map img { display: block; width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: 12px; background: #3f4a3a; }
.map figcaption { margin-top: 4px; }
/* the story-logic table: who can / cannot do what, and the model that draws each one (phone width: it scrolls) */
#logic { overflow-x: auto; }
.logic { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.logic th, .logic td { text-align: left; vertical-align: top; padding: 4px 6px; border-top: 1px solid rgba(0,0,0,.08); }
.logic th { font-weight: 600; color: var(--soft); }

/* the box in words (read only) above the correction box; @ names under the label */
.wordsbox { margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--card); }
.wordsbox summary { cursor: pointer; color: var(--soft); font-size: 14px; }
.wordsbox p { white-space: pre-wrap; margin: 8px 0; font-size: 14px; line-height: 1.45; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; }
.atlist { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.atname { border: 1px solid var(--accent); color: var(--accent); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 14px; min-height: 36px; cursor: pointer; }

/* the story map (map.js): the place from above at true size, a 1 m grid */
.smap { margin: 8px 0 12px; }
.smap summary { cursor: pointer; font-weight: 600; }
.smap summary b { font-weight: 400; color: var(--muted, #777); }
.sm-wrap { margin-top: 6px; }
.sm-svg { display: block; width: 100%; height: min(70vh, 620px); border-radius: 10px; overflow: hidden;
          border: 1px solid #0002; user-select: none; -webkit-user-select: none; touch-action: none; }
.sm-zoom { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }   /* under the map: never over a thing */
.sm-zoom button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #0003; background: #fffe;
                  font-size: 22px; line-height: 1; color: #222; }
.sm-svg.editing .sm-item { cursor: grab; }
.sm-ground { fill: #e9efd9; }
.sm-g1 { stroke: #0000001a; stroke-width: 0.02; }
.sm-g5 { stroke: #00000040; stroke-width: 0.05; }
.sm-item.sel > :first-child { stroke: #ff3b30; stroke-width: 0.12; }
.sm-lab { fill: #222; paint-order: stroke; stroke: #fffc; stroke-width: 0.12; pointer-events: none; }
.sm-lab.dim { fill: #666; }
.sm-read { min-height: 1.4em; margin: 6px 0; font-size: 0.95em; }
.sm-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sm-tab { border: 1px solid #0003; background: none; border-radius: 14px; padding: 3px 10px; }
.sm-tab.on { background: #222; color: #fff; }
.sm-tools, .sm-acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.sm-say { display: flex; gap: 6px; margin: 6px 0; }
.sm-say input { flex: 1; min-width: 0; }
#tale { width: 100%; margin: 4px 0 8px; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--line, #c9ced4);
        font-size: 16px; background: var(--card, #fff); color: var(--ink, #1d1b19); }
.pick { margin: 8px 0 16px; }
.pk-role h3 { margin: 12px 0 2px; font-size: 17px; text-transform: capitalize; }
.pk-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pk-card { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 12px; text-align: left;
           border: 2px solid var(--line, #c9ced4); background: var(--card, #fff); color: var(--ink, #1d1b19); min-width: 0; }
.pk-card.on { border-color: #e07a1f; box-shadow: 0 0 0 2px #e07a1f55; }
.pk-card img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: #eee; }
.pk-card b { font-size: 13px; line-height: 1.2; }
.pk-card small { font-size: 11.5px; line-height: 1.25; overflow-wrap: anywhere; }
.pk-model, .pk-score { opacity: .8; }
#pk-go { width: 100%; margin-top: 12px; }
.shplan { margin: 6px 0 10px; }
.shplan summary { cursor: pointer; font-weight: 600; }
.pair2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.pair2 img { width: 100%; border-radius: 10px; aspect-ratio: 9 / 16; object-fit: cover; }
.sh-place { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; border: 1px solid #0002; }

.archived { margin-top: 12px; }
.archived > summary { cursor: pointer; padding: 10px 2px; color: var(--muted, #777); }
.archive { display: block; margin: 24px auto 8px; }

.sm-checks { margin: 8px 0; padding: 8px 12px; list-style: none; border-radius: 10px;
  background: color-mix(in srgb, #e8a33a 18%, transparent); font-size: 14px; }
.sm-checks li + li { margin-top: 4px; }
.sm-list { margin: 8px 0 12px; padding: 0; list-style: none; font-size: 14px; }
.sm-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 4px; min-height: 36px;
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent); cursor: pointer; }
.sm-list li span { opacity: .75; }
.sm-list li.sel { background: color-mix(in srgb, #ff7a2f 14%, transparent); }
.sm-list li button { margin-left: auto; }
.mdchar { margin-top: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--accent, #e8590c); background: transparent; color: var(--accent, #e8590c); font-weight: 600; }
.mdchk { display: flex; gap: 8px; align-items: center; font-size: 0.95rem; margin: 6px 0; }

/* the proxy film: the whole film in plain shapes, a comment box under every scene's number */
.proxy video, .paint video { display: block; width: min(100%, 300px); aspect-ratio: 9 / 16; margin: 8px auto; border-radius: 12px; background: #000; }
.px-scenes { display: grid; gap: 10px; margin: 10px 0; }
.px-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
.px-row img, .px-all { width: 64px; aspect-ratio: 9 / 16; border-radius: 8px; object-fit: cover; background: var(--line, #ddd); }
.px-all { display: grid; place-items: center; font-size: 24px; aspect-ratio: 1; }
.px-row textarea { width: 100%; min-height: 44px; margin-top: 4px; padding: 10px; border: 1px solid var(--line, #ccc); border-radius: 10px;
  background: transparent; resize: none; font-size: 16px; }
.px-row textarea:disabled { opacity: .6; }
.px-row img { cursor: pointer; }
.px-pop { border: 0; border-radius: 14px; padding: 12px; max-width: min(92vw, 420px); text-align: center; }
.px-pop::backdrop { background: rgba(0, 0, 0, .6); }
.px-pop video, .px-pop img { display: block; width: 100%; max-height: 70vh; margin: 8px 0; border-radius: 10px; background: #000; }
.px-pop button { min-height: 44px; padding: 0 18px; }
.px-under ul { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; }
.px-under li { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line, #ccc); }
.px-under li p { margin: 4px 0 0; text-wrap: pretty; }
.px-unsure { color: var(--warn, #b45309); }
.px-said { margin: 4px 0 0; padding-left: 8px; border-left: 3px solid var(--line, #ccc); font-size: 13px; opacity: .8; text-wrap: pretty; }
#px-say.err, #pt-say.err { color: var(--err); }

/* paint & clips (step 4): the proxy film's scenes painted, then filmed; it takes the place of the older box way */
.paint h3 { margin: 6px 0; font-size: 1rem; }
.paint .small { min-height: 44px; }
.px-row img.pt-todo { opacity: .45; cursor: default; }
.px-pop [hidden] { display: none; }
#project[data-step="4"][data-paint] > :is(#animals, #scenery, #boxes, #film, #strip, #step4say, #retry) { display: none !important; }
#project[data-step="4"][data-vf] > :is(#animals, #scenery, #boxes, #film, #strip, #step4say, #retry, #paint) { display: none !important; }
.pv-speed { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; }
.pv-speed label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
#vf-music { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 6px 0; cursor: pointer; }

/* the film's steps (user 11-12): one step on screen at a time - story, map, proxy film, paint & clips */
.steps { display: flex; gap: 6px; margin: 4px 0 10px; }
.steps button { flex: 1; min-height: 44px; padding: 4px 2px; border-radius: 10px; border: 1px solid var(--line, #e6d9c6);
  background: transparent; color: inherit; font: inherit; font-size: 12px; line-height: 1.2; cursor: pointer; opacity: .6; }
.steps button i { display: block; font-style: normal; font-weight: 700; font-size: 14px; }
.steps button.done i::after { content: " ✓"; }
.steps button.on { opacity: 1; border-color: var(--accent, #e8590c); border-width: 2px; font-weight: 600; }
#project[data-step="1"] > [data-s]:not([data-s~="1"]), #project[data-step="2"] > [data-s]:not([data-s~="2"]),
#project[data-step="3"] > [data-s]:not([data-s~="3"]), #project[data-step="4"] > [data-s]:not([data-s~="4"]) { display: none !important; }
#project[data-step="1"] .frame .bx { display: none; }
#project[data-step="2"] > #smap > summary, #project[data-step="3"] > #proxy > summary { pointer-events: none; list-style: none; }
