/* Omni Studio — an editing-suite look: warm darkroom blacks, one safelight accent,
   takes framed like film. */

@property --a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  --bg: #0f0e0c;
  --bg-2: #141210;
  --panel: #191714;
  --panel-2: #211e1a;
  --line: #2e2a25;
  --line-2: #3b362f;
  --paper: #efe8dc;
  --text: #e9e2d5;
  --muted: #9b9184;
  --dim: #6f675d;
  --accent: #ff5a1f;
  --accent-ink: #1a0c05;
  --accent-soft: rgba(255, 90, 31, 0.14);
  --amber: #f2c14e;
  --ok: #86d49a;
  --danger: #ff5d5d;
  --radius: 14px;
  --radius-sm: 9px;
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: 'Schibsted Grotesk', ui-sans-serif, sans-serif;
  --mono: 'Martian Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 90, 31, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(242, 193, 78, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  overflow-x: hidden;
}
/* film grain */
body::before {
  content: '';
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 100;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; }
.dim { color: var(--dim); }
h2 {
  margin: 0;
  font: 800 22px/1 var(--display);
  letter-spacing: .06em;
  text-transform: uppercase;
}
u { text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* ——— brand ——— */
.brand-word {
  font: 900 30px/1 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.brand-word span { color: var(--accent); margin-left: 4px; }
.slate {
  height: 14px; width: 100%;
  border-radius: 3px 3px 0 0;
  background: repeating-linear-gradient(-55deg, var(--paper) 0 12px, #1b1916 12px 24px);
}
.slate-sm { width: 30px; height: 30px; border-radius: 6px; background: repeating-linear-gradient(-55deg, var(--paper) 0 5px, var(--accent) 5px 10px); }

/* ——— gate ——— */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid; gap: 16px;
  padding: 0 24px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: rise .6s var(--ease) both;
}
.gate-card .slate { margin: 0 -24px 8px; width: auto; height: 18px; }
.gate-card .brand-word { font-size: 46px; margin: 0; }
.gate-sub { margin: -8px 0 4px; color: var(--muted); }
.gate-error { min-height: 1.2em; margin: 0; color: var(--danger); font-size: 14px; }

/* ——— top bar ——— */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 32px);
  background: rgba(15, 14, 12, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .brand-word { font-size: 26px; }
.topbar-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.topbar-meta b { color: var(--amber); font-weight: 500; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.linkish:hover { color: var(--text); }

/* ——— layout ——— */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 40px);
  padding: 24px clamp(16px, 3vw, 32px) 64px;
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
}
.composer { position: sticky; top: 84px; display: grid; gap: 14px; max-height: calc(100dvh - 100px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.block {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid; gap: 12px;
}
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hint { color: var(--dim); text-transform: uppercase; }
.reveal { animation: rise .7s var(--ease) both; animation-delay: calc(var(--d) * 90ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ——— continuing banner ——— */
.continuing {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  animation: rise .4s var(--ease) both;
}
.continuing video, .continuing img { width: 76px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #000; }
.continuing b { font: 800 18px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.continuing p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.continuing .seg { margin-top: 8px; }

/* ——— media bin ——— */
.bin { display: grid; gap: 10px; border-radius: var(--radius-sm); }
.bin.dragging { outline: 2px dashed var(--accent); outline-offset: 4px; }
.bin-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.bin-items:empty { display: none; }
.bin-drop {
  display: grid; justify-items: center; gap: 4px;
  padding: 18px 12px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.bin-drop:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.bin-plus { font: 800 30px/1 var(--display); color: var(--accent); }
.bin-small { color: var(--dim); font-size: 10px; }

.item {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  overflow: hidden;
  display: grid;
  animation: rise .35s var(--ease) both;
}
.item.drag-over { border-color: var(--accent); }
.item-media { position: relative; aspect-ratio: 4/3; background: #000; }
.item-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-tag {
  position: absolute; left: 6px; top: 6px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(0, 0, 0, .72); color: var(--paper);
  font: 500 10px/1.4 var(--mono); letter-spacing: .05em; text-transform: uppercase;
}
.item-tag.vid { background: var(--accent); color: var(--accent-ink); }
.item-x {
  position: absolute; right: 6px; top: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .72); color: var(--paper);
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.item-x:hover { background: var(--danger); }
.item-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .2s; }
.item select {
  width: 100%;
  border: 0; border-top: 1px solid var(--line-2);
  background: var(--panel-2);
  padding: 7px 8px;
  font: 500 11px/1.2 var(--mono);
  letter-spacing: .02em;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.item-warn { padding: 5px 8px; font-size: 11px; color: var(--amber); border-top: 1px solid var(--line-2); }

.note {
  margin: 0; padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(242, 193, 78, .08);
  border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--text);
}

/* ——— direction ——— */
.director-tools { display: flex; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--panel-2);
  font: 500 12px/1 var(--body);
  transition: border-color .2s, background .2s, transform .15s;
}
.tool i { font-style: normal; color: var(--accent); }
.tool:hover { border-color: var(--accent); background: var(--accent-soft); }
.tool:active { transform: scale(.97); }
.tool[disabled] { opacity: .5; cursor: progress; }
.tool.busy i { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.prompt-wrap { position: relative; }
textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #0c0b09;
  line-height: 1.55;
  transition: border-color .2s;
}
textarea:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: var(--dim); }
.prompt-badge {
  position: absolute; right: 10px; bottom: 10px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  text-transform: uppercase; font-size: 10px;
}

.ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.idea {
  display: grid; gap: 6px; align-content: start;
  padding: 11px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2);
  animation: rise .4s var(--ease) both;
  animation-delay: calc(var(--i) * 70ms);
}
.idea h3 { margin: 0; font: 800 17px/1.05 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.idea p { margin: 0; font-size: 12.5px; color: var(--muted); }
.idea-actions { display: flex; gap: 6px; margin-top: 2px; }
.idea-actions button { flex: 1; padding: 6px 8px; font-size: 12px; }
.ideas-close { grid-column: 1 / -1; justify-self: end; }

.picks-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #0c0b09; }
.picks-box summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer; list-style: none;
  color: var(--dim); text-transform: uppercase;
}
.picks-box summary::-webkit-details-marker { display: none; }
.picks-box summary::after { content: '+'; color: var(--accent); font: 800 16px/1 var(--display); }
.picks-box[open] summary::after { content: '–'; }
.picks-sum { margin-left: auto; color: var(--text); font-size: 12px; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.picks-box .pick-row { padding: 0 12px 10px; }
.picks { display: grid; gap: 8px; }
.pick-row { display: grid; grid-template-columns: 62px 1fr; gap: 8px; align-items: start; }
.pick-row > span { padding-top: 5px; color: var(--dim); text-transform: uppercase; font-size: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 4px 9px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: transparent;
  font: 400 12px/1.3 var(--body);
  color: var(--muted);
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed='true'] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.toggle { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle b { color: var(--text); font-weight: 600; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; }
.toggle-ui::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); transition: transform .2s var(--ease); }
.toggle input:checked + .toggle-ui { background: var(--accent); }
.toggle input:checked + .toggle-ui::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ——— settings ——— */
.settings { display: grid; gap: 12px; }
.setting { display: grid; gap: 6px; }
.setting-row { grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.field { display: grid; gap: 6px; }
.field-label { color: var(--dim); text-transform: uppercase; font-size: 10px; }
.field input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #0c0b09;
}
.field input:focus, select:focus { outline: none; border-color: var(--accent); }
.seg { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: #0c0b09; }
.seg button {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 8px;
  border: 0; border-radius: 7px;
  background: transparent;
  font: 500 13px/1 var(--body);
  color: var(--muted);
  transition: background .15s, color .15s;
}
.seg button small { font: 400 9px/1 var(--mono); text-transform: uppercase; opacity: .8; }
.seg button:hover { color: var(--text); }
.seg button[aria-checked='true'] { background: var(--paper); color: var(--bg); }
.seg-sm button { min-width: 44px; }
.ar { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.ar-wide { width: 16px; height: 9px; }
.ar-tall { width: 9px; height: 16px; }

/* ——— action ——— */
.action { display: grid; gap: 8px; position: sticky; bottom: 0; padding: 8px 0 4px; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2);
  font: 600 14px/1 var(--body);
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff6d37; border-color: #ff6d37; box-shadow: 0 10px 30px rgba(255, 90, 31, .25); }
.btn-roll { width: 100%; padding: 17px 18px; font: 900 22px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.btn-roll kbd { margin-left: auto; padding: 3px 6px; border-radius: 4px; background: rgba(0, 0, 0, .18); font-size: 10px; letter-spacing: 0; }
.btn-roll[disabled] { opacity: .6; cursor: not-allowed; }
.rec { width: 11px; height: 11px; border-radius: 50%; background: var(--accent-ink); box-shadow: 0 0 0 3px rgba(0, 0, 0, .15); }
.btn-roll:hover .rec { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.estimate { margin: 0; text-align: center; color: var(--muted); }
.estimate b { color: var(--amber); font-weight: 500; }

/* ——— reel ——— */
.reel { display: grid; gap: 16px; min-width: 0; }
.reel-head { display: flex; align-items: baseline; gap: 10px; }
.reel-head h2 { font-size: 30px; }
.takes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.reel-empty { display: grid; justify-items: center; gap: 6px; padding: 60px 16px; text-align: center; color: var(--muted); }
.reel-empty p { margin: 0; }
.reel-empty .leader { width: min(360px, 90%); border-radius: var(--radius); margin-bottom: 16px; }

.take {
  --sprocket: #0a0908;
  position: relative;
  background: #0b0a09;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  animation: rise .5s var(--ease) both;
}
.take::before, .take-frame::after {
  content: '';
  display: block;
  height: 12px;
  background:
    radial-gradient(ellipse 4px 3px at 50% 50%, #26221d 0 99%, transparent 100%) 0 0 / 18px 12px repeat-x,
    var(--sprocket);
}
.take-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.take-n { font: 900 20px/1 var(--display); letter-spacing: .06em; color: var(--paper); }
.take-n em { font-style: normal; color: var(--accent); }
.take-title { font-weight: 600; font-size: 14px; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.take-meta { color: var(--muted); text-transform: uppercase; font-size: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.take-meta .cost { color: var(--amber); }
.take-frame { position: relative; background: #000; }
.take-frame video { display: block; width: 100%; max-height: 70vh; background: #000; }
.take-frame.tall video { aspect-ratio: 9/16; max-height: 70vh; margin: 0 auto; width: auto; max-width: 100%; }
.take-body { display: grid; gap: 10px; padding: 12px 14px 14px; background: var(--panel); }
.take-inputs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.take-inputs img { width: 44px; height: 32px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line-2); }
.take-inputs .from { padding: 3px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font: 500 10px/1.3 var(--mono); text-transform: uppercase; }
.take-prompt summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; display: flex; gap: 8px; align-items: center; }
.take-prompt summary::-webkit-details-marker { display: none; }
.take-prompt summary::before { content: '▸'; color: var(--accent); transition: transform .2s; }
.take-prompt[open] summary::before { transform: rotate(90deg); }
.take-prompt p { margin: 8px 0 0; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.take-prompt .idea-line { color: var(--muted); font-style: italic; }
.take-prompt .model-text { color: var(--amber); }
.take-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.take-actions .btn { padding: 8px 11px; font-size: 12.5px; }
.take-actions .btn-edit { border-color: var(--accent); color: var(--accent); }
.take-actions .btn-edit:hover { background: var(--accent-soft); }
.take-actions .del { margin-left: auto; color: var(--dim); }
.take-actions .del:hover { color: var(--danger); border-color: var(--danger); }
.take.err .take-frame { display: grid; place-items: center; aspect-ratio: 16/9; padding: 24px; text-align: center; background: repeating-linear-gradient(-45deg, #120f0d 0 14px, #17130f 14px 28px); }
.take-error { max-width: 46ch; color: var(--text); font-size: 14px; }
.take-error b { display: block; margin-bottom: 6px; color: var(--danger); font: 800 18px/1.1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.take-error small { display: block; margin-top: 8px; color: var(--muted); }

/* ——— the leader (render in progress) ——— */
.leader {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background:
    linear-gradient(var(--line-2), var(--line-2)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) 0 50% / 100% 1px no-repeat,
    radial-gradient(circle at 50% 50%, transparent 0 25%, #4a443c 25% 25.6%, transparent 25.6% 31%, #4a443c 31% 31.6%, transparent 31.6%),
    #1a1815;
  display: grid; place-items: center;
}
.leader.tall { aspect-ratio: 9/16; max-height: 70vh; margin: 0 auto; width: auto; height: 70vh; }
.leader-sweep {
  position: absolute;
  width: 62%; aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 90, 31, .5) 0deg, rgba(255, 90, 31, .5) var(--a), transparent var(--a));
  animation: sweep 1.6s linear infinite;
}
.leader.tall .leader-sweep { width: 80%; }
@keyframes sweep { to { --a: 360deg; } }
.leader-num { position: relative; font: 900 clamp(48px, 9vw, 96px)/1 var(--display); color: var(--paper); text-shadow: 0 2px 20px rgba(0, 0, 0, .6); }
.leader-status { position: absolute; left: 12px; bottom: 10px; right: 12px; display: flex; justify-content: space-between; gap: 10px; color: var(--paper); text-transform: uppercase; }
.leader-status .rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; animation: blink 1s steps(2) infinite; }
.leader::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
  animation: flicker .18s steps(2) infinite;
}
@keyframes flicker { 50% { opacity: .5; } }
.leader-idle .leader-sweep { animation-duration: 4s; }

/* ——— overlays ——— */
.dropveil {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(15, 14, 12, .8);
  border: 3px dashed var(--accent);
  font: 900 44px/1 var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
  pointer-events: none;
}
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  font-size: 13.5px;
  animation: rise .3s var(--ease) both;
}
.toast.bad { border-left-color: var(--danger); }
.toast.good { border-left-color: var(--ok); }

/* ——— small screens ——— */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding-top: 16px; }
  .composer { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .meta-model { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 16px; }
  .brand .brand-word { font-size: 22px; }
  .topbar-meta { gap: 12px; font-size: 10px; flex-wrap: nowrap; }
  .spend-all { display: none; }
  .ideas { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; }
  .seg button { font-size: 12px; padding: 5px 4px; }
  .btn-roll kbd { display: none; }
  .takes { grid-template-columns: 1fr; }
  .pick-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ——— studio tabs ——— */
.tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; background: #0c0b09; }
.tab { padding: 6px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font: 900 18px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: var(--accent-ink); }

/* ——— GPU pill ——— */
.gpu { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: #0c0b09; color: var(--text); white-space: nowrap; }
.gpu-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.gpu[data-state='ready'] .gpu-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(134, 212, 154, .15); }
.gpu[data-state='busy'] .gpu-dot { background: var(--accent); animation: blink 1s steps(2) infinite; }
.gpu[data-state='waking'] .gpu-dot, .gpu[data-state='starting'] .gpu-dot, .gpu[data-state='stopping'] .gpu-dot { background: var(--amber); animation: blink 1s steps(2) infinite; }
.gpu-btn { padding: 3px 10px; border: 0; border-radius: 999px; background: var(--paper); color: var(--bg); font: 600 11px/1.4 var(--body); }
.gpu[data-state='ready'] .gpu-btn { background: var(--line-2); color: var(--text); }

/* ——— cast ——— */
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; transition: opacity .2s; }
.cast.muted { opacity: .45; }
.char { position: relative; display: grid; gap: 0; padding: 0; overflow: hidden; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); text-align: left; animation: rise .35s var(--ease) both; }
.char img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #000; display: block; }
.char-name { padding: 5px 7px; font: 800 14px/1.1 var(--display); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.char-n { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 900 13px/1 var(--display); }
.char-edit { position: absolute; right: 5px; top: 5px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7); color: var(--paper); font-size: 12px; opacity: 0; transition: opacity .15s; }
.char:hover .char-edit, .char:focus-visible .char-edit { opacity: 1; }
@media (hover: none) { .char-edit { opacity: 1; } }
.char-new { place-items: center; align-content: center; gap: 4px; min-height: 150px; border-style: dashed; color: var(--muted); font-size: 12px; text-align: center; }
.char-new span { font: 800 30px/1 var(--display); color: var(--accent); }
.char-new:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.editor { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: rgba(255, 90, 31, .05); animation: rise .3s var(--ease) both; }
.editor-row { display: flex; gap: 10px; }
.grow { flex: 1; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-actions .del { margin-left: auto; }
.editor textarea { min-height: 70px; }
.ed-pics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pic { position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); background: #000; }
.pic img { width: 100%; height: 100%; object-fit: cover; }
.pic .item-x { position: absolute; right: 4px; top: 4px; }
.pic-add { display: grid; place-items: center; align-content: center; gap: 2px; border-style: dashed; background: transparent; color: var(--muted); font-size: 12px; }
.pic-add span { font: 800 26px/1 var(--display); color: var(--accent); }
.tool-xs { padding: 3px 8px; font-size: 11px; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.field-label .tool { vertical-align: middle; }

/* ——— scene ——— */
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 1 30%; font-size: 12.5px; }
.mode-help { margin: 0; color: var(--muted); font-size: 13px; }
.source, .swaps { display: grid; gap: 8px; }
.clip { display: grid; gap: 8px; }
.clip-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; border-radius: 8px; overflow: hidden; }
.clip-strip img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.clip-meta { color: var(--muted); }
.clip-range { display: grid; gap: 6px; }
.clip-range b { color: var(--amber); font-weight: 500; }
input[type='range'] { width: 100%; accent-color: var(--accent); }
.clip-actions { display: flex; gap: 14px; }
.source .bin-drop { width: 100%; background: transparent; font: inherit; }
.frames { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.frame-slot { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 16/10; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); background: transparent; color: var(--muted); overflow: hidden; }
.frame-slot.filled { border-style: solid; }
.frame-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame-slot .mono { position: relative; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .7); color: var(--paper); text-transform: uppercase; font-size: 10px; }
.swap-row { display: grid; grid-template-columns: 34px auto auto 1fr; gap: 8px; align-items: center; }
.swap-row img { width: 34px; height: 44px; object-fit: cover; border-radius: 5px; }
.swap-row b { font: 800 15px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.swap-row input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #0c0b09; }
.swap-row input:focus { outline: none; border-color: var(--accent); }
.setting-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ——— prompt ——— */
.prompt-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #0c0b09; }
.prompt-box summary { padding: 10px 12px; cursor: pointer; color: var(--muted); list-style: none; display: flex; justify-content: space-between; text-transform: uppercase; }
.prompt-box summary::-webkit-details-marker { display: none; }
.prompt-box summary::after { content: '+'; color: var(--accent); font: 800 16px/1 var(--display); }
.prompt-box[open] summary::after { content: '–'; }
.prompt-box textarea { border: 0; border-top: 1px solid var(--line); border-radius: 0; font: 12px/1.55 var(--mono); min-height: 260px; }
.prompt-foot { display: flex; gap: 14px; justify-content: flex-end; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--dim); }
.prompt-foot span { margin-right: auto; }
.mono-prompt { font: 11.5px/1.55 var(--mono) !important; max-height: 320px; overflow: auto; }
.take-inputs img.src { width: 64px; }

@media (max-width: 560px) {
  .tab { font-size: 15px; padding: 5px 9px; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar-meta { width: 100%; justify-content: space-between; }
  .setting-row.two { grid-template-columns: 1fr; }
  .swap-row { grid-template-columns: 34px 1fr; }
  .swap-row .dim { display: none; }
  .swap-row input { grid-column: 1 / -1; }
}
