/* ─── Seedance Studio: Higgsfield-style theme ───
   Almost-black neutral background, acid lime, white pills,
   Space Grotesk in caps for headings, system grotesk for body text. */

:root {
  --bg: #0d0e10;
  --panel: #131416;
  --card: #1a1c1e;
  --card-2: #222426;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #f7f7f8;
  --muted: #9a9fa6;
  --dim: #5d6167;
  --lime: #d1fe17;
  --lime-dim: #a8cd12;
  --pink: #ff005b;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Menlo", monospace;
  /* header height — re-measured by app.js (syncTopbarHeight); everything sticky hangs off it */
  --topbar-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* the hidden attribute always beats class-based display */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── header ─── */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 60;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-dot {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--lime);
  position: relative;
  flex-shrink: 0;
}
.brand-dot::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg);
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand h1 em { font-style: normal; color: var(--lime); }

.topbar-status {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-left: auto;
}

.token-total { color: var(--muted); }

.api-status { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.api-led { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.api-status.online .api-led { background: var(--lime); box-shadow: 0 0 8px rgba(209, 254, 23, .5); }
.api-status.online { color: var(--lime); }
.api-status.offline .api-led { background: var(--pink); }
.api-status.offline { color: var(--pink); }

/* ─── layout ─── */

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

/* tabs without the slate (art dept, cast, library): the right zone gets full width */
.layout.reel-only { grid-template-columns: 1fr; }

/* ─── generation panel ─── */

.slate {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 18px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.slate-field { min-width: 0; }

textarea, input[type="number"] {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 12px 13px;
  resize: vertical;
  transition: border-color .15s;
}
textarea:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--line-strong);
}
textarea::placeholder, input::placeholder { color: var(--dim); }

.note { margin-top: 7px; font-size: 11.5px; color: var(--dim); }

/* upload zones */

.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.drop {
  position: relative;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drop:hover, .drop.dragover { border-color: var(--lime); background: var(--card-2); }

.drop-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.drop-hint { font-size: 11px; color: var(--dim); }

/* segments (model) */

.seg {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button.active { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg button .seg-hint {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--dim);
  margin-top: 1px;
}
.seg button.active .seg-hint { color: var(--muted); }

/* model dropdown — a list, not segments: it has to hold engines from several
   vendors without running out of the slate's 340px */

.model-picker { position: relative; }

.model-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  padding: 11px 13px;
  cursor: pointer;
  transition: border-color .15s;
}
.model-btn:hover, .model-picker [aria-expanded="true"] { border-color: var(--line-strong); }
.model-btn-name { font-size: 13.5px; font-weight: 600; }
.model-btn-price {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--lime);
}
.model-caret { color: var(--muted); flex-shrink: 0; }
.model-picker [aria-expanded="true"] .model-caret { transform: rotate(180deg); }

/* fixed, not absolute: the slate is an overflow-y:auto container and would clip
   the list as soon as it grows past the panel edge. Placement is computed in
   placeModelMenu() — flips above the trigger when there is no room below. */
/* .model-picker prefix on purpose: plain .model-menu would lose to .project-menu,
   which sits later in this file and sets position:absolute */
.model-picker .model-menu {
  position: fixed;
  top: auto; left: auto; right: auto;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.menu-group {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 8px 11px 4px;
}

.model-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  width: 100%;
  background: none;
  border: none;
  border-radius: 9px;
  padding: 8px 11px;
  text-align: left;
  cursor: pointer;
}
.model-item:hover { background: var(--card-2); }
.model-item-name { font-family: var(--font-body); font-size: 13px; color: var(--text); }
.model-item.current .model-item-name { color: var(--lime); font-weight: 600; }
.model-item-price { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.model-item-hint { grid-column: 1 / -1; font-size: 11px; color: var(--dim); margin-top: 1px; }
.model-item-hint:empty { display: none; }

/* pill chips */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: rgba(255, 255, 255, .3); }
.chip.active {
  background: var(--lime);
  border-color: var(--lime);
  color: #101201;
  font-weight: 700;
}


/* slider */

input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 3px;
  background: var(--line-strong);
  border-radius: 2px;
  margin-top: 12px;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--lime);
  cursor: pointer;
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px var(--lime);
}
output { font-family: var(--font-mono); color: var(--lime); }

/* the far-left notch means "auto" — say so instead of hiding it in a tooltip */
.range-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--dim);
}

/* toggle */

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 6px; }
.switch input { display: none; }
.switch-track {
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}
.switch input:checked + .switch-track { background: var(--lime); border-color: var(--lime); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #101201; }
.switch-label { font-size: 12.5px; color: var(--muted); }

.slate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.slate-extra summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
.slate-extra summary::-webkit-details-marker { display: none; }
.slate-extra summary::before { content: "+"; color: var(--lime); font-family: var(--font-mono); font-size: 11px; }
.slate-extra[open] summary::before { content: "−"; }
.slate-extra summary .eyebrow { margin-bottom: 0; }
.slate-extra summary:hover .eyebrow { color: var(--text); }
.slate-extra .slate-field { margin-top: 12px; }
.slate-extra .slate-grid { margin-top: 12px; }

/* collapsed summary carries the live values, so folding hides nothing */
.params-summary {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slate-extra[open] .params-summary { display: none; }

/* cast under the prompt: click to insert @name */
.cast-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cast-quick:empty { display: none; }
.cast-quick-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 10px 3px 4px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.cast-quick-chip:hover { border-color: var(--lime); color: var(--lime); }
.cast-quick-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 50%; }
.cast-quick-chip .cast-quick-noface {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--card-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--muted);
}

/* button + variants selector */

/* The dock is pinned to the bottom of the (scrolling) slate: the primary action
   and its price must never sit below the fold. The ::before gradient doubles as
   the "there is more above" scroll affordance. */
.fire-dock {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 0 -16px;
  padding: 10px 16px 16px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fire-dock::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -24px;
  height: 24px;
  background: linear-gradient(to top, var(--panel), transparent);
  pointer-events: none;
}

.takes-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.takes-label {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fire-row { display: flex; gap: 8px; align-items: stretch; }
.fire-row .fire { flex: 1; }

.variants {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.variants button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  min-width: 38px;
  height: 26px;
  padding: 0 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.variants button:last-child { border-right: none; }
.variants button.active { background: var(--lime); color: #101201; font-weight: 700; }

/* button */

.fire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  background: var(--lime);
  color: #101201;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 14px 20px;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.fire:hover { filter: brightness(1.07); }
.fire:active { transform: scale(.99); }
.fire:disabled { background: var(--card-2); color: var(--dim); cursor: wait; }

.fire-rec {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #101201;
  flex-shrink: 0;
}
.fire:disabled .fire-rec { background: var(--pink); animation: blink 1s infinite; }

.form-error {
  color: #ff5c92;
  font-size: 12.5px;
  border: 1px solid rgba(255, 0, 91, .35);
  border-radius: 12px;
  padding: 10px 13px;
  background: rgba(255, 0, 91, .07);
}

/* ─── studio header: back to projects ─── */

.studio-nav { display: flex; align-items: center; gap: 10px; margin-left: 10px; min-width: 0; }

.back-home {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 6px 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.back-home:hover { color: var(--lime); border-color: rgba(209, 254, 23, .4); }

.studio-sep { color: var(--dim); font-size: 13px; }

.studio-project-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── home: project grid ─── */

.home { padding: 40px clamp(20px, 5vw, 64px) 80px; }

.home-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -.02em;
  text-transform: uppercase;
  color: var(--lime);
  line-height: 1;
}

.home-counts {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 10px;
}
.home-counts-spent { color: var(--muted); }

.home-head .pill { flex: none; padding: 11px 22px; }

/* min card 272px, capped at 4 columns on wide screens */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(272px, (100% - 3 * 24px) / 4), 1fr));
  gap: 24px;
  align-items: start;
}

.project-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.project-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.project-cover {
  aspect-ratio: 16 / 9;
  background: #08090a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-cover video, .project-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.project-cover-fallback {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: var(--dim);
}

.project-live {
  position: absolute;
  top: 12px; left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--lime);
  color: #101201;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 9px;
  transform: skewX(-8deg);
  border-radius: 3px;
}
.project-live::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #101201;
  animation: blink 1s infinite;
}

.project-body { padding: 16px; }

.project-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.project-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}
.project-meta-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-cost {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.project-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .15s;
}
.project-card:hover .project-actions { opacity: 1; }
.project-actions .icon-btn { background: rgba(8, 9, 10, .65); backdrop-filter: blur(4px); }

.project-card.project-new-card {
  background: transparent;
  border-style: dashed;
  border-color: var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: stretch;
  min-height: 181px;
  padding: 16px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  transition: color .15s, border-color .15s;
}
.project-card.project-new-card:hover { color: var(--lime); border-color: rgba(209, 254, 23, .4); transform: none; }
.project-new-sub { font: 400 11px var(--font-mono); color: var(--dim); }

.project-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 250px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 6px;
  z-index: 70;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

.project-item {
  display: flex; align-items: center; gap: 8px;
  border-radius: 9px;
  padding: 2px 2px 2px 11px;
}
.project-item:hover { background: var(--card-2); }
.project-item.current .project-item-name { color: var(--lime); }

.project-item-name {
  flex: 1;
  background: none; border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  padding: 8px 0;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.item-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
}

.project-new {
  display: block; width: 100%;
  background: none;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 8px 11px;
  margin-top: 6px;
  cursor: pointer;
  text-align: left;
}
.project-new:hover { color: var(--lime); border-color: rgba(209, 254, 23, .4); }

/* ─── mentions ─── */

.prompt-wrap { position: relative; }

/* @tags get lost in a long prompt, so a mirror layer over the textarea repaints the
   text with the tags in lime, and the textarea's own text goes transparent. The layers
   must be metrically IDENTICAL — same font, size, line-height, padding, border width —
   and nothing inside .prompt-hl may change metrics (no padding, no bold), otherwise the
   wrapping diverges and the text ghosts. The textarea only goes transparent once JS has
   actually filled the layer (.hl-on), so a missing layer can't leave the prompt blank. */
#prompt { display: block; position: relative; z-index: 0; }
.prompt-wrap.hl-on #prompt { color: transparent; caret-color: var(--text); }
#prompt::selection { background: rgba(209, 254, 23, .28); }

.prompt-hl {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border: 1px solid transparent;
  padding: 12px 13px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}
.prompt-hl mark { background: transparent; color: var(--lime); }

.mention-menu {
  position: absolute;
  left: 8px; right: 8px;
  bottom: 8px;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 5px;
  z-index: 40;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

.mention-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: none;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
}
.mention-item img {
  width: 32px; height: 32px;
  object-fit: cover;
  border-radius: 7px;
}
.mention-item:hover, .mention-item.sel { background: rgba(255, 255, 255, .07); color: var(--lime); }
.mention-empty { padding: 10px 12px; font-size: 12px; color: var(--muted); font-family: var(--font-body); }

.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mention-chips:empty { display: none; }

.mention-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lime);
}
.mention-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 50%; }

/* ─── frame slots ─── */

/* empty = one compact row (the hint moved to title); filled = a preview card */
.frame-slot {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  min-height: 0;
}
.frame-slot .drop-tag { font-size: 10px; }
.frame-slot .drop-plus { color: var(--muted); font-size: 14px; line-height: 1; }
.frame-slot:hover .drop-plus { color: var(--lime); }
.frame-slot.filled {
  border-style: solid;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 8px;
}
.frame-slot.filled .drop-plus { display: none; }
.frame-slot.filled .drop-tag { font-size: 9.5px; color: var(--muted); }

.slot-preview { position: relative; margin-top: 6px; }
.slot-preview img {
  width: 100%; height: 72px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.slot-preview .slot-name {
  position: absolute; left: 6px; bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  background: rgba(13, 14, 16, .8);
  border-radius: 5px;
  padding: 2px 6px;
  max-width: calc(100% - 40px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-preview .slot-clear {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

/* ─── right zone ─── */

.reel { padding: 16px 24px 24px; min-width: 0; }

/* Crumbs + tabs are the studio's navigation and must not scroll away with the pane
   under them — the art chat runs long, and losing the tabs mid-conversation was the
   complaint. Negative side margins bleed the bar across the section's padding, so
   cards and messages pass UNDER it instead of appearing beside it. */
.reel-head {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30; /* over the feed, under the app header (60) */
  background: var(--bg);
  margin: -16px -24px 18px;
  padding: 16px 24px 10px;
  border-bottom: 1px solid var(--line);
}
.reel-head .crumbs { margin-bottom: 12px; }
.reel-head .reel-nav { margin-bottom: 0; }

/* breadcrumb: folder / scene */

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.crumb-sep { color: var(--dim); font-size: 13px; }

.crumb-picker { position: relative; }

.crumb-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color .15s;
}
.crumb-btn:hover { border-color: var(--line-strong); }
.crumb-btn svg:first-child { color: var(--muted); }
.crumb-picker[data-kind="scene"] .crumb-btn svg:first-child { color: var(--lime); }

.crumb-menu { left: 0; right: auto; }

/* actual spend of the selected scene and project — to the right of the breadcrumbs */
.reel-cost {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
}

.reel-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}

.tabs { display: flex; gap: 2px; }

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 12px 9px;
  cursor: pointer;
  transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--lime); border-bottom-color: var(--lime); }
.tab-count { font-family: var(--font-mono); font-weight: 400; opacity: .65; margin-left: 3px; }

.reel-tools { display: flex; align-items: center; gap: 8px; }

.chip-star {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1;
  padding: 5px 11px;
  color: var(--dim);
}
.chip-star.active { background: transparent; border-color: var(--lime); color: var(--lime); }

.search {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 8px 15px;
  width: 220px;
  transition: border-color .15s, width .2s;
}
.search:focus { outline: none; border-color: var(--line-strong); width: 280px; }
.search::placeholder { color: var(--dim); }

/* ─── takes feed (masonry, like Higgsfield's Explore feed) ─── */

.gallery {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* masonry column — layout in renderGallery/layoutMasonry */
.gallery-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s;
}
.card:hover { border-color: var(--line-strong); }

@keyframes blink { 50% { opacity: .15; } }

.card-screen {
  background: #08090a;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.card-screen video { width: 100%; height: 100%; display: block; background: #08090a; object-fit: cover; }

.timecode {
  font-family: var(--font-mono);
  font-size: 19px;
  letter-spacing: .08em;
  color: var(--lime);
  text-shadow: 0 0 28px rgba(209, 254, 23, .35);
}
.timecode-sub {
  position: absolute;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--dim);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.card-screen:has(.card-fail) { aspect-ratio: auto; min-height: 96px; }

.card-fail {
  padding: 38px 16px 16px;
  font-size: 12px;
  color: #ff5c92;
  text-align: center;
}

/* skewed status badge (Higgsfield's signature trick) */
.card-badge[hidden] { display: none; }
.card-badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--lime);
  color: #101201;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 9px;
  transform: skewX(-8deg);
  border-radius: 3px;
}
.card-badge > * { transform: skewX(8deg); }
.card-badge.badge-live::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #101201;
  animation: blink 1s infinite;
}
.card-badge.badge-fail { background: var(--pink); color: #fff; }
/* upscaled copy exists: outlined, not filled — it is a property of the take, not an
   event demanding attention like a live render or a failure */
.card-badge.badge-hd {
  background: transparent;
  color: var(--lime);
  border: 1px solid var(--lime);
}

/* hover overlay: prompt and actions */
.card-hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(to top, rgba(8, 9, 10, .88) 0%, rgba(8, 9, 10, .45) 45%, transparent 75%);
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.card:hover .card-hover, .card:focus-within .card-hover { opacity: 1; pointer-events: auto; }

.card-prompt {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-take {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-actions { display: flex; gap: 5px; flex-shrink: 0; }
.card-actions .icon-btn { background: rgba(8, 9, 10, .6); backdrop-filter: blur(4px); }

.act-star { font-size: 14px; line-height: 1; }
.act-star.starred { color: var(--lime); border-color: var(--lime); }
.act-star.starred:hover { background: transparent; color: var(--lime); }

/* star on a favorited take card (visible even without hover) */
.card-star-badge {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  color: var(--lime);
  font-size: 15px;
  text-shadow: 0 0 10px rgba(8, 9, 10, .9);
}

/* ─── lightbox ─── */

.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(5, 6, 7, .82); backdrop-filter: blur(6px); }

.lightbox-close {
  position: fixed;
  top: 14px; right: 356px;
  width: 36px; height: 36px;
  z-index: 5;
  background: var(--card);
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  z-index: 5;
  background: var(--card);
}
.lightbox-prev { left: 26px; }
.lightbox-next { right: 366px; }
.lightbox-nav[disabled] { opacity: .25; pointer-events: none; }

.lightbox-media {
  position: relative;
  flex: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  min-width: 0;
}

/* SD ⇄ HD switch over the video: the original is never replaced, so there has to be
   a way back to it (upscaling can smear faces or plasticise grain) */
.hd-toggle {
  position: absolute;
  top: 40px;
  left: 40px;
  z-index: 5; /* above the paused-state overlay button */
  display: flex;
  gap: 2px;
  padding: 2px;
  background: rgba(8, 9, 10, .78);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.hd-opt {
  background: none;
  border: none;
  border-radius: 999px;
  padding: 4px 11px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.hd-opt:hover { color: var(--text); }
.hd-opt.current { background: var(--lime); color: #101201; }

/* running upscale: same pill, but reads as a live process rather than a control */
.upscale-live { align-items: center; gap: 8px; padding: 6px 12px 6px 10px; }
.upscale-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lime);
  animation: blink 1s infinite;
}
.upscale-live-text {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--lime);
}
.upscale-live-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.lightbox-media video {
  width: 100%;
  max-width: 1180px;
  max-height: calc(100vh - 140px); /* the player bar lives below the video, not over it */
  object-fit: contain;
  border-radius: 14px;
  background: #08090a;
}
.lightbox-media .lightbox-placeholder {
  font-family: var(--font-mono);
  color: var(--dim);
  font-size: 12px;
}

/* big centered play button — the paused state of the viewer */
.lb-playbig {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
}
.lb-playbig span {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: rgba(13, 14, 16, .62);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* custom transport bar pinned to the bottom of the media zone */
.lb-bar {
  position: absolute;
  left: 40px;
  right: 380px; /* 340px side panel + the media zone's 40px inset */
  bottom: 34px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lb-track {
  position: relative;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
  cursor: pointer;
}
/* fat invisible hit area — a 3px line is not a target */
.lb-track::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }
.lb-track-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 2px;
  background: var(--lime);
}
.lb-track-thumb {
  position: absolute;
  top: 50%; left: 0;
  width: 11px; height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--lime);
}
.lb-bar-row { display: flex; align-items: center; gap: 16px; }
.lb-rbtn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(8, 9, 10, .6);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: color .15s;
}
.lb-bar-right .lb-rbtn { color: var(--muted); }
.lb-rbtn:hover { color: var(--lime); }
.lb-time {
  flex: none;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--text);
}
.lb-time-total { color: var(--dim); }
.lb-flags {
  flex: none;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}
.lb-bar-right { margin-left: auto; display: flex; gap: 8px; }
/* icon pairs swap with the player state */
.lb-bar .lb-ic-play { display: none; }
.lb-bar.paused .lb-ic-play { display: block; }
.lb-bar.paused .lb-ic-pause { display: none; }
.lb-bar .lb-ic-muted { display: none; }
.lb-bar.muted .lb-ic-muted { display: block; }
.lb-bar.muted .lb-ic-sound { display: none; }
@media (max-width: 1100px) { .lb-flags { display: none; } }

.lightbox-side {
  width: 340px;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 22px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lightbox-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lightbox-take {
  margin-right: auto;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.lightbox-status { position: static; }

.lightbox-star {
  width: 32px; height: 32px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--dim);
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lightbox-star:hover { color: var(--lime); }
.lightbox-star.starred { color: var(--lime); border-color: var(--lime); }

.lightbox-copy {
  float: right;
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  padding: 0;
}
.lightbox-copy:hover { color: var(--lime); }

.lightbox-prompt {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.lightbox-params {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  font-size: 12px;
}
.lightbox-params dt { color: var(--dim); }
.lightbox-params dd { font-family: var(--font-mono); color: var(--text); text-align: right; }

.lightbox-refs { display: flex; flex-wrap: wrap; gap: 8px; }
.lightbox-ref { position: relative; }
.lightbox-ref-icon {
  width: 62px; height: 62px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--lime);
  background: var(--card);
}
.lightbox-ref img {
  width: 62px; height: 62px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  display: block;
}
.lightbox-ref .ref-role {
  position: absolute;
  left: 3px; bottom: 3px;
  background: rgba(8, 9, 10, .8);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 8.5px;
  border-radius: 4px;
  padding: 1px 5px;
}
.lightbox-refs-block[hidden] { display: none; }

.lightbox-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

/* More: everything that is not Download, in one drop-up menu (as in the design) */
.more-picker { display: contents; }
.lb-more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.lb-more[aria-expanded="true"] .lb-more-caret { transform: rotate(180deg); }
.more-picker .more-menu {
  position: fixed;
  top: auto; left: auto; right: auto; bottom: auto;
  min-width: 250px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lb-mi {
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--text);
  font: 400 13px var(--font-body);
  text-align: left;
  padding: 8px 11px;
  cursor: pointer;
  transition: background .12s;
}
.lb-mi:hover { background: var(--card-2); }
.lb-mi[disabled] { color: var(--dim); cursor: default; }
.lb-mi[disabled]:hover { background: none; }
.lb-mi.danger { color: #ff5c92; }
.lb-mi.danger:hover { background: rgba(255, 0, 91, .12); }
.lb-mi-sep { display: block; height: 1px; background: var(--line); margin: 5px; }

/* engine picker: same trick as the model one — fixed, so the scrolling side panel
   can't clip it. The wrapper only exists to host the menu. */
.upscale-picker { display: contents; }
.upscale-picker .upscale-menu {
  position: fixed;
  top: auto; left: auto; right: auto; bottom: auto;
  width: 268px;
  min-width: 0;
  /* the list grew past a couple of rows — cap it and scroll inside instead of
     running off the top of the screen when it flips above the button */
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pill {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.pill:hover { filter: brightness(1.15); }
.pill-lime { background: var(--lime); border-color: var(--lime); color: #101201; }
.pill-danger { background: transparent; border-color: rgba(255, 0, 91, .5); color: #ff5c92; }
.pill-danger:hover { background: var(--pink); color: #fff; }

/* ─── A/B take comparison ─── */

.card.compare-pick { outline: 2px solid var(--lime); outline-offset: -2px; }
.card.compare-pick::after {
  content: "A";
  position: absolute;
  top: 10px; right: 10px;
  z-index: 4;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--lime);
  color: #101201;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
body.comparing .card { cursor: crosshair; }

.compare {
  border: none;
  padding: 0;
  background: transparent;
  max-width: none; max-height: none;
  width: 100vw; height: 100vh;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.compare[open] { display: flex; }
.compare::backdrop { background: rgba(5, 6, 7, .88); backdrop-filter: blur(6px); }

.compare-close { position: fixed; top: 14px; right: 14px; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
}

.compare-cell { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.compare-cell video {
  width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  border-radius: 12px;
  background: #08090a;
}
.compare-cell figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.compare-bar { display: flex; gap: 10px; }
.compare-bar .pill { flex: none; padding: 10px 26px; }

@media (max-width: 900px) {
  .compare-grid { grid-template-columns: 1fr; }
  .compare-cell video { max-height: 38vh; }
}

/* live-renders indicator on the tab */
.tab-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--lime);
  color: #101201;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tab-live::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #101201;
  animation: blink 1s infinite;
}

.icon-btn {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: #101201; background: var(--lime); border-color: var(--lime); }
.icon-btn.act-delete:hover, .icon-btn.act-del:hover { color: #fff; background: var(--pink); border-color: var(--pink); }

/* ─── library ─── */

.asset-uploader { margin-bottom: 16px; }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.asset {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: grab;
  transition: border-color .15s;
}
.asset:hover { border-color: var(--line-strong); }
.asset:active { cursor: grabbing; }

.asset-pic { aspect-ratio: 4 / 3; background: #08090a; }
.asset-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

.asset-body { padding: 8px 10px 10px; }

.asset-name {
  display: block;
  width: 100%;
  background: none; border: none;
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: left;
  padding: 0 0 7px;
  cursor: text;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-name::before { content: "@"; color: var(--dim); }

.asset-actions { display: flex; gap: 5px; }
.asset-actions .icon-btn { width: 26px; height: 26px; font-family: var(--font-mono); font-size: 12px; }

/* ─── cast ─── */

.cast-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.cast-card { cursor: default; }

.cast-pic { aspect-ratio: 1 / 1; position: relative; }
.cast-pic .cast-noface {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--dim);
}

.cast-name { color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 12.5px; cursor: default; }
.cast-name::before { content: "@"; color: var(--lime); }

.cast-voice {
  width: 100%;
  height: 30px;
  margin: 4px 0 6px;
}
.cast-voice[hidden] { display: none; }
audio::-webkit-media-controls-panel { background: #222426; }

.cast-hint {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cast-hint:empty { display: none; }

/* screen test: verdict badge over the portrait, its clip on hover, the reason below */
.cast-pic .cast-test {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .18s;
}
.cast-pic:hover .cast-test { opacity: 1; }
.cast-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  background: rgba(13, 14, 16, .82);
  backdrop-filter: blur(4px);
}
.cast-badge-ok { color: var(--lime); }
.cast-badge-bad { color: var(--pink); }
.cast-badge-warn,
.cast-badge-muted { color: var(--dim); }

.cast-check-hint {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 7px;
}
.cast-check-hint.bad { color: var(--pink); }

/* screen-test block in the character dialog */
.cast-check {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.cast-check-line { font-size: 12px; color: var(--text); }
.cast-check-line.ok { color: var(--lime); }
.cast-check-line.bad { color: var(--pink); }
.cast-check-line.warn,
.cast-check-line.muted { color: var(--dim); }
#castCheckDetail { white-space: pre-line; }

.cast-quick-chip.rejected { border-color: color-mix(in srgb, var(--pink) 55%, transparent); }
.cast-quick-chip.rejected::after {
  content: "✕";
  color: var(--pink);
  font-size: 10px;
}

/* audio asset in the library */
.asset-pic.is-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 4 / 3;
  color: var(--lime);
}
.asset-pic.is-audio audio { width: calc(100% - 16px); height: 30px; }

/* character dialog */
.cast-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(480px, calc(100vw - 32px));
  margin: auto; /* restores UA centering killed by the global *{margin:0} */
}
.cast-dialog::backdrop { background: rgba(5, 6, 7, .8); backdrop-filter: blur(6px); }

.cast-form { padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }

.cast-form input[type="text"] {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 10px 12px;
}
.cast-form input[type="text"]:focus { outline: none; border-color: var(--line-strong); }

.cast-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cast-slot {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--card);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s;
  position: relative;
}
.cast-slot:hover, .cast-slot.dragover { border-color: var(--lime); }
.cast-slot img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 10px;
}
.cast-slot .slot-file {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--lime);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cast-slot .slot-clear {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--pink);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
/* character files live only here, so this is the only place to pull one back to disk */
.cast-slot .slot-get {
  position: absolute; top: -7px; right: 17px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
}
.cast-slot .slot-get:hover { color: var(--lime); border-color: var(--lime-dim); }

/* appearance generator: creation paths */
.mocap-drop { min-height: 72px; }

.mocap-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
}
.mocap-thumbs:empty { display: none; }
.mocap-thumb { position: relative; }
.mocap-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  display: block;
}
.mocap-thumb button {
  position: absolute; top: -5px; right: -5px;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: none;
  background: var(--pink);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.banana-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.banana-panel textarea { background: var(--card-2); }

.banana-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }

.banana-result img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 10px;
  background: #08090a;
}
/* voice sample: the native player, only sized and darkened to fit the panel */
.banana-result audio {
  width: 100%;
  height: 36px;
  border-radius: 999px;
  color-scheme: dark;
}

/* resolved prompt in the lightbox */
.lightbox-resolved-block summary { cursor: pointer; list-style: none; }
.lightbox-resolved-block summary::before { content: "+ "; color: var(--lime); }
.lightbox-resolved-block[open] summary::before { content: "− "; }
.lightbox-resolved {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ─── art dept: asset-generation chat ─── */

.art-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 780px;
  margin: 0 auto;
  padding: 4px 0 18px;
}
.art-feed:empty { display: none; }

.art-msg { display: flex; flex-direction: column; gap: 7px; }

.art-user {
  align-self: flex-end;
  max-width: min(78%, 560px);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 16px 16px 5px 16px;
  padding: 11px 14px;
}

.art-text {
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.art-user-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.art-user-ref {
  width: 34px; height: 34px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
}

.art-en {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  word-break: break-word;
}

.art-ai { align-self: flex-start; max-width: min(88%, 520px); }

.art-image {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #08090a;
  display: block;
  object-fit: cover;
  cursor: zoom-in;
  transition: border-color .15s;
}
.art-image:hover { border-color: var(--line-strong); }

.art-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
}

.art-ai-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.art-act {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 6px 11px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.art-act:hover { color: #101201; background: var(--lime); border-color: var(--lime); }
.art-act:disabled { opacity: .4; cursor: wait; }

.art-saved {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--lime);
}

.art-ai-error { max-width: 100%; }

.art-skeleton {
  width: 380px;
  max-width: 100%;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}
.art-skeleton-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  animation: blink 1s infinite;
}

/* floating composer, sticks to the bottom of the window */
.art-composer {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  max-width: 780px;
  margin: 14px auto 0;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s;
}
.art-composer.dragover { border-color: var(--lime); }

.art-context { display: flex; flex-wrap: wrap; gap: 6px; }
.art-context:empty { display: none; }

.art-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 6px 3px 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
.art-chip img { width: 24px; height: 24px; object-fit: cover; border-radius: 6px; }
.art-chip button {
  width: 17px; height: 17px;
  border: none;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.art-chip button:hover { background: var(--pink); color: #fff; }
.art-chip-edit { border-color: rgba(209, 254, 23, .5); color: var(--lime); }

.art-input-row { display: flex; gap: 8px; align-items: flex-end; }
.art-input-row textarea { flex: 1; min-height: 44px; background: var(--card); }

.art-attach-wrap { position: relative; flex-shrink: 0; }
.art-attach-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.art-attach-btn:hover { color: #101201; background: var(--lime); border-color: var(--lime); }

.attach-menu {
  top: auto;
  bottom: calc(100% + 10px);
  left: 0;
  width: 280px;
  max-height: 300px;
  overflow-y: auto;
}
.attach-file-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  border: 1px dashed var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--lime);
  flex-shrink: 0;
}

.art-send {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  background: var(--lime);
  color: #101201;
  border: none;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 0 20px;
  cursor: pointer;
  transition: filter .15s;
}
.art-send:hover { filter: brightness(1.07); }
.art-send:disabled { background: var(--card-2); color: var(--dim); cursor: wait; }
.art-send:disabled .fire-rec { background: var(--pink); animation: blink 1s infinite; }
.art-send-price { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; opacity: .7; }
.art-send-price:empty { display: none; }

/* settings bar: engine · ratio · variants · ··· in one 34px strip */
.art-bar {
  display: flex;
  align-items: stretch;
  height: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.art-bar-sep { width: 1px; background: var(--line); flex: none; }
.art-bar-fill { flex: 1; min-width: 8px; }
.art-pop { position: relative; display: flex; min-width: 0; }
.art-bar-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  transition: background .12s;
  min-width: 0;
}
.art-bar-btn:hover { background: var(--card-2); }
.art-pop:first-child .art-bar-btn { border-radius: 10px 0 0 10px; }
.art-engine-ic { color: var(--lime); flex: none; }
.art-engine-label { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-engine-price { font-family: var(--font-mono); font-size: 11px; color: var(--lime); white-space: nowrap; }
.art-engine-price:empty { display: none; }
.art-caret { color: var(--muted); flex: none; }
.art-bar-btn[aria-expanded="true"] .art-caret { transform: rotate(180deg); }

.art-ratio-ic { display: flex; align-items: center; flex: none; }
.art-ratio-rect { display: block; border: 1.5px solid var(--muted); border-radius: 2px; flex: none; }
.art-ratio-rect.on { border-color: var(--lime); }
.art-ratio-label { font-family: var(--font-mono); font-size: 12px; }

.art-pop-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 300px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 6px;
  z-index: 80;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.art-ratio-menu {
  width: 184px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.art-ratio-menu[hidden] { display: none; }
.art-ratio-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  transition: background .12s;
}
.art-ratio-opt:hover { background: var(--card-2); }
.art-ratio-opt.current { color: var(--lime); }
.art-ratio-opt.current .art-ratio-rect { border-color: var(--lime); }

.art-variants { display: flex; align-items: center; height: 100%; flex: none; }
.art-variants-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 10px 0 12px;
  white-space: nowrap;
}
.art-variants button {
  background: transparent;
  border: none;
  color: var(--muted);
  font: 700 11px var(--font-mono);
  min-width: 32px;
  height: 100%;
  padding: 0 4px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.art-variants button:hover { color: var(--text); }
.art-variants button.active { background: var(--lime); color: #101201; }

.art-more-pick { flex: none; }
.art-more-btn {
  width: 40px;
  justify-content: center;
  border-radius: 0 10px 10px 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: .06em;
  padding: 0;
}
.art-more-btn:hover { color: var(--lime); }
.art-more-menu {
  left: auto;
  right: 0;
  width: auto;
  min-width: 236px;
  display: flex;
  flex-direction: column;
}
.art-more-menu[hidden] { display: none; }

/* frame-edit marker above the user bubble */
.art-edit-pill {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid rgba(209, 254, 23, .5);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--lime);
}

/* ─── empty states ─── */

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 64px 30px;
  text-align: center;
  color: var(--muted);
  max-width: 520px;
  margin: 48px auto;
}
.empty-slate {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--lime);
  margin-bottom: 10px;
}

/* ─── responsive ─── */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .slate { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--line); }
  .project-picker { margin-left: 0; }
  .reel-nav { flex-direction: column; align-items: stretch; }
  .search, .search:focus { width: 100%; }
  .art-user, .art-ai { max-width: 94%; }
  .art-composer { bottom: 8px; }
  .topbar .brand h1 { display: none; } /* on the sign-in gate the brand stays */
  .lightbox[open] { flex-direction: column; }
  .lightbox-media { height: auto; max-height: 55vh; padding: 16px; width: 100%; }
  .lightbox-side { width: 100%; height: auto; flex: 1; border-left: none; border-top: 1px solid var(--line); }
  .lightbox-close { right: 14px; }
  .lightbox-next { right: 14px; }
  .lightbox-nav { top: 28vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ─── sign-in (gate) and account ─── */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  overflow: auto;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(209, 254, 23, .05), transparent 60%),
    rgba(13, 14, 16, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 28px;
}

/* the big popup: sign-in on the left, the decorative studio pass on the right */
.auth-modal {
  margin: auto; /* centers AND keeps the top reachable when the viewport is short */
  width: 100%;
  max-width: 1020px;
  min-height: min(620px, calc(100dvh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 60px 140px rgba(0, 0, 0, .65);
  overflow: hidden;
}

.auth-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px 46px 22px;
}

.auth-top { display: flex; align-items: center; gap: 16px; }
.auth-top-side { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.auth-back { font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.auth-back:hover { color: var(--lime); }

.auth-main { margin: auto 0; padding: 44px 0 36px; max-width: 430px; width: 100%; }

.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--lime);
}

.auth-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.2vw, 46px);
  font-weight: 700;
  line-height: .98;
  letter-spacing: -.025em;
  text-transform: uppercase;
  margin-top: 14px;
}
.auth-title-accent {
  display: inline-block;
  color: var(--lime);
  transform: skewX(-8deg);
  padding-right: .08em;
}

.auth-lead { color: var(--muted); font-size: 15px; line-height: 1.6; margin-top: 16px; max-width: 42ch; }

.auth-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  font: 500 14.5px var(--font-body);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s ease, box-shadow .18s ease;
}
.auth-btn:hover { border-color: rgba(255, 255, 255, .32); background: var(--card-2); }

.auth-btn-primary {
  background: var(--text);
  border-color: transparent;
  color: #101201;
  font: 700 15px var(--font-display);
  letter-spacing: .01em;
}
.auth-btn-primary:hover {
  background: var(--text);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(247, 247, 248, .14);
}
.auth-btn:active { transform: none; box-shadow: none; }
.auth-btn[disabled] { cursor: default; transform: none; box-shadow: none; }

.auth-btn-wait { display: flex; align-items: center; gap: 10px; }
.auth-spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(247, 247, 248, .25);
  border-top-color: var(--text);
  animation: auth-spin .7s linear infinite;
}
.auth-btn-primary .auth-spinner { border-color: rgba(16, 18, 1, .25); border-top-color: #101201; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #ff5c92;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid rgba(255, 0, 91, .35);
  border-radius: 12px;
  padding: 11px 13px;
  background: rgba(255, 0, 91, .07);
  margin-top: 14px;
}
.auth-error-cut { font-family: var(--font-mono); letter-spacing: .1em; flex: none; }

.auth-note { margin-top: 18px; font-size: 12.5px; color: var(--dim); line-height: 1.6; }

.auth-foot {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.auth-foot b { font-weight: 400; color: var(--muted); }
.auth-foot b.auth-foot-lime { color: var(--lime); }

/* right side: decorative soundstage panel with the studio pass card */
.auth-right {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(560px 300px at 70% -8%, rgba(209, 254, 23, .09), transparent 62%),
    radial-gradient(460px 340px at 20% 110%, rgba(255, 0, 91, .07), transparent 60%),
    #101113;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 40px;
}
/* film grain (under the pass card — ::before renders before children) */
.auth-right::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.9'%20numOctaves='2'/%3E%3C/filter%3E%3Crect%20width='160'%20height='160'%20filter='url(%23n)'%20opacity='0.6'/%3E%3C/svg%3E");
}
/* clapper hazard stripe along the top edge */
.auth-right::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 10px;
  background: repeating-linear-gradient(-55deg, var(--lime) 0 15px, transparent 15px 32px);
  opacity: .85;
}

.auth-pass {
  position: relative;
  width: 100%;
  max-width: 400px;
  transform: rotate(-1.6deg);
  background: #17191b;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
  overflow: hidden;
}

.auth-pass-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--line);
}
.auth-pass-dot { width: 20px; height: 20px; border-radius: 6px; background: var(--lime); position: relative; flex: none; }
.auth-pass-dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #17191b; }
.auth-pass-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.auth-pass-no { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--dim); }

.auth-pass-body { padding: 22px 20px 18px; }
.auth-pass-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}
.auth-pass-name {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px dashed rgba(255, 255, 255, .16);
  padding: 5px 0 10px;
}
.auth-pass-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 20px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.auth-pass-lime { color: var(--lime); }

.auth-pass-tear { border-top: 1px dashed rgba(255, 255, 255, .16); margin: 0 10px; }

.auth-pass-foot { display: flex; align-items: center; gap: 16px; padding: 15px 20px 17px; }
.auth-pass-barcode {
  width: 74px; height: 34px;
  flex: none;
  background: repeating-linear-gradient(90deg, var(--text) 0 2px, transparent 2px 4px, var(--text) 4px 5px, transparent 5px 9px);
  opacity: .5;
}
.auth-pass-price { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.auth-pass-price span { color: var(--dim); }

.auth-stage {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}
.auth-rolling { display: inline-flex; align-items: center; gap: 7px; color: #ff6b9e; }
.auth-rolling-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); animation: auth-blink 1.4s ease-in-out infinite; }
@keyframes auth-blink { 50% { opacity: .15; } }
.auth-stage-sep { color: rgba(255, 255, 255, .2); }
.auth-tc { color: var(--lime); }
.auth-stage-note { position: relative; margin-top: 12px; max-width: 34ch; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--dim); }

@media (max-width: 960px) {
  .auth-modal { grid-template-columns: 1fr; max-width: 560px; min-height: 0; }
  .auth-right { display: none; }
  .auth-left { padding: 24px 30px 20px; }
  .auth-main { padding: 36px 0 30px; }
}
@media (max-width: 560px) {
  .auth-gate { padding: 12px; }
  .auth-left { padding: 20px 22px 16px; }
  .auth-foot { gap: 12px 18px; }
}

/* account chip in the header */
.user-box { position: relative; }

.user-chip {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--lime);
  font: 700 13px var(--font-display);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-chip img { width: 100%; height: 100%; object-fit: cover; }
.user-chip:hover, .user-chip.open { border-color: var(--lime); }

/* account dropdown: who you are, what the studio costs you, whose keys it runs on */
.acct-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 308px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  z-index: 80;
  overflow: hidden;
  text-align: left;
}

.acct-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 13px;
  border-bottom: 1px solid var(--line);
}
.acct-ava {
  width: 36px; height: 36px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(90% 80% at 50% 20%, rgba(209, 254, 23, .5), var(--card-2));
  color: #101201;
  font: 700 14px var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
}
.acct-ava img { width: 100%; height: 100%; object-fit: cover; }
.acct-who { min-width: 0; }
.acct-name {
  display: block;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-name:empty { display: none; }
.acct-email {
  display: block;
  font-size: 12px;
  color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.acct-stats {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.acct-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.acct-k { color: var(--dim); }
.acct-v { margin-left: auto; text-align: right; }
.acct-v.lime { color: var(--lime); }
.acct-v.warn { color: #ff5c92; }
.acct-num { font-variant-numeric: tabular-nums; }

.acct-keys {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.acct-keys-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.acct-keys-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.acct-manage {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--dim);
  font: 400 11px var(--font-body);
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}
.acct-manage:hover { color: var(--lime); }
.acct-keys-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.acct-key { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.acct-key.off { color: var(--dim); }
.acct-key-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); flex: none; }
.acct-key.off .acct-key-dot { background: var(--dim); }

.acct-actions {
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.acct-item {
  display: block;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--text);
  font: 400 13px var(--font-body);
  text-align: left;
  padding: 8px 11px;
  cursor: pointer;
  transition: background .12s, color .12s;
  text-decoration: none;
}
.acct-item:hover { background: var(--card-2); color: var(--text); }
.acct-signout { color: var(--muted); }
.acct-signout:hover { color: #ff5c92; }

/* keys dialog */
.keys-dialog .keys-intro { margin: -4px 0 6px; }

.agent-token { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2px; }
.agent-token .note { margin: 6px 0 0; font-size: 12px; line-height: 1.45; }
.agent-token-env {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--lime);
  border-radius: 10px;
  font: 12px/1.6 var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}
.agent-token-actions { display: flex; gap: 8px; margin-top: 10px; }

.key-status {
  font-size: 11px;
  color: var(--dim);
  margin-top: 4px;
}

.keys-dialog input,
.onboarding .slate-field input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font: 13px var(--font-mono);
}

.keys-dialog input:focus,
.onboarding .slate-field input:focus {
  outline: none;
  border-color: var(--lime);
}

/* ── first-run onboarding ── */
.onboarding {
  width: min(560px, 92vw);
  max-height: 92vh;
  overflow: auto;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* bulletproof centering (global *{margin:0} kills margin:auto) */
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.onboarding::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.ob-slate {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 24px; border-bottom: 1px solid var(--line);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em;
}
.ob-clap {
  width: 28px; height: 18px; border-radius: 3px;
  background: repeating-linear-gradient(-52deg, var(--lime) 0 6px, #0d0e10 6px 12px);
}
.ob-scene { font-weight: 700; font-size: 12px; color: var(--lime); }
.ob-take { font-size: 11px; color: var(--muted); margin-left: auto; }
.ob-step { padding: 28px 26px 6px; }
.ob-title {
  font-family: var(--font-display); font-size: 27px; font-weight: 700;
  margin: 0 0 10px; text-transform: none; letter-spacing: -.01em;
}
.ob-title em { color: var(--lime); font-style: normal; }
.ob-lead { color: var(--muted); line-height: 1.55; margin: 0 0 22px; font-size: 14px; }
.ob-shots { list-style: none; margin: 0; padding: 0; display: grid; gap: 15px; }
.ob-shots li { display: flex; gap: 14px; align-items: flex-start; }
.ob-num { font-family: var(--font-display); color: var(--lime); font-weight: 700; font-size: 13px; min-width: 22px; padding-top: 1px; }
.ob-shots b { display: block; font-size: 14px; margin-bottom: 2px; }
.ob-shots span { color: var(--dim); font-size: 13px; line-height: 1.45; }
.onboarding .slate-field { margin-bottom: 16px; }
.ob-hint { color: var(--dim); font-size: 12px; margin: 6px 0 0; }
.key-help {
  display: inline-block; margin-top: 7px;
  font-size: 12px; color: var(--lime); text-decoration: none; opacity: .85;
}
.key-help:hover { opacity: 1; text-decoration: underline; }

/* language picker (header) */
.lang-pick {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden;
}
.lang-pick button {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: 700 11px var(--font-display); letter-spacing: .05em; padding: 4px 10px;
}
.lang-pick button:hover { color: var(--text); }
.lang-pick button.on { background: var(--lime); color: #0d0e10; }
.ob-price { display: flex; align-items: baseline; gap: 14px; margin: 10px 0 6px; }
.ob-amount { font-family: var(--font-display); font-size: 42px; font-weight: 700; line-height: 1; }
.ob-amount small { font-size: 16px; color: var(--muted); font-weight: 400; }

/* plan tiles: the choice itself is the price, so the amount is the headline and the
   period is the label under it */
.ob-plans { display: flex; gap: 10px; margin: 14px 0 10px; flex-wrap: wrap; }
.ob-plan {
  position: relative;
  flex: 1 1 150px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--card-2);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ob-plan:hover { border-color: var(--muted); }
.ob-plan.current { border-color: var(--lime); background: rgba(209, 254, 23, .07); }
.ob-plan-amount { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.05; color: var(--text); }
.ob-plan-amount small { font-size: 13px; color: var(--muted); font-weight: 400; }
.ob-plan-name {
  font-family: var(--font-display); font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--dim);
}
.ob-plan.current .ob-plan-name { color: var(--lime); }
.ob-plan-save {
  position: absolute; top: 10px; right: 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--lime);
}
.ob-trial {
  padding: 5px 12px; border-radius: 999px; background: rgba(209, 254, 23, .14); color: var(--lime);
  font-family: var(--font-display); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
}
.ob-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px 20px; border-top: 1px solid var(--line); margin-top: 16px;
}
.ob-dots { display: flex; gap: 7px; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: background .2s; }
.ob-dot.on { background: var(--lime); }
.ob-actions { display: flex; align-items: center; gap: 12px; }
.ob-skip { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; font-size: 13px; padding: 4px; }
.ob-skip:hover { color: var(--text); }

/* move-to-scene picker: same fixed-position trick as the upscale one */
.move-picker { display: contents; }
.move-picker .move-menu {
  position: fixed;
  top: auto; left: auto; right: auto; bottom: auto;
  width: 250px;
  min-width: 0;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.move-picker .model-item:disabled { cursor: default; opacity: .55; }
