:root {
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #161412;
  --ink-2: #3a3631;
  --muted: #6f685d;
  --line: #d8d0bf;
  --rule: #e8e1d2;
  --red: #c8331d;
  --red-dark: #a3260f;
  --ok: #2f6b3a;
  --sel: #c8331d;
  --cond: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --bin-h: 128px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; overflow-x: hidden; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  padding: calc(8px + var(--safe-t)) 10px 8px;
  display: flex; align-items: center; gap: 8px; min-height: 52px;
}
.topbar h1 { margin: 0; flex: 1; min-width: 0; font-family: var(--cond); font-weight: 700; font-size: 20px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 button { background: none; border: 0; padding: 4px 0; text-align: left; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: inherit; color: inherit; }
.topbar-center { position: relative; }
.topbar-center h1 { position: absolute; left: 0; right: 0; top: calc(8px + var(--safe-t)); bottom: 8px; display: flex; align-items: center; justify-content: center; padding: 0 96px; pointer-events: none; }
.topbar-center .sp { flex: 1; }
.topbar-center h1 { padding: 0 56px; }
/* board: the storyboard name is always centered. Phones: its own centered line under the buttons. Wider screens: centered in the bar. */
.topbar-board { flex-wrap: wrap; row-gap: 2px; position: relative; }
.topbar-board .sp { flex: 1; }
.topbar-board h1 { order: 10; flex: 0 0 100%; text-align: center; font-size: 19px; }
.topbar-board h1 button { text-align: center; padding: 0 4px 2px; }
@media (min-width: 600px) {
  .topbar-board h1 { position: absolute; left: 0; right: 0; top: calc(8px + var(--safe-t)); bottom: 8px; display: flex; align-items: center; justify-content: center; padding: 0 190px; pointer-events: none; }
  .topbar-board h1 button { pointer-events: auto; }
}
.lede .cr { font-family: var(--sans); font-size: 18px; font-weight: 700; margin-left: 3px; position: relative; top: -12px; }
.lede .ver { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: none; color: var(--muted); margin-left: 6px; white-space: nowrap; vertical-align: middle; }
.slate { height: 7px; background: repeating-linear-gradient(-45deg, var(--ink) 0 12px, #fff 12px 24px); border-bottom: 1px solid var(--ink); }
.tb-btn { background: transparent; border: 1.5px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; height: 36px; min-width: 36px; padding: 0 10px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tb-btn.icon { padding: 0; justify-content: center; border-color: transparent; font-size: 20px; }
.tb-btn.red { background: var(--red); border-color: var(--red); }
.chip-ratio { font-family: var(--mono); font-size: 13px; }

/* ---------- buttons ---------- */
.btn { border: 1.5px solid var(--ink); background: var(--card); border-radius: 10px; min-height: 44px; padding: 0 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { border-color: var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }

/* ---------- home ---------- */
.home { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(40px + var(--safe-b)); }
.home .lede { font-family: var(--cond); font-size: 30px; font-weight: 700; line-height: 1.05; margin: 6px 0 4px; text-transform: uppercase; letter-spacing: .01em; }
.home .sub { color: var(--ink-2); font-weight: 700; margin: 0 0 16px; }
.hero-stack { position: relative; margin: 8px 6px 38px 4px; }
.hero-stack::before, .hero-stack::after { content: ''; position: absolute; inset: 0; border: 1.5px solid var(--ink); border-radius: 1px; pointer-events: none; }
/* bottom sheet: faint storyboard panels showing through */
.hero-stack::before { background-color: #f7f3ea; transform: rotate(-2.4deg) translate(-3px, 9px); box-shadow: 3px 4px 0 rgba(22,20,18,.18);
  background-image: linear-gradient(90deg, transparent 32.6%, #e2dacb 32.6%, #e2dacb 33.4%, transparent 33.4%, transparent 66%, #e2dacb 66%, #e2dacb 66.8%, transparent 66.8%),
                    linear-gradient(transparent 49.5%, #e2dacb 49.5%, #e2dacb 50.5%, transparent 50.5%); }
/* middle sheet */
.hero-stack::after { background: #fdfbf7; transform: rotate(1.7deg) translate(5px, 5px); box-shadow: 2px 3px 0 rgba(22,20,18,.14); }
.hero { position: relative; z-index: 1; margin: 0; background: #fff; border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 6px; }
.hero-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.hero img { display: block; width: 100%; height: auto; }
.hero figcaption { font-size: 13px; color: var(--muted); padding: 8px 4px 2px; line-height: 1.4; }
.hero .tap { color: var(--ink); font-weight: 600; }
@media (min-width: 900px) { .hero .tap { display: none; } }
.hero-view .hero-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; align-items: center; padding: 12px; touch-action: pan-x pan-y pinch-zoom; }
.hero-view .hero-scroll img { display: block; margin: auto; width: max(100%, 1000px); max-width: 1303px; height: auto; background: #fff; }
.home-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 22px; }
.section-label { font-family: var(--cond); text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; }
.proj-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.proj { background: var(--card); border: 1.5px solid var(--ink); border-radius: 4px; display: flex; gap: 12px; padding: 10px; align-items: center; position: relative; box-shadow: 3px 3px 0 var(--ink); }
.proj-open { all: unset; cursor: pointer; display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.proj-thumb { width: 92px; flex: none; border: 1.5px solid var(--ink); background: var(--rule); overflow: hidden; position: relative; }
.proj-thumb img { position: absolute; }
.proj-meta { min-width: 0; }
.proj-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-info { font-size: 13px; color: var(--muted); margin-top: 2px; }
.proj-more { background: none; border: 0; font-size: 22px; width: 40px; height: 40px; flex: none; }
.empty-state { border: 2px dashed var(--line); border-radius: 6px; padding: 26px 16px; text-align: center; color: var(--muted); }
.hint { background: #fff8e6; border: 1.5px solid #e6cf8e; border-radius: 8px; padding: 12px 14px; font-size: 14px; margin-top: 22px; position: relative; }
.hint .ht { display: block; margin-bottom: 4px; font-weight: 700; }
.hint .x { position: absolute; right: 6px; top: 4px; background: none; border: 0; font-size: 20px; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
.foot button { background: none; border: 0; color: var(--ink); text-decoration: underline; font-size: 13px; }

/* ---------- board ---------- */
.board { padding: 14px 12px calc(var(--bin-h) + 90px + var(--safe-b)); max-width: 1180px; margin: 0 auto; }
.board-head { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); padding: 0 2px 12px; }
.board-head b { color: var(--ink); font-weight: 600; }
.panels { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1050px) { .panels { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.panel { background: var(--card); border: 1.5px solid var(--ink); border-radius: 3px; padding: 10px 10px 12px; box-shadow: 3px 3px 0 var(--ink); min-width: 0; }
.panel.flash { animation: flash 1s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--red); } 100% { box-shadow: 3px 3px 0 var(--ink); } }
.p-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.shotno { font-family: var(--mono); font-weight: 700; font-size: 14px; background: var(--ink); color: #fff; padding: 3px 8px; letter-spacing: .06em; border-radius: 2px; }
.p-head .sp { flex: 1; }
.icon-btn { background: none; border: 1.5px solid transparent; width: 38px; height: 38px; border-radius: 8px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.icon-btn:active { background: var(--rule); }
.icon-btn:disabled { opacity: .25; }

.frame { position: relative; overflow: hidden; background: #e9e4d8; border: 2px solid var(--ink); margin: 0 auto; width: 100%; cursor: pointer; touch-action: manipulation; }
.frame img { position: absolute; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.frame .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px); background-size: 33.333% 33.333%; background-position: -1px -1px; }
.frame .empty .plus { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--muted); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 400; background: var(--card); }
.frame.placing { outline: 3px dashed var(--red); outline-offset: 3px; }
.stamp { position: absolute; left: 0; top: 0; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 6px; letter-spacing: .04em; pointer-events: none; }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.enlarge { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border-radius: 8px; border: 0; background: rgba(22,20,18,.7); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; }

/* shot assistant */
.assist { margin-top: 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #faf7f0; }
.assist-title { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); border-bottom: 1.5px solid var(--line); }
.assist-body { padding: 10px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld label, .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.info { border: 0; background: none; color: var(--muted); font-size: 15px; padding: 0 2px; line-height: 1; }
.fld select, .fld input, .fld textarea, .notes textarea, .notes input, .notes select, .sheet input, .sheet select {
  width: 100%; min-height: 42px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 10px; appearance: none; -webkit-appearance: none;
}
.fld select, .notes select, .sheet select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.tipline { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); background: #fff; border-left: 3px solid var(--red); padding: 6px 8px; border-radius: 0 6px 6px 0; }
.commit { grid-column: 1 / -1; }
.assist-done { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.assist-done .sum { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.assist-done .check { color: var(--ok); font-weight: 800; }

.notes { margin-top: 10px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.notes .fld.wide textarea { min-height: 64px; resize: vertical; line-height: 1.4;
  background-image: repeating-linear-gradient(transparent 0 25px, var(--rule) 25px 26px); background-attachment: local; background-position: 0 8px; }

.add-panel { margin-top: 18px; width: 100%; min-height: 64px; border: 2px dashed var(--ink-2); background: transparent; border-radius: 4px; font-weight: 700; font-size: 16px; color: var(--ink-2); }

/* ---------- photo bin ---------- */
.bin { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--ink); color: #fff; padding: 8px 10px calc(10px + var(--safe-b)); box-shadow: 0 -4px 18px rgba(0,0,0,.18); }
.bin-head { display: flex; align-items: center; gap: 8px; }
.bin-head .t { font-family: var(--cond); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; white-space: nowrap; margin-right: 2px; }
.bin-head .sp { flex: 1; }
.tb-btn.maize { color: #FBEC5D; border-color: rgba(251,236,93,.55); }
.bin-strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 2px; scroll-snap-type: x proximity; min-height: 76px; }
.bin-strip::-webkit-scrollbar { height: 0; }
.bin-item { flex: none; width: 92px; height: 66px; border: 2px solid #4a453f; border-radius: 4px; background: #2a2724 center/cover no-repeat; position: relative; scroll-snap-align: start; padding: 0; }
.bin-item.sel { border-color: var(--red); box-shadow: 0 0 0 3px var(--red); }
.bin-item .used { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.75); color: #fff; font-family: var(--mono); font-size: 10px; padding: 1px 4px; border-radius: 3px; }
.bin-empty { color: #b5ada0; font-size: 14px; padding: 18px 4px; }
.bin.collapsed .bin-strip, .bin.collapsed .placebar { display: none; }
.placebar { display: flex; align-items: center; gap: 8px; background: var(--red); margin: 8px -10px -2px; padding: 8px 10px; font-size: 14px; font-weight: 600; }
.placebar .grow { flex: 1; }
.placebar .btn { min-height: 34px; border-color: #fff; background: transparent; color: #fff; font-size: 13px; padding: 0 10px; }

/* ---------- overlays: sheet + modal ---------- */
#overlay:empty { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(22,20,18,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--paper); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); animation: up .2s ease; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 14px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.grabber { width: 40px; height: 5px; background: var(--line); border-radius: 3px; margin: 2px auto 10px; }
.sheet h2 { font-family: var(--cond); text-transform: uppercase; letter-spacing: .04em; font-size: 22px; margin: 4px 0 12px; }
.req { font-size: 10px; letter-spacing: .06em; color: var(--red-dark); background: #fbe3dd; border-radius: 4px; padding: 1px 6px; text-transform: uppercase; }
.err { color: var(--red-dark); font-size: 13px; font-weight: 600; margin-top: 4px; }
input.bad { border-color: var(--red) !important; outline: 2px solid var(--red); outline-offset: 0; }
.req-note { margin: -4px 0 12px; font-size: 14px; color: var(--ink-2); background: #fff8e6; border: 1.5px solid #e6cf8e; border-radius: 8px; padding: 8px 10px; }
.sheet .row { display: flex; gap: 10px; margin-top: 14px; }
.sheet .row .btn { flex: 1; }
.sheet .form { display: grid; gap: 12px; }
.menu-list { display: grid; gap: 2px; margin: 0 -4px; }
.menu-list button { background: none; border: 0; text-align: left; padding: 13px 8px; border-radius: 8px; font-size: 16px; display: flex; gap: 12px; align-items: center; }
.menu-list button:active { background: var(--rule); }
.menu-list button .ic { width: 24px; text-align: center; }
.menu-list button.danger { color: var(--red-dark); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }

.ratios { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 420px) { .ratios { grid-template-columns: repeat(3, 1fr); } }
.ratio { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ratio .box { height: 54px; width: 70px; display: flex; align-items: center; justify-content: center; }
.ratio .shape { border: 2px solid var(--ink); background: var(--rule); }
.ratio .n { font-family: var(--mono); font-weight: 700; font-size: 13px; }
.ratio .d { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.ratio.on { border-color: var(--red); box-shadow: 0 0 0 2px var(--red); }
.ratio.on .shape { background: #f2c3b9; border-color: var(--red-dark); }
.ratio-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

.guide-list { display: grid; gap: 6px; }
.guide-item { text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.guide-item b { display: block; }
.guide-item span { font-size: 14px; color: var(--ink-2); }
.guide-item.on { border-color: var(--red); }

.bin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.bin-grid button { aspect-ratio: 4/3; border: 2px solid var(--line); border-radius: 6px; background: #ddd center/cover no-repeat; }

.progress { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; background: var(--red); width: 0; transition: width .2s; }

/* ---------- full-screen tools: crop + viewer ---------- */
.full { position: fixed; inset: 0; z-index: 60; background: #0d0c0b; color: #fff; display: flex; flex-direction: column; user-select: none; }
.full-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 8px; }
.full-top .t { flex: 1; font-family: var(--cond); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.full-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 10px; min-height: 42px; min-width: 42px; padding: 0 12px; font-weight: 600; font-size: 15px; }
.full-btn.red { background: var(--red); }
.stage { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; }
.stage .frame { border-color: #fff; cursor: grab; flex: none; background: #222; }
.thirds { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
                    linear-gradient(transparent calc(33.33% - .5px), rgba(255,255,255,.55) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(255,255,255,.55) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.crop-tools { padding: 12px 16px calc(14px + var(--safe-b)); display: grid; gap: 12px; }
.crop-tools .zoomrow { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.crop-tools input[type=range] { flex: 1; accent-color: var(--red); height: 32px; }
.crop-tools .btns { display: flex; gap: 8px; }
.crop-tools .btns .full-btn { flex: 1; }
.crop-help { font-size: 13px; color: #b5ada0; text-align: center; }

.viewer .stage { cursor: default; }
.viewer .vframe { position: relative; overflow: hidden; border: 2px solid #fff; background: #222; transform-origin: center center; will-change: transform; flex: none; }
.viewer .vframe img { position: absolute; max-width: none; pointer-events: none; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; font-size: 28px; z-index: 2; }
.viewer .nav.prev { left: 8px; } .viewer .nav.next { right: 8px; }
.caption { padding: 10px 16px calc(14px + var(--safe-b)); background: #161412; border-top: 1px solid #2f2b27; max-height: 34vh; overflow-y: auto; }
.caption .c-shot { font-family: var(--mono); font-size: 13px; color: #f2c3b9; font-weight: 700; letter-spacing: .04em; }
.caption .c-desc { font-size: 17px; line-height: 1.4; margin-top: 4px; white-space: pre-wrap; }
.caption .c-meta { font-size: 14px; color: #b5ada0; margin-top: 6px; white-space: pre-wrap; }
.viewer.nocap .caption { display: none; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--bin-h) + 26px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; border: 1.5px solid #fff; border-radius: 10px; padding: 10px 14px; font-size: 14px; z-index: 80; opacity: 0; pointer-events: none; transition: .2s; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast.home-pos { bottom: calc(24px + var(--safe-b)); }
#toast button { background: none; border: 0; color: #f6b7a8; font-weight: 800; text-transform: uppercase; font-size: 13px; letter-spacing: .06em; padding: 4px 2px; }

@media print { body { display: none; } }

/* scenes */
.scene-break { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 3px; margin-top: 6px; }
.scene-break .sb-no { font-family: var(--mono); font-weight: 700; font-size: 13px; color: #f6b7a8; letter-spacing: .06em; }
.scene-break .sb-name { flex: 1; font-family: var(--cond); font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-break .btn { color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }
/* purpose */
.notes .purpose textarea { border-color: #c9bfa9; background: #fffdf6; }
.notes .purpose.missing textarea { border-color: var(--red); border-style: dashed; }
.notes .purpose.missing label { color: var(--red-dark); }
.caption .c-scene { font-family: var(--mono); font-size: 12px; color: #b5ada0; letter-spacing: .06em; margin-bottom: 2px; }
.caption .c-why { font-size: 15px; color: #f2e6c9; margin-top: 6px; }

/* sketch pad */
.sketcher .stage { background: #2a2622; }
.sk-wrap { position: relative; flex: none; background: #fff; box-shadow: 0 0 0 2px #fff; touch-action: none; }
.sk-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#skInk { touch-action: none; cursor: crosshair; }
.sk-wrap .thirds { background-image: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(0,0,0,.18) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(0,0,0,.18) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
  linear-gradient(transparent calc(33.33% - .5px), rgba(0,0,0,.18) calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), rgba(0,0,0,.18) calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.sk-tools { padding: 10px 14px calc(12px + var(--safe-b)); display: grid; gap: 10px; }
.sk-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.sk-row .full-btn { flex: 1; max-width: 140px; }
.sk-row .full-btn.on { background: #f3efe6; color: var(--ink); }
.sk-color { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #4a453f; background: var(--c); }
.sk-color.on { border-color: #fff; box-shadow: 0 0 0 3px var(--red); }
.sk-size { width: 42px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; }
.sk-size i { display: block; background: #fff; border-radius: 50%; }
.sk-size.on { box-shadow: 0 0 0 2px #fff; }
.sk-sep { width: 1px; height: 28px; background: #4a453f; margin: 0 4px; }
/* animatic */
.animatic .stage { background: #000; }
.animatic canvas { flex: none; background: #000; }
.an-load { position: absolute; color: #b5ada0; font-size: 15px; }
.an-ctrl { padding: 8px 16px calc(12px + var(--safe-b)); display: grid; gap: 8px; }
.an-ctrl input[type=range] { width: 100%; accent-color: var(--red); height: 28px; }
.an-row { display: flex; gap: 10px; align-items: center; justify-content: center; }
.an-play { min-width: 64px; font-size: 18px; }
.an-time { font-family: var(--mono); font-size: 13px; color: #b5ada0; min-width: 96px; text-align: center; }
.full-btn:disabled { opacity: .4; }
.board-head .anim-btn { margin-left: auto; }
.dur-read { display: block; font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 3px; }
.ios-warn { background: #fff3cd; border: 1.5px solid #d9b44a; border-radius: 8px; padding: 9px 12px; font-size: 14px; line-height: 1.4; margin: 0 0 12px; }
.lockscr { align-items: center; justify-content: center; background: rgba(13,12,11,.94); padding: 20px; }
.lock-box { background: var(--paper, #f3efe6); color: var(--ink); border-radius: 14px; padding: 20px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 10px; }
.lock-box h2 { margin: 0; } .lock-box p { margin: 0 0 6px; color: var(--ink-2); }
.an-ask { position: absolute; inset: 0; background: rgba(0,0,0,.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; z-index: 3; }
.an-ask p { margin: 0; max-width: 340px; font-size: 16px; }
body.typing .bin { display: none; }
body.typing #toast { bottom: calc(16px + var(--safe-b)); }
.frame:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.sheet:focus { outline: none; }
