/* ============================================================
   Prompt Studio — Compact AI Studio (dark premium)
   Design system + components. Single accent: ember.
   Radius scale: panels 10px / controls 8px / chips pill.
   ============================================================ */

/* ---------- fonts (self-hosted, OFL) ---------- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/manrope-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/manrope-lat.woff2') format('woff2');
  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+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/jbmono-cyr.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/jbmono-lat.woff2') format('woff2');
  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+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  --bg: #0b0d10;
  --bg-2: #0e1014;
  --panel: #14171d;
  --panel-2: #191d24;
  --panel-3: #1e232b;
  --input: #0d0f13;

  --border: #242932;
  --border-2: #333a45;
  --hairline: rgba(255, 255, 255, 0.06);

  --fg: #e9ecf1;
  --fg-2: #c3cad4;
  --muted: #8b95a3;
  --faint: #6e7986;

  --accent: #f0813f;
  --accent-soft: rgba(240, 129, 63, 0.13);
  --accent-border: rgba(240, 129, 63, 0.38);
  --accent-ink: #1c0e05;

  --ok: #4fae7c;
  --ok-soft: rgba(79, 174, 124, 0.13);
  --warn: #d9a441;
  --warn-soft: rgba(217, 164, 65, 0.13);
  --err: #e2604f;
  --err-soft: rgba(226, 96, 79, 0.12);

  --font-ui: 'Manrope', system-ui, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

  --radius: 10px;
  --radius-sm: 8px;

  --topbar-h: 48px;
  --sidebar-w: 236px;

  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.45);
  --z-drawer: 40;
  --z-modal: 50;
  --z-toast: 60;
  --z-scrim: 35;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, video, canvas, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus:not(:focus-visible) { outline: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a303a; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #38404c; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- app shell ---------- */
.app { display: grid; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 0; overflow: hidden; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { width: 22px; height: 22px; color: var(--accent); flex: none; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: 0.01em; white-space: nowrap; }
.brand-sub { color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.provider-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; font-size: 12.5px; color: var(--fg-2);
  max-width: 240px;
}
.provider-chip:hover { border-color: var(--border-2); color: var(--fg); }
.provider-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.provider-chip.is-ok .dot { background: var(--ok); }
.provider-chip .pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-menu { display: none; }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px;
  overflow-y: auto; min-height: 0;
}
.nav-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); padding: 12px 8px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--fg-2); font-size: 13px; font-weight: 500;
  text-align: left; min-height: 34px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--panel); color: var(--fg); }
.nav-item.is-active { background: var(--panel-2); color: var(--fg); }
.nav-item.is-active .nav-num { color: var(--accent); }
.nav-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); width: 16px; flex: none; }
.nav-icon { width: 15px; height: 15px; flex: none; color: var(--faint); }
.nav-item:hover .nav-icon, .nav-item.is-active .nav-icon { color: var(--fg-2); }
.nav-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-state { font-size: 11px; color: var(--faint); flex: none; }
.nav-state.is-done { color: var(--ok); }
.nav-state.is-active { color: var(--accent); }
.nav-item .kbd-hint { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.sidebar-history { display: flex; flex-direction: column; gap: 2px; }
.history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 12px; text-align: left; width: 100%; cursor: pointer;
}
.history-item:hover { background: var(--panel); color: var(--fg-2); }
.history-item .hi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .hi-del { color: var(--faint); font-family: var(--font-mono); font-size: 12px; padding: 2px 4px; border-radius: 4px; }
.history-item .hi-del:hover { color: var(--err); background: var(--err-soft); }
.history-empty { color: var(--faint); font-size: 12px; padding: 6px 9px; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 2px; color: var(--faint); font-size: 11px; border-top: 1px solid var(--hairline); }
.sidebar-foot .privacy-line { display: flex; gap: 6px; align-items: center; }
.privacy-line svg { width: 12px; height: 12px; color: var(--ok); flex: none; }

.sidebar-scrim {
  position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-scrim); display: none;
}

/* ---------- workspace ---------- */
.workspace { overflow-y: auto; min-height: 0; background: var(--bg); }
.view { max-width: 1220px; margin: 0 auto; padding: 18px 20px 56px; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-height: 30px; flex-wrap: wrap; }
.view-title { font-size: 17px; font-weight: 700; letter-spacing: 0.01em; margin: 0; }
.view-sub { color: var(--muted); font-size: 12.5px; }
.view-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-pad { padding: 14px 16px; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 0; font-weight: 500;
}
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-body { padding: 14px; }
.panel + .panel { margin-top: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-video { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
.grid-analyze { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 12px; align-items: start; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; letter-spacing: 0.005em; white-space: nowrap;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease, transform 0.05s ease;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #f59157; }
.btn-secondary { background: var(--panel-2); border-color: var(--border-2); color: var(--fg); }
.btn-secondary:hover { background: var(--panel-3); border-color: var(--faint); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: var(--panel-2); }
.btn-danger-ghost { color: var(--muted); }
.btn-danger-ghost:hover { color: var(--err); background: var(--err-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn .lbl-copied { color: var(--ok); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-danger:hover { color: var(--err); background: var(--err-soft); }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; background: var(--input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; min-height: 34px;
  transition: border-color 0.13s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { resize: vertical; line-height: 1.55; min-height: 80px; font-family: var(--font-mono); font-size: 12.5px; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.field-hint { font-size: 11.5px; color: var(--faint); margin: 0; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }
.check {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2);
  cursor: pointer; user-select: none; min-height: 28px;
}
.check input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }

/* ---------- segmented ---------- */
.segmented {
  display: inline-flex; background: var(--input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px; gap: 2px;
}
.segmented button {
  height: 27px; padding: 0 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
  color: var(--muted); transition: background 0.12s ease, color 0.12s ease; white-space: nowrap;
}
.segmented button:hover { color: var(--fg); }
.segmented button[aria-pressed="true"] { background: var(--panel-3); color: var(--fg); }
.segmented.seg-accent button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 13px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease; min-height: 36px;
}
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab .tab-badge { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-left: 5px; }

/* ---------- chips / badges / dots ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--fg-2); white-space: nowrap;
}
.chip .c-muted { color: var(--faint); }
.chip.is-on { border-color: var(--accent-border); color: var(--accent); background: var(--accent-soft); }
.chip[type="button"] { cursor: pointer; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.07em;
  text-transform: uppercase;
}
.badge-demo { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(217, 164, 65, 0.3); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(79, 174, 124, 0.3); }
.badge-info { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.badge-err { background: var(--err-soft); color: var(--err); border: 1px solid rgba(226, 96, 79, 0.3); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--err); }
.dot-faint { background: var(--faint); }

/* ---------- dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 240px; padding: 32px 20px; text-align: center;
  background: var(--panel); border: 1.5px dashed var(--border-2); border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--faint); background: var(--panel-2); }
.dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { width: 34px; height: 34px; color: var(--muted); }
.dropzone.is-drag .dz-icon { color: var(--accent); }
.dz-title { font-size: 14.5px; font-weight: 700; }
.dz-sub { color: var(--muted); font-size: 12.5px; }
.dz-hint { color: var(--faint); font-size: 11.5px; margin-top: 6px; }

/* ---------- video ---------- */
.video-wrap { background: #000; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.video-wrap video { width: 100%; max-height: 380px; background: #000; }
.transport { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.transport .timecode { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.seek-wrap { position: relative; flex: 1; min-width: 0; padding: 8px 0 0; }
.seekbar { width: 100%; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.seek-marks { position: relative; height: 7px; margin-top: -14px; pointer-events: none; }
.seek-mark { position: absolute; top: 0; width: 2px; height: 7px; background: var(--faint); border-radius: 1px; }
.seek-mark.is-frame { background: var(--accent); opacity: 0.85; }
.seek-mark.is-cut { background: var(--fg-2); width: 1px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--hairline); padding: 6px 0; font-size: 12.5px; }
.info-row .k { color: var(--muted); }
.info-row .v { font-family: var(--font-mono); font-size: 12px; color: var(--fg-2); text-align: right; }

.ref-frame { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.ref-thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--input); }
.ref-thumb-empty {
  width: 96px; height: 54px; border-radius: 6px; border: 1px dashed var(--border-2);
  display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 10px; text-align: center; padding: 4px;
}
.ref-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

/* frames strip */
.frames-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.frame-card {
  position: relative; flex: none; width: 108px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--input); overflow: hidden;
  transition: border-color 0.12s ease;
}
.frame-card:hover { border-color: var(--border-2); }
.frame-card.is-selected { border-color: var(--accent); }
.frame-card img { width: 100%; height: 61px; object-fit: cover; }
.frame-card .fc-time {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.68); font-family: var(--font-mono); font-size: 10px; color: var(--fg);
}
.frame-card .fc-del svg, .frame-card .fc-full svg { width: 11px; height: 11px; }
.frame-add svg { width: 14px; height: 14px; }
.history-item .hi-del svg { width: 11px; height: 11px; }
.frame-card .fc-del {
  position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.6); color: var(--fg-2); font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.12s ease;
}
.frame-card:hover .fc-del, .frame-card:focus-within .fc-del { opacity: 1; }
.frame-card .fc-full {
  position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.6); color: var(--fg-2); font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.12s ease;
}
.frame-card:hover .fc-full { opacity: 1; }
.frame-add {
  flex: none; width: 108px; height: 61px; border-radius: 8px; border: 1px dashed var(--border-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px;
}
.frame-add:hover { border-color: var(--accent); color: var(--accent); }

/* scenes strip */
.scenes-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.scene-chip {
  flex: none; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--input); text-align: left; min-width: 110px;
}
.scene-chip:hover { border-color: var(--border-2); }
.scene-chip.is-active { border-color: var(--accent); background: var(--accent-soft); }
.scene-chip .sc-name { font-size: 11.5px; font-weight: 700; color: var(--fg-2); }
.scene-chip .sc-time { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ---------- progress steps ---------- */
.steps { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.step-row { display: flex; align-items: center; gap: 9px; padding: 5px 2px; font-size: 12.5px; color: var(--faint); }
.step-row .st-icon { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; }
.step-row .st-icon svg { width: 13px; height: 13px; }
.step-row .st-detail { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.step-row.is-active { color: var(--fg); }
.step-row.is-active .st-icon { color: var(--accent); }
.step-row.is-done { color: var(--fg-2); }
.step-row.is-done .st-icon { color: var(--ok); }
.step-row.is-error { color: var(--err); }
.step-row.is-error .st-icon { color: var(--err); }

/* spinner */
.spin { width: 13px; height: 13px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 2.4s; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- notices ---------- */
.notice { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); font-size: 12.5px; }
.notice svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.notice-warn { border-color: rgba(217, 164, 65, 0.35); background: var(--warn-soft); color: #ecc27a; }
.notice-err { border-color: rgba(226, 96, 79, 0.35); background: var(--err-soft); color: #f0917f; }
.notice-info { color: var(--muted); }
.notice .n-title { font-weight: 700; color: inherit; margin: 0 0 3px; }
.notice .n-text { margin: 0; color: inherit; opacity: 0.92; }
.notice .n-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

/* ---------- accordion ---------- */
.acc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.acc + .acc { margin-top: 8px; }
.acc-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 13px;
  text-align: left; font-size: 13px; font-weight: 600; color: var(--fg-2);
}
.acc-head:hover { background: var(--panel-2); color: var(--fg); }
.acc-head .acc-caret { margin-left: auto; color: var(--faint); transition: transform 0.15s ease; width: 14px; height: 14px; }
.acc[open] .acc-caret, .acc.is-open .acc-caret { transform: rotate(90deg); }
.acc-head .acc-sum { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-body { padding: 2px 13px 13px; font-size: 12.5px; color: var(--fg-2); }
.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }

/* ---------- timeline ---------- */
.tl-scene-bar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.tl-scene-seg {
  position: relative; min-width: 24px; background: var(--panel-2); border-right: 1px solid var(--bg);
  font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); cursor: pointer; overflow: hidden;
}
.tl-scene-seg:hover { background: var(--panel-3); color: var(--fg-2); }
.tl-scene-seg.is-active { background: var(--accent-soft); color: var(--accent); }
.tl-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tl-table th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 7px 9px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tl-table td { padding: 8px 9px; border-bottom: 1px solid var(--hairline); vertical-align: top; color: var(--fg-2); }
.tl-table tr:hover td { background: var(--panel-2); }
.tl-table tr.tl-row { cursor: pointer; }
.tl-table tr.is-active td { background: var(--accent-soft); }
.tl-time { font-family: var(--font-mono); font-size: 11px; color: var(--accent); white-space: nowrap; }
.tl-cell-strong { color: var(--fg); font-weight: 600; }
.tl-empty { color: var(--faint); }

/* ---------- prompt card ---------- */
.prompt-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.counts { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.counts.is-over { color: var(--warn); }
.prompt-editor {
  width: 100%; min-height: 240px; max-height: 46vh; resize: vertical;
  background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 13px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: var(--fg);
}
.prompt-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.avoid-block { margin-top: 10px; border: 1px solid rgba(226, 96, 79, 0.28); background: var(--err-soft); border-radius: var(--radius-sm); padding: 9px 11px; }
.avoid-block .avoid-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--err); margin: 0 0 5px; }
.avoid-block ul { margin: 0; padding-left: 16px; color: #f0a294; font-size: 12px; }

/* ---------- empty state ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 44px 20px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--muted);
}
.empty .em-icon { width: 26px; height: 26px; color: var(--faint); margin-bottom: 4px; }
.empty .em-title { font-size: 13.5px; font-weight: 700; color: var(--fg-2); }
.empty .em-text { font-size: 12px; max-width: 44ch; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: 380px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--border);
  z-index: var(--z-drawer); display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform 0.22s ease; box-shadow: var(--shadow-pop);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: 14px; font-weight: 700; margin: 0; flex: 1; }
.drawer-body { padding: 14px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.drawer-tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); }
.drawer-scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0, 0, 0, 0.45); z-index: var(--z-scrim); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(4, 5, 7, 0.78);
}
.modal-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); max-width: 92vw; max-height: 92vh; overflow: auto; box-shadow: var(--shadow-pop); }
.modal-box img { max-height: 78vh; width: auto; }
.modal-bar { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.modal-bar .mt { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); flex: 1; }

/* ---------- toast ---------- */
.toast-region { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-3); border: 1px solid var(--border-2); color: var(--fg);
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; box-shadow: var(--shadow-pop);
  animation: toast-in 0.18s ease;
}
.toast.is-err { border-color: rgba(226, 96, 79, 0.5); color: #f0917f; }
.toast.is-ok { border-color: rgba(79, 174, 124, 0.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */
.divider { border: 0; border-top: 1px solid var(--hairline); margin: 12px 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.skeleton { position: relative; overflow: hidden; background: var(--panel-2); border-radius: 6px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: sk 1.4s infinite;
}
@keyframes sk { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.output-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.output-list li { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--fg-2); }
.output-list li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: none; transform: translateY(-2px); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .grid-video { grid-template-columns: 1fr; }
  .grid-analyze { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: 262px; z-index: var(--z-drawer);
    transform: translateX(-102%); transition: transform 0.22s ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim.is-open { display: block; }
  .btn-menu { display: inline-flex; }
  .view { padding: 14px 14px 48px; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .ref-frame { grid-template-columns: 76px 1fr; }
  .topbar { gap: 8px; padding: 0 10px; }
  .provider-chip .pc-name { max-width: 110px; }
  .view-head .right { margin-left: 0; width: 100%; }
  .field-row { flex-direction: column; }
  .drawer { width: 100%; }
}

/* Narrow phones (360–400px): keep all topbar actions inside the viewport. */
@media (max-width: 400px) {
  .topbar { gap: 6px; padding: 0 7px; }
  .topbar-right { gap: 5px; }
  .provider-chip { padding: 0 9px; gap: 6px; }
  .provider-chip .pc-name { max-width: 80px; }
  .brand-name { font-size: 13px; }
}

/* ═══════════ CINEMATIC PASS — hero, cards, timeline thumbs ═══════════ */

.upload-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d0f13;
  min-height: clamp(360px, 52vh, 540px);
  display: flex;
  align-items: center;
}
.hero-bg {
  position: absolute; inset: 0;
  background-color: #0d0f13;
  background-image: url('hero-cinematic.webp');
  background-size: cover;
  background-position: center right;
  opacity: 0.55;
  filter: saturate(0.92) contrast(1.02);
}
.hero-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 10, 13, 0.94) 0%, rgba(9, 10, 13, 0.74) 44%, rgba(9, 10, 13, 0.28) 100%),
    radial-gradient(120% 90% at 88% 16%, rgba(240, 129, 63, 0.10), transparent 55%);
}
.hero-content { position: relative; z-index: 1; width: 100%; padding: clamp(26px, 4.6vw, 54px); max-width: 660px; }
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.hero-title {
  font-size: clamp(26px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -0.02em;
  font-weight: 800; margin: 0 0 12px;
  background: linear-gradient(180deg, var(--fg), #b9c0cb);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 14.5px; line-height: 1.62; margin: 0 0 22px; max-width: 54ch; }
.dropzone-hero {
  max-width: 480px; min-height: 188px; padding: 26px 22px;
  background: rgba(20, 23, 29, 0.62);
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dropzone-hero:hover { border-color: rgba(240, 129, 63, 0.55); background: rgba(24, 27, 34, 0.72); }
.dropzone-hero.is-drag { border-color: var(--accent); background: rgba(240, 129, 63, 0.10); }
.dz-error { color: var(--err); font-size: 13px; margin: 12px 0 0; max-width: 52ch; }
.hero-note { color: var(--faint); font-size: 12px; margin: 16px 0 0; }

.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.meta-chips-dyn { display: contents; }
.analysis-chip.is-ok { border-color: rgba(79, 174, 124, 0.4); color: var(--ok); }
.analysis-chip.is-warn { border-color: rgba(217, 164, 65, 0.4); color: var(--warn); }
.analysis-chip.is-run { border-color: var(--accent-border); color: var(--accent); }

.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(188px, 1fr)); gap: 12px; margin-top: 12px; }
.model-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 15px; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0) 55%), var(--panel);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.model-card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); }
.model-card.is-active { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.model-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mc-name { font-weight: 700; font-size: 14px; letter-spacing: 0.01em; color: var(--fg); }
.mc-status {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px; white-space: nowrap;
}
.mc-status.is-ok { color: var(--ok); border-color: rgba(79, 174, 124, 0.35); }
.mc-cap { font-size: 11.5px; color: var(--muted); }
.mc-preview {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5; color: var(--fg-2);
  min-height: 48px; max-height: 66px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.mc-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.mc-len { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.mc-copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; color: var(--muted);
  border: 1px solid transparent; transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.mc-copy:hover { color: var(--fg); background: var(--panel-2); border-color: var(--border); }
.mc-copy svg { width: 13px; height: 13px; }

.tl-thumb-cell { width: 74px; }
.tl-thumb { width: 64px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.tl-thumb-empty { background: var(--panel-2); border-style: dashed; }

@media (max-width: 920px) {
  .hero-content { max-width: 100%; }
  .dropzone-hero { max-width: 100%; }
}
