/* THE SET · FRVR Club brand v3 — chrome · black · red · white */
:root {
  --void: #050506; --black: #0A0A0B; --panel: #121214; --panel-2: #0E0E10; --panel-3: #17171A;
  --line: #242428; --line-2: #2F2F34; --line-soft: rgba(244, 243, 240, 0.08);
  --red: #D42A2A; --red-bright: #FF3B30; --crimson: #8E1212;
  --red-glow: rgba(212, 42, 42, 0.38); --red-soft: rgba(212, 42, 42, 0.12);
  --white: #F4F3F0; --dim: #A0A0A6; --ash: #6E6E74;
  --chrome-hi: #ECEEF2; --chrome-mid: #9AA0A8; --chrome-lo: #565A60;
  --chrome-grad: linear-gradient(178deg, var(--chrome-hi) 8%, var(--chrome-mid) 42%, var(--chrome-lo) 55%, var(--chrome-hi) 92%);
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --top: 54px; --rail: 236px; --side: 392px; --strip: 132px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--void); color: var(--white); font-family: var(--font-body); font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
::selection { background: var(--red); color: var(--void); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); }
.red { color: var(--red); }
.dim { color: var(--dim); }
.ash { color: var(--ash); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26262b; border-radius: 10px; border: 2px solid var(--void); }
::-webkit-scrollbar-track { background: transparent; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes sweep { 100% { background-position: 300% 0 } }

/* ── gate ── */
#gate { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px;
  background: radial-gradient(ellipse 70% 55% at 50% 28%, rgba(142, 18, 18, .28), transparent 70%), var(--void); }
#gate .bfly { width: 132px; filter: grayscale(1) contrast(1.25) brightness(1.15); margin-bottom: 18px; opacity: .92; }
#gate .gk { font-family: var(--font-mono); font-size: 11px; letter-spacing: .3em; color: var(--red); text-transform: uppercase; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
#gate .gk i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1.8s infinite; }
#gate h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(54px, 10vw, 112px); line-height: .86; text-transform: uppercase; letter-spacing: .01em; }
#gate h1 span { background: var(--chrome-grad); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: sweep 9s linear infinite; }
#gate p { color: var(--dim); font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; margin: 16px 0 26px; text-transform: uppercase; }
#gate .row { display: flex; gap: 10px; }
#gcode { background: var(--panel); border: 1px solid var(--line); padding: 14px 18px; border-radius: 3px; width: 220px; text-align: center; font-family: var(--font-mono); letter-spacing: .3em; text-transform: uppercase; outline: none; }
#gcode:focus { border-color: var(--red); }
#gerr { color: var(--red-bright); font-family: var(--font-mono); font-size: 12px; margin-top: 12px; height: 16px; opacity: 0; transition: opacity .2s; }

/* ── buttons + fields ── */
.btn { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 10px 16px; border-radius: 3px; border: 1px solid var(--line); color: var(--white); background: var(--panel); transition: all .16s; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--chrome-lo); background: var(--panel-3); }
.btn.sm { padding: 7px 11px; font-size: 9.5px; }
.btn.xs { padding: 4px 8px; font-size: 9px; letter-spacing: .08em; }
.btn-red { background: var(--red); border-color: var(--red); color: var(--void); }
.btn-red:hover { background: var(--red-bright); border-color: var(--red-bright); box-shadow: 0 0 22px var(--red-glow); }
.btn-ghost { background: transparent; }
.btn-chrome { background: var(--chrome-grad); background-size: 300% 100%; color: var(--void); border-color: var(--chrome-mid); }
.btn-chrome:hover { animation: sweep 3s linear infinite; }
.btn:disabled { opacity: .4; pointer-events: none; }
.ibtn { width: 32px; height: 32px; border-radius: 3px; border: 1px solid var(--line); color: var(--dim); display: inline-grid; place-items: center; font-size: 15px; transition: all .15s; }
.ibtn:hover { color: var(--white); border-color: var(--chrome-lo); }
.ibtn.on { color: var(--void); background: var(--red); border-color: var(--red); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ash); }
.in, .field input, .field select, .field textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: 7px 9px; outline: none; font-size: 12.5px; min-width: 0; }
.field textarea { resize: vertical; min-height: 56px; line-height: 1.45; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--red); }
select option { background: var(--panel); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 5px 8px; border-radius: 3px; border: 1px solid var(--line); color: var(--dim); background: var(--panel-2); }
.seg button:hover { color: var(--white); border-color: var(--chrome-lo); }
.seg button.on { color: var(--white); border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px rgba(212, 42, 42, .25); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; border: 1px solid var(--line-2); color: var(--dim); white-space: nowrap; }
.chip.red { border-color: rgba(212, 42, 42, .55); color: var(--red-bright); background: var(--red-soft); }
.chip.chrome { border-color: var(--chrome-lo); color: var(--chrome-hi); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.kbd { font-family: var(--font-mono); font-size: 9px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; color: var(--dim); }
.sect-h { font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--red); display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 8px; }
.sect-h:first-child { margin-top: 0; }
.hr { height: 1px; background: var(--line-soft); margin: 12px 0; }
.empty { color: var(--ash); font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 4px; }
.title { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; line-height: .95; }

/* ── app shell ── */
.app { position: fixed; inset: 0; display: grid; grid-template-rows: var(--top) 1fr; }
.top { display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0c0c0e, var(--black)); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 30px; filter: grayscale(1) contrast(1.3) brightness(1.2); }
.brand b { font-family: var(--font-display); font-weight: 400; font-size: 21px; letter-spacing: .04em; line-height: 1; display: block; }
.brand b span { color: var(--red); }
.brand small { font-family: var(--font-mono); font-size: 7.5px; letter-spacing: .24em; color: var(--ash); text-transform: uppercase; display: block; margin-top: 3px; }
.proj { border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px; max-width: 220px; display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; }
.proj:hover { border-color: var(--chrome-lo); color: var(--white); }
.proj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin-left: 6px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ash); padding: 0 12px; height: 100%; position: relative; white-space: nowrap; }
.tabs button:hover { color: var(--white); }
.tabs button.on { color: var(--white); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--red); box-shadow: 0 0 12px var(--red-glow); }
.tabs button i { font-style: normal; color: var(--red); margin-left: 5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.save { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .18em; color: var(--ash); min-width: 58px; text-align: right; }
.save.dirty { color: var(--red); }
.body { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 0; }
.body.norail { grid-template-columns: 0 1fr; }
.rail { border-right: 1px solid var(--line); background: var(--black); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.rail-h { padding: 12px 12px 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rail-h b { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em; color: var(--ash); text-transform: uppercase; font-weight: 700; }
.scenes { overflow-y: auto; padding: 0 8px 12px; flex: 1; }
.scn { display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 8px; border-radius: 4px; border: 1px solid transparent; cursor: pointer; margin-bottom: 2px; }
.scn:hover { background: var(--panel-2); }
.scn.on { background: var(--panel); border-color: var(--line-2); box-shadow: inset 2px 0 0 var(--red); }
.scn .n { font-family: var(--font-display); font-size: 20px; line-height: 1; color: var(--chrome-mid); text-align: right; }
.scn.on .n { color: var(--red); }
.scn .h { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .02em; line-height: 1.35; color: var(--white); text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.scn .m { display: flex; align-items: center; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.scn .m .dot { width: 6px; height: 6px; }
.scn .m em { font-style: normal; font-family: var(--font-mono); font-size: 8.5px; color: var(--ash); letter-spacing: .06em; margin-left: auto; }
.views { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; min-height: 0; }
.view.on { display: block; animation: rise .25s ease-out; }
.scroll { position: absolute; inset: 0; overflow: auto; }
.pad { padding: 22px 26px 60px; max-width: 1280px; margin: 0 auto; }
.vhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.vhead .eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: .24em; color: var(--red); text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.vhead h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 4vw, 46px); line-height: .92; text-transform: uppercase; }
.vhead .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── welcome / script ── */
.hero-drop { border: 1px dashed var(--line-2); border-radius: 8px; padding: 42px 26px; text-align: center; background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(212, 42, 42, .08), transparent 70%), var(--panel-2); transition: all .2s; }
.hero-drop:hover, .hero-drop.over { border-color: var(--red); }
.hero-drop h3 { font-family: var(--font-display); font-weight: 400; font-size: 34px; text-transform: uppercase; line-height: 1; margin-bottom: 8px; }
.hero-drop p { color: var(--dim); max-width: 60ch; margin: 0 auto 18px; }
.formats { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.card h4 { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.card p { color: var(--dim); font-size: 12.5px; }
.script-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.page { background: #0d0d0f; border: 1px solid var(--line); border-radius: 4px; padding: 38px 0 60px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; position: relative; }
.el { position: relative; padding: 0 64px 0 72px; cursor: text; border-left: 2px solid transparent; }
.el:hover { background: rgba(244, 243, 240, .025); }
.el.sel { background: var(--red-soft); border-left-color: var(--red); }
.el.t-scene { font-weight: 700; margin: 22px 0 10px; color: var(--white); text-transform: uppercase; }
.el.t-scene .snum { position: absolute; left: 22px; color: var(--red); font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.el.t-action { color: #d9d8d4; margin: 0 0 12px; white-space: pre-wrap; }
.el.t-character { padding-left: 262px; margin-top: 12px; text-transform: uppercase; color: var(--white); }
.el.t-paren { padding-left: 220px; padding-right: 230px; color: var(--dim); }
.el.t-dialogue { padding-left: 174px; padding-right: 150px; margin-bottom: 10px; color: #e8e7e3; }
.el.t-transition { text-align: right; margin: 12px 0; color: var(--dim); }
.el.t-centered { text-align: center; margin: 12px 0; }
.el.t-section, .el.t-note { color: var(--ash); font-style: italic; margin: 8px 0; }
.el.t-lyric { padding-left: 174px; font-style: italic; color: #e8e7e3; }
.el .lines { position: absolute; right: 4px; top: 0; bottom: 0; display: flex; gap: 3px; }
.el .lines i { width: 3px; border-radius: 2px; background: var(--red); opacity: .85; }
.el .lines i.wig { background: repeating-linear-gradient(180deg, var(--red) 0 4px, transparent 4px 7px); }
.el .beatpin { position: absolute; left: 44px; top: 2px; font-family: var(--font-mono); font-size: 8.5px; color: var(--void); background: var(--chrome-mid); border-radius: 2px; padding: 0 3px; }
.script-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; }
.selbar { position: sticky; top: 8px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: rgba(18, 18, 20, .96); border: 1px solid var(--red); border-radius: 5px; padding: 8px; margin-bottom: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.selbar b { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--red); margin-right: 4px; }

/* ── floor ── */
.floor { position: absolute; inset: 0; display: grid; grid-template-columns: 50px minmax(0, 1fr) var(--side); grid-template-rows: minmax(0, 1fr) var(--strip); }
.tools { grid-row: 1 / 3; border-right: 1px solid var(--line); background: var(--black); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; overflow-y: auto; }
.tool { width: 38px; height: 38px; border-radius: 4px; display: grid; place-items: center; color: var(--dim); border: 1px solid transparent; position: relative; font-size: 16px; }
.tool svg { width: 20px; height: 20px; }
.tool:hover { color: var(--white); background: var(--panel); }
.tool.on { color: var(--white); background: var(--red-soft); border-color: rgba(212, 42, 42, .6); }
.tool small { position: absolute; bottom: 1px; right: 3px; font-family: var(--font-mono); font-size: 7px; color: var(--ash); }
.tools .sep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; }
.plan-wrap { position: relative; overflow: hidden; background: var(--void); touch-action: none; }
#plan { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.plan-wrap.tool-place #plan { cursor: crosshair; }
.plan-wrap.panning #plan { cursor: grabbing; }
.plan-hud { position: absolute; left: 12px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.plan-hud .chip { background: rgba(10, 10, 11, .85); pointer-events: auto; }
.plan-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.plan-ctl .ibtn { background: rgba(10, 10, 11, .85); width: 30px; height: 30px; font-size: 13px; }
.plan-quick { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.plan-quick > * { pointer-events: auto; }
.plan-tip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: var(--dim); background: rgba(10, 10, 11, .9); border: 1px solid var(--line); border-radius: 3px; padding: 5px 10px; pointer-events: none; white-space: nowrap; }
.side { grid-row: 1 / 2; grid-column: 3; border-left: 1px solid var(--line); background: var(--black); display: flex; flex-direction: column; min-height: 0; }
.vf { position: relative; flex: none; background: #000; border-bottom: 1px solid var(--line); }
.vf-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: #000; }
.vf-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vf-stage .ovl { position: absolute; inset: 0; pointer-events: none; }
.vf-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); }
.vf-read { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-soft); border-top: 1px solid var(--line-soft); }
.vf-read div { background: var(--black); padding: 5px 7px; min-width: 0; }
.vf-read span { display: block; font-family: var(--font-mono); font-size: 7.5px; letter-spacing: .16em; color: var(--ash); text-transform: uppercase; }
.vf-read b { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vf-read b.warn { color: var(--red-bright); }
.vf-cam { position: absolute; left: 8px; top: 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--white); background: rgba(0, 0, 0, .6); padding: 2px 6px; border-radius: 2px; pointer-events: none; }
.vf-cam i { color: var(--red); font-style: normal; animation: pulse 1.6s infinite; }
.vf-none { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ash); font-family: var(--font-mono); font-size: 11px; padding: 20px; }
.inspector { flex: 1; overflow-y: auto; padding: 12px 12px 30px; min-height: 0; }
.insp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.insp-head .title { font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout { font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; line-height: 1.7; }
.readout b { color: var(--white); }
.readout .warn { color: var(--red-bright); font-weight: 700; }
.meter-row { display: grid; grid-template-columns: 58px 1fr 64px; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 10px; margin: 3px 0; }
.meter-row .bar { height: 6px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.meter-row .bar i { display: block; height: 100%; background: var(--chrome-grad); }
.meter-row .bar i.hot { background: linear-gradient(90deg, var(--crimson), var(--red-bright)); }
.strip { grid-column: 2 / 4; grid-row: 2; border-top: 1px solid var(--line); background: var(--black); display: grid; grid-template-rows: 34px 1fr; min-width: 0; }
.strip-bar { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.strip-bar b { font-family: var(--font-mono); font-size: 9px; letter-spacing: .2em; color: var(--ash); margin-right: 4px; }
.beat { font-family: var(--font-mono); font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 3px; border: 1px solid var(--line); color: var(--dim); position: relative; flex: none; }
.beat.on { color: var(--void); background: var(--chrome-hi); border-color: var(--chrome-hi); }
.beat.keyed::after { content: ''; position: absolute; top: -3px; right: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.shots-row { display: flex; gap: 8px; padding: 8px 10px; overflow-x: auto; align-items: stretch; }
.sthumb { flex: none; width: 150px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; position: relative; }
.sthumb:hover { border-color: var(--chrome-lo); }
.sthumb.on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.sthumb .img { flex: 1; min-height: 0; background: #000 center / cover no-repeat; position: relative; }
.sthumb .cap { display: flex; align-items: center; gap: 5px; padding: 3px 6px; font-family: var(--font-mono); font-size: 9px; font-weight: 700; }
.sthumb .cap em { font-style: normal; color: var(--ash); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sthumb.add { display: grid; place-items: center; color: var(--ash); font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; border-style: dashed; }

/* ── board ── */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.panel.drag { opacity: .4; }
.panel.over { box-shadow: -3px 0 0 var(--red); }
.panel .frame { position: relative; background: #000; }
.panel .frame img, .panel .frame canvas { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.panel .frame .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ash); font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; }
.panel .num { position: absolute; left: 8px; top: 8px; font-family: var(--font-display); font-size: 22px; line-height: 1; color: var(--white); text-shadow: 0 1px 8px #000; }
.panel .tools-o { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.panel:hover .tools-o { opacity: 1; }
.panel .tools-o .ibtn { background: rgba(0, 0, 0, .7); width: 28px; height: 28px; font-size: 12px; }
.panel .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.panel .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.panel .desc { font-size: 12.5px; color: var(--white); line-height: 1.45; min-height: 18px; outline: none; border-radius: 2px; }
.panel .desc:focus { box-shadow: 0 0 0 1px var(--red); }
.panel .dlg { font-family: var(--font-mono); font-size: 11px; color: var(--dim); border-left: 2px solid var(--line-2); padding-left: 8px; max-height: 58px; overflow: hidden; }
.panel .status { position: absolute; right: 8px; bottom: 8px; }
.board-scene { font-family: var(--font-display); font-weight: 400; font-size: 26px; text-transform: uppercase; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.board-scene em { font-style: normal; color: var(--red); }
.board-scene small { font-family: var(--font-mono); font-size: 10px; color: var(--ash); letter-spacing: .1em; }

/* ── tables ── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ash); text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:hover td { background: rgba(244, 243, 240, .02); }
.tbl td.n { font-family: var(--font-display); font-size: 17px; color: var(--white); white-space: nowrap; }
.tbl td.mono { font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.tbl input, .tbl select { background: transparent; border: 1px solid transparent; border-radius: 2px; padding: 3px 4px; width: 100%; outline: none; font-size: 12px; }
.tbl input:hover, .tbl select:hover { border-color: var(--line); }
.tbl input:focus, .tbl select:focus { border-color: var(--red); background: var(--panel-2); }
.tbl .thumb { width: 88px; height: 37px; background: #000 center / cover; border-radius: 2px; border: 1px solid var(--line); }
.tbl tr.grp td { background: var(--panel); font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--red); text-transform: uppercase; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.stat span { font-family: var(--font-mono); font-size: 9px; letter-spacing: .16em; color: var(--ash); text-transform: uppercase; }
.stat b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.05; }
.stat b.warn { color: var(--red-bright); }

/* ── package ── */
.pkg { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.asset { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--panel-2); position: relative; }
.asset .img { aspect-ratio: 4 / 3; background: #000 center / cover; display: grid; place-items: center; color: var(--ash); font-family: var(--font-mono); font-size: 11px; }
.asset .cap { padding: 5px 7px; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset .role { position: absolute; left: 5px; top: 5px; }
.asset .x { position: absolute; right: 4px; top: 4px; opacity: 0; }
.asset:hover .x { opacity: 1; }
.castrow { display: grid; grid-template-columns: 40px 1fr 1fr 70px 30px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.castrow .face { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-3) center / cover; border: 2px solid; display: grid; place-items: center; font-family: var(--font-display); font-size: 16px; cursor: pointer; }

/* ── overlays ── */
.drop { position: fixed; inset: 0; z-index: 1500; background: rgba(5, 5, 6, .88); display: grid; place-items: center; pointer-events: none; }
.drop div { border: 2px dashed var(--red); border-radius: 12px; padding: 50px 70px; text-align: center; }
.drop h3 { font-family: var(--font-display); font-weight: 400; font-size: 44px; text-transform: uppercase; }
.drop p { font-family: var(--font-mono); color: var(--dim); font-size: 11px; letter-spacing: .1em; margin-top: 8px; text-transform: uppercase; }
.modal { position: fixed; inset: 0; z-index: 1200; background: rgba(5, 5, 6, .78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: rise .2s ease-out; }
.modal-card.wide { width: min(980px, 100%); }
.modal-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 30px; text-transform: uppercase; line-height: 1; margin-bottom: 6px; }
.modal-card .sub { color: var(--dim); margin-bottom: 16px; }
.modal-card .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.opt-list { display: grid; gap: 6px; }
.opt { text-align: left; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; background: var(--panel-2); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.opt:hover { border-color: var(--chrome-lo); }
.opt.on { border-color: var(--red); background: var(--red-soft); }
.opt b { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.opt small { color: var(--dim); grid-column: 1; font-size: 11.5px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1600; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--red); border-radius: 4px; padding: 10px 14px; font-size: 12.5px; max-width: 380px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: rise .2s ease-out; }
.toast b { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--red); text-transform: uppercase; display: block; }
.ctx { position: fixed; z-index: 1400; background: var(--panel); border: 1px solid var(--line-2); border-radius: 5px; padding: 4px; min-width: 190px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.ctx button { display: flex; width: 100%; justify-content: space-between; gap: 18px; text-align: left; padding: 7px 10px; border-radius: 3px; font-size: 12.5px; }
.ctx button:hover { background: var(--red-soft); }
.ctx button span { color: var(--ash); font-family: var(--font-mono); font-size: 10px; }
.ctx .sep { height: 1px; background: var(--line); margin: 4px 0; }
.busy { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.busy i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 1s infinite; }
.log { font-family: var(--font-mono); font-size: 11px; line-height: 1.8; color: var(--dim); background: #0a0a0b; border: 1px solid var(--line); border-radius: 5px; padding: 12px; max-height: 260px; overflow: auto; }
.log b { color: var(--white); }
.sketch-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.sketch-stage { position: relative; background: #000; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; touch-action: none; }
.sketch-stage img, .sketch-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sketch-stage canvas.draw { cursor: crosshair; }

/* ── responsive ── */
@media (max-width: 1180px) {
  :root { --side: 330px; --rail: 200px; }
  .cards3 { grid-template-columns: 1fr; }
  .script-layout { grid-template-columns: 1fr; }
  .script-side { position: static; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  :root { --top: 50px; }
  .brand small, .proj { display: none; }
  .body, .body.norail { grid-template-columns: 1fr; }
  .rail { display: none; }
  .rail.open { display: flex; position: fixed; top: var(--top); left: 0; bottom: 0; width: 260px; z-index: 30; box-shadow: 20px 0 50px rgba(0, 0, 0, .6); }
  .floor { grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: 52vh auto auto; position: absolute; overflow-y: auto; }
  .tools { grid-row: 1 / 2; }
  .side { grid-column: 1 / 3; grid-row: 2; border-left: 0; border-top: 1px solid var(--line); }
  .strip { grid-column: 1 / 3; grid-row: 3; min-height: 140px; }
  .inspector { overflow: visible; }
  .top-actions .btn span { display: none; }
  .el { padding: 0 16px 0 22px; }
  .el.t-character { padding-left: 120px; }
  .el.t-dialogue { padding-left: 60px; padding-right: 30px; }
  .el.t-paren { padding-left: 90px; padding-right: 40px; }
  .pad { padding: 16px 14px 60px; }
}

/* ── print: white paper, black ink, red accents ── */
@media print {
  @page { size: landscape; margin: 12mm; }
  body { background: #fff; color: #000; overflow: visible; }
  .top, .rail, .tools, .side, .strip, .toasts, .modal, .drop, .vhead .acts, .no-print, #gate { display: none !important; }
  .app, .body, .views, .view, .scroll { position: static !important; display: block !important; overflow: visible !important; height: auto !important; }
  .view:not(.printing) { display: none !important; }
  .pad { padding: 0; max-width: none; }
  .vhead h2 { color: #000; }
  .vhead .eyebrow, .board-scene em { color: #b31d1d; }
  .board { grid-template-columns: repeat(3, 1fr); gap: 8mm; }
  .panel { background: #fff; border: 1px solid #000; break-inside: avoid; }
  .panel .desc, .panel .dlg { color: #000; }
  .panel .tools-o { display: none; }
  .chip { color: #000; border-color: #000; background: none; }
  .chip.red { color: #b31d1d; border-color: #b31d1d; }
  .board-scene { color: #000; break-after: avoid; }
  .tbl-wrap { border-color: #000; overflow: visible; }
  .tbl th { background: #eee; color: #000; position: static; }
  .tbl td, .tbl td.n { color: #000; border-color: #bbb; }
  .tbl input, .tbl select { color: #000; border: 0; -webkit-appearance: none; appearance: none; }
  .tbl tr.grp td { background: #f3f3f3; color: #b31d1d; }
  .stat { border-color: #000; background: #fff; }
  .stat b, .stat span { color: #000; }
  .print-plan { display: block !important; }
  .print-plan svg { width: 100%; height: auto; }
}
.print-plan { display: none; }

/* ── big lens view + editable placeholders ── */
.floor.vfbig .vf { position: absolute; left: 50px; top: 0; right: var(--side); bottom: var(--strip); z-index: 6; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.floor.vfbig .vf-stage { flex: 1; aspect-ratio: auto; }
[contenteditable][data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--ash); }
@media (max-width: 900px) { .floor.vfbig .vf { left: 0; right: 0; bottom: auto; height: 60vh; } }

/* ── shell never grows past the viewport ── */
.app { grid-template-columns: minmax(0, 1fr); }
.top, .body, .views { min-width: 0; }
.tabs { min-width: 0; flex: 0 1 auto; }
.brand { min-width: 0; }
@media (max-width: 1280px) {
  .brand small { display: none; }
  .top-actions .btn span { display: none; }
  .proj { max-width: 150px; }
  .tabs button { padding: 0 9px; letter-spacing: .1em; }
}
.castrow { grid-template-columns: 40px 1fr 1fr 96px 56px 30px; }

/* ── phone: tabs become a bottom bar ── */
@media (max-width: 900px) {
  .app { bottom: 56px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 56px; margin: 0; background: #0A0A0B; border-top: 1px solid var(--line); justify-content: space-around; z-index: 60; padding-bottom: env(safe-area-inset-bottom); }
  .tabs button { padding: 0 6px; font-size: 9.5px; letter-spacing: .06em; }
  .tabs button.on::after { top: -1px; bottom: auto; }
  .save { display: none; }
  .brand b { font-size: 18px; }
}

/* ── phone: the floor view scrolls as one column instead of squeezing into the screen ── */
@media (max-width: 900px) {
  #view-floor.on { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .floor { position: relative; inset: auto; height: auto; overflow: visible; grid-template-rows: 56vh auto auto; }
  .side { min-height: auto; }
  .inspector { flex: none; overflow: visible; }
}
