:root {
  --bg: #0f0f12;
  --panel: #17171c;
  --panel-2: #1e1e25;
  --line: #2a2a33;
  --text: #ececf1;
  --muted: #9a9aa8;
  --faint: #6b6b78;
  --accent: #e8b04a;
  --accent-ink: #1a1305;
  --user: #262633;
  --ok: #6fcf97;
  --danger: #eb5757;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; }
input, textarea { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
.btn { background: var(--accent); color: var(--accent-ink); padding: 9px 16px; font-weight: 600; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }
.btn-ghost:hover { color: var(--text); border-color: var(--faint); }

/* ---------- home ---------- */
.home { max-width: 880px; margin: 0 auto; padding: 56px 24px; }
.brand { font-family: var(--serif); font-size: 34px; letter-spacing: .2px; margin: 0 0 4px; }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); margin: 0 0 36px; }
.new-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 40px; }
.new-card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.new-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.new-row label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.new-row .grow { flex: 1; min-width: 220px; }
.new-row input.num { width: 96px; }
.note { font-size: 12px; color: var(--faint); margin-top: 10px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); margin: 0 0 12px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s; }
.pcard:hover { border-color: var(--accent); }
.pcard h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.pcard .meta { color: var(--muted); font-size: 12px; }
.empty { color: var(--faint); }

/* ---------- project ---------- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 18px; height: 52px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar .back { color: var(--muted); font-size: 13px; }
.topbar .back:hover { color: var(--text); }
.topbar .title { font-family: var(--serif); font-size: 19px; }
.tabs { display: flex; gap: 4px; margin-left: 10px; }
.tab { padding: 6px 14px; border-radius: 7px; color: var(--muted); font-size: 14px; }
.tab.active { background: var(--panel-2); color: var(--text); }
.format { margin-left: auto; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.format b { color: var(--text); font-weight: 600; }
.format input { width: 62px; padding: 4px 6px; font-size: 12px; }

.workspace { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(380px, 46%); min-height: 0; }
.workspace[hidden] { display: none; }
.badge[hidden] { display: none; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.banner { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin: 10px 20px 0; padding: 8px 8px 8px 14px; border: 1px solid rgba(235,87,87,.4); background: rgba(235,87,87,.08); border-radius: 8px; font-size: 13px; color: var(--muted); }
.banner b { color: var(--text); }
.stale-note { border: 1px solid rgba(235,87,87,.4); background: rgba(235,87,87,.08); border-radius: 8px; padding: 10px 14px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.stale-note b { color: var(--text); }
.stale-note ul { margin: 6px 0 0; padding-left: 18px; }

/* chat */
.chat { display: grid; grid-template-rows: 1fr auto; min-height: 0; border-right: 1px solid var(--line); }
.messages { overflow-y: auto; padding: 24px 28px 12px; }
.msg { margin: 0 0 18px; max-width: 760px; }
.msg.user { margin-left: auto; background: var(--user); padding: 10px 14px; border-radius: 12px 12px 4px 12px; width: fit-content; max-width: 80%; white-space: pre-wrap; }
.msg.assistant .who { font-size: 12px; color: var(--accent); margin-bottom: 4px; font-weight: 600; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md h1, .md h2, .md h3 { font-family: var(--serif); font-weight: 500; margin: 14px 0 6px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
.md strong { color: #fff; }
.md code { font-family: var(--mono); font-size: 13px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.md blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 4px 3px 10px; color: var(--muted); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chip.deleted .dot { background: var(--danger); }
.chip a { color: var(--text); cursor: pointer; }
.chip button { background: transparent; color: var(--faint); font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.chip button:hover { color: var(--text); background: var(--line); }
.chip.undone { opacity: .45; }
.chip.undone button { display: none; }
.chip.reviewed { padding-right: 10px; }
.chip.reviewed .dot { background: var(--faint); }
.chip.working { padding-right: 10px; color: var(--text); }
.chip.working .dot { background: var(--accent); animation: blink 1s steps(2) infinite; }
.cursor::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.err { color: var(--danger); font-size: 13px; }

.starters { max-width: 640px; margin: 40px auto 0; text-align: center; color: var(--muted); }
.starters h2 { font-family: var(--serif); font-weight: 500; color: var(--text); font-size: 24px; margin: 0 0 6px; }
.starters .list { display: grid; gap: 8px; margin-top: 22px; text-align: left; }
.starters button { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 12px 14px; text-align: left; border-radius: var(--radius); }
.starters button:hover { border-color: var(--accent); }

.bottom { border-top: 1px solid var(--line); }
.composer { padding: 12px 20px 18px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 240px; line-height: 1.45; }
.composer .btn { height: 46px; }
.btn-stop { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); height: 46px; padding: 0 16px; }

/* bible */
.bible { display: grid; grid-template-columns: 190px 1fr; min-height: 0; background: var(--panel); }
.files { border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 8px; }
.files .group { font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--faint); padding: 12px 10px 6px; }
.file { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; color: var(--muted); padding: 7px 10px; text-align: left; font-size: 14px; border-radius: 7px; }
.file:hover { color: var(--text); background: var(--panel-2); }
.file.active { color: var(--text); background: var(--panel-2); }
.file .state { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; }
.file.filled .state { background: var(--accent); }
.file.stale .state { background: var(--danger); }
.file.none { cursor: default; color: var(--faint); }
.file.none:hover { background: transparent; color: var(--faint); }
.file .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: rgba(232,176,74,.35); } 100% { background: transparent; } }
.viewer { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.viewer-head .name { font-weight: 600; margin-right: auto; }
.viewer-body { overflow-y: auto; padding: 18px 22px 40px; }
.viewer-body textarea { width: 100%; height: 100%; min-height: 60vh; font-family: var(--mono); font-size: 13px; resize: none; }
.viewer-body .placeholder { color: var(--faint); font-style: italic; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 45vh; }
  .chat { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- characters ---------- */
.workspace.chars { grid-template-columns: 220px 1fr; }
.cast { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; }
.cast .files { border: 0; padding: 14px 8px; }
.file .count { margin-left: auto; font-size: 11px; color: var(--faint); }
.sheet-view { overflow-y: auto; padding: 22px 28px 60px; }
.sheet-view > * { max-width: 1100px; }
.sheet-empty { color: var(--faint); margin-top: 40px; }
.look-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.look-row label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.look-row input { flex: 1; }
.hint { font-size: 12px; color: var(--faint); font-weight: 400; }
.cname { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 6px 0 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.card .row.end { justify-content: flex-end; margin-bottom: 0; }
.card textarea { width: 100%; resize: vertical; font-size: 13px; line-height: 1.5; }
.card textarea.prompt { min-height: 230px; font-family: var(--mono); font-size: 12.5px; }
.btn-ghost.upload { cursor: pointer; }
.btn-ghost.upload.disabled { opacity: .4; pointer-events: none; }
.btn-ghost.danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-ghost:disabled { opacity: .4; cursor: default; }
.img-slot { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 2; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; color: var(--faint); font-size: 13px; gap: 10px; }
.base-slot .img-slot { max-width: 900px; }
.img-slot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.img-slot.pending { color: var(--muted); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.variant { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.variant .v-body { margin-top: 8px; }
.variant .v-title { font-weight: 600; }
.variant .v-text { font-size: 13px; color: var(--muted); margin-top: 2px; }
.variant .row { margin: 8px 0 0; }
.variant input, .variant textarea { width: 100%; margin-bottom: 6px; }
.warn { font-size: 12px; color: var(--accent); margin-top: 4px; }
.add-variant { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }

/* ---------- environments ---------- */
.custom-panel { overflow-y: auto; background: var(--bg); min-height: 0; position: relative; }
.env-wrap { padding: 18px 20px 60px; }
.env-toolbar { max-width: 1400px; margin-bottom: 18px; }
.env-toolbar .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.env-toolbar .banner { margin: 12px 0 0; }
.toggle { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.env-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.env-card.unused { opacity: .5; }
.env-card .img-slot { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.env-card .img-slot.pending { cursor: default; }
.env-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.env-name { font-weight: 600; }
.env-meta { font-size: 12px; color: var(--muted); }
.env-body .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 10; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; width: min(980px, 100%); display: grid; gap: 8px; }
.modal-head { display: flex; align-items: baseline; gap: 12px; }
.modal-head .act-close { margin-left: auto; }
.m-name { font-family: var(--serif); font-weight: 500; font-size: 22px; }
.m-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.modal-box textarea { width: 100%; resize: vertical; font-size: 13px; }
.modal-box .m-prompt { font-family: var(--mono); font-size: 12.5px; }
.modal-box .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
[hidden] { display: none !important; }

/* ---------- video ---------- */
.video-view { overflow-y: auto; padding: 22px 28px 60px; }
.video-view > * { max-width: 1100px; }
.ep-sum { margin: -8px 0 14px; font-size: 13px; }
.vid-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.vid-toolbar label { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
select { font: inherit; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.video-view .banner { margin: 0 0 16px; }
.file.done .state { background: var(--ok); }
.file.busy .state { background: var(--accent); animation: blink 1s steps(2) infinite; }
.cast-row { display: grid; grid-template-columns: 96px minmax(0, 360px); gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cast-row:first-of-type { border-top: 0; }
.cast-thumb { width: 96px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.cast-thumb.empty { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--faint); background: var(--panel-2); }
.cast-main { display: grid; gap: 6px; }
.cast-name { font-weight: 600; }
.cast-row .voice { width: 100%; font-size: 13px; }
.seg .card-head { flex-wrap: wrap; }
.dur { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.dur input { width: 64px; padding: 4px 6px; font-size: 13px; }
.refs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ref { width: 120px; font-size: 11px; color: var(--muted); }
.ref img, .ref-empty { width: 120px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; margin-bottom: 4px; }
.ref-empty { display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--faint); }
.ref.missing span { color: var(--danger); }
.excerpt { margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.excerpt summary { cursor: pointer; }
.excerpt pre, pre.fixed { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; color: var(--muted); }
.seg textarea.body { width: 100%; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.takes { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.take { width: 220px; display: grid; gap: 6px; }
.take video, .take-box { width: 220px; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; border: 1px solid var(--line); }
.take.chosen video { border: 2px solid var(--accent); }
.take-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--panel-2); color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }
.bar { width: 80%; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.take-meta { font-size: 11px; color: var(--faint); }
.take .row { margin: 0; gap: 6px; }
.chosen-tag { font-size: 12px; color: var(--accent); font-weight: 600; }

.tag { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: middle; }
.env-card.child { border-left: 3px solid var(--accent); }
.env-card.flash { animation: flash 1.6s ease-out; }
.warn-inline { color: var(--accent); }
.m-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.m-grid > div { display: grid; gap: 6px; align-content: start; }
.modal-box .m-desc { font-family: var(--mono); font-size: 12.5px; }
.modal-box select { width: 100%; }
.seg .m-label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
@media (max-width: 900px) { .m-grid { grid-template-columns: 1fr; } }

.img-slot.sq { aspect-ratio: 1 / 1; }
.m-image.sq .img-slot { max-width: 420px; margin: 0 auto; }
.props-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ref-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; margin-bottom: 6px; }
.ref-row input, .ref-row select { width: 100%; font-size: 12.5px; padding: 6px 8px; }
.ok-total { color: var(--ok); font-weight: 600; }
.bad-total { color: var(--danger); font-weight: 600; }
.voice-slot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.voice-slot audio, .cast-main audio { height: 32px; max-width: 100%; }
.audio-refs { margin: -4px 0 10px; }

.msg.user { position: relative; }
.msg.user .edit-msg { position: absolute; left: -46px; top: 50%; transform: translateY(-50%); background: transparent; color: var(--faint); font-size: 12px; padding: 2px 6px; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.msg.user:hover .edit-msg { opacity: 1; }
.msg.user .edit-msg:hover { color: var(--text); background: var(--panel-2); }
.msg.will-drop { opacity: .35; }
.edit-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 20px 0; padding: 6px 8px 6px 14px; border: 1px solid var(--accent); border-radius: 8px; font-size: 13px; color: var(--muted); }
.prompt-modal pre, .hist-modal pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; max-height: 60vh; overflow: auto; }
.prompt-modal .pm-params { max-height: 30vh; }
.prompt-modal .modal-head .pm-copy { margin-left: auto; }
.prompt-modal .modal-head .pm-close { margin-left: 0; }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 20px 0; }
.att { position: relative; }
.att img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.att button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); font-size: 10px; padding: 0; }
.composer .attach { height: 46px; display: flex; align-items: center; font-size: 16px; padding: 0 10px; cursor: pointer; }
.msg-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-imgs img { height: 120px; max-width: 220px; object-fit: cover; border-radius: 8px; display: block; }
.chat.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }
.seg input.sound { width: 100%; font-size: 13px; margin-bottom: 4px; }
.blocking-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -2px 0 10px; }
.blocking-row details { flex-basis: 100%; }
.blocking-row textarea.positions { width: 100%; font-family: var(--mono); font-size: 12px; margin-top: 6px; }
.ref.blocking-ref .ref-empty { gap: 8px; }

/* History */
.workspace.hist { display: block; overflow-y: auto; padding: 22px 28px 60px; }
.workspace.hist[hidden] { display: none; }
.hist-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.hist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.hist-card { display: grid; gap: 6px; }
.hist-card video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; border: 1px solid var(--line); }
.hist-card.chosen video { border: 2px solid var(--accent); }
.hist-card .row { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-more { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; }
.ref video { width: 120px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; margin-bottom: 4px; background: #000; }

.ref.ref-switch { cursor: pointer; }
.ref.ref-switch img { outline: 2px solid var(--accent); outline-offset: -2px; }
.ref.ref-switch.off img { outline: none; opacity: .3; filter: grayscale(1); }

.direction { margin: 10px 0; display: grid; gap: 6px; }
.dir-switch { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.direction textarea.shots { width: 100%; font-family: var(--mono); font-size: 12.5px; }

/* Test tab */
.tsec > summary { cursor: pointer; padding: 2px 0 8px; }
.ttable { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.ttable th, .ttable td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.ttable th { color: var(--muted); font-weight: 600; }
.tscroll { overflow-x: auto; margin-bottom: 14px; }
.ttable.states td, .ttable.states th { min-width: 190px; }
.ttable.states tr > th:first-child { min-width: 80px; position: sticky; left: 0; background: var(--panel); }
.ttable td.off { opacity: .45; }
.ttable td.moved { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tag-inf { font-size: 11px; color: var(--accent); }
.tclip { border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 4px; font-size: 13px; }
.tdlg { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; margin: 0; }
.tckpts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tckpt { display: grid; gap: 6px; font-size: 13px; align-content: start; }
.tck-img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; }
.tjob textarea.tprompt, .tslot-req textarea.tslot-prompt { width: 100%; font-family: var(--mono); font-size: 12px; }
.warn-inline { color: var(--accent); font-size: 12px; }
.test-view .stage-note { width: 100%; margin: 8px 0; }
.ref.ref-switch video { outline: 2px solid var(--accent); outline-offset: -2px; }
.ref.ref-switch.off video { outline: none; opacity: .3; filter: grayscale(1); }

/* Sandbox */
.sbx-form { display: grid; gap: 8px; margin: 14px 0 22px; }
.sbx-form .sbx-prompt { width: 100%; font-family: var(--mono); font-size: 12.5px; }
.sbx-form .sbx-dur { width: 64px; }
.sbx-form .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sbx-selected .ref .row { display: flex; gap: 4px; margin-top: 4px; }
.sbx-selected .ref .row button { padding: 2px 8px; }
.sbx-tag { cursor: pointer; text-decoration: underline dotted; }
.sbx-picker > summary { cursor: pointer; padding: 4px 0; }

.tdirect { display: grid; gap: 6px; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.tdirect .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tdirect .tdir-note { flex: 1; min-width: 220px; }

.tobs { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
.tobs-sheet { width: 160px; border-radius: 6px; border: 1px solid var(--line); display: block; }

details.told { flex-basis: 100%; margin-top: 6px; }
details.told > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
details.told .take { opacity: .8; }

.tblock { margin: 22px 0 8px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 6px; display: grid; gap: 6px; }
.tblock .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tblock .tblock-note { flex: 1; min-width: 220px; }

.tshots { display: grid; gap: 4px; }
.tshots img { width: 100%; border-radius: 6px; border: 1px solid var(--line); display: block; }

.sbx-form .ref { position: relative; }
.sbx-form .ref video { width: 120px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; margin-bottom: 4px; background: #000; }
.sbx-form .act-unup { position: absolute; top: 4px; right: 4px; padding: 0 6px; font-size: 12px; background: var(--panel); }

.tgreys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 8px 0 16px; }
.tgrey { display: grid; gap: 6px; align-content: start; }
.tgrey .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tgrey textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
.tleg { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.tleg i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.style-tab { max-width: 820px; } .style-tab textarea { width: 100%; }

.pgroup { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.pgroup > summary { cursor: pointer; padding: 10px 14px; }
.pgroup > .env-grid { padding: 0 14px 14px; }
.sheet-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.sheet-tools input { flex: 1; min-width: 220px; }

.tslot { background: #3a1a2b; border-color: #c2507f; }
.tslot .tslot-note { background: #2a1320; border: 1px solid #c2507f; border-radius: 8px; padding: 8px 10px; margin: 6px 0; font-style: italic; }
.tslot-req { border-top: 1px dashed #c2507f; padding-top: 10px; margin-top: 10px; }
.tslot-req .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tslot-req input.tslot-sec { width: 60px; }
.tslot-req textarea { width: 100%; }

.voice-design { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.voice-design textarea { width: 100%; }
.vd-previews { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0; }
.vd-preview { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* accounts */
.userbar { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.home-userbar { position: absolute; top: 14px; right: 18px; }
.ub-cog { font-size: 18px; color: var(--muted); }
.ub-cog:hover { color: var(--accent); }
.login .new-card { max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ro-banner { background: #2b2614; color: var(--accent); font-size: 13px; padding: 6px 18px; border-bottom: 1px solid var(--line); }
.workspace.readonly .composer { display: none; }
.admin-page, .cost-tab { max-width: 1100px; margin: 0 auto; }
.admin-page .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-card .user-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-card .grow { flex: 1; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.pill.off { background: var(--danger); color: #fff; }
.cost-top { display: flex; align-items: center; gap: 14px; }
.cost-top select, .admin-page select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.cost-total { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 14px; }
.cost-total b { font-size: 30px; font-family: var(--serif); }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.cost-table th, .cost-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cost-table th { color: var(--muted); font-weight: 500; }
.cost-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table.keys input { width: 100%; }
.cost-api > summary { display: flex; gap: 12px; align-items: baseline; cursor: pointer; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cost-api > summary .hint { flex: 1; }
.access td, .access th { text-align: center; }
.access td:first-child, .access th:first-child { text-align: left; }
