:root {
  --left-w: 44%;
  --bg: #171717;
  --panel: #1b1b1b;
  --card: #1f1f1f;
  --card2: #252525;
  --field: #262626;
  --line: #2c2c2c;
  --line2: #383838;
  --text: #ececec;
  --muted: #a3a3a3;
  --dim: #737373;
  --brand: #8b5cf6;
  --brand2: #ec4899;
  --ok: #6ee7b7;
  --err: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #c4b5fd; }
svg { flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }  /* dvh: the height Safari really shows */
html { touch-action: manipulation; }  /* no zoom on a double tap (a pinch still zooms) */

/* ---------- buttons & fields ---------- */
.btn {
  height: 30px; padding: 0 12px; border: 1px solid var(--line2); background: #212121; color: var(--text);
  border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: #2a2a2a; border-color: #444; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #262626; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 26px; }
.btn.primary { background: #f2f2f2; color: #111; border-color: #f2f2f2; }
.btn.primary:hover { background: #fff; }
.btn.brand { background: linear-gradient(135deg, var(--brand), #7c3aed); border-color: transparent; color: #fff; }
.btn.brand:hover { filter: brightness(1.1); }
.btn.danger { color: #fca5a5; border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.06); }
.btn.danger:hover { background: rgba(248,113,113,.14); }
.btn.on { background: #333; border-color: #4a4a4a; }

.ctl {
  height: 30px; background: var(--field); border: 1px solid #333; border-radius: 7px; padding: 0 9px;
  font-size: 12.5px; outline: none; min-width: 0; color: var(--text);
}
.ctl:focus, textarea.ctl:focus { border-color: #5b5b5b; }
select.ctl { padding-right: 24px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
textarea.ctl { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.ctl.num { width: 72px; }
.ctl.num.count { width: 136px; }.ctl.full { width: 100%; }
/* a file picker: its button and the chosen file's name centred in the box */
input[type="file"].ctl { height: auto; padding: 7px 10px; line-height: 28px; cursor: pointer; color: var(--muted); }
input[type="file"].ctl::file-selector-button { height: 28px; margin: 0 12px 0 0; padding: 0 14px; border: 1px solid var(--line2); border-radius: 6px; background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; vertical-align: middle; }
input[type="file"].ctl::file-selector-button:hover { border-color: #5b5b5b; }

.seg { display: inline-flex; background: #232323; border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg.wide { display: flex; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 11px; border-radius: 6px; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: #3a3a3a; color: #fff; }

.switch { position: relative; width: 36px; height: 20px; border-radius: 20px; background: #3a3a3a; border: 0; padding: 0; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(16px); }

.chip { border: 1px solid var(--line2); background: #222; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.chip:hover { color: var(--text); border-color: #4a4a4a; }
.chip.on { color: #fff; border-color: var(--brand); background: rgba(139,92,246,.18); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; font-weight: 600; }
.badge.ok { color: var(--ok); border-color: rgba(110,231,183,.35); background: rgba(110,231,183,.06); }
.badge.brand { color: #c4b5fd; border-color: rgba(139,92,246,.45); background: rgba(139,92,246,.1); }

.spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #555; border-top-color: #c4b5fd; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar { height: 48px; display: flex; border-bottom: 1px solid var(--line); background: #151515; flex: none; }
.tb-left { width: var(--left-w); min-width: 380px; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.tb-right { flex: 1; display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 0 12px; min-width: 0; }
.tb-right > .btn { flex: none; margin-left: auto; }
.proj-name { background: none; border: 0; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; max-width: 260px; }
.proj-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-name:hover { background: #232323; }
.tabs { display: flex; gap: 2px; height: 100%; flex: 0 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 13px; padding: 0 10px; flex: none; display: flex; align-items: center; gap: 7px; position: relative; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab .dot { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .7; }
.tab .count { font-size: 10.5px; color: var(--dim); font-weight: 600; }
.tab.on { color: #fff; }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: #fff; border-radius: 2px; }
.tab.on .dot { background: currentColor; }

/* ---------- workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }
.left { width: var(--left-w); min-width: 380px; display: flex; flex-direction: column; background: var(--panel); position: relative; }
.resizer { width: 5px; margin: 0 -2px; cursor: col-resize; z-index: 5; position: relative; }
.resizer::after { content: ""; position: absolute; left: 2px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.resizer:hover::after, .resizer.drag::after { background: var(--brand); width: 2px; }
.right { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #191919; }

.pane-head { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.pane-head .ttl { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pane-head .ttl .sub { color: var(--dim); font-weight: 500; font-size: 12px; }
.cost { color: var(--dim); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }

/* ---------- setup card ---------- */
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 8px; scroll-behavior: auto; }
.setup { border: 1px solid var(--line); border-radius: 14px; background: #1e1e1e; padding: 16px; }
.setup h3 { display: flex; gap: 9px; align-items: center; font-size: 15px; margin: 0 0 12px; }
.label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 14px 0 7px; }
.label:first-of-type { margin-top: 0; }

.basic { display: flex; flex-wrap: wrap; gap: 12px 12px; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: 10.5px; color: var(--dim); font-weight: 600; white-space: nowrap; }
.fld .unit { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11.5px; }
.opt-row { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-top: 14px; background: #1b1b1b; }
.opt-row b { display: block; font-size: 13px; }
.opt-row p { margin: 2px 0 0; font-size: 11.5px; color: var(--dim); line-height: 1.4; }
.more-row { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; padding: 14px 0 4px; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.more-row:hover { color: var(--text); }
.more-row svg { transition: transform .15s; }
.more-row.open svg { transform: rotate(90deg); }
.pos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 8px 0 4px; }
.pos .full { grid-column: 1 / -1; }
.btn-lg { width: 100%; height: 42px; margin-top: 14px; background: #f0f0f0; color: #111; border: 0; border-radius: 10px; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-lg:hover { background: #fff; }
.setup-summary { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 12px; background: #1e1e1e; }
.setup-summary .sw { width: 30px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center; font-size: 16px; }
.setup-summary .txt { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-summary .txt b { color: var(--text); }

/* ---------- chat ---------- */
.msg { margin: 16px 0; display: flex; gap: 10px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: #2b2b2b; border-radius: 14px 14px 4px 14px; padding: 8px 13px; max-width: 86%; white-space: pre-wrap; word-wrap: break-word; }
.msg.user .atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ai-av { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; margin-top: 1px; }
.msg .body { flex: 1; min-width: 0; }
.part-text { word-wrap: break-word; }
.part-text > :first-child { margin-top: 0; }
.part-text > :last-child { margin-bottom: 0; }
.part-text p { margin: 0 0 8px; }
.part-text ul, .part-text ol { margin: 4px 0 8px; padding-left: 20px; }
.part-text li { margin: 2px 0; }
.part-text h4, .part-text h5 { margin: 12px 0 6px; font-size: 13.5px; }
.part-text code { background: #2a2a2a; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.part-text pre { background: #141414; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; }
.part-text pre code { background: none; padding: 0; }
.part-text blockquote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid #444; color: var(--muted); }
.part-think { margin: 4px 0 8px; }
.part-think summary { list-style: none; cursor: pointer; color: var(--dim); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.part-think summary::-webkit-details-marker { display: none; }
.part-think summary:hover { color: var(--muted); }
.part-think .tt { border-left: 2px solid #333; margin: 6px 0 0 5px; padding: 2px 10px; color: var(--dim); font-size: 12px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.part-tool { display: flex; align-items: center; gap: 9px; background: #202020; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; margin: 6px 0; font-size: 12px; }
.part-tool .ic { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: #2a2a2a; color: #c4b5fd; flex: none; }
.part-tool .nm { font-weight: 600; white-space: nowrap; }
.part-tool .sm { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.part-tool.done .ic { color: var(--ok); }
.part-tool.error .ic { color: var(--err); }
.part-status { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 11.5px; margin: 10px 0; }
.part-status::before, .part-status::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.part-error { color: #fecaca; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); border-radius: 9px; padding: 8px 11px; margin: 6px 0; font-size: 12.5px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #666; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-intro { color: var(--dim); font-size: 12px; text-align: center; margin: 22px 0 6px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }

.composer { margin: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: #1f1f1f; padding: 10px 12px 8px; flex: none; transition: border-color .15s; }
.composer:focus-within { border-color: #4a4a4a; }
.composer.drag { border-color: var(--brand); background: rgba(139,92,246,.06); }
.composer textarea { width: 100%; background: none; border: 0; outline: none; resize: none; min-height: 40px; max-height: 220px; line-height: 1.5; }
.composer textarea::placeholder { color: #6b6b6b; }
.comp-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.send { width: 34px; height: 34px; border-radius: 9px; border: 0; background: #4a4a4a; color: #ddd; display: grid; place-items: center; }
.send.ready { background: #f0f0f0; color: #111; }
.send.stop { background: #f0f0f0; color: #111; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.att { display: inline-flex; align-items: center; gap: 6px; background: #2a2a2a; border: 1px solid var(--line2); border-radius: 7px; padding: 3px 4px 3px 8px; font-size: 11.5px; max-width: 240px; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att button { background: none; border: 0; color: var(--dim); padding: 0 3px; }
.att-thumb { width: 26px; height: 26px; object-fit: cover; border-radius: 4px; margin: -1px 0 -1px -5px; flex: none; }
.att button:hover { color: var(--text); }

/* ---------- right panel ---------- */
.r-head { min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 16px; border-bottom: 1px solid var(--line); flex: none; }
.r-head .ttl { font-weight: 700; font-size: 14px; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.r-head .ttl small { color: var(--dim); font-weight: 500; font-size: 12px; }
.r-body { flex: 1; overflow-y: auto; padding: 16px; }
.r-inner { max-width: 980px; margin: 0 auto; }
/* Phân cảnh (its table), Prompt video (its cards), Storyboard (a scene's frames) and Ảnh tham chiếu (the
   cards) use the whole panel, 4 a row when there is room (a 9:16 storyboard's narrow frames keep filling the row) */
.r-inner.wide { max-width: 1680px; container-type: inline-size; container-name: rinner; }
@container rinner (min-width: 1040px) {
  .r-inner.wide .sdc-grid, .r-inner.wide .acards, .r-inner.wide .sbf-grid:not(.tall) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.empty { height: 100%; min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); gap: 4px; }
.empty .ic { color: #555; margin-bottom: 10px; }
.empty h4 { margin: 0; color: #cfcfcf; font-weight: 500; font-size: 14px; }
.empty p { margin: 6px 0 16px; max-width: 250px; font-size: 12px; color: var(--dim); line-height: 1.5; }

.bible { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(236,72,153,.04) 60%, transparent), var(--card); padding: 16px 18px; margin-bottom: 14px; }
.bible h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.bible .log { color: #d4d4d4; margin: 6px 0 0; font-size: 13px; }
.bible .syn { color: var(--muted); font-size: 12.5px; margin-top: 10px; white-space: pre-wrap; }
.bible .syn.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bible .row { display: flex; gap: 8px; align-items: flex-start; }
.bible .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bible .tags .badge { white-space: normal; max-width: 100%; overflow-wrap: anywhere; line-height: 1.45; border-radius: 10px; padding: 3px 9px; font-size: 11px; }

.ep { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); margin-bottom: 10px; transition: border-color .15s; }
.ep:hover { border-color: #3a3a3a; }
/* the open episode: a purple frame so it stands out among the others */
.ep.open, .ep.open:hover { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(139,92,246,.45), 0 6px 22px rgba(139,92,246,.12); }
.ep.open .ep-head { background: rgba(139,92,246,.07); border-radius: var(--radius) var(--radius) 0 0; }
.ep.open .ep-num { background: var(--brand); color: #fff; }
.ep.open .ep-body { border-top-color: rgba(139,92,246,.35); }
.ep.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139,92,246,.2); } }
.ep-head { display: flex; align-items: center; gap: 10px; row-gap: 6px; flex-wrap: wrap; padding: 11px 12px 11px 14px; cursor: pointer; }
.ep-num { font: 700 11px/1 ui-monospace, Consolas, monospace; background: #2d2d2d; border-radius: 6px; padding: 5px 7px; color: #ddd; flex: none; }
.ep-main { flex: 1 1 140px; min-width: 0; }  /* a narrow panel: the meta and buttons wrap under the title */
.ep-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-log { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-meta { color: var(--dim); font-size: 11.5px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.ep-actions { display: flex; gap: 2px; opacity: .5; transition: opacity .15s; }
.ep:hover .ep-actions { opacity: 1; }
.ep-head .chev { color: var(--dim); transition: transform .15s; }
.ep.open .ep-head .chev { transform: rotate(180deg); }
.ep-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.ep-tabs { display: flex; gap: 2px; margin: 10px 0 12px; }
.hooks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hook { background: #252525; border-radius: 9px; padding: 8px 11px; font-size: 12.5px; }
.hook b, .kv b { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: 2px; }
.hook.cl { background: linear-gradient(135deg, rgba(236,72,153,.1), #252525); }
.hook.op { background: linear-gradient(135deg, rgba(139,92,246,.12), #252525); }
.hook.em { background: linear-gradient(135deg, rgba(251,146,60,.13), #252525); margin-bottom: 8px; white-space: pre-wrap; }
.hook.em b { display: flex; align-items: center; gap: 4px; color: #fdba74; }
.scene-emo { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11.5px; color: #fdba74; font-style: italic; }
.ep-sum { color: #cfcfcf; font-size: 12.5px; margin: 10px 0 4px; white-space: pre-wrap; }
.scenes { margin-top: 8px; }
.scene { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 9px 0; border-top: 1px dashed #2f2f2f; }
.scene .n { font: 700 11px ui-monospace, Consolas, monospace; color: var(--dim); padding-top: 2px; }
.scene .loc { font-weight: 700; font-size: 12px; line-height: 1.4; letter-spacing: .02em; }
.scene .who { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.scene p { margin: 2px 0 0; font-size: 12.5px; color: #cfcfcf; }

/* reading script in the app font: heading, action, centered name, parenthetical, dialogue column */
.script { background: #141414; border: 1px solid var(--line); border-radius: 10px; padding: 30px 36px; font-size: 14px; line-height: 1.65; color: #e8e8e8; max-width: 760px; margin: 0 auto; }
.script .ttl { text-align: center; font-weight: 700; letter-spacing: .06em; margin: 0 0 22px; }
.script .sh { font-weight: 700; margin: 28px 0 14px; padding: 5px 10px; text-transform: uppercase; background: #1e1e1e; border-left: 3px solid var(--brand); border-radius: 4px; }
.script > .sh:first-child, .script > .sblk:first-child > .sh:first-child { margin-top: 0; }
.script .act { margin: 0 0 14px; white-space: pre-wrap; }
.script .dlg { margin: 16px 0; }
.script .cue { text-align: center; text-transform: uppercase; font-weight: 700; color: #fff; }
.script .par { text-align: center; color: #a8a8a8; font-style: italic; }
.script .dia { margin: 2px auto 0; max-width: 64%; white-space: pre-wrap; }
.script .tl { margin: 1px auto 6px; max-width: 64%; white-space: pre-wrap; font-style: italic; font-size: 12.5px; line-height: 1.5; color: #9ca3af; }
.script .tr { text-align: right; margin: 18px 0; text-transform: uppercase; font-weight: 700; color: #c4b5fd; }
.script-notes { max-width: 760px; margin: 12px auto 0; font-size: 12.5px; color: #cfcfcf; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #181818; }
.script-notes summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.script-notes div { margin-top: 8px; white-space: pre-wrap; line-height: 1.55; }
/* "## NHỊP 01: ..." beat headings (Fountain section lines): set like the outline's beat titles, a rule above each */
.script .sec { font-weight: 800; font-size: 13.5px; letter-spacing: .02em; text-transform: uppercase; color: var(--text); margin: 34px 0 6px; padding-top: 12px; border-top: 1px solid var(--line2); }
.script > .sec:first-child, .script > .sblk:first-child .sec { margin-top: 4px; padding-top: 0; border-top: 0; }
.script .syn, .script .note { color: var(--dim); font-style: italic; margin: 0 0 8px; }
.script hr { border: 0; border-top: 1px dashed #333; margin: 18px 0; }
.script-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.script-tools > .dim { flex: 1 1 220px; min-width: 0; }
.script-tools > .spacer { display: none; }
.script-tools > .btn { flex: none; }
.no-script { border: 1px dashed #3a3a3a; border-radius: 10px; padding: 22px; text-align: center; color: var(--dim); }
.no-script .btns { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.no-script-tip { max-width: 460px; margin: 14px auto 0; font-size: 12px; line-height: 1.5; color: var(--dim); }

.chain { position: relative; padding-left: 38px; }
.chain::before { content: ""; position: absolute; left: 14px; top: 14px; bottom: 14px; width: 2px; background: linear-gradient(var(--brand), var(--brand2)); opacity: .6; }
.chain-ep { position: relative; margin-bottom: 16px; }
.chain-ep .node { position: absolute; left: -38px; top: 0; width: 30px; height: 30px; border-radius: 50%; background: #1d1d1d; border: 2px solid var(--brand); display: grid; place-items: center; font: 700 11px ui-monospace, monospace; }
.chain-ep h5 { margin: 0 0 6px; font-size: 13px; padding-top: 5px; display: flex; gap: 8px; align-items: center; }
.chain-link { color: var(--dim); font-size: 11px; margin: -8px 0 8px 0; display: flex; align-items: center; gap: 6px; }
.chain-warn { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; }
.card:hover { border-color: #3a3a3a; }
.card.variant { border-left: 3px solid rgba(139,92,246,.5); }
.card-top { display: flex; gap: 12px; padding: 14px 14px 10px; align-items: flex-start; }
.avatar { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.card-id { flex: 1; min-width: 0; }
.card-top h4 { margin: 0; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.card-top .sub { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 5px; }
.card-top .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card-top .meta span { font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 999px; background: #262626; border: 1px solid var(--line); color: var(--muted); }
.variant-of { font-size: 11px; color: var(--dim); margin-top: 4px; }
.variant-of b { font-weight: 500; color: #a78bfa; font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 10.5px; }
.card-acts { display: flex; align-items: center; gap: 2px; padding: 3px 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #1b1b1b; opacity: .7; transition: opacity .15s; }
.card:hover .card-acts { opacity: 1; }
.card-acts .grow { flex: 1; }
.card-acts .flow-btn { padding: 4px 7px; gap: 4px; font-size: 11.5px; }
.kv { padding: 2px 14px 6px; font-size: 12.5px; color: #d0d0d0; }
.kv > div { margin-top: 8px; }
.kv .clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.prompt-box { margin: 8px 14px 14px; background: #181818; border: 1px dashed #353535; border-radius: 9px; padding: 8px 10px; font-size: 11.5px; color: #a8a8a8; position: relative; margin-top: auto; }
.prompt-box b { display: flex; justify-content: space-between; align-items: center; font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin-bottom: 3px; }
.prompt-box .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-spacer { margin-top: auto; }


/* ---------- modal, menus, toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; z-index: 60; animation: fade .12s; padding: 20px;
  grid-template-columns: minmax(0, 1fr); }  /* one column the screen's width: a dialog's 100% never grows with its text */
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: 90vh; max-height: min(90dvh, calc(100dvh - 40px - var(--kb, 0px))); display: flex; flex-direction: column; background: #1f1f1f; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; padding: 14px 16px 10px; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { padding: 4px 16px 12px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.scene-rows { display: flex; flex-direction: column; gap: 8px; }
.scene-row { display: grid; gap: 6px; align-items: start; padding-bottom: 8px; border-bottom: 1px dashed var(--line);
  grid-template-columns: 1.4fr .55fr 1.4fr .7fr 28px; grid-template-areas: "title act loc time rm" "goal goal shift emo who"; }
.scene-row textarea { min-height: 30px; height: 30px; }

.menu { position: fixed; z-index: 70; background: #232323; border: 1px solid var(--line2); border-radius: 10px; padding: 4px; min-width: 210px; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: fade .1s; }
.menu button { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; }
.menu button:hover { background: #2e2e2e; }
.menu button.danger { color: #fca5a5; }
.menu button .d { display: block; color: var(--dim); font-size: 11px; font-weight: 400; }
.menu button.sel { background: #2b2b2b; }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu button:disabled:hover { background: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #2b2b2b; border: 1px solid #3d3d3d; padding: 8px 14px; border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 12.5px; animation: fade .15s; }
.toast.err { border-color: rgba(248,113,113,.5); color: #fecaca; }


/* ---------- board ---------- */
.board { position: fixed; inset: 0; z-index: 55; background: #141414; display: flex; flex-direction: column; animation: fade .15s; }
.board-head { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.board-head h2 { margin: 0; font-size: 16px; flex: 1; }
.board-body { flex: 1; overflow: auto; padding: 22px; }
.board-inner { max-width: 1280px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.stat { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; }
.stat b { font-size: 22px; display: block; letter-spacing: -.02em; }
.stat span { color: var(--dim); font-size: 11.5px; font-weight: 600; }
.progress { height: 6px; background: #2a2a2a; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); }
.board-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.board-col { border: 1px solid var(--line); background: #181818; border-radius: 12px; padding: 12px; min-height: 120px; }
.board-col h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; text-transform: uppercase; letter-spacing: .06em; }
.bcard { background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin-bottom: 8px; cursor: pointer; }
.bcard:hover { border-color: #444; }
.bcard .t { font-weight: 600; font-size: 12.5px; }
.bcard .l { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.cast { display: flex; flex-wrap: wrap; gap: 10px; }
.cast .p { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; }
.cast .avatar { width: 28px; height: 28px; font-size: 12px; border-radius: 50%; }
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin: 22px 0 10px; font-weight: 700; }

/* ---------- home ---------- */
.home { flex: 1; overflow: auto; }
.home-head { height: 60px; display: flex; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--line); gap: 12px; position: sticky; top: 0; background: rgba(23,23,23,.9); backdrop-filter: blur(8px); z-index: 2; }
.logo { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 9px; letter-spacing: -.01em; }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand2)); display: grid; place-items: center; font-style: normal; }
.home main { max-width: 1180px; margin: 0 auto; padding: 28px; }
.home h1 { font-size: 26px; margin: 10px 0 4px; letter-spacing: -.02em; }
.home .lead { color: var(--muted); margin: 0 0 24px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pcard { border: 1px solid var(--line); background: var(--card); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .15s, border-color .15s; position: relative; }
.pcard:hover { border-color: #444; transform: translateY(-2px); }
.pcard .thumb { height: 120px; position: relative; display: grid; place-items: center; font-size: 42px; }
.pcard .info { padding: 12px 14px; }
.pcard .info b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .info p { margin: 4px 0 8px; color: var(--muted); font-size: 12px; height: 36px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pcard .info .m { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--dim); font-size: 11.5px; white-space: nowrap; }  /* a narrow card: the time goes under, never cut */
.pcard .info .m > span:not(.spacer):not(.fit) { flex: none; }
.pcard .info .m > span.fit { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pcard .more { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.45); border-color: transparent; }
.pnew { border: 1px dashed #444; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 230px; color: var(--muted); background: none; font-weight: 600; }
.pnew:hover { border-color: var(--brand); color: #fff; background: rgba(139,92,246,.05); }
.pnew .plus { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #242424; }
.doc-box { border: 1px solid rgba(139,92,246,.45); background: rgba(139,92,246,.06); border-radius: 12px; padding: 10px 14px; }
.doc-box > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: #c4b5fd; display: flex; align-items: center; gap: 6px; }
.doc-in { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.doc-in .seg { align-self: flex-start; }
.doc-in label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.doc-go { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-go .dim { font-size: 11.5px; flex: 1; min-width: 200px; }
.doc-or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 11.5px; }
.doc-or::before, .doc-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.fg-st.bad { color: var(--err); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 980px) {
  .tabs .tab { padding: 0 7px; }
  .tab .dot { display: none; }
  .hooks, .board-cols, .pos, .form { grid-template-columns: 1fr; }
}

/* ---------- model connections (home) ---------- */
.conn { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); scroll-margin-top: 70px; }
.conn-head h2 { font-size: 20px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.conn-head .lead { margin-bottom: 16px; }
.defaults { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 16px; }
.def { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; }
.def b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.def > div:last-child { flex: 1; min-width: 0; }
.def select { width: 100%; }
.def-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #262626; color: #c4b5fd; flex: none; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.conn-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px; }
.conn-card.on { border-color: rgba(110,231,183,.35); }
.conn-card .cg { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; color: #fff; font-weight: 700; }
.conn-card .ci { flex: 1; min-width: 0; }
.conn-card .ci b { font-size: 13.5px; }
.conn-card .ci p { margin: 3px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.conn-card .kinds { display: flex; flex-wrap: wrap; gap: 5px; }
.conn-card .cs { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.conn-card .st { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.conn-card .st.on { color: var(--ok); }
.test { border-radius: 9px; padding: 8px 11px; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.test.ok { color: var(--ok); background: rgba(110,231,183,.08); border: 1px solid rgba(110,231,183,.3); }
.test.bad { color: #fecaca; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); }

/* ---------- media ---------- */
.ref-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-thumb { width: 64px; height: 64px; border-radius: 9px; border: 2px solid transparent; background: #262626; padding: 0; overflow: hidden; color: var(--dim); font-size: 11px; }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb.sel { border-color: var(--brand); }
.ref-named { position: relative; }
.ref-named b { position: absolute; left: 3px; top: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 4px; }
[data-refs-box].off .ref-pick { opacity: .35; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.mcard { border: 1px solid var(--line); background: var(--card); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.mc-prev { position: relative; aspect-ratio: 4 / 3; background: #121212; display: grid; place-items: center; }
.mc-prev img, .mc-prev video { width: 100%; height: 100%; object-fit: contain; display: block; background: #0d0d0d; }
.mc-prev img { cursor: zoom-in; }
.mc-kind { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; pointer-events: none; }
.mc-state { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 16px; text-align: center; }
.mc-state.bad { color: #fca5a5; font-size: 11.5px; overflow: auto; max-height: 100%; }
.mc-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.mc-t { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.mc-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-t span { font-size: 11px; white-space: nowrap; }
.mc-m { font-size: 11px; }
.mc-p { font-size: 11.5px; color: #bdbdbd; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-a { display: flex; gap: 4px; margin-top: auto; padding-top: 8px; align-items: center; }
/* background music: the mark and the "Tách nhạc" button (media.js musicHTML) */
.badge.warn { color: var(--warn); border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.08); }
.mu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; min-height: 22px; }
.mu-row .btn { padding: 2px 8px; }
.mu-wait { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.mu-wait .spin { width: 11px; height: 11px; }
.mu-note { color: var(--muted); }
.mu-err { color: #fca5a5; cursor: help; }
.sdc-music { padding: 6px 12px 0; }
.sdc-err { max-width: none; margin: 8px 12px 0; text-align: left; overflow-wrap: anywhere; }
.scene-vid + .mu-row { margin-top: 6px; }
.card-cover { position: relative; aspect-ratio: 16 / 10; background: #121212; overflow: hidden; }
.card-cover.characters { aspect-ratio: 4 / 3; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.cover-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(0,0,0,.55); font-size: 12px; color: #ddd; }
.scene-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.scene-top .btn { opacity: .55; }
.scene:hover .scene-top .btn { opacity: 1; }

/* beat-sheet outline */
.beats { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.act-head { margin: 10px 0 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: #c4b5fd; text-transform: uppercase; }
.act-head:first-child { margin-top: 0; }
.beat { position: relative; border-left: 2px solid #3a3a3a; padding: 6px 0 6px 12px; border-radius: 0 6px 6px 0; }
.beat:hover > .sblk-tools { display: flex; }
.beat:hover { background: rgba(139,92,246,.05); }
.beat.on { border-left-color: var(--brand); background: rgba(139,92,246,.08); }
.beat:hover { border-left-color: var(--brand); }
.beat-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.beat-title { font-size: 13px; line-height: 1.4; }
.beat-title b { letter-spacing: .02em; }
.beat-where { color: var(--muted); font-size: 12px; }
.beat-line { display: grid; grid-template-columns: 92px 1fr; gap: 8px; margin-top: 3px; font-size: 12.5px; line-height: 1.5; color: #d4d4d4; }
.beat-line > span { color: var(--dim); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.shift { font-weight: 700; }
.shift.up { color: var(--ok); }
.shift.down { color: #f87171; }
.emo { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: #2a2a2a; color: #e5e5e5; }
.emo-1 { background: rgba(56,189,248,.18); color: #7dd3fc; }
.emo-2 { background: rgba(251,146,60,.18); color: #fdba74; }
.emo-3 { background: rgba(74,222,128,.16); color: #86efac; }
.emo-4 { background: rgba(96,165,250,.16); color: #93c5fd; }
.emo-5 { background: rgba(248,113,113,.18); color: #fca5a5; }
.emo-6 { background: rgba(250,204,21,.18); color: #fde047; }
.emo-7 { background: rgba(192,132,252,.18); color: #d8b4fe; }
.ep-core { font-size: 12.5px; line-height: 1.75; color: #d4d4d4; background: linear-gradient(135deg, rgba(251,146,60,.1), #232323); border-radius: 9px; padding: 9px 12px; white-space: pre-wrap; }
.ep-idea { font-size: 12.5px; line-height: 1.65; color: #d4d4d4; background: linear-gradient(135deg, rgba(139,92,246,.12), #232323); border-radius: 9px; padding: 9px 12px; margin-bottom: 8px; white-space: pre-wrap; }
.ep-idea b { color: #c4b5fd; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.check-row { flex-direction: row !important; align-items: center; gap: 8px !important; align-self: end; font-weight: 500 !important; color: var(--text) !important; }
.check-row input { accent-color: var(--brand); }
/* Tạo tất cả ảnh: the cards (or Vẽ theo bộ: the characters with their looks) to make, ticked one by one */
.gen-pick-head { display: flex; gap: 6px; align-items: center; }
.gen-pick-head .ctl { flex: 1; min-width: 0; }
.gen-pick-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 2px 10px; }
.gen-pick { display: flex !important; align-self: stretch !important; width: 100%; padding: 5px 0; font-size: 12.5px; }
.gen-pick + .gen-pick { border-top: 1px solid var(--line); }
.gen-pick-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gen-pick-state { flex: none; font-size: 11.5px; }
.gen-pick.gen-hide { display: none !important; }
.ep-core b { color: #fdba74; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.legacy-note { margin-top: 8px; display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 12px; color: var(--warn); background: rgba(250,204,21,.07); border: 1px solid rgba(250,204,21,.25); border-radius: 9px; padding: 7px 10px; }

/* asset labels and Seedance scenes */
.label-tag { display: inline-block; margin-top: 4px; font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 10.5px; line-height: 1.5; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; background: rgba(139,92,246,.16); color: #c4b5fd; }
.label-tag[data-act] { cursor: copy; transition: background .15s; }
.label-tag[data-act]:hover { background: rgba(139,92,246,.3); }
.label-tag.missing { background: #2a2a2a; color: var(--dim); }
.sd-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.sdc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 10px; }
/* Phân cảnh: one block per scene, its shots in a table (panels.js shotsHTML) */
.shs { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.shs-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.shs-loc { font-size: 11.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.shs-locks { padding: 8px 12px 0; font-size: 11.5px; line-height: 1.5; display: grid; gap: 2px; }
.shs-table { overflow-x: auto; }
.shot-table { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.45; min-width: 820px; }
.shot-table th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11px; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.shot-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.shot-table td.n { white-space: nowrap; color: var(--text); font-weight: 600; }
.shot-table tbody tr { cursor: pointer; }
.shot-table tbody tr:hover td { background: rgba(139,92,246,.06); color: var(--text); }
.shot-table tbody tr:last-child td { border-bottom: 0; }
/* each shot's spot in the scene's location, and its people (panels.js shotSceneHTML) */
.shot-table td.shs-spot { min-width: 110px; }
.shot-table td.shs-comp { min-width: 130px; }
/* the shot dialog's quick lists beside a field (panels.js shotModal, SHOT_TERMS) */
.shot-pick-row { display: flex; gap: 6px; align-items: stretch; }
.shot-pick-row > input.ctl { flex: 1; min-width: 0; }
.shot-pick-row > select.shot-pick { flex: 0 0 auto; width: 118px; font-size: 12px; cursor: pointer; }
.form label > span[data-vi] { min-height: 1.5em; }  /* the Vietnamese reading keeps its line: the fields beside stay level */
.shot-table td.shs-who { min-width: 110px; font-size: 11.5px; }
.shot-table td.shs-who div + div { margin-top: 2px; }
.shot-table .shs-nocard { color: var(--warn); }
/* a line's Vietnamese meaning under it (shot list, storyboard card, printable sheet): for reading only */
.dlg-vi { display: block; margin-top: 3px; font-style: italic; color: var(--dim); }
.dlg-vi::before { content: "↳ "; font-style: normal; opacity: .7; }
/* Storyboard: one card per scene, its frames (one picture per shot, in the film's frame) in a grid, each caption under
   its frame (panels.js storyboardHTML) */
.sbc-list { display: grid; gap: 12px; margin-top: 10px; }
.sbc { border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.sbc-head { padding: 10px 12px 0; flex-wrap: wrap; }
.sbc-head > b, .sbc-head > .badge { white-space: nowrap; }
.sbc-meta { display: grid; gap: 1px; margin-top: 2px; font-size: 11.5px; color: var(--dim); }
.sbc-meta b { color: var(--text); font-weight: 600; }
.sbc-old { display: flex; gap: 10px; align-items: center; margin: 8px 12px 0; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; font-size: 12px; }
.sbc-old img { width: 120px; border-radius: 6px; cursor: zoom-in; flex: none; }
.sbc-old .dim { flex: 1; }
.sbf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; padding: 10px 12px 12px; }
.sbf-grid.tall { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.sbf { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sbf-media { position: relative; background: #111; border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.sbf-media img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }  /* never stretched */
.sbf-empty { display: grid; justify-items: center; gap: 4px; color: var(--dim); font-size: 11.5px; }
.sbf-num { position: absolute; top: 6px; left: 6px; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 5px;
  background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 700; }
.sbf-tools { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.sbf:hover .sbf-tools, .sbf:focus-within .sbf-tools { opacity: 1; }
@media (hover: none) { .sbf-tools { opacity: 1; } }
.sbf-tools .btn { background: rgba(17,17,17,.8); border-color: transparent; color: #fff; }
.sbf-cap { font-size: 12px; line-height: 1.45; color: var(--muted); }
.sbf-cap > b { color: var(--text); font-weight: 600; }
.sbf-warn { font-size: 11.5px; line-height: 1.4; color: #fbbf24; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3);
  border-radius: 7px; padding: 4px 7px; }
.sbf-warn[hidden] { display: none; }
.sbf-stale { font-size: 11.5px; line-height: 1.4; color: var(--muted); background: rgba(139,92,246,.08); border: 1px solid rgba(139,92,246,.3);
  border-radius: 7px; padding: 4px 7px; }
/* Storyboard → Sửa khung: the frame beside what to change */
.sbe { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sbe.tall { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); }
@media (max-width: 720px) { .sbe, .sbe.tall { grid-template-columns: minmax(0, 1fr); } }
.sbe-img { background: #111; border-radius: 10px; overflow: hidden; display: grid; place-items: center; max-height: 62vh; }
.sbe-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sbe-side { display: grid; gap: 10px; }
.sbe-cap { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sbe-label { display: grid; gap: 6px; font-size: 13px; }
.sbe-label textarea { width: 100%; resize: vertical; }
.sbe-tip { margin: 0; font-size: 12px; line-height: 1.5; }
/* Storyboard → In / lưu PDF: the episode's frames with their captions over the page; printing shows only them */
.sb-print { position: fixed; inset: 0; z-index: 1000; overflow: auto; background: #f4f4f4; color: #111; }
.sb-print-bar { position: sticky; top: 0; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff;
  border-bottom: 1px solid #ddd; font-size: 13px; }
.sb-print-bar .btn { background: #fff; color: #111; border-color: #ccc; }  /* white paper in both themes */
.sb-print-bar .btn:hover { background: #f0f0f0; }
.sb-print-bar .btn.primary { background: #18181b; color: #fff; border-color: #18181b; }
.sb-print-bar .btn.primary:hover { background: #3f3f46; }
.sb-print-page { max-width: 1000px; margin: 16px auto; padding: 24px; background: #fff; font: 14px/1.5 "Segoe UI", Arial, sans-serif; }
.sb-print-page h1 { font-size: 18px; margin: 0 0 16px; }
.sb-print-page h2 { font-size: 14px; margin: 0 0 8px; }
.sb-print-page section { margin: 0 0 28px; }
.sbp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.sb-print.tall .sbp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sbp-grid figure { margin: 0; break-inside: avoid; page-break-inside: avoid; }
.sbp-frame { position: relative; background: #e9e9e9; display: grid; place-items: center; overflow: hidden; color: #888; font-size: 12px; }
.sbp-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sbp-frame b { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; }
.sbp-grid figcaption { margin-top: 6px; font-size: 12.5px; line-height: 1.45; }
.sb-print-page .talk { color: #555; font-size: 12px; margin-left: 12px; }
.sb-print-page .talk.dlg-vi { color: #777; margin-top: 0; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body > *:not(.sb-print) { display: none !important; }
  .sb-print { position: static; overflow: visible; background: #fff; }
  .sb-print-bar { display: none; }
  .sb-print-page { max-width: none; margin: 0; padding: 0; }
}/* the scenes in a frame per outline beat (panels.js sdBeatsHTML) */
.sd-beat { margin-top: 14px; padding: 12px; border: 1px solid var(--line2); border-radius: 14px; }
.sd-beat-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.sd-beat-head b { font-size: 13.5px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--text); }
.sd-beat-head .dim { font-size: 11.5px; }
.sdc { border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.sdc:hover, .acard:hover { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(139,92,246,.45), 0 6px 22px rgba(139,92,246,.12); }
.sdc-media { position: relative; aspect-ratio: 16 / 9; background: #141414; display: grid; border-bottom: 1px solid var(--line); }
.sdc-empty { place-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; }
.sdc-refrow { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px 0; cursor: pointer; }
.sdc-refrow .sdc-th { width: 36px; height: 36px; border-color: var(--line2); color: var(--muted); }
.sdc-th.k-environments { background-size: cover; background-position: center; }
.sdc-media video { width: 100%; height: 100%; object-fit: cover; background: #000; cursor: auto; }
.sdc-media .mc-state { place-self: center; }
.sdc-th { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; border: 1.5px solid rgba(255,255,255,.75); background: #2a2a2a no-repeat center / cover; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.sdc-th.k-characters { background-size: auto 230%; background-position: 7% 29%; }  /* the sheet's big portrait: the face */
.sdc-th.k-props { background-size: auto 140%; background-position: 12% 50%; }  /* the sheet's hero shot, on the left */
.sdc-th.more { font-size: 11px; }
.sdc-body { padding: 10px 12px 4px; cursor: pointer; flex: 1; }
.sdc-title { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.sdc-title .dim { font-size: 11.5px; }
.sdc-refs { margin-top: 6px; font-size: 11.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sdc-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px; padding: 4px 8px 8px 12px; font-size: 11px; }
.sdc-foot .btn { padding: 3px 7px; }
/* Prompt video → "+" between the scene cards (a scene added there is 001.1) */
.sdc-wrap { position: relative; display: flex; min-width: 0; }
.sdc-wrap > .sdc { flex: 1; min-width: 0; }
.sdc-plus { position: absolute; top: 50%; right: -19px; transform: translateY(-50%); z-index: 3; width: 26px; height: 26px; padding: 0;
  border-radius: 50%; border: 1.5px dashed var(--line2); background: var(--bg); color: var(--muted); display: grid; place-items: center;
  cursor: pointer; opacity: .65; transition: opacity .15s, border-color .15s, color .15s; }
.sdc-wrap:hover .sdc-plus, .sdc-plus:focus-visible { opacity: 1; }
.sdc-plus:hover { border-style: solid; border-color: var(--brand); color: var(--brand); }
@media (hover: none) { .sdc-plus { opacity: 1; } }
.sdc-grid { container-type: inline-size; }
@container (max-width: 579px) {  /* one card a row: the "+" sits in the gap under the card */
  .sdc-plus { top: auto; bottom: -19px; right: 50%; transform: translateX(50%); }
}
.sdc-added { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(139,92,246,.16); color: #c4b5fd; white-space: nowrap; }
.sdi-kinds { display: grid; gap: 6px; }
.sdm-edit { width: 100%; min-height: 220px; font: 12.5px/1.55 ui-monospace, Consolas, monospace; resize: vertical; }
.sdm-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.sdm-ref { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.sdm-ref img, .sdm-noimg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #222; display: grid; place-items: center; color: var(--dim); }
.sdm-ref .dim { font-size: 11px; }
.sdm-text { max-height: 46vh; overflow: auto; cursor: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #181818; }
.sd { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #1d1d1d; }
.sd-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sd-top .btn { padding: 3px 7px; }
.sd-text { margin-top: 8px; font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.55; color: #cfcfcf; white-space: pre-wrap; word-break: break-word; cursor: pointer; }
.sd-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sd-warns { margin-top: 6px; font-size: 11.5px; color: var(--warn); display: flex; flex-direction: column; gap: 2px; }
.sd-flag { color: var(--warn); }

/* Google Flow hand-off */
.flow-steps { margin: 0 0 14px; padding-left: 20px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.flow-steps b { color: var(--text); }
.flow-btns { display: flex; gap: 8px; margin: 10px 0 4px; }
.flow-btns a.btn { text-decoration: none; }
.flow-refs { display: flex; flex-wrap: wrap; gap: 10px; }
.flow-ref { width: 92px; text-decoration: none; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; gap: 4px; }
.flow-ref img { width: 92px; height: 92px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); display: block; }
.flow-ref span { display: flex; align-items: center; gap: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-ref:hover { color: var(--text); }
.flow-drop { margin-top: 16px; width: 100%; border: 1.5px dashed #4a4a4a; border-radius: 12px; background: #1b1b1b; color: var(--muted); padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }
.flow-drop b { color: var(--text); font-size: 13.5px; }
.flow-drop:hover, .flow-drop.over { border-color: var(--brand); color: var(--text); background: #202020; }
.scene-vid { margin-top: 8px; max-width: 220px; border-radius: 9px; overflow: hidden; background: #121212; }
.scene-vid video { width: 100%; display: block; max-height: 320px; }
.scene-vid .mc-state { padding: 12px; }
.notice { margin-top: 8px; font-size: 11.5px; color: var(--warn); line-height: 1.4; }
.ref-thumb.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px dashed #4a4a4a; color: var(--muted); }
.ref-thumb.add:hover { border-color: var(--brand); color: #fff; }
.conn-sub { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 0 10px; }
.conn-head + .conn-sub { margin-top: 4px; }

/* ---------- genre DNA ---------- */
.dna-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dna-new { min-height: 170px; }
.dna-card { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s; }
.dna-card:hover { border-color: #444; transform: translateY(-2px); }
.dna-card.busy { border-color: rgba(139,92,246,.45); }
.dna-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dna-top b { font-size: 14px; }
.dna-card p { margin: 0; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dna-prog { font-size: 11.5px; }
.dna-meta { display: flex; gap: 10px; color: var(--dim); font-size: 11.5px; margin-top: auto; padding-top: 6px; }
.badge.bad { color: #fca5a5; border-color: rgba(248,113,113,.4); }
.dna-pick { display: flex; gap: 8px; align-items: center; }
.dna-pick select { flex: 1; min-width: 0; }
.dna-sum { margin: 6px 0 0; font-size: 11.5px; line-height: 1.45; }
.dna-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
.dna-body { flex: 1; display: flex; min-height: 0; }
.dna-side { width: 270px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 10px; }
.dna-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); margin: 14px 8px 6px; }
.dna-nav { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: 8px; padding: 7px 8px; text-align: left; font-size: 12.5px; color: var(--muted); }
.dna-nav:hover { background: #222; color: var(--text); }
.dna-nav.on { background: #2a2a2a; color: #fff; }
.dna-nav .id { font: 700 10.5px ui-monospace, Consolas, monospace; color: var(--dim); width: 28px; flex: none; display: flex; }
.dna-nav .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dna-nav .n { font-size: 10.5px; color: var(--dim); }
.dna-nav .n.empty { color: var(--warn); }
.dna-main { flex: 1; overflow-y: auto; padding: 22px 28px; }
.dna-block { max-width: 900px; }
.dna-block.locked { opacity: .45; pointer-events: none; }
.dna-block h3 { margin: 0; font-size: 17px; }
.dna-lbl { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dna-busy { display: flex; align-items: center; gap: 12px; border: 1px solid rgba(139,92,246,.4); background: rgba(139,92,246,.08); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.dna-busy > div:nth-child(2) { flex: 1; }
.rules { display: flex; flex-direction: column; gap: 10px; }
.rule { display: grid; grid-template-columns: 30px 1fr 28px; gap: 8px; border: 1px solid var(--line); background: #1b1b1b; border-radius: 10px; padding: 10px; }
.rule-n { font: 700 11px ui-monospace, Consolas, monospace; color: var(--dim); padding-top: 4px; }
.rule-f { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.rule-f label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rule-f textarea { font-size: 12.5px; text-transform: none; letter-spacing: 0; }
@media (max-width: 980px) { .rule-f { grid-template-columns: 1fr; } .dna-side { width: 200px; } }
.ref-video { border: 1px solid var(--line); border-radius: 9px; background: #1b1b1b; margin-bottom: 8px; }
.ref-video summary { cursor: pointer; padding: 8px 11px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; list-style: none; }
.ref-video summary::-webkit-details-marker { display: none; }
.ref-video summary a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-body { padding: 4px 12px 12px; font-size: 12.5px; color: #cfcfcf; white-space: pre-wrap; max-height: 420px; overflow: auto; }
.link-status { font-size: 12px; font-weight: 600; }
.link-ok { color: var(--ok); }
.link-bad { color: #fca5a5; }
.brief-opt summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.brief-opt summary:hover { color: var(--text); }
.brief-opt textarea { width: 100%; }
.cc-row { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.cc-row b { width: 110px; flex: none; color: var(--muted); font-weight: 600; }
.cc-login { margin-top: 10px; border: 1px solid rgba(251,191,36,.35); background: rgba(251,191,36,.06); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.cc-cmd { margin: 0; background: #121212; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; }
.cc-toggle { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 10px; align-self: end; }
.key-ok { color: var(--ok); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.dna-sw { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; }
.pcard .thumb { color: rgba(255,255,255,.85); }
.pcard .pdna { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.55); border-color: transparent; color: #fff; display: inline-flex; gap: 4px; align-items: center; }

/* delivery check */
.audit-status { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 10px 12px; border-radius: 10px; }
.audit-status span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.audit-status.pass { color: var(--ok); background: rgba(110,231,183,.08); border: 1px solid rgba(110,231,183,.3); }
.audit-status.fail { color: var(--err); background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); }
.audit-sub { margin: 14px 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); }
.audit-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; display: flex; flex-direction: column; gap: 4px; }
.audit-list.err li { color: #fca5a5; }
.audit-list.rev li { color: #d6d6d6; }
.audit-tl { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-tl td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.audit-tl td:first-child { white-space: nowrap; color: #c4b5fd; font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 11px; }
.sd-vers { margin-bottom: 8px; width: fit-content; }
.omni-refs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.omni-refs .label-tag { margin-top: 0; cursor: copy; }

/* film genres & character worlds */
.pcard .pshared { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.6); border-color: transparent; color: #fde68a; }
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.signin-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px; border: 1px solid var(--line2); border-radius: 14px; background: #1c1c1c; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.signin-card .logo { margin-bottom: 4px; }
.signin-card h2 { margin: 0; font-size: 19px; }
.signin-card p { margin: 0; font-size: 13px; }
.signin-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.signin-card .btn { justify-content: center; height: 38px; margin-top: 4px; }
.signin-err { color: #fca5a5; font-size: 12.5px; }
.signin-ok { color: #6ee7b7; font-size: 13px; line-height: 1.5; }
.signin-alt { text-align: center; color: var(--dim); }
.signin-alt a { color: var(--text); }
.user-btn { position: relative; }
.user-dot { position: absolute; left: 20px; top: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.users-wait { border: 1px solid rgba(245,158,11,.4); background: rgba(245,158,11,.08); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.uw-row { display: flex; align-items: center; gap: 8px; }
.user-btn { gap: 7px; padding-left: 5px; flex: none; }
.user-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.user-nm { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.users-top p { margin: 0; flex: 1; font-size: 12.5px; }
table.users { width: 100%; border-collapse: collapse; font-size: 13px; }
table.users th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 8px; border-bottom: 1px solid var(--line); }
table.users tr.off td { opacity: .55; }
.u-use { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.user-dot.warn { background: #f59e0b; color: #1b1b1b; }
.conn-foot { margin: 12px 0 0; font-size: 12px; line-height: 1.5; }
/* Kết nối của tôi in its dialog (account menu): the dialog's title says it */
.myconn-box .conn { margin-top: 0; padding-top: 0; border-top: 0; }
.myconn-box .conn-head h2 { display: none; }
.myconn-box .conn-head .lead { font-size: 13px; }
.del-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
/* account groups (groups.js) */
.grp-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; flex: none; }
table.users tr.u-grp td { background: rgba(255,255,255,.03); padding-top: 10px; font-size: 12.5px; border-bottom: 1px solid var(--line2); }
table.users .u-sel { width: 28px; padding-right: 0; }
.users-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.users-tools input.ctl { width: min(260px, 100%); }
.users-tools select.ctl { width: auto; min-width: 160px; }
.grp-colors { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.grp-color { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 400; cursor: pointer; }
.grp-color input { margin: 0 4px 0 0; }
.acc-tabs { margin: 0 0 12px; }
.modal.xwide { width: min(1120px, 100%); }
/* the Chi tiêu tab (spend.js) */
.spd { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.spd-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spd-bar select.ctl { width: auto; min-width: 150px; }
.spd-bar a.btn { text-decoration: none; }
.spd-alert { border: 1px solid rgba(245,158,11,.45); background: rgba(245,158,11,.08); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.spd-warn { margin: 0; color: var(--warn); font-size: 12.5px; }
.spd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.spd-kpis > div { background: var(--card2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spd-kpis span { color: var(--muted); font-size: 12px; }
.spd-kpis b { font-size: 20px; font-variant-numeric: tabular-nums; }
.spd-kpis small { color: var(--dim); font-size: 11.5px; }
.spd-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.spd-legend span { display: inline-flex; align-items: center; gap: 5px; }
.spd-legend i, .spd-sq { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.spd-sq { margin-right: 6px; vertical-align: -1px; }
.spd-chart { position: relative; display: flex; align-items: stretch; gap: 3px; height: 150px; padding-top: 18px; border-bottom: 1px solid var(--line2); }
.spd-axis { position: absolute; left: 0; top: 0; font-size: 11px; color: var(--dim); }
.spd-col { flex: 1; min-width: 0; display: flex; flex-direction: column-reverse; align-items: center; border-radius: 3px 3px 0 0; }
.spd-col:hover { background: rgba(255,255,255,.05); }
.spd-col i { display: block; width: min(100%, 40px); min-height: 1px; flex: none; }
.spd-col i + i { border-bottom: 1px solid #1f1f1f; }
.spd-col i:last-child { border-radius: 3px 3px 0 0; }
.spd-days { display: flex; gap: 3px; font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.spd-days span { flex: 1; min-width: 0; text-align: center; }
.spd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 12px; }
.spd-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.spd-card h4 { margin: 0 0 6px; font-size: 13px; }
table.spd-t { width: 100%; border-collapse: collapse; }
table.spd-t td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.spd-t tr:last-child td { border-bottom: 0; }
table.spd-t td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.spd-t td.num.warn { color: var(--warn); }
table.spd-t td.num.ok { color: var(--ok); }
table.spd-t tr.free td { color: var(--dim); }
.spd-meter-td { width: 38%; }
.spd-meter { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.spd-meter i { display: block; height: 100%; background: #2a78d6; border-radius: 3px; }
.spd-foot { margin: 6px 0 0; font-size: 11.5px; }
table.spd-t tr.spd-link { cursor: pointer; }
table.spd-t tr.spd-link:hover td { background: rgba(255,255,255,.04); }
.spd-more { color: var(--dim); display: inline-flex; vertical-align: -1px; }
.spd-scroll { max-height: 380px; overflow: auto; }
table.spd-lines th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11.5px; padding: 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #1f1f1f; }
table.spd-lines th.num { text-align: right; }
table.spd-lines td { font-size: 12px; }
.spd-nowrap { white-space: nowrap; }
.spd-none { margin: 0; }
.spp { display: flex; flex-direction: column; gap: 10px; }
.spp-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.spp-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 8px; margin-top: 6px; }
.spp-fields label { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; font-size: 11.5px; color: var(--muted); }  /* inputs in line, whatever the labels' lines */
.pcard .pworld { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.55); border-color: transparent; color: #fff; display: inline-flex; gap: 4px; align-items: center; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-modal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.fg-modal .form { grid-template-columns: 1fr; }
.fg-guide { border: 1px solid var(--line); background: #181818; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; line-height: 1.55; color: #d0d0d0; max-height: 64vh; overflow: auto; }
.fg-guide summary { cursor: pointer; font-weight: 600; color: #c4b5fd; display: flex; align-items: center; gap: 6px; }
.fg-guide h5 { margin: 12px 0 4px; font-size: 12.5px; color: #fff; }
.fg-guide ol, .fg-guide ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
.fg-guide p { margin: 8px 0; }
.fg-example { border-left: 3px solid rgba(139,92,246,.5); padding: 2px 0 2px 10px; margin: 6px 0 10px; color: #bdbdbd; }
.fg-example p { margin: 4px 0; }
.fg-example .fg-grp { margin: 10px 0 3px; font-weight: 700; color: #c4b5fd; font-size: 12px; letter-spacing: .03em; }
/* Film genre: the six story blocks under the brief */
.fg-blocks { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.fg-bhead { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.fg-bhead b { display: inline-flex; align-items: center; gap: 6px; color: #c4b5fd; }
.fg-bnote { margin: 0; font-size: 12.5px; line-height: 1.5; }
.fg-bacts { display: flex; gap: 8px; align-items: center; }
.fg-bacts .ctl { flex: 1; height: 34px; }
.fg-st { font-size: 11.5px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.fg-st.ok { color: #86efac; border-color: rgba(134,239,172,.35); }
.fg-st.busy { color: #c4b5fd; border-color: rgba(139,92,246,.45); }
.fg-block { border: 1px solid var(--line); border-radius: 10px; background: #1a1a1a; padding: 8px 12px; }
.fg-block summary { cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13.5px; list-style: none; }
.fg-block summary::-webkit-details-marker { display: none; }
.fg-block[open] summary { margin-bottom: 8px; }
.fg-block .fld { margin-top: 6px; }
.fg-fb { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #333; }
.fg-fb .ctl { flex: 1; height: 34px; }
.modal.xl .fg-modal .fg-block textarea.ctl { min-height: 0; font-size: 13.5px; }

/* the project's World tab */
.world-tab .form { grid-template-columns: 1fr; }
.world-note { font-size: 12.5px; margin: 0 0 12px; line-height: 1.5; }
.world-save { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.world-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: #c4b5fd; background: rgba(139,92,246,.14); border-radius: 999px; padding: 2px 9px; white-space: nowrap; min-width: 0; max-width: 260px; }
.world-chip span { overflow: hidden; text-overflow: ellipsis; }

/* Claude Code card: the long-lived token */
.cc-token { border: 1px solid rgba(139,92,246,.45); background: rgba(139,92,246,.07); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 12.5px; line-height: 1.5; }
.cc-token.ok { border-color: rgba(110,231,183,.35); background: rgba(110,231,183,.05); }
.cc-token b { display: inline-flex; align-items: center; gap: 6px; }
.cc-steps { margin: 0 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.cc-steps .cc-cmd { margin: 6px 0; }

/* Characters / Environments / Props: one big card per family */
.acards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 14px; align-items: start; }
.acard { border: 1px solid var(--line); background: var(--card); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.acard-cover { aspect-ratio: 16 / 9; background: #f4f4f4; position: relative; display: grid; place-items: center; overflow: hidden; }
.acard-cover img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.acard-empty { color: #8a8a8a; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; }
.acard-empty-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.acard-err { max-width: 92%; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; font-size: 12px; line-height: 1.45; text-align: center; }
.acard-cover:has(.acard-empty) { background: #171717; }
.acard-looks, .acard-acts, .acard-thumbs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.acard-thumbs { flex-wrap: nowrap; overflow-x: auto; }
.acard-acts .grow { flex: 1; }
.look { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: #1d1d1d; border-radius: 9px; padding: 3px 10px 3px 3px; font-size: 12px; font-weight: 600; color: var(--muted); max-width: 100%; cursor: pointer; }
.look span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.look img, .look .look-dot { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: none; background: #2a2a2a; }
.look.on { color: #fff; background: #2b2b2b; border-color: #4a4a4a; }
.look.add { border-style: dashed; padding: 6px 12px; }
.look:hover { color: #fff; }
.vthumb { width: 58px; height: 44px; border-radius: 7px; overflow: hidden; border: 2px solid transparent; padding: 0; background: #222; flex: none; cursor: pointer; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb.on { border-color: var(--brand); }
/* the × on a card's version picture (panels.js del-version): on hover, always on a touch screen */
.vthumb-wrap { position: relative; flex: none; display: flex; }
.vthumb-del { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 0; display: none; place-items: center; background: rgba(0,0,0,.72); color: #fff; cursor: pointer; }
.vthumb-wrap:hover .vthumb-del, .vthumb-del:focus-visible { display: grid; }
.vthumb-del:hover { background: #dc2626; }
@media (hover: none) { .vthumb-del { display: grid; } }
@media (pointer: coarse) { .vthumb-del { width: 24px; height: 24px; top: 2px; right: 2px; } }
.acard-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.acard-name { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.acard-name h4 { margin: 0; font-size: 16px; }
.acard-name .role { color: var(--muted); font-size: 12.5px; }
.acard-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-top: -4px; }
.acard-label .label-tag { margin-top: 0; }
.acard-sec .sec-t { display: block; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; font-weight: 700; }
.acard-sec .txt { font-size: 12.5px; line-height: 1.65; color: #d4d4d4; }
.acard-sec .txt b { color: #e5e5e5; font-weight: 600; }
.ptags { display: flex; flex-wrap: wrap; gap: 6px; }
.ptag { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; background: #262626; border: 1px solid var(--line2); color: #d4d4d4; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; }
.pick { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #1b1b1b; cursor: pointer; text-align: left; color: var(--text); }
.pick:hover { border-color: var(--brand); }
.pick img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #222; }
.pick span { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick small { font-size: 10.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* setup: a project that still uses a Genre DNA */
.dna-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; margin: 10px 0 2px; background: #1b1b1b; }

/* the project's progress bar */
.pgbar { flex: none; border-bottom: 1px solid var(--line); background: #171717; padding: 8px 14px 9px; display: flex; flex-direction: column; gap: 7px; }
.pg-steps { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.pg-sep { flex: 1 1 8px; min-width: 6px; height: 1px; background: var(--line2); }
.pg-step { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--dim); font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; flex: none; }
.pg-step:hover { color: var(--text); background: #222; }
.pg-n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: #2a2a2a; color: var(--muted); flex: none; }
.pg-step.done { color: #a7f3d0; }
.pg-step.done .pg-n { background: rgba(110,231,183,.18); color: #6ee7b7; }
.pg-step.on { color: #fff; border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.12); }
.pg-step.on .pg-n { background: var(--brand); color: #fff; }
.pg-step.view { color: #fff; box-shadow: inset 0 -2px 0 #fff; border-radius: 6px 6px 3px 3px; }
.pg-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg-msg { flex: 1 1 240px; min-width: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.pg-ep { height: 28px; width: auto; }
/* narrow panel: only the current step keeps its name; the others show their number (name in the tooltip) */
.pgbar { container-type: inline-size; }
@container (max-width: 800px) { .pg-step:not(.on):not(.view) .pg-t { display: none; } .pg-step:not(.on):not(.view) { padding: 3px; } }

/* the home page's "Bắt đầu" checklist */
.start { border: 1px solid rgba(139,92,246,.45); background: linear-gradient(135deg, rgba(139,92,246,.1), rgba(236,72,153,.04) 60%, transparent), var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 22px; }
.start-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.start-head h2 { margin: 0; font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.start-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 10px; }
.start-step { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #1b1b1b; }
.start-step.done { opacity: .7; }
.start-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.start-step.done .start-n { background: rgba(110,231,183,.2); color: #6ee7b7; }
.start-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.45; min-width: 0; }
.start-txt span { color: var(--muted); }
.start-txt .btn { align-self: flex-start; margin-top: 5px; }
.start-ok { color: #6ee7b7; font-size: 12px; font-weight: 600; flex: none; }

/* Seedance scene length picker */
.len-pick { display: flex; flex-direction: column; gap: 8px; }
.len-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.len-opt:hover { border-color: #444; }
.len-opt:has(input:checked) { border-color: var(--brand); background: rgba(139,92,246,.08); }
.len-opt input { margin-top: 3px; accent-color: var(--brand); }
.len-opt b { display: block; font-size: 13.5px; }
.len-opt span { color: var(--muted); font-size: 12px; }

/* Duyệt kịch bản → Đồng bộ dàn ý: what the outline will lose, rename, gain */
.sync-plan { font-size: 13px; line-height: 1.5; }
.sync-plan p { margin: 0 0 8px; }
.sync-sum b { color: var(--text); }
.sync-part { margin: 0 0 10px; }
.sync-head { font-weight: 600; font-size: 12.5px; margin-bottom: 3px; }
.sync-part ul { margin: 0; padding-left: 18px; max-height: 168px; overflow-y: auto; }
.sync-part li { font-size: 12.5px; color: var(--muted); }
.sync-part li b { color: var(--text); font-weight: 600; }
.sync-line { font-size: 12.5px; color: var(--muted); }
.sync-ai { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  margin: 8px 0 0; cursor: pointer; font-size: 12.5px; }
.sync-ai:has(input:checked) { border-color: var(--brand); background: rgba(139,92,246,.08); }
.sync-ai input { margin-top: 3px; accent-color: var(--brand); flex: none; }
.sync-plan > .dim.sync-line { margin-top: 10px; }

/* Large dialog for the genre and world forms: form on the left, guide on the right, both filling the height */
.modal.xl { width: min(1320px, 100%); height: min(92vh, 1040px); max-height: 92vh;
  height: min(92dvh, 1040px, calc(100dvh - 40px - var(--kb, 0px))); max-height: min(92dvh, calc(100dvh - 40px - var(--kb, 0px))); }
.modal.xl .modal-head { padding: 18px 24px 12px; }
.modal.xl .modal-head h3 { font-size: 18px; }
.modal.xl .modal-body { flex: 1; min-height: 0; display: flex; overflow: hidden; padding: 4px 24px 16px; }
.modal.xl .modal-foot { padding: 14px 24px; }
.modal.xl .fg-modal { flex: 1; min-height: 0; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 22px; align-items: stretch; }
.modal.xl .fg-modal .form { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow: auto; padding-right: 2px; }
.modal.xl .fg-modal .fld > span { font-size: 13px; }
.fg-films { margin: 0; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.modal.xl .fg-modal .ctl { font-size: 15px; }
.modal.xl .fg-modal input.ctl { height: 42px; padding: 0 12px; }
.modal.xl .fg-modal input[type="file"].ctl { padding: 6px 12px; }  /* 42px tall: the 28px button sits in the middle */
.modal.xl .fg-modal textarea.ctl { padding: 10px 12px; line-height: 1.6; min-height: 150px; }
.modal.xl .fg-modal .fld:last-child { flex: 1; min-height: 240px; }
.modal.xl .fg-modal .fld:last-child textarea.ctl { flex: 1; resize: none; }
.modal.xl .fg-guide { max-height: none; min-height: 0; font-size: 13.5px; line-height: 1.6; padding: 12px 16px; }
.modal.xl .fg-guide[open] { height: 100%; }
.modal.xl .fg-guide:not([open]) { align-self: start; }
.modal.xl .fg-guide summary { font-size: 14px; }
.modal.xl .fg-guide h5 { font-size: 13.5px; margin: 14px 0 5px; }
.modal.xl .fg-guide ol, .modal.xl .fg-guide ul { gap: 4px; padding-left: 20px; }
@media (max-width: 760px) {
  .fg-modal { grid-template-columns: 1fr; }
  .modal.xl { height: auto; }
  .modal.xl .modal-body { display: block; overflow: auto; padding: 4px 16px 12px; }
  .modal.xl .fg-modal { grid-template-columns: 1fr; }
  .modal.xl .fg-modal .form { overflow: visible; }
  .modal.xl .fg-guide[open] { height: auto; }
}

/* cost tags: Claude usage or a paid image/video API call */
.costtag { display: inline-flex; align-items: center; margin-left: 6px; padding: 0 5px; height: 15px; border-radius: 999px; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; line-height: 1; vertical-align: middle; flex: none; }
.costtag-claude { background: rgba(217,119,87,.18); color: #f0a37f; }
.costtag-api { background: rgba(251,191,36,.16); color: #fbbf24; }
.btn.brand .costtag, .btn.primary .costtag { background: rgba(0,0,0,.28); color: #fff; }
.menu button .costtag { margin-left: 7px; }

/* chat replies: the next steps stand out, the technical part folds away */
.part-text h5.md-next { color: #c4b5fd; border-left: 3px solid var(--brand); padding-left: 8px; }
.part-text details.md-more { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #1a1a1a; }
.part-text details.md-more > summary { cursor: pointer; color: var(--dim); font-size: 12px; font-weight: 600; }
.part-text details.md-more[open] > summary { margin-bottom: 6px; }

/* setup: "Nâng cao" */
.adv-sum { font-weight: 400; font-size: 11.5px; }
.adv-box { border-left: 2px solid var(--line2); padding: 4px 0 2px 12px; margin-top: 4px; }

/* home: Genre DNA under "Nâng cao" */
.home-adv { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 14px; }
.home-adv > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--muted); }
.home-adv > summary::-webkit-details-marker { display: none; }
.home-adv > summary svg { transition: transform .15s; flex: none; }
.home-adv[open] > summary svg { transform: rotate(90deg); }
.home-adv > summary .dim { font-weight: 400; font-size: 12.5px; }

/* an episode's "Ảnh cần" list */
.needs { display: flex; flex-direction: column; gap: 6px; }
.need { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: #1b1b1b; }
.need.miss { border-color: rgba(251,191,36,.35); }
.need-th { width: 46px; height: 46px; border-radius: 8px; overflow: hidden; flex: none; display: grid; place-items: center; background: #242424; color: var(--dim); font-weight: 700; }
.need-th svg { width: 20px; height: 20px; }
.need-th img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.need-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.need-txt b { overflow-wrap: anywhere; }
.need-txt span { color: var(--dim); font-size: 11.5px; }
.need-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.need-ok { color: var(--ok); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.need-busy { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.need-busy .spin { width: 12px; height: 12px; }
.need-miss-n { color: #fbbf24; }

/* script: one passage at a time */
.script-hint { max-width: 760px; margin: 0 auto 6px; font-size: 11.5px; }
.script.editable .sblk { position: relative; margin: 0 -10px; padding: 1px 10px; border-radius: 6px; }
.script.editable .sblk:hover { background: rgba(139,92,246,.06); box-shadow: inset 0 0 0 1px rgba(139,92,246,.3); }
.script.editable .sblk.on { background: rgba(139,92,246,.09); box-shadow: inset 0 0 0 1px rgba(139,92,246,.55); }
.sblk-tools { position: absolute; bottom: 100%; margin-bottom: -4px; right: 8px; z-index: 3; display: none; gap: 1px; padding: 2px; background: #232323; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.script.editable .sblk:hover > .sblk-tools { display: flex; }
.sblk-tools .btn { height: 24px; padding: 0 7px; font-size: 11.5px; gap: 4px; font-style: normal; text-transform: none; letter-spacing: 0; color: var(--muted); }
.sblk-tools .btn:hover { color: var(--text); }
/* a beat heading: the whole-beat tools on a row above the passage's own (fits a narrow iPad column) */
.sblk-tools.rows { flex-direction: column; align-items: flex-end; }
.sblk-grp { display: flex; gap: inherit; }
/* the rest of a beat the assistant is asked to rewrite (panels.js, AI sửa cả nhịp): one band, no hover */
.script.editable .sblk.in-beat, .script.editable .sblk.in-beat:hover { background: rgba(139,92,246,.06); box-shadow: inset 2px 0 0 rgba(139,92,246,.55); border-radius: 0; }
.sblk-editor { margin: 6px -10px 14px; padding: 8px; border: 1px solid rgba(139,92,246,.55); border-radius: 8px; background: #1b1b1b; }
.sblk-editor textarea { width: 100%; font: inherit; font-size: 13.5px; line-height: 1.6; resize: vertical; }
.sblk-edit-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 11.5px; }

/* outline: one beat at a time */
.beats-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; }
.beats-tools .dim { flex: 1 1 220px; }
.beat-editor { padding: 8px 10px; border: 1px solid rgba(139,92,246,.55); border-radius: 8px; background: #1b1b1b; }
.beat-editor > textarea { width: 100%; font: inherit; font-size: 13px; line-height: 1.55; resize: vertical; }
.beat-form { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.beat-form label { flex: 1 1 140px; display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); min-width: 0; }
.beat-form label.w2 { flex: 2 1 240px; }
.beat-form label.full { flex-basis: 100%; }
.beat-form .ctl { font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
.beat-form textarea { resize: vertical; line-height: 1.5; }

/* asset cards: one field at a time */
.acard-sec[data-field], .prompt-box[data-field] { position: relative; }
.acard-sec[data-field] { margin: 0 -6px; padding: 2px 6px; border-radius: 6px; }
.acard-sec[data-field]:hover, .prompt-box[data-field]:hover { background: rgba(139,92,246,.06); }
.acard-sec[data-field]:hover > .sblk-tools, .prompt-box[data-field]:hover > .sblk-tools { display: flex; }
.acard-sec.on, .prompt-box.on { background: rgba(139,92,246,.08); box-shadow: inset 0 0 0 1px rgba(139,92,246,.45); }
.acard .sblk-editor, .items-ai .sblk-editor { margin: 6px 0 2px; }
.prompt-box .sblk-editor textarea { font-size: 12px; }
.acard-add { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 11.5px; }
.chip-add { display: inline-flex; align-items: center; gap: 3px; background: none; border: 1px dashed var(--line2); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.chip-add:hover { color: var(--text); border-color: var(--brand); }
.items-ai { margin-bottom: 12px; }
.empty .items-ai { width: min(520px, 100%); margin: 12px auto 0; text-align: left; }

/* world tab: one line at a time */
.wsec { margin-top: 16px; }
.wsec-h { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #c4b5fd; margin-bottom: 6px; }
.wsec-h .dim { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11.5px; }
.wlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.witem { position: relative; padding: 5px 8px; border-radius: 6px; font-size: 13px; line-height: 1.55; color: #d4d4d4; }
.wlist .witem { padding-left: 18px; }
.wlist .witem::before { content: ''; position: absolute; left: 7px; top: 13px; width: 4px; height: 4px; border-radius: 50%; background: #555; }
.wlist .witem.on::before { display: none; }
/* an item's details: the indented lines under it (a character's look, ways, motives…) */
.wsub { list-style: none; margin: 4px 0 2px; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.wsub li { font-size: 12.5px; line-height: 1.55; }
.witem:hover { background: rgba(139,92,246,.06); }
.witem:hover > .sblk-tools { display: flex; }
.witem.on { background: rgba(139,92,246,.08); box-shadow: inset 0 0 0 1px rgba(139,92,246,.45); }
.witem .badge { font-size: 10.5px; margin-right: 2px; }
.wtext.wname { font-size: 15px; font-weight: 700; color: var(--text); }
.witem .sblk-editor, .witem-new .sblk-editor, .wsec > .witem-new .sblk-editor { margin: 4px 0; }
.witem-new { list-style: none; }
.wsec-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.wempty { margin: 0; font-size: 12.5px; }

/* film genre: signature traits ("Dấu ấn riêng") */
.fg-traits { border: 1px solid rgba(139,92,246,.4); border-radius: 12px; padding: 12px 14px; background: rgba(139,92,246,.04); }
.tr-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #1b1b1b; }
.tr-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.tr-head .btn { opacity: .45; }
.tr:hover .tr-head .btn { opacity: 1; }
.badge.tr-must { background: rgba(139,92,246,.22); color: #ddd6fe; }
.tr-rule { font-size: 12.5px; line-height: 1.55; color: #d4d4d4; margin-top: 4px; white-space: pre-wrap; }
.tr-ex { font-size: 12px; line-height: 1.5; color: var(--muted); font-style: italic; margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--line2); white-space: pre-wrap; }
.tr-form { display: flex; flex-direction: column; gap: 6px; border-color: rgba(139,92,246,.55); }
.tr-form-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tr-form-row input { flex: 1 1 200px; }
.tr-form-row select { flex: 0 0 auto; width: auto; }
.tr-form textarea, .tr-ai textarea { width: 100%; resize: vertical; font: inherit; font-size: 12.5px; line-height: 1.5; }
.tr-form-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.tr-ai { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tr-busy { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.tr-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* Genre DNA editor: a centered window with tabs */
.dna-back { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.62); display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.dna-win { width: min(1040px, 100%); height: min(88vh, 920px); display: flex; flex-direction: column; background: #1b1b1b; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden; }
.dna-win-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dna-win-head h2 { margin: 0; font-size: 15px; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.dna-win-head .dna-ic { width: 30px; height: 30px; border-radius: 8px; }
.dna-tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dna-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 7px 12px 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.dna-tab:hover { color: var(--text); }
.dna-tab.on { color: #fff; border-bottom-color: var(--brand); }
.dna-tab .dim { font-weight: 500; font-size: 11.5px; margin-left: 3px; }
.dna-subtabs { display: flex; gap: 5px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #181818; }
.dna-sub { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; background: #232323; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dna-sub:hover { color: var(--text); border-color: #444; }
.dna-sub.on { background: rgba(139,92,246,.18); border-color: rgba(139,92,246,.6); color: #fff; }
.dna-sub.empty .id { color: var(--warn); }
.dna-sub .id { font: 700 10.5px ui-monospace, Consolas, monospace; color: var(--dim); }
.dna-win .dna-main { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; }
.dna-win .dna-block { max-width: none; }
.dna-win-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }

/* new genre DNA: what to make once it is written */
.dna-make { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #1b1b1b; display: flex; flex-direction: column; gap: 4px; }
.dna-make-h { font-size: 12px; font-weight: 700; color: var(--muted); }
.dna-make .check-row { align-self: stretch; margin: 0; width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 7px; font-size: 13px; text-align: left; color: var(--text); font-weight: 500; }
.dna-make .check-row input { width: auto; flex: none; margin: 0; }
.dna-make .check-row .dim { font-size: 11.5px; }
.dna-made { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* characters tab: reference layout picker */
.r-head .ref-layout { width: auto; height: 30px; font-size: 12px; padding: 0 8px; }

/* Kho visual */
.pcard .thumb .vk-cover { width: 100%; height: 100%; object-fit: cover; }
.pcard .thumb { overflow: hidden; }
.pcard .thumb.lib { height: 170px; }
.pcard .thumb.lib .vk-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 28%; }  /* square portraits: keep the face */
.thumb-btn { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s; }
.pcard:hover .thumb-btn { opacity: 1; }
.thumb-busy { position: absolute; left: 8px; bottom: 8px; display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; }
.vk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.vk-thumb { position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #1b1b1b; aspect-ratio: 4 / 3; }
.vk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vk-thumb .badge { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; }
.vk-thumb [data-vk-del] { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); opacity: 0; }
.vk-thumb:hover [data-vk-del] { opacity: 1; }
.vk-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 4 / 3; border: 1px dashed var(--line2); border-radius: 9px; color: var(--muted); font-size: 12px; cursor: pointer; }
.vk-add:hover { color: var(--text); border-color: var(--brand); }
.vk-videos { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.vk-videos a { color: var(--muted); }
.vk-learn { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tr-heavy { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.bd-note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 8px 10px; margin-bottom: 8px; border: 1px dashed var(--line); border-radius: 10px; }
.bd-note .bd-err { color: var(--warn); }
/* Storyboard → Tạo tất cả: the run's bar (panels.js sbRunHTML), the frames it left out under it */
.sbr .sbr-skip { flex-basis: 100%; }
.sbr .sbr-skip summary { cursor: pointer; color: var(--warn); }
.sbr .sbr-skip ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; max-height: 220px; overflow: auto; }
.stale-note { border-color: rgba(245, 158, 11, .45); color: var(--text); }
.pg-check { display: block; margin-top: 2px; font-size: 11.5px; color: var(--dim); }
.refs-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 4px; border-bottom: 1px solid var(--line); }
.refs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.refs-row .ttl { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.refs-count { font-size: 12.5px; color: var(--muted); }
.refs-needs { max-height: 46vh; overflow: auto; }
.ref-kinds { align-self: flex-start; margin-bottom: 8px; }
.ref-kinds .count { font-size: 10.5px; color: var(--dim); margin-left: 4px; }
.ep.ep-solo, .ep.ep-solo:hover { border: 0; background: none; box-shadow: none; }  /* no frame around a whole tab */
.ep.ep-solo > .ep-body { padding: 0; border: 0; }
.ep-pick { max-width: 62%; overflow-x: auto; flex-wrap: nowrap; }
.ep-pick button { white-space: nowrap; }
.badge.ep-go { cursor: pointer; border: 0; font: inherit; }
.vk-report { display: flex; flex-direction: column; gap: 4px; font-size: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.vk-notes { font-size: 12px; margin-bottom: 8px; }
.vk-notes > summary { cursor: pointer; color: var(--muted); }
.vk-note { margin-top: 8px; }
.vk-note-head { font-weight: 600; margin-bottom: 4px; }
[data-vk-locks] { display: flex; flex-direction: column; gap: 8px; }
.vk-vi { font-size: 12.5px; margin: 0 0 10px; grid-column: 1 / -1; }
.vk-vi > summary, .vk-orig > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.vk-vi > summary { padding: 2px 0; }
.vk-vi > div { margin-top: 6px; padding: 10px 12px; color: var(--text); line-height: 1.55; background: #1f1f1f;
  border: 1px solid var(--line); border-radius: 8px; }
.vk-orig { margin-top: 4px; }
.vk-note pre { white-space: pre-wrap; font: inherit; color: var(--muted); max-height: 220px; overflow: auto; margin: 0; padding: 8px; border-radius: 8px; background: var(--bg2, rgba(127,127,127,.08)); }
.vk-learn .ctl { flex: 1 1 260px; }
.modal.xl .vk-modal { flex: 1; min-height: 0; overflow: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- iPad and other touch screens, narrow windows ---------- */
/* the assistant column hidden ("Ẩn Trợ lý" in the top bar, app.js): the work panel takes the whole width */
.tb-left > .btn { flex: none; }
.proj-name { min-width: 0; }
.chat-toggle { margin-left: auto; }
#app.chat-off .left, #app.chat-off .resizer { display: none; }
#app.chat-off .tb-left { width: auto; min-width: 0; }
.resizer { touch-action: none; }
@media (max-width: 900px) { .left, .tb-left { min-width: 300px; } }
/* the step bar scrolls to the page on screen (panels.js showStep); a very narrow one names only that page */
.pg-steps { position: relative; scrollbar-width: none; }
.pg-steps::-webkit-scrollbar { display: none; }
@container (max-width: 520px) { .pg-step.on:not(.view) .pg-t { display: none; } .pg-step.on:not(.view) { padding: 3px; } }
/* the project board's header: a narrow screen puts the title and the close button on the first line, the export
   buttons under it (they need about 1,100px in one row) */
.board-head { height: auto; min-height: 56px; flex-wrap: wrap; row-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
.board-head > * { flex-shrink: 0; }
.board-head h2 { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1280px) {
  .board-head h2 { flex: 1 1 calc(100% - 120px); }
  .board-head [data-close] { order: 1; }
  .board-head > .btn:not([data-close]) { order: 2; }
}
/* the on-screen keyboard (touch.js sets --kb while it is open): dialogs end above it */
.modal-back { bottom: var(--kb, 0px); }
/* a long press shows an element's title (touch.js longPressTips) */
.tap-tip { position: fixed; z-index: 90; max-width: min(360px, calc(100vw - 16px)); max-height: 40vh; overflow: auto; padding: 8px 11px; border-radius: 9px; background: #2b2b2b; color: var(--text); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; pointer-events: none; animation: fade .1s; }
@media (hover: none) {
  button[title], a[title], [role="button"][title], .badge[title], .pg-step { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}
/* a tapped block shows its tools (panels.js); with no hover, a faint ⋯ marks the blocks that have them */
.touch-on > .sblk-tools { display: flex; }
@media (hover: none) {
  .script.editable .sblk:not(.on), .beat:not(.on), .acard-sec[data-field]:not(.on), .prompt-box[data-field]:not(.on), .witem:not(.on) { padding-right: 30px; }
  .script.editable .sblk:not(.on)::after, .beat:not(.on)::after, .acard-sec[data-field]:not(.on)::after,
  .prompt-box[data-field]:not(.on)::after, .witem:not(.on)::after {
    content: "⋯"; position: absolute; top: 3px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid;
    place-items: center; font-size: 14px; line-height: 1; color: var(--dim); background: rgba(127,127,127,.1); pointer-events: none;
  }
  .touch-on::after { color: var(--text) !important; background: rgba(139,92,246,.35) !important; }
  .thumb-btn, .vk-thumb [data-vk-del] { opacity: .85; }
  .ep-actions, .card-acts, .scene-top .btn, .tr-head .btn { opacity: 1; }
}
/* finger-sized buttons and fields (Apple asks for about 44 points); a mouse keeps the compact sizes */
@media (pointer: coarse) {
  .btn { height: 38px; padding: 0 14px; }
  .btn.sm { height: 34px; padding: 0 11px; }
  .btn.icon { width: 38px; padding: 0; }
  .btn.sm.icon { width: 34px; }
  .sblk-tools { gap: 4px; padding: 4px; }
  .sblk-tools .btn { height: 34px; padding: 0 10px; }
  .ctl { height: 38px; }
  textarea.ctl { height: auto; }
  .seg button { padding: 8px 13px; }
  .chip { padding: 6px 12px; }
  .chip-add { padding: 7px 12px; }
  .menu button { padding: 11px 12px; }
  .send { width: 40px; height: 40px; }
  .pg-step { padding: 5px 11px 5px 5px; }
  .pg-n { width: 24px; height: 24px; }
  .thumb-btn { width: 36px; height: 36px; }
  .mc-a, .sdc-foot, .ep-actions, .card-acts, .mu-row { gap: 8px; }
  .check-row input, input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .badge.ep-go { padding: 6px 11px; font-size: 11.5px; }
  .label-tag[data-act] { padding: 5px 9px; }
  .switch { width: 44px; height: 26px; }
  .switch::after { width: 20px; height: 20px; }
  .switch.on::after { transform: translateX(18px); }
  summary { padding-top: 6px; padding-bottom: 6px; }
  /* the divider: a wider strip to grab, with a grip in the middle */
  .resizer { width: 20px; margin: 0 -10px; }
  .resizer::after { left: 9px; }
  .resizer::before { content: ""; position: absolute; top: 50%; left: 6px; width: 8px; height: 44px; margin-top: -22px; border-radius: 4px; background: #3a3a3a; z-index: 1; }
}
