/* Screenwriters' Room — клиентский интерфейс по макетам 2026-09-29.
   Тёмная тема комнаты: заголовки Literata, текст Golos Text, сценарий PT Mono. */

:root {
  --bg: #0e0e10;
  --panel: #16161b;
  --panel-2: #1d1d23;
  --line: #2a2a32;
  --line-2: #4a4a55;
  --text: #e5e5e5;
  --text-2: #c9c9cf;
  --muted: #a0a0a8;
  --accent: #f4a261;
  --accent-hover: #f6b176;
  --accent-fg: #1a1208;
  --ok: #6cc070;
  --ok-line: #2ea84d;
  --strong-bg: #1f7a3a; --strong-line: #2ea84d; --strong-fg: #ecfff0;
  --good-bg: #8a6a00;   --good-line: #b58900;   --good-fg: #fff8d8;
  --needs-bg: #a8380a;  --needs-line: #ea580c;  --needs-fg: #ffe6d0;
  --weak-bg: #8f1a1a;   --weak-line: #dc2626;   --weak-fg: #ffd9d9;
  --danger: #ef4444;
  --serif: Literata, Georgia, serif;
  --sans: "Golos Text", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "PT Mono", Menlo, monospace;
  --radius: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 44px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 19px; line-height: 1.3; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { margin: 8px 0 0 20px; padding: 0; }

/* ----- шапка ----- */
.topbar {
  height: 64px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10;
}
.topbar .left, .topbar .right { display: flex; align-items: center; gap: 24px; min-width: 0; }
.topbar .right { gap: 12px; }
.brand { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.topbar .divider { width: 1px; height: 24px; background: var(--line); }
.session-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.session-title .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.session-title .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a, .nav button {
  display: flex; align-items: center; height: 44px; padding: 0 16px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none;
}
.nav a:hover, .nav button:hover { color: var(--text); background: var(--panel); }
.nav a.active { background: var(--panel-2); color: #fff; font-weight: 600; }
.nav a.outline, .nav button.outline { border: 1px solid var(--line-2); color: var(--text); }
.lang-switch { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.lang-switch button { min-width: 48px; height: 36px; border: 0; border-radius: 6px; font-size: 13px; font-weight: 600; background: transparent; color: var(--muted); }
.lang-switch button.on { background: var(--line); color: #fff; }

/* ----- контейнеры ----- */
.view { min-height: calc(100vh - 64px); }
.wrap { max-width: 1376px; margin: 0 auto; padding: 32px; }
.wrap.narrow { max-width: 1040px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px 32px; }
.card.tight { padding: 20px 24px; border-radius: var(--radius); }
.card + .card { margin-top: 20px; }
.card-label { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
/* Две колонки «содержимое + боковая панель»; на узком экране — в столбик. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.split.w-380 { grid-template-columns: minmax(0, 1fr) 380px; }
.split.w-400 { grid-template-columns: minmax(0, 1fr) 400px; }
.split.scene { grid-template-columns: minmax(0, 760px) minmax(360px, 1fr); }
.split.progress { grid-template-columns: 1fr 400px; gap: 24px; }
@media (max-width: 1000px) { .split, .split.w-380, .split.w-400, .split.scene, .split.progress { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .topbar { padding: 0 16px; } .wrap { padding: 16px; } }

/* ----- кнопки ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 44px; padding: 0 18px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn.primary { height: 52px; padding: 0 22px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-fg); font-size: 16px; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-fg); }
.btn.ghost { border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--panel); }
.btn.danger { border-color: var(--danger); color: #ffb4b4; }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex-shrink: 0; }
.btn.primary .spinner { border-color: rgba(26,18,8,0.25); border-top-color: var(--accent-fg); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- сегменты и чипы ----- */
.seg { display: flex; gap: 8px; }
.seg button { flex-grow: 1; height: 44px; border-radius: 8px; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.outline { border: 1px solid var(--line); color: var(--text-2); font-weight: 500; padding: 6px 12px; font-size: 13px; }
.chip.v-strong { background: var(--strong-bg); color: var(--strong-fg); }
.chip.v-good { background: var(--good-bg); color: var(--good-fg); }
.chip.v-needs_work { background: var(--needs-bg); color: var(--needs-fg); }
.chip.v-weak { background: var(--weak-bg); color: var(--weak-fg); }
.chip.v-passed { background: var(--strong-bg); color: var(--strong-fg); }
.chip.v-neutral { background: var(--line); color: var(--text-2); }
.chip.school { border: 1px solid var(--danger); color: #ffb4b4; background: transparent; }
.chip.sev-high { background: var(--weak-bg); color: var(--weak-fg); }
.chip.sev-medium { background: var(--good-bg); color: var(--good-fg); }
.chip.sev-low { background: var(--line); color: var(--text-2); }
.chip.status-done { background: var(--strong-bg); color: var(--strong-fg); }
.chip.status-in_progress { background: var(--good-bg); color: var(--good-fg); }
.chip.status-pending { background: var(--line); color: var(--text-2); }

/* ----- сетка сцен ----- */
.scene-grid { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.scene-cell {
  width: 52px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line); position: relative; flex-shrink: 0;
}
.scene-cell:hover { filter: brightness(1.15); color: inherit; }
.scene-cell.v-strong { background: var(--strong-bg); color: var(--strong-fg); border-color: var(--strong-line); }
.scene-cell.v-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.scene-cell.v-needs_work { background: var(--needs-bg); color: var(--needs-fg); border-color: var(--needs-line); }
.scene-cell.v-weak { background: var(--weak-bg); color: var(--weak-fg); border-color: var(--weak-line); }
.scene-cell.current { outline: 2px solid var(--accent); outline-offset: 2px; }
.scene-cell .pin { position: absolute; right: 4px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: 0.85; }
.act-label { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.act-label:first-child { margin-top: 0; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ----- сценарный текст ----- */
.script { font-family: var(--mono); font-size: 15px; line-height: 1.6; display: flex; flex-direction: column; gap: 16px; }
.script .slug { font-weight: 600; letter-spacing: 0.02em; }
.script .action { color: #d6d6da; white-space: pre-wrap; }
.script .cue { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.script .cue .name { font-weight: 600; }
.script .cue .paren { width: 420px; max-width: 100%; color: var(--muted); text-align: center; }
.script .cue .line { width: 420px; max-width: 100%; color: #d6d6da; white-space: pre-wrap; }
.script .transition { text-align: right; color: var(--muted); }
textarea.script-edit {
  width: 100%; min-height: 420px; resize: vertical; padding: 24px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-family: var(--mono); font-size: 15px; line-height: 1.6; outline: none;
}
textarea.script-edit:focus { border-color: var(--accent); }

/* ----- формы ----- */
label.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
input.text, textarea.text, select.text {
  height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
}
textarea.text { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
input.text:focus, textarea.text:focus, select.text:focus { border-color: var(--accent); }
.dropzone {
  padding: 28px 24px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--panel-2);
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: #24211c; }
.dropzone .title { font-size: 16px; font-weight: 500; }
.dropzone .hint { font-size: 13px; color: var(--muted); }
.dropzone .file { font-family: var(--mono); font-size: 14px; color: var(--accent); }

/* ----- прочее ----- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  padding: 12px 18px; border-radius: 10px; background: #2a2a32; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  max-width: 640px;
}
.toast.error { background: #7a1f1f; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.4s ease; }
.phase { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.phase.done { border-color: var(--ok-line); }
.phase.active { border-color: var(--accent); background: var(--panel-2); }
.phase .t { font-size: 15px; font-weight: 600; }
.phase .s { font-size: 13px; color: var(--muted); }
.phase.active .s { color: var(--accent-hover); }
.phase svg { flex-shrink: 0; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step .n { flex-shrink: 0; width: 28px; height: 28px; border-radius: 999px; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.step .b { font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--muted); }
.crumbs .here { font-weight: 600; }
.subbar { height: 56px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.big-num { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1.05; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 0 0; border-top: 1px solid var(--line); }
.stat .l { font-size: 13px; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 28px; font-weight: 600; }
.details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.details summary { cursor: pointer; padding: 12px 16px; font-size: 14px; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.details summary::-webkit-details-marker { display: none; }
.details .body { padding: 0 16px 16px; }
.list { display: flex; flex-direction: column; gap: 12px; }
.item { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.item.link { cursor: pointer; }
.item.link:hover { border-color: var(--line-2); }
.school-row { display: grid; grid-template-columns: 120px 110px 1fr 140px; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.school-row:first-child { border-top: 0; }
.school-row .fb { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.school-row .mode { font-size: 12px; color: var(--muted); text-align: right; }
.msg { padding: 14px 18px; border-radius: var(--radius); max-width: 78%; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--line); }
.msg.school { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text-2); font-size: 14px; }
.tabs button.on { background: var(--panel-2); color: #fff; border-color: var(--line-2); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.citation { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line-2); padding-left: 12px; margin-top: 8px; }
.citation b { color: var(--text-2); font-weight: 500; }
.diff-add { background: rgba(46,168,77,0.18); }
.diff-del { background: rgba(220,38,38,0.18); text-decoration: line-through; color: var(--muted); }
.vo-bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.vo-bar i { display: block; height: 100%; background: var(--needs-line); }

/* ----- доска плана ----- */
.board-lanes { display: flex; flex-direction: column; gap: 16px; }
.board-lane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.board-lane.cut { border-style: dashed; opacity: 0.85; }
.board-lane-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px 0; }
.bl-title { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.bl-count { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.bl-hint { font-size: 13px; color: var(--muted); }
.bl-grow { flex: 1; }
.board-cards { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; padding: 12px 20px 18px; min-height: 84px; }
.board-cards.drop-end { box-shadow: inset -3px 0 0 var(--accent); }
.board-card {
  width: 188px; min-height: 96px; background: var(--panel-2); border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 10px; padding: 9px 11px 10px; cursor: grab; user-select: none; transition: transform 0.08s ease;
}
.board-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.35); }
.board-card.dragging { opacity: 0.35; cursor: grabbing; }
.board-card.drop-before { box-shadow: -4px 0 0 var(--accent); }
.board-card.v-strong { border-left-color: var(--strong-line); }
.board-card.v-good { border-left-color: var(--good-line); }
.board-card.v-needs_work { border-left-color: var(--needs-line); }
.board-card.v-weak { border-left-color: var(--weak-line); }
.board-card.stub { border-style: dashed; border-color: var(--strong-line); background: rgba(46,168,77,0.06); }
.board-card.hole { border: 2px dashed var(--weak-line); background: rgba(220,38,38,0.05); width: 150px; min-height: 80px; }
.board-card.editing { width: 340px; cursor: default; user-select: text; transform: none; box-shadow: none; }
.bc-head { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.bc-num { font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--muted); }
.bc-beat { font-size: 10.5px; line-height: 1.6; background: rgba(167,139,250,0.18); color: #c4b5fd; border-radius: 5px; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.bc-title { font-family: var(--mono); font-size: 12px; line-height: 1.35; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-card.editing .bc-title { -webkit-line-clamp: 4; }
.bc-summary { font-size: 11.5px; line-height: 1.4; color: var(--muted); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.board-card.editing .bc-summary { -webkit-line-clamp: 8; }
.bc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.bc-meta .chip { padding: 2px 7px; font-size: 10.5px; }
.bc-note { font-size: 12px; line-height: 1.4; color: #fbbf24; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.bc-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.bc-editor input.text, .bc-editor textarea.text { width: 100%; font-size: 13px; }
.bc-editor input.text { height: 36px; padding: 0 10px; }
.bc-editor textarea.text { min-height: 72px; padding: 8px 10px; }
.bc-editor-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bcp-row { display: grid; grid-template-columns: 96px 1fr; gap: 6px 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.bcp-row:first-child { border-top: 0; }
.bcp-list { margin: 0; padding: 0 0 0 18px; line-height: 1.55; font-size: 14px; color: var(--text-2); }
.bcp-list li + li { margin-top: 4px; }

/* ----- витрина ----- */
.landing .hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 56px; align-items: start; padding-top: 64px; }
.landing .section-title { font-size: 32px; margin-bottom: 20px; }
.landing .features h3 { font-size: 17px; line-height: 1.3; }
.landing footer { padding: 8px 32px 48px; }
.landing #live-demo .scene-cell { width: 44px; height: 38px; font-size: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 1000px) { .landing .hero-grid { grid-template-columns: 1fr; } }
