/* Аркотека — рабочая версия. Тёмная сценарная консоль: сетка, свечения, цветные метки. */
:root {
  --paper: #0a101f;
  --paper-2: #0e1729;
  --paper-3: #16243d;
  --ink: #e6edf7;
  --ink-2: #c7d2e1;
  --muted: #93a4bf;
  --muted-2: #64748b;
  --line: #22314d;
  --line-2: #1a2842;
  --red: #f59e0b;
  --red-2: #d97706;
  --red-soft: rgba(245, 158, 11, .30);
  --gold: #fbbf24;
  --green: #34d399;
  --blue: #38bdf8;
  --plum: #a78bfa;
  --gray: #94a3b8;
  --rose: #fb7185;
  --font-display: "Manrope", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui: "Inter Tight", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: var(--font-display);
  --sans: var(--font-ui);
  --mono: "Menlo", "SF Mono", "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  --radius: 16px;
  --grid: rgba(148, 163, 184, .055);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 8% -8%, rgba(37, 99, 235, .34), transparent 62%),
    radial-gradient(900px 600px at 100% 108%, rgba(34, 211, 238, .20), transparent 62%),
    linear-gradient(180deg, #0a101f 0%, #101b31 48%, #0a101f 100%);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.35) 60%, transparent 95%);
}
.topbar, .page, .toast { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
::selection { background: var(--red-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 64px; display: flex; align-items: center; gap: 24px;
  padding: 0 30px;
  background: rgba(10, 16, 31, .74);
  border-bottom: 1px solid rgba(34, 49, 77, .9);
  backdrop-filter: blur(18px) saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark {
  width: 34px; height: 34px; padding: 5px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(56,189,248,.10));
  border: 1px solid rgba(245,158,11,.38);
  color: var(--ink);
  box-shadow: 0 0 26px rgba(245,158,11,.12);
}
.brand-text { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.brand-name {
  font-family: var(--sans); font-size: 19px; font-weight: 700;
  letter-spacing: -.015em;
}
.brand-sub {
  font-size: 8.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted-2); white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 1px; margin-left: 8px; }
.nav a {
  position: relative; padding: 7px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted); letter-spacing: .01em;
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { color: var(--ink); background: rgba(148,163,184,.08); }
.nav a.active { color: #0a101f; background: var(--red); font-weight: 600; }
.nav a.active::after { display: none; }
.nav .nav-sep { width: 1px; height: 18px; background: var(--line); margin: 0 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.icon-btn {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(245,158,11,.95), rgba(56,189,248,.85));
  color: #0a101f;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .04em;
}

/* ---------- page ---------- */
.page { width: min(1500px, 100%); margin: 0 auto; padding: 28px 32px 90px; }
.page.narrow { width: min(1180px, 100%); }
.eyebrow {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 9px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--red); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; }
h1 { font-size: clamp(38px, 4vw, 54px); line-height: 1.02; letter-spacing: -.018em; }
h2 { font-size: 27px; line-height: 1.1; letter-spacing: -.01em; }
h3 { font-size: 20px; line-height: 1.15; }
p { margin: 0; }
.lead { font-family: var(--serif); font-size: 19px; line-height: 1.45; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border: 1px solid var(--ink);
  border-radius: 3px; background: var(--ink); color: var(--paper-2);
  font-size: 12.5px; letter-spacing: .01em; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: rgba(28,26,23,.04); }
.btn.small { min-height: 30px; padding: 0 11px; font-size: 11.5px; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff7ef; }
.btn.red:hover { background: var(--red-2); border-color: var(--red-2); }
.btn:disabled { opacity: .45; cursor: default; }
.text-link { color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.text-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- project head ---------- */
.project-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 30px;
  padding: 6px 0 21px; border-bottom: 1px solid var(--line);
}
.project-head h1 { font-size: clamp(40px, 4.6vw, 62px); margin-top: 7px; }
.project-sub { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.health { display: flex; align-items: center; gap: 14px; text-align: right; }
.health-score { font-family: var(--serif); font-size: 46px; line-height: .9; letter-spacing: -.03em; }
.health-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.health-state { color: var(--gold); font-size: 11px; letter-spacing: .04em; }

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-columns: 258px minmax(0, 1fr); gap: 30px; padding-top: 22px; align-items: start; }
.workspace > * { min-width: 0; }
.rail { position: sticky; top: 86px; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.rail-title { font-size: 10px; letter-spacing: .17em; text-transform: uppercase; color: var(--muted); }
.rail-count { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }
.arc-list { display: flex; flex-direction: column; gap: 2px; }
.arc-item {
  position: relative; display: grid; grid-template-columns: 3px 36px minmax(0,1fr); gap: 9px;
  padding: 10px 9px 11px 8px; border-radius: 3px; cursor: pointer;
  border-left: 2px solid transparent;
  transition: background .15s, border-color .15s;
}
.arc-item:hover { background: rgba(28,26,23,.035); }
.arc-item.active { background: var(--paper-2); border-left-color: var(--c); box-shadow: var(--shadow); }
.arc-stem { width: 3px; border-radius: 2px; background: var(--c); margin-top: 3px; height: 64px; }
.arc-item .arc-thumb { margin-top: 1px; }
.arc-item .role { font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.arc-item .name { font-family: var(--serif); font-size: 15.5px; line-height: 1.15; }
.arc-item .carrier { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.arc-item .formula {
  font-size: 10.5px; color: var(--muted); line-height: 1.4; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.add-arc {
  width: 100%; margin-top: 8px; min-height: 36px; border: 1px dashed var(--line);
  border-radius: 3px; color: var(--muted); font-size: 11.5px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.add-arc:hover { border-color: var(--ink); color: var(--ink); }
.rail-note {
  margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px;
  font-size: 11px; color: var(--muted); line-height: 1.45;
}
.rail-note b { color: var(--ink); font-weight: 600; }

/* ---------- map ---------- */
.map-card {
  min-width: 0;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 18px 12px; box-shadow: var(--shadow);
}
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.map-title { display: flex; align-items: baseline; gap: 12px; }
.map-title h2 { font-size: 23px; }
.map-sub { font-size: 11px; color: var(--muted); }
.map-controls { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 3px; padding: 2px; background: var(--paper); }
.map-controls button { padding: 5px 10px; border-radius: 2px; font-size: 10.5px; color: var(--muted); }
.map-controls button.active { background: var(--ink); color: var(--paper-2); }
.map-controls button:hover:not(.active) { color: var(--ink); }
.map-svg { width: 100%; height: auto; margin-top: 2px; overflow: visible; }
.map-caption {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 9px;
}
.map-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 9.5px; color: var(--muted); letter-spacing: .03em; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 2px; background: var(--ink); }
.legend-swatch.dashed { height: 0; border-top: 1px dashed var(--red); }
.legend-diamond { width: 7px; height: 7px; background: var(--red); transform: rotate(45deg); }
.density-wrap { margin-top: 2px; }
.density { display: grid; grid-template-columns: repeat(24, minmax(0,1fr)); gap: 2px; align-items: end; height: 26px; padding: 0 3.9%; border-bottom: 1px solid var(--line); }
.density-legend { display: flex; justify-content: space-between; margin-top: 5px; font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.density i { display: block; background: var(--line); border-radius: 2px 2px 0 0; min-height: 2px; }
.density i.hot { background: var(--red); }

/* SVG map text */
.map-act-label { font-family: var(--sans); font-size: 10px; fill: var(--muted); letter-spacing: .16em; }
.map-act-line { stroke: var(--line); stroke-width: 1; }
.map-scene-num { font-family: var(--mono); font-size: 8px; fill: var(--muted-2); }
.map-scene-num.conv { fill: var(--red); font-weight: 700; }
.map-arc-label { font-family: var(--sans); font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; fill: var(--muted); }
.map-side-label { font-family: var(--serif); font-size: 13px; fill: var(--ink); }
.map-side-sub { font-family: var(--sans); font-size: 7.5px; letter-spacing: .12em; text-transform: uppercase; fill: var(--muted-2); }
.map-note { font-family: var(--serif); font-size: 11px; fill: var(--muted); }
.arc-shape { cursor: pointer; transition: opacity .18s, stroke-width .18s; }
.arc-shape .arch-fill { transition: opacity .18s; }
.arc-shape.dim { opacity: .20; }
.arc-shape.active .arch-line { stroke-width: 3.4; }
.scene-hit { cursor: pointer; }
.conv-pillar { stroke: var(--red); stroke-width: 1; stroke-dasharray: 2 4; opacity: .55; }
.conv-diamond { fill: var(--red); }

/* ---------- metrics strip ---------- */
.project-diagnostics { margin-top: 18px; display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 24px; align-items: start; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 14px; overflow: hidden; }
.metric { background: var(--paper-2); padding: 13px 15px 12px; }
.metric .k { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.metric .v { font-family: var(--serif); font-size: 27px; line-height: 1.1; margin-top: 4px; }
.metric .v small { font-family: var(--sans); font-size: 10.5px; color: var(--muted); letter-spacing: 0; }
.metric .n { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.metric .n.warn { color: var(--gold); }
.metric .n.bad { color: var(--red); }

/* ---------- library ---------- */
.library-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.library-head h1 { font-size: clamp(38px, 4.4vw, 58px); margin-top: 6px; }
.library-head .lead { max-width: 44ch; margin-top: 8px; font-size: 17px; }
.library-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.library-search { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--ink); padding: 4px 2px 6px; min-width: 250px; }
.library-search input { border: 0; background: transparent; outline: 0; width: 100%; font-size: 12.5px; }
.library-search span { color: var(--muted); font-size: 14px; }
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 15px 0 16px; }
.chip {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px;
  font-size: 11px; color: var(--muted); background: transparent;
  transition: all .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
.chip .n { font-family: var(--mono); font-size: 9px; opacity: .6; margin-left: 4px; }
.filter-sep { width: 1px; height: 20px; background: var(--line); margin: 0 7px; }
.select {
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 5px 18px 5px 3px; font-size: 11px; color: var(--muted); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 7px) 11px, calc(100% - 3px) 11px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.arc-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.arc-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 14px; min-height: 286px;
  transition: border-color .16s, transform .16s, box-shadow .16s;
  cursor: pointer;
}
.arc-card:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 4px 18px rgba(28,26,23,.06); }
.arc-glyph { height: 56px; width: 100%; margin-bottom: 6px; }
.arc-glyph svg { height: 100%; width: auto; }
.arc-card .genre { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.arc-card h3 { font-size: 23px; line-height: 1.06; margin: 5px 0 7px; letter-spacing: -.01em; }
.arc-card .fromto { font-size: 11.5px; line-height: 1.42; color: var(--ink-2); }
.arc-card .fromto b { font-weight: 600; color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.arc-card .state-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.arc-card .log { font-size: 11px; line-height: 1.45; color: var(--muted); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.arc-card .meta { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line-2); font-size: 10px; color: var(--muted); }
.arc-card .meta b { color: var(--ink); font-weight: 600; }
.arc-card .arrow { margin-left: auto; color: var(--red); font-size: 14px; }
.empty-state { grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: var(--muted); font-family: var(--serif); font-size: 20px; }

/* ---------- passport ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); padding: 2px 0 16px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.passport-hero { display: grid; grid-template-columns: minmax(340px, .92fr) minmax(0, 1.08fr); gap: 40px; align-items: center; padding: 9px 0 27px; border-bottom: 1px solid var(--line); }
.arch-hero { width: 100%; max-width: 520px; }
.arch-hero svg { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 34px rgba(245,158,11,.10)); }
.passport-title .genre { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.passport-title h1 { font-size: clamp(40px, 4.6vw, 60px); margin: 6px 0 16px; }
.state-pair { display: grid; grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr); gap: 10px; align-items: start; }
.state-block .k { font-size: 8.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.state-block .v { font-family: var(--serif); font-size: 15.5px; line-height: 1.32; color: var(--ink-2); }
.state-arrow { color: var(--red); font-size: 18px; text-align: center; padding-top: 17px; }
.question { font-family: var(--serif); font-size: 21px; line-height: 1.25; color: var(--red-2); margin-top: 19px; padding-top: 14px; border-top: 1px solid var(--line); }
.question small { display: block; font-family: var(--sans); font-size: 8.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.passport-meta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 13px 0 0; font-size: 10.5px; color: var(--muted); }
.passport-meta b { color: var(--ink); font-weight: 600; }
.passport-actions { margin-left: auto; display: flex; gap: 7px; }
.passport-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 38px; padding-top: 26px; align-items: start; }
.passport-main { min-width: 0; }
.passport-side { position: sticky; top: 86px; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { position: relative; padding: 0 0 9px; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); font-weight: 600; }
.tabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); }
.tab-count { font-family: var(--mono); font-size: 9px; color: var(--muted-2); margin-left: 4px; }

/* beats */
.acts-head { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 10px; }
.act-head { border-top: 2px solid var(--ink); padding-top: 6px; display: flex; justify-content: space-between; gap: 8px; }
.act-head b { font-family: var(--serif); font-size: 15px; font-weight: 500; }
.act-head span { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.beats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; align-items: start; }
.beat-col { display: flex; flex-direction: column; gap: 9px; }
.beat {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 12px 13px 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.beat:hover { border-color: var(--ink); }
.beat.highlight { border-color: var(--red); background: #fbf1eb; }
.beat-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.beat-num { font-family: var(--mono); font-size: 9px; color: var(--red); }
.beat-head h3 { font-size: 16px; line-height: 1.15; }
.beat .stage-text { font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.beat .stage-change { font-size: 10.5px; line-height: 1.4; color: var(--muted); margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line-2); }
.beat .stage-change b { font-weight: 600; color: var(--ink-2); }
.beat .turn { display: inline-block; margin-top: 7px; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }

/* side boxes */
.box { border-top: 1px solid var(--line); padding: 13px 0 15px; }
.box:first-child { border-top: 2px solid var(--ink); }
.box h4 { margin: 0 0 7px; font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.box p { font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.box .big { font-family: var(--serif); font-size: 17px; line-height: 1.3; color: var(--ink); }
.formula-box { background: var(--ink); color: var(--paper-2); border-radius: 3px; padding: 15px 16px; margin-top: 14px; }
.formula-box .k { font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: #bdb4a5; }
.formula-box p { font-family: var(--serif); font-size: 16px; line-height: 1.35; color: #fff8ee; margin-top: 5px; }
.compat-list { display: flex; flex-direction: column; }
.compat-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.compat-row:first-child { border-top: 0; }
.compat-row .t { font-family: var(--serif); font-size: 15px; }
.compat-row .g { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.compat-row .role { font-size: 9px; color: var(--red); border: 1px solid var(--red-soft); border-radius: 99px; padding: 3px 7px; white-space: nowrap; }
.compat-row .films { font-family: var(--mono); font-size: 9px; color: var(--muted); margin-left: 7px; }
.roles-list { display: grid; gap: 8px; }
.role-card { border: 1px solid var(--line); background: var(--paper-2); border-radius: 3px; padding: 12px 13px; display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 10px; }
.role-letter { width: 28px; height: 28px; border-radius: 50%; background: var(--paper-3); display: grid; place-items: center; font-family: var(--serif); font-size: 13px; color: var(--ink); }
.role-card .fn { font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.role-card h3 { font-size: 16px; margin: 2px 0 4px; }
.role-card p { font-size: 11px; line-height: 1.45; color: var(--muted); }
.examples { display: flex; flex-direction: column; gap: 9px; }
.example { border: 1px solid var(--line); background: var(--paper-2); border-radius: 3px; padding: 12px 14px; }
.example-head { display: flex; align-items: baseline; gap: 8px; }
.example-head h3 { font-size: 17px; }
.example-head .badge { font-size: 9px; color: var(--muted); border: 1px solid var(--line); padding: 2px 6px; border-radius: 99px; }
.example p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.example .acts-note { font-size: 10.5px; color: var(--ink-2); margin-top: 6px; }

/* ---------- pick ---------- */
.pick-hero { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); gap: 40px; align-items: end; padding: 18px 0 28px; border-bottom: 1px solid var(--line); }
.pick-hero h1 { font-size: clamp(40px, 4.7vw, 62px); margin: 7px 0 12px; }
.pick-hero .lead { max-width: 48ch; }
.pick-form { margin-top: 22px; }
.pick-input {
  width: 100%; min-height: 116px; resize: vertical; border: 1px solid var(--line);
  border-radius: 3px; background: var(--paper-2); padding: 14px 15px;
  font-family: var(--serif); font-size: 18px; line-height: 1.4; color: var(--ink);
  outline: none;
}
.pick-input:focus { border-color: var(--ink); }
.pick-form-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 9px; }
.pick-form-row .hint { font-size: 10.5px; color: var(--muted); }
.pick-results { padding-top: 24px; }
.pick-results-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 13px; }
.pick-results-head h2 { font-size: 24px; }
.pick-results-head span { font-size: 10.5px; color: var(--muted); }
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-row {
  display: grid; grid-template-columns: 34px 56px minmax(0,1fr) 112px 140px;
  gap: 14px; align-items: center;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 13px 15px; animation: rise .4s ease both;
}
.pick-row.top { border-color: var(--ink); }
.pick-rank { font-family: var(--serif); font-size: 27px; color: var(--muted-2); }
.pick-glyph { width: 56px; }
.pick-glyph svg { width: 100%; height: auto; }
.pick-row.top .pick-rank { color: var(--red); }
.pick-row .t { font-family: var(--serif); font-size: 19px; }
.pick-row .why { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.pick-row .why span { font-size: 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 6px; }
.pick-score { display: flex; flex-direction: column; gap: 5px; }
.pick-score .bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.pick-score .bar i { display: block; height: 100%; background: var(--red); }
.pick-score .lbl { font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pick-actions { display: flex; gap: 6px; justify-content: flex-end; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- film ---------- */
.film-head { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(260px,.8fr); gap: 40px; align-items: end; padding: 12px 0 24px; border-bottom: 1px solid var(--line); }
.film-head h1 { font-size: clamp(40px, 4.8vw, 64px); margin: 5px 0 9px; }
.film-head .lead { font-size: 17px; max-width: 58ch; }
.film-facts { display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--line); padding-left: 22px; }
.fact { display: flex; justify-content: space-between; gap: 15px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line-2); padding-bottom: 7px; }
.fact b { color: var(--ink); font-weight: 600; }
.film-strip { display: flex; flex-direction: column; gap: 7px; border: 1px solid var(--line); background: var(--paper-2); border-radius: 3px; padding: 14px 16px; margin-top: 20px; }
.film-strip-row { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 18px; align-items: center; }
.film-strip-label { font-family: var(--serif); font-size: 12px; line-height: 1.2; display: flex; align-items: center; gap: 7px; }
.scope-dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 auto; }
.film-strip-track { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 28px; align-items: center; }
.film-act { position: relative; height: 20px; }
.film-act::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; background: var(--c); opacity: .82; }
.film-act::after { content: ""; position: absolute; left: 0; top: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--paper-2); }
.film-act em { position: absolute; right: 0; top: -11px; font-size: 7px; font-style: normal; letter-spacing: .14em; color: var(--muted); }
.lines { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.line-row { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 18px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px; padding: 15px 17px; }
.line-meta .scope { font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.line-meta h3 { font-size: 19px; margin: 4px 0 6px; }
.line-meta .lead-names { font-size: 10.5px; color: var(--muted); }
.line-meta .arc-link { display: inline-block; margin-top: 10px; font-size: 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
.line-meta .arc-link:hover { color: var(--ink); border-color: var(--ink); }
.line-acts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.act-cell { border-left: 1px solid var(--line); padding-left: 11px; }
.act-cell:first-child { border-left: 0; padding-left: 0; }
.act-cell .k { font-size: 8px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 4px; }
.act-cell p { font-size: 11px; line-height: 1.48; color: var(--ink-2); }

/* ---------- check ---------- */
.check-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.check-head h1 { font-size: clamp(38px, 4.4vw, 56px); margin-top: 6px; }
.score-wrap { display: flex; align-items: center; gap: 20px; }
.score-ring { position: relative; width: 96px; height: 96px; }
.score-ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.score-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 31px; }
.check-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); gap: 38px; padding-top: 24px; align-items: start; }
.check-cards { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.check-card { background: var(--paper-2); padding: 12px 12px 11px; }
.check-card .k { font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.check-card .v { font-size: 18px; margin-top: 5px; }
.check-card .v.ok { color: var(--green); }
.check-card .v.warn { color: var(--gold); }
.check-card .v.bad { color: var(--red); }
.check-card .n { font-size: 9.5px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.issues { margin-top: 22px; }
.issues-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.issues-head h2 { font-size: 23px; }
.issues-head span { font-size: 10px; color: var(--muted); }
.issue { display: grid; grid-template-columns: 20px minmax(0,1fr) auto; gap: 11px; padding: 13px 0; border-top: 1px solid var(--line); align-items: start; }
.issue .sev { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: #fff7ef; margin-top: 1px; }
.issue .sev.warn { background: var(--gold); }
.issue .sev.bad { background: var(--red); }
.issue h3 { font-size: 16px; line-height: 1.2; }
.issue p { font-size: 11px; line-height: 1.45; color: var(--muted); margin-top: 3px; }
.issue .where { font-size: 10px; color: var(--red); border-bottom: 1px solid var(--red-soft); white-space: nowrap; }
.balance { margin-top: 6px; }
.balance-row { display: grid; grid-template-columns: 80px minmax(0,1fr) 40px; gap: 10px; align-items: center; margin-top: 8px; font-size: 10px; color: var(--muted); }
.balance-row .track { height: 7px; background: var(--paper-3); border-radius: 2px; overflow: visible; position: relative; }
.balance-row .track i { display: block; height: 100%; background: var(--ink); position: relative; z-index: 1; border-radius: 2px; }
.balance-row .track b { position: absolute; top: -3px; width: 1.5px; height: 13px; background: var(--red); z-index: 2; }
.balance-row .num { font-family: var(--mono); font-size: 10px; color: var(--ink); text-align: right; }
.balance-note { font-size: 10.5px; color: var(--muted); line-height: 1.45; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.score-formula { border-top: 2px solid var(--ink); padding-top: 12px; }
.score-formula summary { cursor: pointer; list-style: none; font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.score-formula summary::-webkit-details-marker { display: none; }
.score-formula summary::after { content: "−"; float: right; color: var(--muted); }
.score-formula:not([open]) summary::after { content: "+"; }
.score-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 10.5px; color: var(--muted); }
.score-row b { font-family: var(--mono); font-size: 10px; color: var(--ink); font-weight: 500; }
.score-row.total { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; color: var(--ink); font-weight: 600; }
.score-row.total b { color: var(--red); font-size: 13px; }
.service-table { width: 100%; border-collapse: collapse; font-size: 10.5px; margin-top: 4px; }
.service-table th { text-align: left; font-weight: 500; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 6px 6px 0; border-bottom: 1px solid var(--line); }
.service-table td { padding: 8px 6px 8px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.service-table td.t { font-family: var(--serif); font-size: 13px; }
.tick { font-weight: 700; }
.tick.ok { color: var(--green); }
.tick.warn { color: var(--gold); }

/* ---------- method ---------- */
.method-head { padding: 12px 0 26px; border-bottom: 1px solid var(--line); }
.method-head h1 { font-size: clamp(40px, 4.7vw, 60px); margin: 7px 0 10px; }
.method-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(280px,.7fr); gap: 40px; padding-top: 24px; }
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step .num { font-family: var(--serif); font-size: 21px; color: var(--red); }
.step h3 { font-size: 18px; }
.step p { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check-line { display: grid; grid-template-columns: 16px minmax(0,1fr); gap: 8px; font-size: 11.5px; line-height: 1.45; color: var(--ink-2); }
.check-line b { color: var(--red); }

/* ---------- inspector ---------- */
.inspector-backdrop { position: fixed; inset: 0; background: rgba(28,26,23,.18); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .2s; }
.inspector-backdrop.open { opacity: 1; pointer-events: auto; }
.inspector {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw); z-index: 71;
  background: var(--paper-2); border-left: 1px solid var(--line);
  transform: translateX(102%); transition: transform .24s cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column;
}
.inspector.open { transform: none; }
.inspector-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.inspector-head .eyebrow { margin-bottom: 5px; }
.inspector-head h2 { font-size: 25px; }
.inspector-body { padding: 18px 22px 30px; overflow-y: auto; }
.inspector .close { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; }
.inspector .close:hover { border-color: var(--ink); color: var(--ink); }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.field .value { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.field textarea, .field input, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 2px;
  padding: 7px 8px; font-size: 12px; outline: none;
}
.field textarea:focus, .field input:focus, .field select:focus { border-color: var(--ink); }
.field textarea { min-height: 64px; resize: vertical; }
.field input[type="checkbox"] { width: auto; accent-color: var(--red); }
.inspector-arcs { display: flex; flex-direction: column; gap: 6px; }
.inspector-arc { display: grid; grid-template-columns: 8px minmax(0,1fr) 92px; gap: 8px; align-items: center; font-size: 11px; }
.inspector-arc .stem { width: 3px; height: 24px; background: var(--c); border-radius: 2px; }
.inspector-arc .nm { font-family: var(--serif); font-size: 13.5px; }
.inspector-arc select { font-size: 10px; padding: 4px; }
.inspector-foot { margin-top: auto; padding: 13px 22px; border-top: 1px solid var(--line); display: flex; gap: 7px; }
.inspector-foot .btn { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--paper-2); padding: 10px 16px;
  border-radius: 3px; font-size: 11.5px; z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: min(460px, 90vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 18px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 10px; color: var(--muted); }
.footer a { border-bottom: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .arc-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .arc-card { grid-template-columns: 180px minmax(0, 1fr); }
  .passport-hero { grid-template-columns: 1fr; gap: 24px; }
  .arch-hero { max-width: 440px; margin: 0 auto; }
  .passport-grid { grid-template-columns: 1fr; }
  .passport-side { position: static; }
  .check-grid, .method-grid { grid-template-columns: 1fr; }
  .pick-hero, .film-head { grid-template-columns: 1fr; gap: 22px; }
  .film-facts { border-left: 0; padding-left: 0; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .nav { display: none; }
  .brand-sub { display: none; }
  .icon-btn { display: none; }
  .page { padding: 20px 16px 70px; }
  .workspace { grid-template-columns: 1fr; }
  .rail { position: static; }
  .arc-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .project-diagnostics { grid-template-columns: 1fr; }
  .density { min-width: 760px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  .map-card { padding: 12px 8px; overflow-x: auto; }
  .map-svg { min-width: 760px; }
  .arc-grid { grid-template-columns: 1fr; }
  .beats, .acts-head { grid-template-columns: 1fr; }
  .act-head { margin-top: 8px; }
  .line-row { grid-template-columns: 1fr; }
  .line-acts { grid-template-columns: 1fr; }
  .act-cell { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-2); padding-top: 7px; }
  .check-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pick-row { grid-template-columns: 28px 44px minmax(0,1fr); }
  .pick-score, .pick-actions { grid-column: 3; }
  .pick-glyph { width: 44px; }
  .film-strip-row { grid-template-columns: 1fr; gap: 4px; }
  .project-head, .library-head, .check-head { flex-direction: column; align-items: flex-start; }
  .health { text-align: left; }
  .library-tools { align-items: flex-start; width: 100%; }
  .state-pair { grid-template-columns: 1fr; }
  .state-arrow { display: none; }
}

/* ============================================================
   Dark console — overrides in the language of the project banner
   ============================================================ */
h1, h2 { font-weight: 700; letter-spacing: -.03em; }
h3 { font-weight: 600; letter-spacing: -.015em; }
.lead { font-family: var(--sans); font-size: 18px; line-height: 1.5; color: var(--muted); }
.project-head h1, .library-head h1, .film-head h1, .check-head h1, .method-head h1, .pick-hero h1, .passport-title h1 { color: var(--ink); }
.eyebrow { color: var(--muted); }
.eyebrow::before { background: var(--red); box-shadow: 0 0 12px rgba(245,158,11,.7); }
.crumbs, .project-sub, .passport-meta, .map-sub, .map-legend, .rail-note, .metric .n, .metric .k, .small.muted { color: var(--muted); }
.crumbs a:hover, .text-link:hover { color: var(--ink); }

/* buttons and chips */
.btn {
  background: var(--red); border-color: var(--red); color: #0a101f;
  border-radius: 999px; min-height: 38px; font-weight: 600;
  box-shadow: 0 0 0 rgba(245,158,11,0);
}
.btn:hover { background: #fbbf24; border-color: #fbbf24; color: #0a101f; box-shadow: 0 0 26px rgba(245,158,11,.22); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: rgba(148,163,184,.08); border-color: var(--ink); }
.btn.red { background: var(--red); border-color: var(--red); color: #0a101f; }
.btn.red:hover { background: #fbbf24; border-color: #fbbf24; }
.btn.small { min-height: 32px; padding-inline: 13px; font-size: 11px; }
.text-link { color: var(--muted); border-bottom-color: var(--line); }
.chip {
  border-color: var(--line); color: var(--muted); border-radius: 999px;
  background: rgba(14,23,41,.45); padding: 7px 12px;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--red); border-color: var(--red); color: #0a101f; font-weight: 600; }
.chip.active .n { color: rgba(10,16,31,.65); opacity: 1; }
.select { color: var(--muted); border-bottom-color: var(--line); }
.select:hover { color: var(--ink); }

/* surfaces */
.map-card, .arc-card, .film-strip, .line-row, .pick-row, .beat, .role-card, .example, .check-card, .inspector, .tabs, .table-wrap {
  background: rgba(14, 23, 41, .92);
  border-color: var(--line);
}
.map-card { border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.arc-card { border-radius: 16px; }
.arc-card:hover { border-color: rgba(245,158,11,.7); box-shadow: 0 18px 44px rgba(0,0,0,.28), 0 0 0 1px rgba(245,158,11,.12); }
.beat, .role-card, .example, .pick-row, .line-row, .film-strip { border-radius: 12px; }
.beat:hover { border-color: rgba(245,158,11,.55); }
.beat.highlight { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.75); }
.metrics { border-radius: 14px; }
.metric { background: rgba(14,23,41,.92); }
.metric .v { font-family: var(--sans); font-weight: 700; font-size: 30px; letter-spacing: -.03em; }
.metric .v small { font-family: var(--sans); font-size: 10.5px; color: var(--muted); }
.project-diagnostics { border-color: var(--line); }
.box { border-top-color: var(--line); }
.box:first-child { border-top-color: var(--ink); }
.box h4 { color: var(--muted); }
.box p { color: var(--ink-2); }
.box .big { font-family: var(--sans); font-weight: 600; letter-spacing: -.02em; color: var(--ink); }

/* project head */
.health-score { font-family: var(--sans); font-weight: 700; letter-spacing: -.04em; }
.health-label { color: var(--muted); }
.health-state { color: var(--gold); }
.project-head, .library-head, .check-head, .film-head, .pick-hero, .passport-hero, .method-head { border-bottom-color: var(--line); }
.arc-item .name { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; }
.arc-item .role { color: var(--muted); }
.arc-item.active { background: rgba(14,23,41,.9); box-shadow: none; }
.rail-note b { color: var(--ink); }
.add-arc { border-color: var(--line); color: var(--muted); border-radius: 10px; }
.add-arc:hover { border-color: var(--red); color: var(--ink); }

/* map */
.map-controls { background: rgba(10,16,31,.65); border-color: var(--line); border-radius: 999px; padding: 3px; }
.map-controls button { border-radius: 999px; padding: 6px 12px; }
.map-controls button.active { background: var(--red); color: #0a101f; }
.map-controls button:hover:not(.active) { color: var(--ink); background: rgba(148,163,184,.08); }
.map-card .density { opacity: .9; }
.map-card .density i { background: rgba(148,163,184,.22); }
.map-card .density i.hot { background: var(--red); box-shadow: 0 0 12px rgba(245,158,11,.45); }
.map-caption { border-top-color: var(--line-2); }

/* library */
.arc-card .genre { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.genre-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex: 0 0 auto; box-shadow: 0 0 8px rgba(255,255,255,.12); }
.arc-card h3 { color: var(--ink); }
.arc-card .fromto { color: var(--ink-2); }
.arc-card .fromto b { color: var(--muted-2); }
.arc-card .log { color: var(--muted); }
.arc-card .meta { border-top-color: var(--line-2); color: var(--muted); }
.arc-card .meta b { color: var(--ink); }
.arc-card .arrow { color: var(--red); }
.library-search { border-bottom-color: var(--ink); }
.library-search input { color: var(--ink); }
.library-search span { color: var(--muted); }

/* passport */
.passport-title .genre { color: var(--muted); }
.state-block .v { font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.state-arrow { color: var(--red); }
.question { font-family: var(--sans); font-weight: 600; font-size: 20px; line-height: 1.35; letter-spacing: -.02em; color: var(--gold); border-top-color: var(--line); }
.question small { color: var(--muted); }
.tabs { border-bottom-color: var(--line); }
.tabs button { color: var(--muted); }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { background: var(--red); box-shadow: 0 0 12px rgba(245,158,11,.55); }
.act-head { border-top-color: var(--ink); }
.act-head b { color: var(--ink); }
.act-head span { color: var(--muted); }
.beat-head h3 { color: var(--ink); }
.beat .stage-text { color: var(--ink-2); }
.beat .stage-change { border-top-color: var(--line-2); color: var(--muted); }
.beat .stage-change b { color: var(--ink); }
.beat .turn { color: var(--red); }
.role-card h3, .example-head h3, .compat-row .t { color: var(--ink); }
.role-card p, .example p { color: var(--muted); }
.role-letter { background: var(--paper-3); color: var(--ink); }
.role-card .fn { color: var(--red); }
.example-head .badge, .badge { border-color: var(--line); color: var(--muted); }
.example .acts-note { color: var(--ink-2); }
.compat-row { border-top-color: var(--line-2); }
.compat-row .g { color: var(--muted); }
.compat-row .role { color: var(--red); border-color: rgba(245,158,11,.35); }
.compat-row .films { color: var(--muted); }
.formula-box {
  background:
    linear-gradient(135deg, rgba(245,158,11,.16), rgba(56,189,248,.07)),
    var(--paper-2);
  border: 1px solid rgba(245,158,11,.32);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  border-radius: 14px;
}
.formula-box .k { color: var(--muted); }
.formula-box p { font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink); }

/* pick */
.pick-input { background: rgba(14,23,41,.92); border-color: var(--line); color: var(--ink); border-radius: 14px; }
.pick-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(245,158,11,.12); }
.pick-input::placeholder { color: var(--muted-2); }
.pick-form-row .hint { color: var(--muted); }
.pick-row { border-color: var(--line); }
.pick-row.top { border-color: rgba(245,158,11,.65); box-shadow: 0 0 0 1px rgba(245,158,11,.12); }
.pick-row .t { color: var(--ink); }
.pick-rank { font-family: var(--sans); font-weight: 700; color: var(--muted-2); }
.pick-row.top .pick-rank { color: var(--red); }
.pick-row .why span { border-color: var(--line); color: var(--muted); }
.pick-score .lbl { color: var(--muted); }
.pick-score .bar { background: var(--line); }
.pick-score .bar i { background: var(--red); box-shadow: 0 0 12px rgba(245,158,11,.4); }
.pick-results-head h2 { color: var(--ink); }
.pick-results-head span { color: var(--muted); }

/* film */
.film-facts { border-left-color: var(--line); }
.fact { border-bottom-color: var(--line-2); color: var(--muted); }
.fact b { color: var(--ink); }
.film-strip { border-color: var(--line); }
.film-strip-label { color: var(--ink); }
.line-meta h3 { color: var(--ink); }
.line-meta .scope { color: var(--red); }
.line-meta .lead-names { color: var(--muted); }
.line-meta .arc-link { color: var(--muted); border-bottom-color: var(--line); }
.line-meta .arc-link:hover { color: var(--ink); border-color: var(--ink); }
.act-cell { border-left-color: var(--line-2); }
.act-cell .k { color: var(--muted-2); }
.act-cell p { color: var(--ink-2); }

/* check */
.check-head { border-bottom-color: var(--line); }
.check-cards { border-color: var(--line); border-radius: 14px; }
.check-card { border-color: var(--line); }
.check-card .k { color: var(--muted); }
.check-card .v.ok { color: var(--green); }
.check-card .v.warn { color: var(--gold); }
.check-card .v.bad { color: var(--rose); }
.check-card .n { color: var(--muted); }
.issues-head h2 { color: var(--ink); }
.issue { border-top-color: var(--line); }
.issue h3 { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.issue p { color: var(--muted); }
.issue .where { color: var(--red); border-bottom-color: rgba(245,158,11,.35); }
.issue .sev.warn { background: var(--gold); }
.issue .sev.bad { background: var(--rose); }
.balance-row { color: var(--muted); }
.balance-row .track { background: var(--paper-3); }
.balance-row .track i { background: var(--ink); }
.balance-row .track b { background: var(--red); box-shadow: 0 0 8px rgba(245,158,11,.6); }
.balance-row .num { color: var(--ink); }
.balance-note { border-top-color: var(--line-2); color: var(--muted); }
.service-table th { color: var(--muted); border-bottom-color: var(--line); }
.service-table td { border-bottom-color: var(--line-2); }
.service-table td.t { color: var(--ink); }
.tick.ok { color: var(--green); }
.tick.warn { color: var(--gold); }

/* method */
.step { border-top-color: var(--line); }
.step .num { color: var(--red); font-family: var(--sans); font-weight: 700; }
.step h3 { color: var(--ink); }
.step p { color: var(--muted); }
.check-line { color: var(--ink-2); }
.check-line b { color: var(--red); }

/* inspector and toast */
.inspector-backdrop { background: rgba(3, 7, 15, .62); backdrop-filter: blur(4px); }
.inspector { background: rgba(14,23,41,.98); border-left-color: var(--line); box-shadow: -30px 0 80px rgba(0,0,0,.35); }
.inspector-head { border-bottom-color: var(--line); }
.inspector-head h2 { color: var(--ink); }
.inspector .close { border-color: var(--line); color: var(--muted); }
.inspector .close:hover { border-color: var(--ink); color: var(--ink); }
.field label { color: var(--muted); }
.field .value { color: var(--ink-2); }
.field textarea, .field input, .field select { background: rgba(10,16,31,.7); border-color: var(--line); color: var(--ink); }
.field textarea:focus, .field input:focus, .field select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(245,158,11,.10); }
.field input[type="checkbox"] { accent-color: var(--red); }
.inspector-arc .nm { color: var(--ink); }
.inspector-arc select { background: var(--paper-2); color: var(--ink); border-color: var(--line); }
.inspector-foot { border-top-color: var(--line); }
.toast { background: var(--ink); color: #0a101f; font-weight: 600; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.empty-state { color: var(--muted); }

/* footer */
.footer { border-top-color: var(--line); color: var(--muted); }
.footer a { border-bottom-color: var(--line); }

/* ============================================================
   Typography and light theme
   ============================================================ */
/* Фиксированная пара: Manrope — заголовки и названия арок, Inter Tight — интерфейс. */
.brand-name,
.arc-item .name,
.health-score,
.metric .v,
.question,
.pick-rank,
.issue h3,
.box .big,
.formula-box p { font-family: var(--font-display); }

.theme-toggle .sun, .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="light"] .theme-toggle .moon { display: block; }

/* ---------- light tokens ---------- */
html[data-theme="light"] {
  --paper: #f4f6fa;
  --paper-2: #ffffff;
  --paper-3: #e9eef6;
  --ink: #0e1729;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #dce3ee;
  --line-2: #e8edf5;
  --red: #b45309;
  --red-2: #92400e;
  --red-soft: rgba(180, 83, 9, .18);
  --gold: #d97706;
  --green: #059669;
  --blue: #0284c7;
  --plum: #7c3aed;
  --gray: #64748b;
  --rose: #e11d48;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --grid: rgba(15, 23, 42, .045);
  color-scheme: light;
}

html[data-theme="light"] body {
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 8% -8%, rgba(37, 99, 235, .10), transparent 62%),
    radial-gradient(900px 600px at 100% 108%, rgba(34, 211, 238, .08), transparent 62%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 48%, #f8fafc 100%);
}
html[data-theme="light"] body::before {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
}
html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, .82);
  border-bottom-color: var(--line);
}
html[data-theme="light"] .brand-mark {
  background: linear-gradient(135deg, rgba(217, 119, 6, .10), rgba(2, 132, 199, .06));
  border-color: rgba(180, 83, 9, .32);
  box-shadow: none;
}
html[data-theme="light"] .nav a:hover { background: rgba(15, 23, 42, .05); }
html[data-theme="light"] .nav a.active { background: var(--red); color: #fff; }

/* buttons, pills, controls */
html[data-theme="light"] .btn { background: var(--red); border-color: var(--red); color: #fff; box-shadow: none; }
html[data-theme="light"] .btn:hover { background: #d97706; border-color: #d97706; color: #fff; box-shadow: 0 10px 24px rgba(180, 83, 9, .16); }
html[data-theme="light"] .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
html[data-theme="light"] .btn.ghost:hover { background: rgba(15, 23, 42, .04); border-color: var(--ink); }
html[data-theme="light"] .btn.red { color: #fff; }
html[data-theme="light"] .chip { background: #fff; border-color: var(--line); color: var(--muted); }
html[data-theme="light"] .chip.active { background: var(--red); border-color: var(--red); color: #fff; }
html[data-theme="light"] .chip.active .n { color: rgba(255, 255, 255, .7); }
html[data-theme="light"] .map-controls { background: #f1f5f9; border-color: var(--line); }
html[data-theme="light"] .map-controls button { color: var(--muted); }
html[data-theme="light"] .map-controls button.active { background: var(--red); color: #fff; }
html[data-theme="light"] .map-controls button:hover:not(.active) { color: var(--ink); background: rgba(15, 23, 42, .05); }

/* surfaces */
html[data-theme="light"] .map-card,
html[data-theme="light"] .arc-card,
html[data-theme="light"] .film-strip,
html[data-theme="light"] .line-row,
html[data-theme="light"] .pick-row,
html[data-theme="light"] .beat,
html[data-theme="light"] .role-card,
html[data-theme="light"] .example,
html[data-theme="light"] .check-card,
html[data-theme="light"] .inspector,
html[data-theme="light"] .metric {
  background: #fff;
  border-color: var(--line);
}
html[data-theme="light"] .map-card { box-shadow: 0 24px 60px rgba(15, 23, 42, .08); }
html[data-theme="light"] .arc-card:hover { border-color: rgba(180, 83, 9, .55); box-shadow: 0 18px 44px rgba(15, 23, 42, .10); }
html[data-theme="light"] .arc-item.active { background: #fff; }
html[data-theme="light"] .beat:hover { border-color: rgba(180, 83, 9, .5); }
html[data-theme="light"] .beat.highlight { background: rgba(217, 119, 6, .08); border-color: rgba(180, 83, 9, .6); }
html[data-theme="light"] .tabs { background: transparent; border-bottom-color: var(--line); }
html[data-theme="light"] .map-caption { border-top-color: var(--line-2); }
html[data-theme="light"] .map-card .density i { background: rgba(15, 23, 42, .12); }
html[data-theme="light"] .map-card .density i.hot { background: var(--red); box-shadow: none; }
html[data-theme="light"] .formula-box {
  background: linear-gradient(135deg, rgba(217, 119, 6, .10), rgba(2, 132, 199, .05)), #fff;
  border-color: rgba(180, 83, 9, .26);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .06);
}
html[data-theme="light"] .formula-box p { color: var(--ink); }
html[data-theme="light"] .question { color: var(--red); }
html[data-theme="light"] .health-state { color: var(--gold); }

/* library, pick, film */
html[data-theme="light"] .library-search { border-bottom-color: var(--ink); }
html[data-theme="light"] .library-search input { color: var(--ink); }
html[data-theme="light"] .pick-input { background: #fff; border-color: var(--line); color: var(--ink); }
html[data-theme="light"] .pick-input::placeholder { color: var(--muted-2); }
html[data-theme="light"] .pick-row { border-color: var(--line); }
html[data-theme="light"] .pick-row.top { border-color: rgba(180, 83, 9, .55); box-shadow: 0 0 0 1px rgba(180, 83, 9, .08); }
html[data-theme="light"] .pick-rank { color: var(--muted-2); }
html[data-theme="light"] .pick-row.top .pick-rank { color: var(--red); }
html[data-theme="light"] .pick-score .bar { background: var(--line); }
html[data-theme="light"] .film-facts { border-left-color: var(--line); }
html[data-theme="light"] .fact { border-bottom-color: var(--line-2); color: var(--muted); }
html[data-theme="light"] .film-strip { border-color: var(--line); }
html[data-theme="light"] .line-row { background: #fff; }
html[data-theme="light"] .act-cell { border-left-color: var(--line-2); }
html[data-theme="light"] .act-cell p { color: var(--ink-2); }
html[data-theme="light"] .line-meta .arc-link { color: var(--muted); border-bottom-color: var(--line); }

/* check, method */
html[data-theme="light"] .check-cards { border-color: var(--line); background: var(--line); }
html[data-theme="light"] .issue { border-top-color: var(--line); }
html[data-theme="light"] .issue p { color: var(--muted); }
html[data-theme="light"] .balance-row .track { background: var(--paper-3); }
html[data-theme="light"] .balance-row .track i { background: var(--ink); }
html[data-theme="light"] .balance-row .track b { background: var(--red); box-shadow: none; }
html[data-theme="light"] .service-table th { border-bottom-color: var(--line); }
html[data-theme="light"] .service-table td { border-bottom-color: var(--line-2); }
html[data-theme="light"] .step { border-top-color: var(--line); }

/* inspector, toast, footer */
html[data-theme="light"] .inspector-backdrop { background: rgba(15, 23, 42, .28); }
html[data-theme="light"] .inspector { box-shadow: -30px 0 80px rgba(15, 23, 42, .14); }
html[data-theme="light"] .field textarea,
html[data-theme="light"] .field input,
html[data-theme="light"] .field select { background: #fff; border-color: var(--line); color: var(--ink); }
html[data-theme="light"] .inspector-arc select { background: #fff; color: var(--ink); border-color: var(--line); }
html[data-theme="light"] .toast { background: var(--ink); color: #fff; }
html[data-theme="light"] .footer { border-top-color: var(--line); }
html[data-theme="light"] .footer a { border-bottom-color: var(--line); }

@media (max-width: 900px) {
  .theme-toggle { display: grid !important; }
}

/* ============================================================
   Help: screenwriter path, score, glossary
   ============================================================ */
.help-wrap { max-width: 1180px; margin: 0 auto; }
.help-head { padding: 8px 0 0; border-bottom: 1px solid var(--line); }
.help-head h1 { font-size: clamp(38px, 4.4vw, 56px); margin: 7px 0 10px; }
.help-head .lead { max-width: 62ch; }
.help-tabs { margin: 20px 0 0; border-bottom: 0; }
.help-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) 300px; gap: 38px; padding: 22px 0 0; align-items: start; }
.help-main { min-width: 0; }
.help-side { position: sticky; top: 86px; }
.help-intro {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; font-size: 13px; line-height: 1.55; color: var(--ink-2);
}
.help-intro b { color: var(--ink); font-family: var(--font-display); font-size: 15px; }
.help-steps { margin-top: 8px; }
.help-step {
  display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 14px;
  padding: 18px 0; border-top: 1px solid var(--line);
}
.help-step:first-child { border-top: 0; }
.help-step-num { font-family: var(--mono); font-size: 12px; color: var(--red); padding-top: 5px; }
.help-step h2 { font-size: 22px; margin-bottom: 6px; }
.help-step p { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.help-tool {
  display: inline-block; margin-top: 9px; font-size: 9px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--red); font-weight: 600;
}
.help-example {
  margin-top: 11px; border-left: 2px solid var(--red);
  background: var(--paper-2); border-radius: 0 10px 10px 0;
  padding: 10px 13px; font-size: 12px; line-height: 1.5; color: var(--muted);
}
.help-example b { color: var(--ink); font-family: var(--font-display); }
.ex-label {
  display: block; font-size: 8px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--red); margin-bottom: 4px;
}
.help-note { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.help-note h3 { font-size: 19px; margin-bottom: 8px; }
.help-note p { font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.help-note ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.help-note li { margin: 5px 0; }
.help-list { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.help-list li { margin: 5px 0; }
.help-callout {
  margin-top: 18px; border-left: 2px solid var(--red); padding: 11px 15px;
  background: var(--paper-2); border-radius: 0 10px 10px 0;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}
.help-callout b { color: var(--ink); font-family: var(--font-display); }
.formula-card {
  background: linear-gradient(135deg, rgba(245,158,11,.14), rgba(56,189,248,.06)), var(--paper-2);
  border: 1px solid rgba(245,158,11,.32); border-radius: 16px; padding: 20px 22px;
}
.formula-card .k { font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.formula-card .formula {
  font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700; letter-spacing: -.03em; margin-top: 5px; color: var(--ink);
}
.formula-card p { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 5px; }
.score-calc { margin-top: 14px; }
.score-calc div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-top: 1px solid var(--line-2);
  font-size: 12px; color: var(--muted);
}
.score-calc b { font-family: var(--mono); font-size: 11px; color: var(--ink); font-weight: 500; }
.score-calc .total { border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.score-calc .total b { color: var(--red); font-size: 17px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 6px; }
.help-table th {
  text-align: left; font-size: 8px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); padding: 0 8px 6px 0;
}
.help-table td {
  border-bottom: 1px solid var(--line-2); padding: 8px 8px 8px 0;
  vertical-align: top; color: var(--muted); line-height: 1.4;
}
.help-table td b { color: var(--ink); font-weight: 500; }
.term-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 26px; }
.term { border-top: 1px solid var(--line-2); padding: 11px 0; }
.term b { display: block; font-family: var(--font-display); font-size: 14px; color: var(--ink); margin-bottom: 3px; }
.term span { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.help-side .box:first-child { border-top: 2px solid var(--ink); }
.help-side .text-link { display: block; margin: 7px 0; }

@media (max-width: 980px) {
  .help-grid { grid-template-columns: 1fr; }
  .help-side { position: static; }
  .term-grid { grid-template-columns: 1fr; }
  .help-step { grid-template-columns: 34px minmax(0,1fr); gap: 10px; }
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 7, 15, .58); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; z-index: 81; top: 50%; left: 50%;
  width: min(640px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.4);
  transform: translate(-50%, -48%); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 22px 13px; border-bottom: 1px solid var(--line);
}
.modal-head .eyebrow { margin-bottom: 4px; }
.modal-head h2 { font-size: 24px; }
.modal-head .close {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); flex: 0 0 auto;
}
.modal-head .close:hover { border-color: var(--ink); color: var(--ink); }
.modal-body { padding: 18px 22px 20px; overflow-y: auto; }
.modal-foot {
  padding: 13px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 15px; }
.arc-picker-list { display: flex; flex-direction: column; margin-top: 10px; }
.arc-picker-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line-2);
}
.arc-picker-row:first-child { border-top: 0; }
.arc-picker-row .t { font-family: var(--font-display); font-size: 14px; }
.arc-picker-row .g { font-size: 10px; color: var(--muted); margin-top: 2px; }
.arc-picker-row .add { white-space: nowrap; }
.arc-picker-row .add:disabled { opacity: .35; cursor: default; }
.modal .danger { color: var(--rose); border-color: rgba(251,113,133,.35); }
.modal .danger:hover { background: rgba(251,113,133,.08); border-color: var(--rose); color: var(--rose); }
@media (max-width: 700px) {
  .field-row { grid-template-columns: 1fr; }
  .modal { width: 94vw; }
}

/* ---------- scene editor ---------- */
.scene-arcs { display: flex; flex-direction: column; }
.scene-arc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--line-2);
}
.scene-arc-row:first-child { border-top: 0; }
.scene-arc-row label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-2); min-width: 0;
}
.scene-arc-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.scene-arc-row select { width: auto; max-width: 200px; font-size: 10px; padding: 5px 8px; }
.scene-arc-row select:disabled { opacity: .4; }

/* ---------- project controls ---------- */
.project-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.project-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.project-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper-2); color: var(--ink-2);
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  padding: 7px 28px 7px 11px; cursor: pointer; max-width: 210px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
.project-select:hover { border-color: var(--ink); color: var(--ink); }
.project-controls .btn { padding: 6px 9px; font-size: 10px; }
.arc-item { position: relative; }
.arc-copy { min-width: 0; }
.arc-edit {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper-2);
  color: var(--muted); font-size: 11px; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.arc-item:hover .arc-edit, .arc-item:focus-within .arc-edit { opacity: 1; }
.arc-edit:hover { color: var(--ink); border-color: var(--ink); }
.rail-empty { font-size: 11.5px; line-height: 1.5; color: var(--muted); padding: 8px 0; }
.map-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-actions .btn { white-space: nowrap; }
@media (max-width: 700px) {
  .project-controls { gap: 4px; }
  .project-select { max-width: 150px; }
  .project-controls .btn { padding: 5px 7px; }
}

/* ---------- library pagination ---------- */
.load-more { display: flex; justify-content: center; align-items: center; padding: 22px 0 4px; }
.arc-card .state-line {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- issue explanations ---------- */
.issue-explained {
  margin-top: 7px; padding: 7px 9px; border-left: 2px solid var(--green);
  background: rgba(52, 211, 153, .06); border-radius: 0 7px 7px 0;
  color: var(--ink-2); font-size: 11.5px; line-height: 1.45;
}
.issue-note-btn { margin-top: 7px; padding: 0; border: 0; background: none; }

/* ---------- scene board / reorder ---------- */
.scene-board { margin-top: 20px; border-top: 2px solid var(--ink); padding-top: 14px; }
.scene-board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.scene-board-head h2 { font-size: 24px; }
.scene-board-head span { font-size: 10.5px; color: var(--muted); }
.scene-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scene-card {
  display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid var(--line); background: var(--paper-2);
  border-radius: 12px; padding: 9px 9px 9px 7px;
  transition: border-color .15s, opacity .15s, box-shadow .15s;
}
.scene-card.dragging { opacity: .35; }
.scene-card.drop-target { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.drag-handle { color: var(--muted2); cursor: grab; font-size: 14px; line-height: 1; padding-top: 3px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.scene-card-num { font-family: var(--mono); font-size: 11px; color: var(--red); padding-top: 4px; min-width: 18px; }
.scene-card-body { flex: 1; min-width: 0; }
.scene-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scene-act { font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.scene-type { font-size: 8px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 5px; }
.scene-type.arc { color: var(--ink); border-color: var(--ink); }
.scene-type.support { color: var(--red); border-color: rgba(245,158,11,.45); }
.scene-conv { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); border: 1px solid rgba(245,158,11,.5); border-radius: 999px; padding: 2px 5px; }
.scene-card h3 { font-size: 14px; line-height: 1.25; margin: 4px 0 5px; }
.scene-card-arcs { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.scene-arc { font-size: 8.5px; color: var(--muted); border-left: 2px solid var(--c); padding-left: 5px; line-height: 1.3; }
.scene-card-actions { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.mini {
  width: 21px; height: 21px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font-size: 11px; line-height: 1; display: grid; place-items: center;
  background: var(--paper-2);
}
.mini:hover { color: var(--ink); border-color: var(--ink); }
.mini:disabled { opacity: .25; cursor: default; }
@media (max-width: 900px) { .scene-list { grid-template-columns: 1fr; } }

/* ---------- print / PDF ---------- */
.print-head { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  html, body { background: #fff !important; color: #0e1729 !important; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .rail, .project-head, .map-toolbar, .map-caption, .density-wrap,
  .metrics, .scene-board, .project-diagnostics, .footer, .toast, .inspector,
  .modal, .modal-backdrop, .backdrop { display: none !important; }
  .print-head { display: block !important; margin: 0 0 8mm; }
  .print-brand { font-family: var(--mono); font-size: 8pt; letter-spacing: .12em; text-transform: uppercase; color: #64748b; }
  .print-head h1 { font-family: var(--font-display); font-size: 26pt; margin: 2mm 0 1mm; color: #0e1729; }
  .print-sub { font-size: 9pt; color: #475569; margin-bottom: 2mm; }
  .print-head p { font-size: 9pt; color: #475569; max-width: 170mm; }
  .workspace { display: block !important; }
  .map-card { border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; border-radius: 0 !important; }
  .map-svg { width: 100% !important; height: auto !important; min-width: 0 !important; }
  .page { padding: 0 !important; max-width: none !important; }
}

/* ---------- compare ---------- */
.compare-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.compare-head h1 { font-size: clamp(38px, 4.2vw, 54px); margin: 6px 0 8px; }
.compare-head .lead { margin-top: 0; }
.compare-head-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.compare-scroll { overflow-x: auto; border-top: 2px solid var(--ink); margin-top: 18px; }
.compare-table { width: 100%; min-width: 840px; border-collapse: collapse; table-layout: fixed; }
.compare-table thead th { vertical-align: top; padding: 14px 14px 12px 0; border-bottom: 1px solid var(--line); text-align: left; }
.compare-table thead th:first-child { width: 128px; }
.compare-table tbody th { width: 128px; text-align: left; vertical-align: top; padding: 11px 12px 11px 0; border-top: 1px solid var(--line); font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.compare-table tbody td { vertical-align: top; padding: 11px 14px 11px 0; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.compare-arc-head .genre { font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.compare-arc-head h2 { font-size: 19px; margin: 0 0 4px; }
.compare-arc-head h2 a:hover { color: var(--red); }
.compare-arc-meta { font-size: 9.5px; color: var(--muted); }
.compare-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.compare-stages { list-style: none; margin: 0; padding: 0; }
.compare-stages li { display: grid; grid-template-columns: 14px minmax(0,1fr); gap: 3px; padding: 3px 0; }
.compare-stages b { font-family: var(--mono); font-size: 8px; color: var(--red); padding-top: 2px; }
.compare-stages span { font-size: 10.5px; color: var(--ink-2); line-height: 1.35; }
.compare-roles { display: flex; flex-direction: column; gap: 4px; }
.compare-roles b { display: block; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); font-weight: 500; }
.compare-roles span { display: block; font-size: 10.5px; color: var(--ink-2); }
.compare-compat { display: flex; flex-direction: column; gap: 4px; }
.compare-compat div { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); }
.compare-compat b { color: var(--ink); font-family: var(--mono); font-size: 9px; }
.compare-example { margin-bottom: 4px; }
.compare-example b { display: block; font-size: 11px; color: var(--ink); }
.compare-example span { font-size: 9px; color: var(--muted); }
.compare-note { margin-top: 16px; border-left: 2px solid var(--gold); padding: 10px 14px; background: var(--paper-2); font-size: 11.5px; color: var(--muted); border-radius: 0 9px 9px 0; }
.compare-pick-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.compare-pick-row:first-child { border-top: 0; }
.compare-pick-row input { flex: 0 0 auto; }
.compare-pick-row span { display: flex; flex-direction: column; gap: 1px; }
.compare-pick-row b { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink); }
.compare-pick-row small { font-size: 9.5px; color: var(--muted); }
@media (max-width: 700px) {
  .compare-head { align-items: flex-start; }
  .compare-table { min-width: 760px; }
}

button.text-link {
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 0 0 1px; font: inherit; color: var(--muted); cursor: pointer;
}
button.text-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- versions ---------- */
.version-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.version-head p { max-width: 46ch; margin: 0; }
.version-list { border-top: 1px solid var(--line); }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.version-row:first-child { border-top: 0; }
.version-row b { display: block; font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--ink); }
.version-row span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; }

/* ---------- version diff ---------- */
.version-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.diff h3 { font-size: 15px; margin: 14px 0 6px; }
.diff h3:first-child { margin-top: 0; }
.diff-row { display: grid; grid-template-columns: 92px minmax(0,1fr) 14px minmax(0,1fr); gap: 6px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line-2); font-size: 10.5px; line-height: 1.4; }
.diff-label { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.diff-old { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.diff-arrow { color: var(--muted2); text-align: center; }
.diff-new { color: var(--ink); }
.diff-note { padding: 5px 0 5px 10px; border-left: 2px solid var(--line); margin: 4px 0; font-size: 10.5px; line-height: 1.4; color: var(--ink-2); }
.diff-note.add { border-left-color: var(--green); }
.diff-note.del { border-left-color: var(--rose); }
.diff-note.change { border-left-color: var(--gold); }
.diff-actions { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 700px) {
  .diff-row { grid-template-columns: 1fr; gap: 1px; }
  .diff-arrow { display: none; }
  .diff-old { text-decoration: none; }
}

/* ---------- comments ---------- */
.comment-list { margin-bottom: 16px; }
.comment-row { position: relative; padding: 10px 28px 10px 0; border-top: 1px solid var(--line-2); }
.comment-row:first-child { border-top: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-meta b { font-family: var(--font-display); font-size: 12px; color: var(--ink); }
.comment-meta span { font-size: 9px; color: var(--muted); }
.comment-row p { font-size: 11.5px; line-height: 1.5; color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; }
.comment-delete { position: absolute; top: 8px; right: 0; width: 20px; height: 20px; border: 1px solid transparent; border-radius: 50%; color: var(--muted2); font-size: 14px; line-height: 1; }
.comment-delete:hover { color: var(--rose); border-color: var(--rose); }
.comment-form { border-top: 2px solid var(--ink); padding-top: 12px; }
.comment-form .field-row { gap: 10px; }
.comment-form textarea { min-height: 74px; }

/* ---------- film catalog ---------- */
.film-catalog-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; flex-wrap: wrap; padding: 10px 0 22px; border-bottom: 1px solid var(--line); }
.film-catalog-head h1 { font-size: clamp(42px, 5vw, 64px); margin: 6px 0 10px; }
.film-search { display: flex; gap: 7px; align-items: center; padding-bottom: 5px; }
.film-search input { width: min(280px, 52vw); padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink); font-size: 12px; outline: none; }
.film-search input:focus { border-color: var(--ink); }
.film-catalog-bar { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0 10px; font-size: 10px; color: var(--muted); }
.film-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.film-card { display: flex; flex-direction: column; min-height: 145px; padding: 12px 13px 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-2); transition: border-color .15s, transform .15s; }
.film-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.film-card-year { font-family: var(--mono); font-size: 9px; color: var(--red); }
.film-card h3 { font-size: 16px; line-height: 1.25; margin: 5px 0 7px; }
.film-card-meta { font-size: 9.5px; color: var(--muted); }
.film-card-open { margin-top: auto; padding-top: 10px; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.film-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 20px 0 4px; }
.film-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 15px 0; border-bottom: 1px solid var(--line); }
.film-overview { margin-top: 16px; border-top: 2px solid var(--ink); }
.film-overview p { font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.line-project { margin-top: 7px; font-size: 9px; color: var(--muted2); }
.line-project.in { color: var(--green); }
@media (max-width: 1100px) { .film-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 800px) {
  .film-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .film-catalog-head { align-items: flex-start; }
  .film-search input { width: 62vw; }
}
@media (max-width: 520px) { .film-grid { grid-template-columns: 1fr; } }

/* ---------- project references ---------- */
.project-refs { margin-top: 20px; border-top: 2px solid var(--ink); padding-top: 13px; }
.project-refs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.project-refs-head h2 { font-size: 24px; }
.project-refs-head span { font-size: 10px; color: var(--muted); }
.project-refs-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.ref-arc { border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); padding: 9px 11px; }
.ref-arc-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.ref-arc-head b { font-family: var(--font-display); font-size: 13px; color: var(--ink); font-weight: 600; }
.ref-letter { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--c); color: var(--c); display: grid; place-items: center; font-family: var(--mono); font-size: 8px; flex: 0 0 auto; }
.ref-film { display: flex; flex-direction: column; gap: 1px; padding: 5px 0 5px 24px; border-top: 1px solid var(--line-2); }
.ref-film span { font-size: 10px; color: var(--ink-2); }
.ref-film small { font-size: 8.5px; color: var(--muted); }
.ref-film:hover span { color: var(--red); }
@media (max-width: 800px) { .project-refs-grid { grid-template-columns: 1fr; } }

/* ---------- passport film breakdowns ---------- */
.film-arc-list { border-top: 1px solid var(--line); }
.film-arc-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.film-arc-row:first-child { border-top: 0; }
.film-arc-row .t { font-family: var(--font-display); font-size: 13px; color: var(--ink); }
.film-arc-row .g { font-size: 9px; color: var(--muted); margin-top: 2px; }
.film-arc-meta { font-size: 8px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.film-arc-meta span { color: var(--red); }
.film-arc-row:hover .t { color: var(--red); }

/* ---------- film filters ---------- */
.film-filters { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field-inline { display: flex; align-items: center; gap: 6px; }
.field-inline label { font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field-inline select, .field-inline input { border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 10px; padding: 7px 10px; outline: none; }
.field-inline input { width: 62px; }
.field-inline select:focus, .field-inline input:focus { border-color: var(--ink); }
.field-inline span { font-size: 9px; color: var(--muted2); }
.film-filter-count { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); }
@media (max-width: 700px) {
  .film-filters { gap: 9px; }
  .film-filter-count { margin-left: 0; }
}

/* ---------- scene refs ---------- */
.scene-refs { display: flex; flex-direction: column; gap: 5px; }
.scene-ref { display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; border-left: 2px solid var(--gold); background: var(--paper-2); border-radius: 0 7px 7px 0; }
.scene-ref span { font-size: 10px; color: var(--ink-2); }
.scene-ref small { font-size: 8.5px; color: var(--muted); }
.scene-ref:hover span { color: var(--red); }
.film-scene-ref { margin-top: 6px; padding: 0; border: 0; background: none; font-size: 8.5px; }

/* ---------- project scene references ---------- */
.project-refs h3 { font-size: 13px; margin: 14px 0 7px; color: var(--muted); font-weight: 600; }
.ref-scenes-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.ref-scene { border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); padding: 9px 11px; }
.ref-scene-head { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.ref-scene-head b { font-family: var(--font-display); font-size: 13px; color: var(--ink); font-weight: 600; }
.ref-scene-head .ref-letter { border-color: var(--line); color: var(--muted); font-family: var(--mono); }
@media (max-width: 800px) { .ref-scenes-grid { grid-template-columns: 1fr; } }

/* ---------- models ---------- */
.models-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; padding: 10px 0 22px; border-bottom: 1px solid var(--line); }
.models-head h1 { font-size: clamp(42px, 5vw, 64px); margin: 6px 0 10px; }
.models-search { display: flex; gap: 7px; align-items: center; }
.models-search input { width: min(300px, 56vw); padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink); font-size: 12px; outline: none; }
.models-search input:focus { border-color: var(--ink); }
.models-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding-top: 10px; }
.model-card { display: flex; flex-direction: column; min-height: 170px; padding: 13px 15px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-2); transition: border-color .15s; }
.model-card:hover { border-color: var(--ink); }
.model-area { font-size: 8px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.model-card h3 { font-size: 19px; line-height: 1.25; margin: 6px 0 7px; }
.model-card p { font-size: 11px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.model-open { margin-top: auto; padding-top: 10px; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.model-hero { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(260px,.75fr); gap: 40px; align-items: end; padding: 12px 0 24px; border-bottom: 1px solid var(--line); }
.model-hero h1 { font-size: clamp(36px, 4.6vw, 58px); margin: 7px 0 10px; }
.model-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.model-tags span { font-size: 8px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; }
.model-formula { font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 68ch; margin-bottom: 14px; }
.model-facts { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid var(--line); padding-left: 20px; }
.model-facts div { display: flex; justify-content: space-between; gap: 14px; }
.model-facts span { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.model-facts b { font-size: 10px; color: var(--ink); font-weight: 500; text-align: right; }
.model-grid { display: grid; grid-template-columns: minmax(0,1.4fr) 300px; gap: 30px; padding-top: 22px; align-items: start; }
.model-box { border-top: 1px solid var(--line); }
.model-box p { font-size: 12px; line-height: 1.55; color: var(--ink-2); margin-top: 5px; }
.model-box b { color: var(--ink); }
.model-scene { padding: 10px 0; border-top: 1px solid var(--line-2); }
.model-scene h3 { font-size: 16px; margin-bottom: 4px; }
.model-scene p { font-size: 11.5px; color: var(--muted); }
.model-working { margin-top: 6px; border-left: 2px solid var(--gold); padding-left: 9px; font-size: 10.5px; color: var(--ink-2); }
@media (max-width: 900px) { .models-grid, .model-grid { grid-template-columns: 1fr; } .model-hero { grid-template-columns: 1fr; gap: 20px; } .model-facts { border-left: 0; padding-left: 0; } }
@media (max-width: 700px) { .models-head { align-items: flex-start; } .models-search input { width: 60vw; } }

@media (min-width: 901px) and (max-width: 1180px) {
  .nav { margin-left: 2px; }
  .nav a { padding: 7px 8px; font-size: 11.5px; }
  .nav .nav-sep { margin: 0 5px; }
  .top-actions { gap: 5px; }
}

/* ---------- model recommendations ---------- */
.model-rec-list { display: flex; flex-direction: column; }
.model-rec { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 9px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.model-rec:first-child { border-top: 0; }
.model-rec-num { font-family: var(--mono); font-size: 9px; color: var(--red); padding-top: 3px; }
.model-rec-area { font-size: 8px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.model-rec h3 { font-size: 15px; line-height: 1.3; margin: 2px 0 3px; }
.model-rec p { font-size: 10.5px; line-height: 1.45; color: var(--muted); }
.model-rec-why { margin-top: 4px; font-size: 8.5px; color: var(--red); }
.model-rec-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 600px) { .model-rec { grid-template-columns: 20px minmax(0,1fr); } .model-rec-actions { grid-column: 2; flex-direction: row; align-items: center; } }

.models-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* ---------- batch model recommendations ---------- */
.batch-scene { border-top: 1px solid var(--line-2); padding: 10px 0; }
.batch-scene:first-child { border-top: 0; }
.batch-scene-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.batch-scene-head span { font-family: var(--mono); font-size: 8px; color: var(--red); }
.batch-scene-head b { font-family: var(--font-display); font-size: 13px; color: var(--ink); }
.batch-scene-head em { margin-left: auto; font-style: normal; font-size: 8px; color: var(--green); }
.batch-recs { display: flex; flex-direction: column; }
.batch-rec { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 5px 0 5px 10px; border-left: 2px solid var(--line); }
.batch-rec-area { font-size: 7.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.batch-rec-title { font-size: 11px; color: var(--ink-2); line-height: 1.35; }
.batch-rec-why { font-size: 8px; color: var(--red); margin-top: 1px; }
.batch-rec-actions { display: flex; align-items: center; gap: 5px; }
.batch-rec-actions .btn { padding: 4px 7px; font-size: 9px; }
@media (max-width: 600px) { .batch-rec { grid-template-columns: 1fr; } .batch-rec-actions { justify-content: flex-end; } }

.model-flags { display: flex; gap: 4px; margin-top: 5px; }
.model-flags span { font-size: 7.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--red); border: 1px solid rgba(245,158,11,.4); border-radius: 999px; padding: 2px 5px; }
.check-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; color: var(--muted); cursor: pointer; }
.check-inline input { accent-color: var(--red); }

/* ---------- hosted auth ---------- */
.auth-btn { white-space: nowrap; }
.auth-gate { min-height: 62vh; display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: min(460px, 100%); border: 1px solid var(--line); border-radius: 18px; background: var(--paper-2); padding: 28px 30px 24px; box-shadow: 0 30px 80px rgba(2, 8, 23, .18); }
.auth-card h1 { font-size: clamp(30px, 4vw, 42px); margin: 7px 0 10px; }
.auth-card .lead { font-size: 12px; margin-bottom: 18px; }
.auth-form .field { margin-bottom: 12px; }
.auth-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 13px; outline: none; }
.auth-form input:focus { border-color: var(--red); }
.auth-error { min-height: 18px; color: var(--red); font-size: 10px; margin-bottom: 6px; }
.auth-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 9px; }
.auth-links a { color: var(--muted); }
.auth-links a:hover { color: var(--red); }
@media (max-width: 600px) { .auth-card { padding: 22px 20px 20px; } }

@media (max-width: 600px) {
  .topbar { gap: 7px; }
  .auth-btn { padding: 6px 9px; font-size: 10px; }
}

/* ---------- account/auth ---------- */
.auth-account { font-size: 10px; color: var(--muted); padding: 6px 7px; border-radius: 999px; white-space: nowrap; }
.auth-account:hover { color: var(--red); background: rgba(148,163,184,.08); }
.auth-tabs { display: flex; gap: 4px; margin: 4px 0 12px; border-bottom: 1px solid var(--line); }
.auth-tabs a { padding: 7px 8px 9px; font-size: 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.auth-tabs a.active { color: var(--ink); border-color: var(--red); }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 13px 0 9px; color: var(--muted2); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.social-login { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; font-size: 9.5px; color: var(--ink-2); background: var(--paper); text-align: center; padding: 5px 6px; }
.social-btn:hover { border-color: var(--ink); color: var(--ink); }
.social-btn small { font-size: 7px; color: var(--muted2); }
.social-off { color: var(--muted2); opacity: .72; cursor: default; }
.social-yandex { border-color: rgba(220, 38, 38, .28); }
.social-vk { border-color: rgba(2, 132, 199, .28); }
.social-mailru { border-color: rgba(37, 99, 235, .25); }
.social-max { border-color: rgba(124, 58, 237, .28); }
.account-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 10px 0 20px; border-bottom: 1px solid var(--line); }
.account-head h1 { font-size: clamp(40px, 5vw, 64px); margin: 5px 0 5px; }
.account-email { font-size: 11px; color: var(--muted); }
.account-avatar { width: 70px; height: 70px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; flex: 0 0 auto; }
.account-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); gap: 30px; padding-top: 20px; align-items: start; }
.account-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.account-section-head h2 { font-size: 28px; }
.account-project-list { display: flex; flex-direction: column; }
.account-project { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.account-project.active { border-left: 2px solid var(--red); padding-left: 10px; }
.account-project-title { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.account-project-meta { font-size: 8.5px; color: var(--muted); margin-top: 2px; }
.account-project-actions { display: flex; gap: 5px; }
.account-side .box { padding: 14px 15px; }
.account-side .box h4 { margin-bottom: 9px; }
.account-side .field { margin-bottom: 8px; }
.account-side input { width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 11px; outline: none; }
.account-side input:focus { border-color: var(--red); }
.account-message { min-height: 15px; font-size: 9px; color: var(--red); }
.account-identity { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line-2); font-size: 10px; }
.account-identity small { color: var(--muted); }
@media (max-width: 800px) { .account-grid { grid-template-columns: 1fr; } .account-head { align-items: flex-start; } .account-avatar { width: 54px; height: 54px; font-size: 18px; } }
@media (max-width: 520px) { .account-project { align-items: flex-start; flex-direction: column; } .account-project-actions { width: 100%; justify-content: flex-end; } }

/* ---------- arcpick model ---------- */
.arcpick-run-row { display: flex; align-items: center; gap: 10px; margin: 7px 0 12px; }
.arcpick-results { border-top: 1px solid var(--line); }
.arcpick-heading { font-family: var(--font-display); font-size: 17px; margin: 13px 0 5px; color: var(--ink); }
.arcpick-row { display: grid; grid-template-columns: 24px minmax(0,1fr) 54px auto; gap: 9px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line-2); }
.arcpick-row.trunk { border-left: 2px solid var(--red); padding-left: 9px; }
.arcpick-num { font-family: var(--mono); font-size: 9px; color: var(--red); padding-top: 3px; }
.arcpick-genre { font-size: 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.arcpick-title { display: block; font-family: var(--font-display); font-size: 14px; color: var(--ink); margin: 2px 0; }
.arcpick-title:hover { color: var(--red); }
.arcpick-why { font-size: 9.5px; line-height: 1.45; color: var(--muted); max-height: 42px; overflow: hidden; }
.arcpick-score { text-align: right; }
.arcpick-score b { display: block; font-size: 12px; color: var(--red); }
.arcpick-score span { font-size: 7px; text-transform: uppercase; color: var(--muted2); }
.arcpick-actions { padding-top: 2px; }
@media (max-width: 600px) { .arcpick-row { grid-template-columns: 20px minmax(0,1fr) auto; } .arcpick-score { display: none; } .arcpick-actions { grid-column: 2; } }

/* ---------- characters ---------- */
.rail-head-sub { margin-top: 15px; }
.character-list { display: grid; gap: 3px; margin: 2px 0 7px; }
.character-item { display: flex; gap: 7px; align-items: flex-start; padding: 5px 6px; border-radius: 2px; cursor: pointer; }
.character-item:hover, .character-item:focus-visible { background: var(--paper3); outline: none; }
.character-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--c, var(--muted)); flex: 0 0 auto; }
.character-copy { min-width: 0; }
.character-name { font-size: 11px; line-height: 1.3; color: var(--ink); }
.character-meta { font-size: 8px; color: var(--muted2); margin-top: 1px; line-height: 1.3; }
.character-checks { display: grid; gap: 4px; max-height: 190px; overflow: auto; padding: 2px 0; }
.character-check { display: grid; grid-template-columns: 14px 8px minmax(0, 1fr) auto; column-gap: 7px; row-gap: 2px; align-items: center; font-size: 10px; color: var(--ink2); cursor: pointer; text-transform: none; letter-spacing: 0; }
.character-check input { margin: 0; }
.character-check small { font-size: 8px; color: var(--muted2); text-align: right; padding-left: 4px; text-transform: none; }
.scene-card-chars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.scene-char { display: inline-flex; align-items: center; gap: 3px; font-size: 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 1px 5px; }
.scene-char::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--c, var(--muted)); }
.scene-char-more { font-size: 8px; color: var(--muted2); padding: 1px 3px; }

/* ---------- characters page ---------- */
.characters-page { max-width: 1180px; margin: 0 auto; padding: 28px 0 50px; }
.characters-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; }
.characters-head h1 { font-family: var(--font-display); font-size: clamp(38px, 5vw, 66px); line-height: .96; margin: 6px 0 14px; color: var(--ink); }
.characters-head .lead { max-width: 70ch; }
.section-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 22px 0 12px; }
.section-line h2 { font-family: var(--font-display); font-size: 22px; color: var(--ink); margin: 0; }
.section-line span { font-family: var(--mono); font-size: 9px; color: var(--muted2); }
.character-suggestions { margin-bottom: 24px; }
.character-suggestion { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center; border: 1px solid var(--line); border-left: 3px solid var(--red); background: var(--paper2); padding: 13px 16px; margin-bottom: 7px; }
.character-suggestion-kicker { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.character-suggestion h3 { font-family: var(--font-display); font-size: 20px; margin: 3px 0 6px; color: var(--ink); }
.character-suggestion-roles { display: flex; flex-wrap: wrap; gap: 5px; }
.character-suggestion-roles span { font-size: 9px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 2px 7px; }
.character-suggestion-roles b { color: var(--red); font-family: var(--mono); font-size: 8px; margin-right: 3px; }
.character-suggestion-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.character-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.character-card { border: 1px solid var(--line); border-top: 2px solid var(--c, var(--ink)); background: var(--paper2); padding: 14px 15px 12px; min-width: 0; }
.character-card-top { display: flex; align-items: center; gap: 6px; }
.character-type { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted2); }
.character-arcs { margin-left: auto; font-family: var(--mono); font-size: 8px; color: var(--red); }
.character-card h3 { font-family: var(--font-display); font-size: 23px; line-height: 1.08; margin: 7px 0 4px; color: var(--ink); }
.character-meta { font-size: 9px; color: var(--muted); margin-bottom: 9px; }
.character-role-list { border-top: 1px solid var(--line-2); }
.character-role-row { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.character-role-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.character-role-head b { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--red); }
.character-role-head span { font-size: 8px; color: var(--muted2); text-align: right; }
.character-role-name { font-size: 11px; color: var(--ink); margin-top: 2px; }
.character-role-row p { font-size: 9px; line-height: 1.45; color: var(--muted); margin: 3px 0 0; }
.character-card-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.character-role-list .character-role-row:last-child { border-bottom: 0; }
@media (max-width: 800px) { .characters-head { display: block; } .character-grid { grid-template-columns: 1fr; } .character-suggestion { grid-template-columns: 1fr; } }

/* characters inside project */
.project-characters { padding: 4px 14px 16px; }
.characters-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border-bottom: 1px solid var(--line); padding: 8px 0 12px; margin-bottom: 4px; }
.characters-panel-head .small { margin: 0; max-width: 74ch; }
.project-characters .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 980px) { .project-characters .character-grid { grid-template-columns: 1fr; } }

/* character merge/split modals */
.character-merge-list { display: grid; gap: 10px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.character-merge-group { border: 1px solid var(--line); padding: 8px 10px; }
.character-merge-source { display: flex; align-items: baseline; gap: 7px; cursor: pointer; margin-bottom: 5px; }
.character-merge-source b { font-size: 12px; color: var(--ink); }
.character-merge-source span { font-size: 8px; color: var(--muted2); text-transform: uppercase; letter-spacing: .05em; }
.character-merge-role, .character-split-role { display: flex; align-items: baseline; gap: 7px; padding: 3px 0 3px 19px; font-size: 10px; color: var(--ink2); cursor: pointer; }
.character-merge-role span, .character-split-role b { flex: 1; }
.character-merge-role small, .character-split-role small { font-size: 8px; color: var(--muted2); }
.character-split-list { display: grid; gap: 3px; max-height: 46vh; overflow: auto; }
.character-split-role { padding-left: 2px; align-items: flex-start; }
.character-split-role span { display: flex; flex-direction: column; gap: 2px; }
.character-split-role small { margin-top: 1px; }
.character-card-actions { flex-wrap: wrap; gap: 5px; }

/* keep the project mode switcher in one stable place */
.map-toolbar { flex-wrap: nowrap; }
.map-title { min-width: 0; flex: 1 1 auto; }
.map-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-actions { flex: 0 0 auto; flex-wrap: nowrap; }
.map-controls { flex: 0 0 auto; }
@media (max-width: 1100px) {
  .map-actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* character drag & drop */
.character-drop-zone {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 3px; padding: 9px 12px;
  margin: 0 0 10px; font-size: 9px; color: var(--muted2);
  background: color-mix(in srgb, var(--paper2) 70%, transparent);
  transition: border-color .15s, background .15s, color .15s;
}
.character-drop-zone.drop-target { border-color: var(--red); color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--paper2)); }
.character-card[draggable="true"] { cursor: grab; }
.character-card.dragging { opacity: .45; }
.character-card.drop-target { outline: 2px solid var(--red); outline-offset: 2px; }
.character-role-row[draggable="true"] { cursor: grab; }
.character-role-row.dragging { opacity: .45; }

.character-grip { font-size: 13px; line-height: 1; color: var(--muted2); cursor: grab; margin-right: 1px; }
.character-card:active .character-grip { cursor: grabbing; }

.character-card { cursor: default; }

/* help: engine tab */
.help-tabs { flex-wrap: wrap; }
.engine-layers { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.engine-layer { border: 1px solid var(--line); border-top: 2px solid var(--red); padding: 10px 11px; background: var(--paper-2); }
.engine-layer b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.engine-layer span { display: block; font-size: 11px; line-height: 1.45; color: var(--muted); }
.engine-models td { font-size: 10.5px; }
.engine-models td:first-child b { font-weight: 500; }
.help-note .engine-note { font-size: 12.5px; line-height: 1.6; color: var(--muted); }
@media (max-width: 840px) { .engine-layers { grid-template-columns: 1fr; } }

/* ---------- mobile layout fixes ---------- */
@media (max-width: 700px) {
  .workspace { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .workspace > .rail { order: 2; }
  .workspace > div { order: 1; }
  .rail .arc-list { grid-template-columns: 1fr; }
  .map-toolbar { flex-direction: column; align-items: stretch; gap: 9px; }
  .map-title { width: 100%; flex: none; }
  .map-sub { white-space: normal; overflow: visible; text-overflow: clip; }
  .map-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .map-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; border-radius: 12px; padding: 3px; }
  .map-controls button { padding: 8px 6px; font-size: 10.5px; text-align: center; }
  .map-actions .btn { flex: 1 1 auto; }
  .map-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .map-caption { align-items: flex-start; flex-direction: column; gap: 8px; }
  .pick-form-row { display: block; }
  .pick-form-row .hint { display: block; margin-bottom: 9px; line-height: 1.45; }
  .pick-form-row > div { display: flex; gap: 7px; width: 100%; }
  .pick-form-row .btn { flex: 1; }
  .help-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-top: 16px; }
  .help-tabs button { padding: 10px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10.5px; text-align: center; line-height: 1.25; }
  .help-tabs button:nth-child(2n) { border-right: 0; }
  .help-tabs button:nth-last-child(-n + 2) { border-bottom: 0; }
  .help-tabs button.active::after { display: none; }
  .help-tabs button.active { background: var(--red); color: #0a101f; }
  .characters-panel-head { flex-direction: column; align-items: stretch; gap: 9px; }
  .characters-panel-head .btn { width: 100%; }
  .character-card-actions .btn { flex: 1; }
  .character-drop-zone { text-align: center; }
  .character-suggestion { padding: 11px 12px; }
  .character-suggestion-actions .btn { flex: 1; }
}

/* keep anchored content below the sticky header on small screens */
@media (max-width: 900px) {
  .map-card, #scene-board, .character-suggestions, .characters-panel-head,
  .project-head, .help-head, .method-head, .library-head, .film-head, .check-head,
  .pick-hero { scroll-margin-top: 78px; }
}

@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .inspector:not(.open) { display: none; }
  .inspector.open { display: flex; }
}

/* ---------- arc illustrations ---------- */
.arc-card { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.arc-art { position: relative; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 10px; background: linear-gradient(145deg, var(--paper3), var(--paper2)); }
.arc-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(3,7,15,.48)); pointer-events: none; }
.arc-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; transition: transform .3s ease; }
.arc-card:hover .arc-art img { transform: scale(1.025); }
.arc-art-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; opacity: .55; }
.arc-art-fallback svg { width: 100%; height: auto; }
.arc-art.art-missing .arc-art-fallback { opacity: 1; }
.arc-card-body { display: flex; flex-direction: column; min-width: 0; }
.arc-card-body .meta { flex-wrap: wrap; row-gap: 3px; }
.arc-card .arrow { margin-left: auto; }
.passport-art { position: relative; width: 100%; max-width: 360px; aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(145deg, var(--paper3), var(--paper2)); }
.passport-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 58%, rgba(3,7,15,.58)); pointer-events: none; }
.passport-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.passport-art-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; opacity: .55; }
.passport-art-fallback svg { width: 100%; height: auto; }
.passport-art figcaption { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; font-family: var(--mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.78); }
.passport-art.art-missing .passport-art-fallback { opacity: 1; }
.arc-thumb { position: relative; width: 36px; height: 64px; flex: 0 0 auto; overflow: hidden; border-radius: 5px; background: var(--paper3); }
.arc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.pick-glyph .arc-thumb, .arcpick-thumb { width: 44px; height: 78px; border-radius: 6px; }
.pick-glyph { width: 44px; height: 78px; }
.arcpick-thumb { display: block; flex: 0 0 auto; }
@media (max-width: 520px) {
  .arc-card { grid-template-columns: 92px minmax(0, 1fr); gap: 11px; }
  .arc-card h3 { font-size: 21px; }
  .arc-art { border-radius: 8px; }
}

/* illustration thumbs in rows */
.arc-picker-thumb { width: 36px; height: 64px; flex: 0 0 auto; overflow: hidden; border-radius: 4px; background: var(--paper3); }
.arc-picker-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.arcpick-row { grid-template-columns: 24px 38px minmax(0, 1fr) 54px auto; }
.arcpick-thumb { width: 38px; height: 68px; overflow: hidden; border-radius: 5px; background: var(--paper3); }
.arcpick-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.pick-row { grid-template-columns: 30px 44px minmax(0, 1fr) 112px 140px; }
.pick-glyph { width: 44px; height: 78px; }
@media (max-width: 700px) {
  .pick-row { grid-template-columns: 26px 38px minmax(0, 1fr); }
  .pick-glyph, .pick-glyph .arc-thumb { width: 38px; height: 68px; }
}
@media (max-width: 600px) {
  .arcpick-row { grid-template-columns: 18px 32px minmax(0, 1fr) auto; }
  .arcpick-thumb { width: 32px; height: 57px; }
  .arcpick-actions { grid-column: 3; }
}

/* mobile pick results: image left, content and actions right */
@media (max-width: 700px) {
  .pick-row { grid-template-columns: 52px minmax(0, 1fr); gap: 10px 12px; align-items: start; }
  .pick-rank { display: none; }
  .pick-glyph { grid-column: 1; grid-row: 1 / span 3; width: 52px; height: 92px; margin-top: 2px; }
  .pick-glyph .arc-thumb { width: 52px; height: 92px; }
  .pick-row > div:nth-child(3) { grid-column: 2; grid-row: 1; }
  .pick-score { grid-column: 2; grid-row: 2; flex-direction: row; align-items: center; gap: 8px; }
  .pick-score .bar { flex: 1; }
  .pick-actions { grid-column: 2; grid-row: 3; justify-content: flex-start; }
}

/* mobile library: two-up poster grid, full 9:16 image, no crop */
@media (max-width: 700px) {
  .arc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .arc-card { display: block; padding: 10px; min-height: 0; border-radius: 14px; }
  .arc-art { width: 100%; aspect-ratio: 9 / 16; border-radius: 8px; }
  .arc-card-body { margin-top: 8px; }
  .arc-card .genre { font-size: 8px; line-height: 1.35; letter-spacing: .01em; }
  .arc-card h3 { font-size: 18px; line-height: 1.14; margin: 5px 0 0; }
  .arc-card .fromto, .arc-card .log, .arc-card .meta { display: none; }
}
@media (max-width: 360px) {
  .arc-card h3 { font-size: 16px; }
}

@media (max-width: 700px) {
  .arc-card .genre-stages { display: none; }
}

/* mobile library: one swipeable genre strip instead of a wall of chips */
@media (max-width: 700px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 12px 0 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .chip { flex: 0 0 auto; }
  .filters .filter-sep { display: none; }
  .filters #arc-sort { flex: 0 0 auto; order: -1; }
  .filters #arc-count { flex: 0 0 auto; margin-left: 0 !important; padding-left: 8px; white-space: nowrap; }
}

/* ---------- mobile menu ---------- */
.mobile-menu-btn { display: none; }
.mobile-menu, .mobile-menu-backdrop { display: none; }
body.mobile-menu-open { overflow: hidden; }

@media (max-width: 900px) {
  .auth-btn, .auth-account { display: none !important; }
  .mobile-menu-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 34px; height: 34px; flex: 0 0 auto;
    border: 1px solid var(--line); border-radius: 50%;
    background: var(--paper-2); color: var(--ink); cursor: pointer;
  }
  .mobile-menu-btn span { display: block; width: 15px; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .18s, opacity .18s; }
  body.mobile-menu-open .mobile-menu-btn span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  body.mobile-menu-open .mobile-menu-btn span:nth-child(2) { opacity: 0; }
  body.mobile-menu-open .mobile-menu-btn span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

  .mobile-menu-backdrop {
    position: fixed; inset: 64px 0 0; z-index: 49;
    background: rgba(3, 7, 15, .55); backdrop-filter: blur(5px);
  }
  .mobile-menu-backdrop.open { display: block; }

  .mobile-menu {
    position: fixed; top: 64px; left: 0; right: 0; z-index: 60;
    max-height: calc(100vh - 64px); overflow-y: auto;
    padding: 16px 16px 22px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
  }
  .mobile-menu.open { display: block; animation: menu-in .16s ease both; }
  .mobile-menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .mobile-menu-head .eyebrow { margin: 0; }
  .mobile-menu-close { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 16px; }
  .mobile-menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
  .mobile-menu-links a {
    display: flex; align-items: center; gap: 7px; min-height: 44px;
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink-2); font-size: 12.5px;
  }
  .mobile-menu-links a.active { color: #0a101f; background: var(--red); border-color: var(--red); font-weight: 600; }
  .mobile-menu-links a:active { background: var(--paper-3); }
  .mobile-menu-foot { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
  .mobile-menu-user { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .mobile-menu-caption { font-family: var(--mono); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  #mobile-user { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-menu-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .mobile-menu-actions a, .mobile-menu-actions button {
    padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px;
    font-size: 10.5px; color: var(--ink-2); background: var(--paper-2); white-space: nowrap;
  }
  .mobile-menu-actions a:hover, .mobile-menu-actions button:hover { border-color: var(--red); color: var(--ink); }
  .mobile-menu-actions [hidden] { display: none !important; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* ---------- library landing / random selection ---------- */
.random-section { margin: 2px 0 20px; padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.random-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.random-head h2 { margin: 4px 0 3px; font-family: var(--serif); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.1; }
.random-grid { display: grid; grid-template-columns: repeat(var(--random-count, 6), minmax(0, 1fr)); gap: 12px; padding: 3px 0 7px; }
.arc-random { min-width: 0; cursor: pointer; }
.arc-random-art { position: relative; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 9px; border: 1px solid var(--line); background: linear-gradient(145deg, var(--paper3), var(--paper2)); }
.arc-random-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 62%, rgba(3,7,15,.4)); pointer-events: none; }
.arc-random-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; transition: transform .3s ease; }
.arc-random:hover .arc-random-art img { transform: scale(1.025); }
.arc-random-art.art-missing .arc-art-fallback { opacity: 1; }
.arc-random-genre { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 8px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-random h3 { margin: 3px 0 2px; font-size: 15px; line-height: 1.15; }
.arc-random-meta { font-size: 9px; color: var(--muted-2); white-space: nowrap; }
@media (max-width: 700px) {
  .random-section { padding-top: 15px; }
  .random-head { align-items: flex-start; }
  .random-head h2 { font-size: 25px; }
}

/* library page navigation */
.arc-pager { padding: 4px 0 10px; }
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; padding: 18px 0 6px; }
.pager button { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); color: var(--muted); font-family: var(--mono); font-size: 11px; }
.pager button:hover:not(:disabled) { border-color: var(--red); color: var(--ink); }
.pager button.active { border-color: var(--red); background: var(--red); color: #0a101f; font-weight: 700; }
.pager button:disabled { opacity: .3; cursor: default; }
.pager-gap { color: var(--muted-2); font-family: var(--mono); font-size: 11px; padding: 0 2px; }
@media (max-width: 700px) {
  .pager button { min-width: 32px; height: 32px; }
}


/* universal story-stage illustrations inside the passport */
.stage-art { margin: -1px -1px 11px; overflow: hidden; border-radius: 10px 10px 8px 8px; background: var(--paper3); aspect-ratio: 3 / 2; }
.stage-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 48%; display: block; }

.mobile-menu-links a .menu-icon { width: 22px; height: 22px; object-fit: contain; flex: 0 0 auto; filter: brightness(1.35) saturate(1.05); }
.mobile-menu-links a.active .menu-icon { filter: brightness(0); }

/* generated section art: atmospheric right-edge panel, text stays clean */
.section-head { position: relative; isolation: isolate; }
.section-head::after { content: ""; position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; width: min(58%, 820px); background-image: var(--section-art); background-size: cover; background-position: center right; opacity: .36; pointer-events: none; mask-image: linear-gradient(90deg, transparent 0, #000 38%, #000 86%, transparent 100%); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 38%, #000 86%, transparent 100%); }
.section-head > * { position: relative; z-index: 1; }
@media (max-width: 700px) { .section-head::after { display: none; } }

/* editorial edition */
.arc-tagline { max-width: 56ch; margin: 8px 0 14px; font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--ink-2); }
.arc-editorial { max-width: 76ch; margin: 26px 0 4px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14,23,41,.72); }
.arc-editorial .eyebrow { margin-bottom: 9px; }
.arc-editorial p { margin: 0 0 10px; font-family: var(--serif); font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.arc-editorial p:last-child { margin-bottom: 0; }
@media (max-width: 700px) {
  .arc-tagline { font-size: 17px; }
  .arc-editorial { margin-top: 18px; padding: 15px 16px; }
  .arc-editorial p { font-size: 16px; }
}

/* editorial layer for scene models */
.model-tagline { max-width: 62ch; margin: 7px 0 12px; font-family: var(--serif); font-size: 20px; line-height: 1.35; color: var(--ink-2); }
.model-family-note { max-width: 78ch; margin: 16px 0 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14,23,41,.72); }
.model-family-note h2 { margin: 5px 0 3px; font-family: var(--serif); font-size: 25px; line-height: 1.15; }
.model-family-note p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.model-family-note p:last-child { margin-bottom: 0; }
.model-family-note .model-family-tagline { color: var(--ink-2); font-family: var(--serif); font-size: 17px; }
.model-editorial p { margin: 0 0 8px; font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.model-editorial p:last-child { margin-bottom: 0; }
@media (max-width: 700px) {
  .model-tagline { font-size: 17px; }
  .model-family-note { padding: 13px 14px; }
  .model-family-note h2 { font-size: 22px; }
}

/* per-arc stage frames and character portraits */
.beat { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; }
.beat-art { width: 86px; margin: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 8px; background: var(--paper-3); }
.beat-art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,.7,.2,1); }
.beat:hover .beat-art img { transform: scale(1.035); }
.beat-body { min-width: 0; }
.role-card { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 10px 12px 11px; align-items: start; }
.role-portrait { position: relative; width: 78px; margin: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 8px; background: var(--paper-3); }
.role-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.role-portrait .role-letter { position: absolute; left: 5px; bottom: 5px; width: 22px; height: 22px; font-size: 11px; background: rgba(8,14,25,.78); color: #fff; backdrop-filter: blur(4px); }
.art-missing { opacity: 0; }
@media (max-width: 700px) {
  .beat { grid-template-columns: 92px minmax(0, 1fr); gap: 11px; }
  .beat-art { width: 92px; }
  .role-card { grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
  .role-portrait { width: 70px; }
}

/* character portraits in the project */
.character-identity { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 11px; align-items: start; }
.character-cover { width: 74px; margin: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 8px; background: var(--paper-3); }
.character-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.character-role-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; }
.character-role-thumb { width: 30px; margin: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 5px; background: var(--paper-3); }
.character-role-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.character-role-copy { min-width: 0; }
.character-suggestion-main { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; align-items: start; }
.character-suggestion-portraits { display: grid; grid-template-columns: repeat(2, 36px); gap: 4px; }
.character-suggestion-portraits figure { width: 36px; margin: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 5px; background: var(--paper-3); }
.character-suggestion-portraits img { width: 100%; height: 100%; object-fit: cover; display: block; }
.character-suggestion-copy { min-width: 0; }
@media (max-width: 700px) {
  .character-identity { grid-template-columns: 64px minmax(0, 1fr); }
  .character-cover { width: 64px; }
  .character-suggestion-main { grid-template-columns: 68px minmax(0, 1fr); }
  .character-suggestion-portraits { grid-template-columns: repeat(2, 31px); }
  .character-suggestion-portraits figure { width: 31px; }
}

/* passport: full-width stage frames and poster roles */
.beat { display: block; padding: 10px 10px 12px; }
.beat-art { width: 100%; margin: 0 0 10px; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 9px; background: var(--paper-3); cursor: zoom-in; }
.beat-art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,.7,.2,1); }
.beat:hover .beat-art img { transform: scale(1.025); }
.roles-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-card { position: relative; display: block; padding: 0; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 14px; cursor: zoom-in; background: var(--paper-3); }
.role-portrait { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; aspect-ratio: auto; border-radius: 0; }
.role-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,.7,.2,1); }
.role-card:hover .role-portrait img { transform: scale(1.03); }
.role-card > .role-letter { position: absolute; z-index: 2; top: 10px; left: 10px; width: 26px; height: 26px; font-size: 12px; background: rgba(8,14,25,.72); color: #fff; backdrop-filter: blur(5px); }
.role-overlay { position: absolute; z-index: 1; inset: auto 0 0; padding: 46px 12px 12px; background: linear-gradient(180deg, transparent, rgba(5,9,17,.94) 48%, rgba(5,9,17,.98)); }
.role-overlay .fn { font-size: 8px; letter-spacing: .12em; color: #f4b860; }
.role-overlay h3 { font-family: var(--serif); font-size: 19px; line-height: 1.1; color: #fff; margin: 3px 0 6px; }
.role-overlay p { font-size: 10.5px; line-height: 1.42; color: rgba(255,255,255,.78); margin: 0; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.role-card .role-letter { background: rgba(8,14,25,.72); color: #fff; }

/* image lightbox */
.image-lightbox { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 24px; background: rgba(2,7,14,.94); cursor: zoom-out; }
.image-lightbox figure { max-width: min(92vw, 760px); max-height: 88vh; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: default; }
.image-lightbox img { display: block; max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 12px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.image-lightbox figcaption { max-width: 70ch; color: rgba(255,255,255,.78); font-family: var(--serif); font-size: 14px; text-align: center; }
.image-lightbox-close { position: fixed; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(8,14,25,.75); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
body.lightbox-open { overflow: hidden; }
@media (max-width: 1000px) { .roles-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .roles-list { grid-template-columns: 1fr; }
  .beat { padding: 9px 9px 11px; }
  .beat-art { margin-bottom: 9px; }
  .role-overlay h3 { font-size: 21px; }
  .role-overlay p { font-size: 11px; -webkit-line-clamp: 4; }
  .image-lightbox { padding: 12px; }
  .image-lightbox img { max-height: 78vh; }
}
