/* CrisoLabs · Reel & Voice Studio
   Laca #0A0F0D · chartreuse #D2F25C · Instrument Sans autoalojada */

@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-normal-400-700-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-normal-400-700-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/instrument-sans-italic-wdth.woff2") format("woff2");
  font-weight: 400 700; font-style: italic; font-display: swap;
}

:root {
  --laca: #0A0F0D;
  --laca-2: #0D1411;
  --surface: #111915;
  --surface-2: #16201B;
  --surface-3: #1C2822;
  --line: rgba(238, 242, 236, .08);
  --line-2: rgba(238, 242, 236, .14);
  --text: #EEF2EC;
  --muted: #98A49D;
  --dim: #64716A;
  --chart: #D2F25C;
  --chart-soft: rgba(210, 242, 92, .14);
  --chart-mid: rgba(210, 242, 92, .5);
  --ink: #0A0F0D;
  --rec: #FF5A4E;
  --amber: #F2B84B;
  --ok: #9BE07E;
  --radius: 16px;
  --radius-sm: 10px;
  --top-h: 60px;
  --tab-h: 0px;
  --gap: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--laca);
  color: var(--text);
  font: 15px/1.45 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .86em; color: var(--chart); }
em { font-style: normal; color: var(--dim); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ top */
.topbar {
  height: var(--top-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0C1310, var(--laca));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--chart); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-weight: 700; letter-spacing: -.01em; }
.brand-text span { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.top-project { display: flex; align-items: baseline; gap: 10px; min-width: 0; justify-content: center; }
.top-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.eyebrow, .label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.top-status { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px; border-radius: 99px;
  font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--line-2); background: var(--surface);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(155, 224, 126, .15); }
.pill.busy .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(242, 184, 75, .18); animation: pulse 1s infinite; }
.pill.err .dot { background: var(--rec); }
.pill-ghost { background: transparent; }

/* --------------------------------------------------------------- layout */
.layout {
  height: calc(100% - var(--top-h) - var(--tab-h) - env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr) minmax(340px, 390px);
}
.col {
  min-width: 0; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 18px 28px;
  display: flex; flex-direction: column; gap: var(--gap);
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.col + .col { border-left: 1px solid var(--line); }
.col-studio { background: radial-gradient(120% 70% at 50% 0%, #0F1814 0%, var(--laca) 70%); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col-head > div:first-child { display: flex; align-items: center; gap: 10px; min-width: 0; }
.col-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.step-num {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--ink); background: var(--chart);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .label em { text-transform: none; letter-spacing: 0; font-weight: 500; }
.field-row { display: flex; gap: 10px; }
.grow { flex: 1; }
input[type=text], input:not([type]), select, textarea {
  width: 100%;
  background: var(--laca-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; line-height: 1.55; min-height: 120px; }
input:focus, select:focus, textarea:focus { border-color: var(--chart-mid); box-shadow: 0 0 0 3px var(--chart-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: rgba(238, 242, 236, .22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 15.5px; width: 100%; white-space: normal; text-align: center; }
.btn-primary { background: var(--chart); color: var(--ink); border-color: var(--chart); }
.btn-primary:hover { background: #DDF77A; border-color: #DDF77A; }
.btn-ai { background: linear-gradient(135deg, rgba(210, 242, 92, .16), rgba(210, 242, 92, .05)); border-color: rgba(210, 242, 92, .4); color: #E9FBA8; }
.btn-ai:hover { background: rgba(210, 242, 92, .2); border-color: var(--chart); }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent;
  animation: spin .8s linear infinite;
}
.btn-primary.loading::after { border-color: var(--ink) transparent var(--ink) transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.end { justify-content: flex-end; }
.btn-row .btn-ai { flex: 1 1 auto; }
.btn-icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-size: 14px;
}
.btn-icon:hover { background: var(--surface-3); }
.btn-icon:disabled { opacity: .35; }
.file-btn { position: relative; overflow: hidden; align-self: flex-start; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.chip.ok { background: rgba(155, 224, 126, .14); color: var(--ok); }
.chip.warn { background: rgba(242, 184, 75, .14); color: var(--amber); }
.chip.bad { background: rgba(255, 90, 78, .14); color: #FF8A80; }
.chip.lime { background: var(--chart-soft); color: var(--chart); }

/* --------------------------------------------------------- project list */
.project-list { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow-y: auto; padding-right: 2px; flex: none; }
.proj {
  text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid transparent; background: transparent;
  transition: background .12s, border-color .12s;
}
.proj:hover { background: var(--surface); }
.proj[aria-selected=true] { background: var(--surface-2); border-color: rgba(210, 242, 92, .35); }
.proj-title { font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.proj-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.proj-ico { font-size: 15px; }
.proj-bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.proj-bar i { display: block; height: 100%; background: var(--chart); border-radius: 3px; }
.proj-src { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); align-self: start; padding-top: 2px; }

/* ---------------------------------------------------------- editor bits */
.editor > .field-row { display: grid; grid-template-columns: minmax(0, 1fr); }
.duration { display: flex; flex-direction: column; gap: 7px; }
.duration-track { position: relative; height: 8px; border-radius: 8px; background: var(--surface-3); }
.duration-range { position: absolute; top: 0; bottom: 0; border-radius: 8px; background: rgba(155, 224, 126, .28); }
.duration-mark { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 3px; background: var(--chart); box-shadow: 0 0 0 3px rgba(10, 15, 13, .9); transition: left .3s; }
.duration-legend { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); gap: 8px; }
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert { font-size: 13px; line-height: 1.4; padding: 9px 11px; border-radius: 10px; background: rgba(242, 184, 75, .09); border: 1px solid rgba(242, 184, 75, .25); color: #F5CF83; }
.video-base { display: flex; flex-direction: column; gap: 8px; }
.video-base .label em { text-transform: none; letter-spacing: 0; font-weight: 500; }
.video-card { display: flex; gap: 12px; align-items: stretch; }
.video-thumb {
  width: 72px; height: 112px; flex: none; border-radius: 10px; overflow: hidden;
  background: var(--laca-2) center/cover no-repeat; border: 1px dashed var(--line-2);
  display: grid; place-items: center; font-size: 11px; color: var(--dim); text-align: center;
}
.video-thumb.has { border-style: solid; }
.video-thumb.has span { display: none; }
.video-meta { display: flex; flex-direction: column; gap: 9px; font-size: 13px; min-width: 0; justify-content: center; }
.notes summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.notes ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.progress { display: block; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; width: 100%; }
.progress i { display: block; height: 100%; width: 0; background: var(--chart); transition: width .2s; }

/* ------------------------------------------------------------- segments */
.seg {
  display: flex; padding: 4px; gap: 4px;
  background: var(--laca-2); border: 1px solid var(--line); border-radius: 14px;
}
.seg button {
  flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-weight: 600; cursor: pointer; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked=true] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px rgba(210, 242, 92, .35); }
.seg-sm { flex: none; }
.seg-sm button { min-height: 30px; font-size: 13px; padding: 0 10px; }
.seg-modes button { min-height: 44px; }
.seg-modes .ico { font-size: 17px; }

/* ---------------------------------------------------------------- stage */
.stage-wrap { display: flex; justify-content: center; }
.stage {
  position: relative;
  height: clamp(380px, calc(100dvh - 404px), 760px);
  aspect-ratio: 9 / 16;
  max-width: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: #050807;
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 0 6px rgba(238, 242, 236, .02);
  isolation: isolate;
}
.stage[data-aspect="16:9"] { aspect-ratio: 16 / 9; height: auto; width: 100%; max-height: calc(100dvh - 404px); }
.stage.recording { border-color: rgba(255, 90, 78, .7); box-shadow: 0 0 0 3px rgba(255, 90, 78, .18), 0 30px 80px -30px rgba(0, 0, 0, .8); }
.stage-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; z-index: 0; }
.stage-media.cam { transform: scaleX(-1); }
.stage[data-mode=dub] #baseVideo.ready { display: block; object-fit: contain; background: #000; }
.stage[data-mode=selfie] #camVideo.live { display: block; }
.voice-bg {
  position: absolute; inset: 0; z-index: 0; display: none;
  background: radial-gradient(90% 60% at 50% 100%, rgba(210, 242, 92, .08), transparent 70%), linear-gradient(180deg, #0B110E, #070B09);
}
.voice-bg canvas { position: absolute; left: 6%; right: 6%; bottom: 7%; width: 88%; height: 16%; opacity: .9; }
.stage[data-mode=voice] .voice-bg { display: block; }
.stage[data-mode=dub] .voice-bg.no-video { display: block; }

.safe-zone {
  position: absolute; left: 0; right: 11.1%; top: 14.06%; height: 51.04%;
  border: 1.5px dashed rgba(210, 242, 92, .55); border-radius: 6px; z-index: 1; pointer-events: none; display: none;
}
.safe-zone span { position: absolute; left: 8px; bottom: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: rgba(210, 242, 92, .85); text-transform: uppercase; }
.stage[data-mode=selfie] .safe-zone { display: block; }

.prompter {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0;
  height: 44%;
  padding: 18px 22px 0;
  background: linear-gradient(180deg, rgba(5, 8, 7, .94) 0%, rgba(5, 8, 7, .86) 70%, rgba(5, 8, 7, 0) 100%);
}
.stage[data-mode=voice] .prompter, .stage.no-media .prompter { height: 100%; background: transparent; padding-top: 28px; }
.stage[data-mode=dub] .prompter { height: 46%; }
.stage[data-aspect="16:9"] .prompter { height: 58%; }
.prompter-scroll {
  height: 100%; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 78%, transparent 100%);
}
.prompter-text {
  --fs: 34px;
  font-size: var(--fs);
  line-height: 1.32;
  font-weight: 500;
  letter-spacing: -.005em;
  color: var(--text);
  padding-bottom: 60vh;
  text-wrap: pretty;
}
.prompter-text .w { transition: opacity .2s, color .2s; border-radius: 4px; }
.prompter-text .w.b { font-weight: 700; color: var(--chart); }
.prompter-text .w.i { font-style: italic; }
.prompter-text .w.past { opacity: .32; }
.prompter-text .w.now { background: rgba(210, 242, 92, .18); box-shadow: 0 0 0 3px rgba(210, 242, 92, .18); }
.prompter-text .br { color: rgba(210, 242, 92, .42); font-weight: 600; font-size: .7em; margin: 0 .12em; letter-spacing: -.08em; }
.prompter-text .br.short { opacity: .7; }
.prompter-text .scene-sep {
  display: flex; align-items: center; gap: 10px; margin: .7em 0 .35em;
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
}
.prompter-text .scene-sep::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.prompter-text .scene-block { margin-bottom: .4em; }
.prompter-text .scene-block.active-scene .scene-sep { color: var(--chart); }
.reading-line { position: absolute; left: 8px; top: 30px; width: 4px; height: 1.2em; border-radius: 3px; background: var(--chart); opacity: .0; z-index: 3; transition: opacity .2s; }
.stage.pacing .reading-line { opacity: .9; }

.stage-hud { position: absolute; z-index: 4; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.rec-badge, .scene-badge {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 99px;
  background: rgba(5, 8, 7, .78); backdrop-filter: blur(6px); font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
}
.rec-badge { color: #FFD7D3; }
.rec-badge i { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); animation: pulse 1s infinite; }
.scene-badge { color: var(--muted); }
.countdown {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  font-size: 140px; font-weight: 700; color: var(--chart); background: rgba(5, 8, 7, .55);
  text-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.countdown.tick { animation: tick .9s ease-out; }
.stage-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); background: rgba(5, 8, 7, .9); }
.stage-empty.cam-off {
  inset: auto 14px 56px 14px; padding: 14px 16px; border-radius: 16px;
  background: rgba(17, 25, 21, .94); border: 1px solid var(--line-2); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; font-size: 13px; line-height: 1.35;
}
.stage-empty.cam-off .btn { flex: none; }
.stage-empty.cam-off span { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- transport */
.transport { display: flex; align-items: center; justify-content: center; gap: 22px; }
.rec-btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 26px 0 12px; border-radius: 99px;
  border: 1px solid rgba(255, 90, 78, .45); background: rgba(255, 90, 78, .08); color: #FFE2DF;
  font-weight: 700; font-size: 15.5px; cursor: pointer; transition: background .15s, transform .08s;
}
.rec-btn:hover { background: rgba(255, 90, 78, .15); }
.rec-btn:active { transform: scale(.98); }
.rec-core { width: 40px; height: 40px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 5px rgba(255, 90, 78, .18); transition: border-radius .2s, transform .2s; }
.rec-btn.on .rec-core { border-radius: 9px; transform: scale(.72); }
.rec-btn.on { background: rgba(255, 90, 78, .2); }
.rec-btn:disabled { opacity: .5; cursor: progress; }

/* ---------------------------------------------------------------- meters */
.meters { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.vu { display: flex; align-items: center; gap: 10px; }
.vu canvas { flex: 1; height: 14px; width: 100%; border-radius: 4px; background: var(--laca-2); }
.clip-led { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; padding: 3px 7px; border-radius: 6px; color: var(--dim); border: 1px solid var(--line-2); }
.clip-led.on { color: #fff; background: var(--rec); border-color: var(--rec); }
.meter-read { display: flex; gap: 18px; flex-wrap: wrap; }
.mr { display: flex; flex-direction: column; gap: 1px; }
.mr em { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.mr b { font-variant-numeric: tabular-nums; font-size: 15px; }
.mr b.ok { color: var(--ok); } .mr b.warn { color: var(--amber); } .mr b.bad { color: #FF8A80; }
.meter-msg { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.meter-msg.warn { color: var(--amber); } .meter-msg.bad { color: #FF8A80; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; align-items: center; }
.ppm-presets { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.ppm-presets .ppm-preset { min-width: 0; padding: 0 6px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.ppm-presets .ppm-preset.active { background: var(--chart); color: var(--laca); font-weight: 700; }
.ctl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.ctl b { color: var(--text); font-variant-numeric: tabular-nums; }
.ctl-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.ctl-check input { width: 18px; height: 18px; accent-color: var(--chart); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--chart); border: 3px solid var(--laca); box-shadow: 0 0 0 1px var(--chart); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--chart); border: 3px solid var(--laca); }

/* ------------------------------------------------------------ scene list */
.scene-list { display: flex; flex-direction: column; gap: 6px; }
.scene-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.scene-row.current { border-color: rgba(210, 242, 92, .45); background: var(--surface-2); }
.scene-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.scene-row.done .scene-n { background: var(--chart); color: var(--ink); }
.scene-txt { font-size: 13.5px; line-height: 1.35; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.scene-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; font-size: 12px; color: var(--dim); }
.scene-act { display: flex; gap: 6px; }
.scene-act .btn-icon { width: 36px; height: 36px; font-size: 12px; }

/* -------------------------------------------------------------- export */
.step-head { display: flex; align-items: center; gap: 10px; }
.step-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.step-dot {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--chart);
}
.step p { margin: 0; font-size: 13.5px; }
.step-alt { background: linear-gradient(180deg, var(--surface), var(--laca-2)); }
.link-out { color: var(--chart); font-weight: 600; font-size: 14px; text-decoration: none; align-self: flex-start; }
.link-out:hover { text-decoration: underline; }
.step-result { font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--laca-2); border: 1px solid var(--line); }
.step-result .row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.step-result a.dl { color: var(--chart); font-weight: 600; text-decoration: none; word-break: break-all; }
.lufs-pair { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.lufs-pair b { color: var(--chart); font-size: 18px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 132px; padding: 18px; border-radius: 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed rgba(210, 242, 92, .4); background: rgba(210, 242, 92, .035);
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone.over { background: rgba(210, 242, 92, .09); border-color: var(--chart); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-title { font-weight: 700; font-size: 15px; color: #E9FBA8; }
.dz-sub { font-size: 13px; color: var(--muted); }
.takes-summary { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.ts-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ts-label { font-size: 12.5px; color: var(--muted); }
.ab-player { display: flex; align-items: center; gap: 12px; }
.btn-play { width: 46px; height: 46px; background: var(--chart); color: var(--ink); border-color: var(--chart); font-size: 15px; }
.btn-play:hover { background: #DDF77A; }
.ab-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 38px; text-align: right; }
.ab-lufs { font-size: 13px; color: var(--muted); }
.ab-lufs b { color: var(--text); font-variant-numeric: tabular-nums; }
#abSeg button:disabled { opacity: .35; cursor: not-allowed; }
.render-out { display: flex; flex-direction: column; gap: 10px; }
.render-out video { width: 100%; max-height: 420px; border-radius: 14px; background: #000; border: 1px solid var(--line); }
.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.downloads a {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; font-weight: 600;
}
.downloads a span { color: var(--muted); font-weight: 500; font-size: 12px; }
.downloads a:hover { border-color: var(--chart-mid); }
.render-meta { font-size: 12.5px; color: var(--muted); }
.render-timer { font-size: 13px; color: var(--amber); }

/* ----------------------------------------------------------------- tabbar */
.tabbar { display: none; }

/* ----------------------------------------------------------------- dialog */
.dlg {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  padding: 0; border: 1px solid var(--line-2); border-radius: 20px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .9);
}
.dlg-wide { width: min(760px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(3, 5, 4, .72); backdrop-filter: blur(4px); }
.dlg form, .dlg .dlg-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h3 { margin: 0; font-size: 19px; }
.dlg p { margin: 0; font-size: 14px; }
.ai-status { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.ai-status::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--chart); border-right-color: transparent; animation: spin .8s linear infinite; }
.ai-status.err::before { display: none; }
.ai-status.err { color: #FF8A80; }
.ai-preview { display: flex; flex-direction: column; gap: 10px; }
.ai-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-scenes { display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow-y: auto; padding: 14px; border-radius: 14px; background: #060A08; border: 1px solid var(--line); }
.ai-scene { font-size: 17px; line-height: 1.45; }
.ai-scene .w.b { color: var(--chart); font-weight: 700; }
.ai-scene .w.i { font-style: italic; }
.ai-scene .br { color: rgba(210, 242, 92, .5); font-size: .75em; font-weight: 700; margin: 0 .1em; }
.ai-scene small { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
.ai-meta { font-size: 12.5px; color: var(--dim); }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--tab-h) + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text); font-size: 14px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .7);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 90, 78, .5); color: #FFD0CB; }
.toast.ok { border-color: rgba(210, 242, 92, .4); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes tick { 0% { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1); } }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .layout { grid-template-columns: minmax(300px, 330px) minmax(0, 1fr) minmax(320px, 350px); }
  .controls { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  :root { --tab-h: calc(64px + env(safe-area-inset-bottom)); --top-h: 56px; }
  body { font-size: 15px; }
  .topbar { grid-template-columns: auto 1fr; gap: 12px; padding: 0 14px; padding-top: env(safe-area-inset-top); }
  .top-status { display: none; }
  .top-project { justify-content: flex-end; }
  .top-project .eyebrow { display: none; }
  .top-title { max-width: 46vw; font-size: 14px; color: var(--muted); }
  .layout { display: block; }
  .col { display: none; height: 100%; padding: 14px 14px 24px; }
  .col + .col { border-left: 0; }
  .layout[data-view=guion] .col-guion,
  .layout[data-view=estudio] .col-studio,
  .layout[data-view=export] .col-export { display: flex; }
  .project-list { max-height: 34vh; }
  .stage { height: min(56dvh, 640px); }
  .stage[data-aspect="16:9"] { max-height: 40dvh; }
  .controls { grid-template-columns: 1fr 1fr; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: var(--tab-h); padding: 6px 10px env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    background: rgba(10, 15, 13, .96); border-top: 1px solid var(--line-2); backdrop-filter: blur(10px);
  }
  .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: transparent; color: var(--dim); font-size: 12px; font-weight: 600; border-radius: 12px; cursor: pointer;
  }
  .tabbar .t-ico { font-size: 18px; line-height: 1; }
  .tabbar button[aria-current=page] { color: var(--chart); background: var(--chart-soft); }
}

@media (max-width: 520px) {
  .brand-text span { display: none; }
  .col-head h2 { font-size: 16px; }
  .seg-modes button { flex-direction: column; gap: 1px; min-height: 52px; font-size: 12px; padding: 0 4px; white-space: normal; line-height: 1.15; }
  .seg-modes .ico { font-size: 18px; }
  .field-row { flex-direction: column; }
  .render .field-row { flex-direction: row; }
  .controls { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
  .ctl-check { font-size: 12.5px; }
  .prompter { padding: 14px 16px 0; }
  .transport { gap: 14px; }
  .rec-btn { height: 60px; padding: 0 20px 0 10px; font-size: 14.5px; }
  .downloads { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .toast { top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); bottom: auto; transform: translate(-50%, -16px); }
  .toast.show { transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
