/* ============================================================
   Нейросовет — премиальный дизайн: матовое стекло + синяя ось
   Светлая и тёмная темы. Фирменный акцент — свечение #0a84ff.
   ============================================================ */

:root {
  --bg-0: #e9eff7;
  --bg-1: #f6f9fd;
  --bg-glow: rgba(10, 132, 255, 0.10);

  --surface: rgba(255, 255, 255, 0.62);
  --surface-2: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --border: rgba(16, 42, 82, 0.10);
  --border-strong: rgba(16, 42, 82, 0.16);
  --inset-hl: rgba(255, 255, 255, 0.7);

  --text: #0b1a2c;
  --text-2: #3d4d63;
  --hint: #72839a;

  --accent: #0a84ff;
  --accent-2: #38a6ff;
  --accent-deep: #0a6ad6;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --on-accent: #ffffff;

  /* Фирменный градиент (Gemini-style): синий → фиолетовый → розовый.
     Используется ТОЧЕЧНО — только на активных элементах (думающий орб/обводка,
     главная кнопка), остальное остаётся нейтральным. */
  --grad-1: #4f86f7;
  --grad-2: #9a6cff;
  --grad-3: #ff86c8;
  --grad-gemini: linear-gradient(120deg, var(--grad-1), var(--grad-2) 48%, var(--grad-3));
  --grad-soft: rgba(120, 110, 255, 0.16);

  --logo-bar: #9fb4d4;

  --consensus: #149a55;
  --consensus-bg: rgba(20, 154, 85, 0.12);
  --disagree: #e08326;
  --disagree-bg: rgba(224, 131, 38, 0.13);
  --single: #7a5cf0;
  --single-bg: rgba(122, 92, 240, 0.12);
  --danger: #e0494c;
  --danger-bg: rgba(224, 73, 76, 0.12);

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --maxw: 680px;

  --shadow: 0 1px 2px rgba(16, 42, 80, 0.05), 0 14px 36px rgba(16, 42, 80, 0.10);
  --shadow-sm: 0 2px 12px rgba(16, 42, 80, 0.07);
  --glow: 0 6px 24px rgba(10, 132, 255, 0.40);
  --glow-strong: 0 0 32px rgba(10, 132, 255, 0.55);
  --blur: blur(22px) saturate(165%);
}

html[data-scheme="dark"] {
  --bg-0: #060a11;
  --bg-1: #0e151f;
  --bg-glow: rgba(42, 157, 255, 0.16);

  --surface: rgba(148, 173, 209, 0.07);
  --surface-2: rgba(148, 173, 209, 0.11);
  --surface-solid: #121a26;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --inset-hl: rgba(255, 255, 255, 0.10);

  --text: #eaf1fb;
  --text-2: #b3c1d4;
  --hint: #8294ab;

  --accent: #2a9dff;
  --accent-2: #5bb4ff;
  --accent-deep: #1f8fff;
  --accent-soft: rgba(42, 157, 255, 0.16);

  --grad-1: #5b93ff;
  --grad-2: #a87dff;
  --grad-3: #ff96cf;
  --grad-soft: rgba(140, 130, 255, 0.24);

  --logo-bar: #cfe0f5;

  --consensus: #2cc070;
  --consensus-bg: rgba(44, 192, 112, 0.14);
  --disagree: #f0993f;
  --disagree-bg: rgba(240, 153, 63, 0.15);
  --single: #9d83ff;
  --single-bg: rgba(157, 131, 255, 0.16);
  --danger: #ff6062;
  --danger-bg: rgba(255, 96, 98, 0.15);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 2px 14px rgba(0, 0, 0, 0.4);
  --glow: 0 6px 28px rgba(42, 157, 255, 0.5);
  --glow-strong: 0 0 36px rgba(42, 157, 255, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background: var(--bg-1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-glow) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px calc(120px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.screen { animation: fade .28s cubic-bezier(.2,.7,.3,1); position: relative; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Стеклянные поверхности ---------- */
.card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--inset-hl);
  padding: 18px;
  margin-bottom: 14px;
}

/* ---------- Типографика и шапки ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 36px;
}
.top .spacer, .top .title { flex: 1; }
.title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.title.sm { font-size: 18px; }

/* ---------- Фирменный знак (hero) ---------- */
/* Декоративный блок: не должен перехватывать тап по кнопке «История»,
   которая абсолютно спозиционирована и визуально лежит в его правом верхнем углу. */
.brand { text-align: center; padding: 22px 0 18px; position: relative; pointer-events: none; }
.brand-mark {
  width: 232px; max-width: 78%; margin: 0 auto 14px;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 70%; height: 36px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--bg-glow), transparent 75%);
  filter: blur(8px); z-index: -1;
}
.mark-svg { width: 100%; height: auto; display: block; }
.brand-name {
  font-size: 30px; font-weight: 750; letter-spacing: -0.03em; margin: 0;
  background: linear-gradient(110deg, var(--text) 52%, var(--grad-2) 88%, var(--grad-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tagline {
  color: var(--text-2); font-size: 15px; line-height: 1.45;
  max-width: 30ch; margin: 8px auto 0;
}
.top-right {
  position: absolute; top: 4px; right: 0;
  z-index: 2; pointer-events: auto;
}

/* ---------- Кнопки ---------- */
.primary-btn {
  width: 100%; border: 0; cursor: pointer;
  border-radius: var(--radius-sm);
  background: var(--grad-gemini);
  color: var(--on-accent);
  font-size: 16px; font-weight: 650; letter-spacing: -0.01em;
  padding: 16px 18px;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform .08s ease, box-shadow .2s ease, filter .2s ease;
}
.primary-btn:active { transform: translateY(1px) scale(.995); filter: brightness(1.04); }
.primary-btn[disabled] { opacity: .55; cursor: default; box-shadow: none; }

.ghost-btn {
  border: 0; background: transparent; color: var(--accent);
  font-size: 15px; font-weight: 550; padding: 8px 10px; cursor: pointer;
  border-radius: 10px; white-space: nowrap; transition: background .15s;
}
.ghost-btn:active { background: var(--accent-soft); }
.link-btn { border: 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 550; cursor: pointer; padding: 4px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--surface);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--text-2); font-size: 13.5px; font-weight: 550;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.fallback-run { margin-top: 6px; }

/* ---------- Поле ввода ---------- */
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--hint); margin: 0 2px 9px; text-transform: uppercase; letter-spacing: .05em; }
.question {
  width: 100%; resize: vertical; min-height: 116px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  color: var(--text); padding: 14px; font: inherit; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
html[data-scheme="dark"] .question { background: rgba(255,255,255,0.04); }
.question::placeholder { color: var(--hint); }
.question:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Панель ролей / модель ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-title { font-size: 12.5px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; }

.experts-toggles { display: flex; flex-direction: column; gap: 8px; }
.expert-toggle {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 12px 14px; cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s;
}
.expert-toggle:active { border-color: var(--accent); }
.expert-toggle input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.expert-toggle .et-name { font-weight: 600; font-size: 15px; flex: 1; }
.expert-toggle .et-tag { color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; }

.segmented { display: flex; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); padding: 5px; border-radius: var(--radius-sm); margin-top: 12px; }

/* ---------- Тумблер-переключатель ---------- */
.switch-row {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 12px 14px; cursor: pointer; user-select: none;
}
.switch-row .sr-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch-row .sr-name { font-weight: 600; font-size: 15px; }
.switch-row .sr-hint { color: var(--hint); font-size: 12px; line-height: 1.35; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui {
  flex: none; width: 46px; height: 28px; border-radius: 999px;
  background: var(--border-strong); position: relative; transition: background .2s;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.switch-row input:checked ~ .switch-ui { background: var(--accent); }
.switch-row input:checked ~ .switch-ui::after { transform: translateX(18px); }
.switch-row input:focus-visible ~ .switch-ui { box-shadow: 0 0 0 3px var(--accent-soft); }
.seg {
  flex: 1; border: 0; background: transparent; color: var(--text-2);
  padding: 11px 8px; border-radius: var(--radius-xs); font-size: 14px; cursor: pointer; font-weight: 550;
  transition: all .18s;
}
.seg.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 650; }
html[data-scheme="dark"] .seg.active { background: rgba(255,255,255,0.10); }

/* ---------- Прогресс ---------- */
.rounds { display: flex; flex-direction: column; gap: 20px; }
.round-block .round-title { font-size: 12.5px; font-weight: 600; color: var(--hint); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; }
.progress-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.pcard {
  position: relative;
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  padding: 14px 15px; display: flex; align-items: center; gap: 12px; min-height: 60px;
  transition: border-color .3s ease, box-shadow .4s ease, opacity .3s ease; opacity: .58;
}
.pcard .pc-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.pcard .pc-state { font-size: 11px; color: var(--hint); margin-top: 2px; }
.progress-note { color: var(--text-2); font-size: 14px; margin-top: 22px; text-align: center; }
.pc-legend { color: var(--hint); font-size: 12px; text-align: center; margin: 14px 0 0; }

/* ---- Орб-статус: один элемент .dot, все состояния — псевдоэлементами ---- */
.pcard .dot {
  position: relative; width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--hint) 28%, transparent); transition: background .3s ease, box-shadow .3s ease;
}
/* думает: орб залит фирменным градиентом и мягко «дышит» (масштаб + свечение) */
.pcard.thinking .dot { background: var(--grad-gemini); animation: orbBreathe var(--breathe, 3.4s) ease-in-out infinite; animation-delay: calc(var(--i, 0) * .22s); }
/* готов: чистая галочка в спокойном тоне (НЕ яркая зелёная точка) */
.pcard.done .dot { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--consensus) 50%, var(--hint)); }
.pcard.done .dot::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 4px; height: 8px;
  border: solid color-mix(in srgb, var(--consensus) 62%, var(--text-2)); border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
}
/* ошибка: приглушённый знак, без кричащего красного */
.pcard.error .dot { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 42%, var(--hint)); }
.pcard.error .dot::after {
  content: "!"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; line-height: 1; color: color-mix(in srgb, var(--danger) 62%, var(--hint));
}

/* думающая карточка: воздух, мягкая градиентная рамка и спокойное дыхание свечения.
   Сдвиг по фазе через --i (animation-delay) — карточки дышат НЕ в унисон. Без вращения. */
.pcard.thinking { --breathe: 3.4s; opacity: 1; border-color: color-mix(in srgb, var(--grad-2) 28%, var(--border));
  animation: cardGlow var(--breathe) ease-in-out infinite; animation-delay: calc(var(--i, 0) * .22s); }
.pcard.done, .pcard.error { opacity: 1; }
/* idle/streaming идут вместе с thinking — задают темп дыхания (объявлены ПОСЛЕ thinking). */
.pcard.idle { --breathe: 3.6s; }
.pcard.streaming { --breathe: 2.3s; }

/* Статическая градиентная обводка, анимируется только прозрачность (дыхание). */
.pcard.thinking::after, .verdict-strip.thinking::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: var(--grad-gemini);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude; pointer-events: none;
  opacity: .5; animation: borderBreathe var(--breathe, 3.4s) ease-in-out infinite; animation-delay: calc(var(--i, 0) * .22s);
}
@keyframes orbBreathe {
  0%, 100% { transform: scale(.82); box-shadow: 0 0 6px 1px var(--grad-soft); }
  50%      { transform: scale(1.04); box-shadow: 0 0 14px 3px var(--grad-soft); }
}
@keyframes cardGlow {
  0%, 100% { box-shadow: 0 4px 18px -10px var(--grad-soft); }
  50%      { box-shadow: 0 10px 32px -8px var(--grad-soft); }
}
@keyframes borderBreathe { 0%, 100% { opacity: .26; } 50% { opacity: .82; } }

/* Полоса промежуточного арбитра между раундами — тот же язык, компактный орб */
.verdict-strip {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  margin: 2px 0 2px 4px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); font-size: 12.5px; color: var(--hint);
  transition: color .3s ease, border-color .3s ease;
}
.verdict-strip .vs-dot { position: relative; width: 13px; height: 13px; border-radius: 50%; flex: none;
  background: color-mix(in srgb, var(--hint) 28%, transparent); transition: background .3s ease, box-shadow .3s ease; }
.verdict-strip.thinking { --breathe: 3.4s; color: var(--text-2); border-color: color-mix(in srgb, var(--grad-2) 26%, var(--border)); }
.verdict-strip.idle { --breathe: 3.6s; }
.verdict-strip.streaming { --breathe: 2.3s; }
.verdict-strip.thinking .vs-dot { background: var(--grad-gemini); animation: orbBreathe var(--breathe) ease-in-out infinite; }
.verdict-strip.done { color: var(--text-2); }
.verdict-strip.done .vs-dot { background: transparent; box-shadow: inset 0 0 0 1.4px color-mix(in srgb, var(--consensus) 50%, var(--hint)); }
.verdict-strip.done .vs-dot::after {
  content: ""; position: absolute; left: 4.6px; top: 2px; width: 3.4px; height: 6.6px;
  border: solid color-mix(in srgb, var(--consensus) 62%, var(--text-2)); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.verdict-strip.error .vs-dot { background: transparent; box-shadow: inset 0 0 0 1.4px color-mix(in srgb, var(--danger) 42%, var(--hint)); }
.verdict-strip.error .vs-dot::after {
  content: "!"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; line-height: 1; color: color-mix(in srgb, var(--danger) 62%, var(--hint));
}
.verdict-strip .vs-text { line-height: 1.35; }

/* ---------- Результат ---------- */
.result-head {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--inset-hl);
  padding: 20px; margin-bottom: 18px;
}
.bottom-line { font-size: 18px; font-weight: 650; margin: 0 0 16px; line-height: 1.4; letter-spacing: -0.01em; }
.gauge-row {
  display: flex; align-items: center; gap: 18px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.gauge { position: relative; width: 104px; height: 104px; flex: none; }
.gauge svg { transform: rotate(-90deg); filter: drop-shadow(0 0 13px color-mix(in srgb, var(--gcol) 45%, transparent)); }
.gauge .gv-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.gauge .gv { font-weight: 750; font-size: 34px; letter-spacing: -0.03em; color: var(--gcol); }
.gauge .gv-max { font-size: 11px; font-weight: 650; color: var(--hint); margin-top: 3px; letter-spacing: 0; }
/* Слово уровня в gauge (длиннее числа — мельче, чтобы помещалось в круг) */
.gauge .gv.gv-lvl { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; padding: 0 8px; text-align: center; }
.gauge-meta { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.gauge-label { font-size: 13px; color: var(--hint); line-height: 1.35; }
.gauge-chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.level-chip {
  display: inline-block; font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
  text-transform: uppercase; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px;
}
.conv-badge {
  display: inline-block; font-size: 12px; font-weight: 650; padding: 4px 11px; border-radius: 999px;
  color: var(--cc); background: color-mix(in srgb, var(--cc) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--cc) 30%, transparent);
}

.map-section { margin-bottom: 20px; }
.map-section h3 { font-size: 13px; margin: 0 0 11px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 650; }
.map-section h3 .swatch { width: 9px; height: 9px; border-radius: 3px; }
.map-item { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px; font-size: 14.5px; border: 1px solid transparent; }
.map-item.c { background: var(--consensus-bg); border-color: color-mix(in srgb, var(--consensus) 22%, transparent); }
.map-item.d { background: var(--disagree-bg); border-color: color-mix(in srgb, var(--disagree) 22%, transparent); }
.map-item.s { background: var(--single-bg); border-color: color-mix(in srgb, var(--single) 22%, transparent); }
.map-item .mi-point { font-weight: 600; margin-bottom: 5px; line-height: 1.4; }
.map-item .mi-meta { font-size: 12.5px; color: var(--hint); }
.map-item .mi-sides { margin-top: 7px; font-size: 13.5px; }
.map-item .mi-sides span { display: block; padding: 3px 0; }
.empty-note { color: var(--hint); font-size: 13px; font-style: italic; padding: 2px 2px 4px; }

/* Ход обсуждения: промежуточные срезы арбитра */
.verdict-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 9px;
}
.verdict-card .vc-head { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--hint); margin-bottom: 6px; }
.verdict-card .vc-verdict { font-size: 14.5px; font-weight: 600; line-height: 1.42; }
.verdict-card .vc-label { font-size: 12px; color: var(--hint); margin: 9px 0 2px; }
.verdict-card .vc-devil {
  margin-top: 10px; padding: 9px 11px; font-size: 13.5px; line-height: 1.45;
  background: var(--danger-bg); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 10px;
}

/* ---------- Канонический результат (§4.5) ---------- */
.task-chip {
  display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: .03em;
  text-transform: uppercase; color: var(--grad-2);
  background: linear-gradient(135deg, var(--grad-soft), color-mix(in srgb, var(--grad-soft) 25%, transparent));
  border: 1px solid color-mix(in srgb, var(--grad-2) 22%, transparent);
  border-radius: 999px; padding: 4px 11px; margin-bottom: 12px;
}

.synth-block {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.synth-block h3 { font-size: 12.5px; margin: 0 0 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 650; }
.synth-answer { font-size: 15px; line-height: 1.5; margin: 0; }
.synth-strong { font-size: 13px; color: var(--text-2); margin-top: 11px; line-height: 1.45; }
.synth-strong b { color: var(--hint); font-weight: 600; }

/* Рейтинг позиций */
.rank-list { display: flex; flex-direction: column; gap: 9px; }
.rank-row { display: flex; gap: 11px; align-items: flex-start; }
.rank-num {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); margin-top: 1px;
}
.rank-main { flex: 1; min-width: 0; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rank-role { font-weight: 600; font-size: 14.5px; }
.rank-score { font-size: 12.5px; font-weight: 650; color: var(--hint); font-variant-numeric: tabular-nums; flex: none; }
.rank-bar { height: 5px; border-radius: 3px; background: var(--surface-2); margin: 6px 0 5px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.rank-why { font-size: 12.5px; color: var(--hint); line-height: 1.4; }

/* Сценарии прогноза */
.scn-grid { display: flex; flex-direction: column; gap: 9px; }
.scn-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }
.scn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.scn-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.scn-name { font-weight: 650; font-size: 14px; }
.scn-p { margin-left: auto; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.scn-row { font-size: 13px; line-height: 1.45; margin-top: 4px; color: var(--text-2); }
.scn-row b { color: var(--hint); font-weight: 600; }

/* Сравнительная матрица */
.matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { padding: 9px 8px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.matrix thead th { font-size: 11px; color: var(--hint); font-weight: 650; text-transform: uppercase; letter-spacing: .02em; background: var(--surface-2); }
table.matrix tbody tr:last-child td { border-bottom: 0; }
table.matrix .mx-role { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--surface-solid); }
.mx-mark { font-size: 15px; font-variant-numeric: tabular-nums; }
.mark-full { color: var(--consensus); }
.mark-half { color: var(--disagree); }
.mark-low { color: var(--hint); }
.mark-none { color: var(--danger); }
.mx-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.mx-trend { font-weight: 700; }
.mx-legend { font-size: 11.5px; color: var(--hint); margin-top: 8px; padding: 0 2px; }

.mi-caveat { font-size: 12.5px; color: var(--disagree); margin-top: 6px; line-height: 1.4; }
.mi-kind { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--hint); background: var(--surface-2); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }

/* Дельта-анализ динамики */
.delta-list { display: flex; flex-direction: column; gap: 8px; }
.delta-row { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.delta-mark { font-size: 15px; line-height: 1.3; flex: none; }
.delta-main { flex: 1; min-width: 0; }
.delta-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.delta-role { font-weight: 600; font-size: 14px; }
.delta-type { font-size: 11.5px; color: var(--hint); }
.delta-score { margin-left: auto; font-size: 12.5px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.delta-change { font-size: 13px; color: var(--text-2); line-height: 1.45; margin-top: 4px; }

/* Дьявольский адвокат (финал) */
.devil-section .devil-list { margin: 0; padding-left: 18px; }
.devil-section .devil-list li {
  margin-bottom: 7px; line-height: 1.45; font-size: 14px;
}

/* Проверяемые факты */
.claims-list { display: flex; flex-direction: column; gap: 7px; }
.claim-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.claim-text { font-size: 14px; line-height: 1.4; margin-bottom: 4px; }
.claim-src { font-size: 12px; color: var(--consensus); word-break: break-word; }
.claim-src.unverified { color: var(--danger); font-weight: 600; }

.ec-summary { font-size: 13.5px; color: var(--text-2); line-height: 1.45; margin: 4px 0 6px; }

/* ---------- График траектории ---------- */
.trajectory {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--inset-hl);
  padding: 20px; margin-bottom: 20px;
}
.trajectory h3 { font-size: 13px; margin: 0 0 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 650; }
.traj-legend { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.traj-legend .lg {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 11px 4px 9px;
}
.traj-legend .lg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Карточки экспертов ---------- */
.expert-cards { display: flex; flex-direction: column; gap: 8px; }
.ecard {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color .2s;
}
.ecard[open] { border-color: var(--border-strong); }
.ecard summary {
  list-style: none; cursor: pointer; padding: 15px 16px;
  display: flex; align-items: center; gap: 11px;
}
.ecard summary::-webkit-details-marker { display: none; }
.ecard .ec-name { font-weight: 600; font-size: 15px; flex: 1; }
.ecard .ec-conf { font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ecard .ec-chev { color: var(--hint); transition: transform .18s; font-size: 18px; }
.ecard[open] .ec-chev { transform: rotate(90deg); }
.ec-body { padding: 0 16px 16px; }
.ec-round { border-top: 1px solid var(--border); padding: 12px 0; }
.ec-round .ecr-h { font-size: 11.5px; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; display: flex; justify-content: space-between; font-weight: 600; }
.ec-stance { font-weight: 600; margin: 2px 0 8px; line-height: 1.4; }
.ec-list { margin: 8px 0; padding-left: 18px; }
.ec-list li { margin-bottom: 4px; }
.ec-field { font-size: 13.5px; margin-top: 7px; line-height: 1.45; }
.ec-field b { color: var(--hint); font-weight: 600; }
.ec-sources { font-size: 12.5px; color: var(--hint); line-height: 1.4; }
.ec-sources b { color: var(--text-2); }
.ec-risk { background: var(--disagree-bg); border: 1px solid color-mix(in srgb, var(--disagree) 20%, transparent); border-radius: 10px; padding: 9px 11px; margin-top: 9px; font-size: 13.5px; line-height: 1.45; }
.ecard.failed summary { color: var(--danger); }

/* ---------- Ворота (ручной режим) ---------- */
.gate-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; padding: 14px 0 4px; margin-top: 14px;
  background: linear-gradient(180deg, transparent, var(--bg-1) 38%);
}
.gate-actions .primary-btn, .gate-actions .ghost-btn-lg { flex: 1; }
.ghost-btn-lg {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; padding: 15px 16px;
  cursor: pointer; transition: transform .08s ease, background .15s ease;
}
.ghost-btn-lg:active { transform: translateY(1px) scale(.995); background: var(--accent-soft); }

.gate-highlight {
  background: var(--disagree-bg); border: 1px solid color-mix(in srgb, var(--disagree) 22%, transparent);
  border-radius: var(--radius-sm); padding: 12px 15px; margin-bottom: 14px; font-size: 13.5px;
}
.gate-highlight .gh-spread { font-weight: 600; }
.gate-highlight .gh-label { font-size: 12px; color: var(--hint); margin: 8px 0 2px; }

.gate-cards { display: flex; flex-direction: column; gap: 9px; }
.gate-card {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px;
  transition: opacity .15s ease, border-color .15s ease;
}
.gate-card.accepted { border-color: color-mix(in srgb, var(--consensus) 45%, transparent); }
.gate-card.excluded { opacity: .55; }
.gate-card.requerying { opacity: .6; pointer-events: none; }
.gx-head { display: flex; align-items: center; gap: 10px; }
.gx-name { font-weight: 600; font-size: 15px; flex: 1; }
.gx-conf { font-size: 13px; color: var(--hint); font-weight: 600; font-variant-numeric: tabular-nums; }
.gx-conf.err { color: var(--danger); }
.gx-badge { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; border-radius: 999px; padding: 2px 8px; }
.gx-badge.ok { background: var(--consensus-bg); color: var(--consensus); }
.gx-badge.ex { background: var(--danger-bg); color: var(--danger); }
.gx-details { margin-top: 9px; }
.gx-details summary {
  list-style: none; cursor: pointer; font-size: 14px; line-height: 1.4; color: var(--text-2);
  padding: 9px 11px; background: var(--surface-2); border-radius: var(--radius-xs);
}
.gx-details summary::-webkit-details-marker { display: none; }
.gx-details[open] summary { font-weight: 600; color: var(--text); }
.gx-full { padding: 11px 2px 2px; }
.gx-actions { display: flex; gap: 7px; margin-top: 11px; }
.gx-act {
  flex: 1; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text-2);
  border-radius: var(--radius-xs); font-size: 13px; font-weight: 550; padding: 9px 6px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.gx-act:active { border-color: var(--accent); color: var(--accent); }
.gx-act[disabled] { opacity: .45; cursor: default; }
.gate-q { font-size: 14.5px; line-height: 1.45; color: var(--text-2); margin: 16px 2px 2px; }

/* ---------- История ---------- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.hitem {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 15px 16px; cursor: pointer; transition: border-color .15s, transform .08s;
}
.hitem:active { transform: scale(.995); border-color: var(--accent); }
.hitem .hi-q { font-weight: 600; font-size: 15px; margin-bottom: 5px; line-height: 1.35; padding-right: 28px; }
.hitem .hi-meta { font-size: 12.5px; color: var(--hint); display: flex; gap: 12px; }
.hitem .hi-del { float: right; color: var(--hint); margin-top: -4px; }

/* ---------- Редактор ролей ---------- */
.roles-editor { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.role-card {
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
}
.role-card .rc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.role-card .rc-name { flex: 1; font-weight: 650; font-size: 15px; border: 0; background: transparent; color: var(--text); padding: 2px 0; }
.role-card .rc-name:focus { outline: none; border-bottom: 1px solid var(--accent); }
.role-card textarea { width: 100%; min-height: 86px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); padding: 11px; font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical; }
html[data-scheme="dark"] .role-card textarea { background: rgba(255,255,255,0.04); }
.role-card textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-card .rc-row { display: flex; align-items: center; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--hint); flex-wrap: wrap; }
.role-card .rc-row label { display: flex; align-items: center; gap: 7px; }
.role-card .rc-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.role-card .rc-del { margin-left: auto; color: var(--danger); background: transparent; border: 0; cursor: pointer; font-size: 13px; font-weight: 550; }
.role-card input[type="range"] { accent-color: var(--accent); flex: 1; min-width: 90px; }
.role-card .rc-temp { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-2); min-width: 2.2ch; text-align: right; }

/* Совет: мультимодельный реестр */
.role-card.role-off { opacity: .6; }
.role-card .rc-name { display: flex; align-items: center; gap: 8px; }
.rc-culture { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em;
  color: var(--grad-2); background: var(--grad-soft); border-radius: 999px; padding: 2px 8px; }
.rc-toggle { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.rc-nokey { margin-left: auto; font-size: 11.5px; color: var(--hint); font-style: italic; }
.role-card .rc-row select { border-radius: 9px; border: 1px solid var(--border); background: var(--surface-solid);
  color: var(--text); padding: 6px 9px; font: inherit; font-size: 13px; }
html[data-scheme="dark"] .role-card .rc-row select { background: rgba(255,255,255,0.04); }
/* Статус ключа провайдера (активная проверка) */
.rc-check { margin: 0 0 12px; }
.role-card .rc-statusrow { margin-top: 2px; font-size: 11.5px; }
.rc-status { font-size: 11.5px; color: var(--hint); }
.rc-status.ok { color: var(--ok, #1a9d56); font-weight: 650; }
.rc-status.checking { color: var(--hint); font-style: italic; }
.role-card .rc-statusrow .rc-nokey { margin-left: 0; font-style: normal; color: var(--danger); }
.role-card .rc-models { margin-top: 8px; font-size: 12px; color: var(--hint); }
.expert-toggle.et-off { opacity: .55; }

/* База знаний */
.kb-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; padding: 15px 16px; cursor: pointer;
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--inset-hl);
  color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s, transform .1s;
}
.kb-btn:active { transform: scale(.99); border-color: var(--border-strong); }
.kb-btn .kb-btn-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.kb-btn .kb-btn-ic { font-size: 19px; line-height: 1; flex: none; }
.kb-btn .kb-btn-label { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.kb-btn .kb-btn-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.kb-btn .kb-btn-count { font-size: 12.5px; color: var(--grad-2); font-weight: 650;
  background: var(--grad-soft); border-radius: 999px; padding: 2px 9px; }
.kb-btn .kb-btn-count:empty { display: none; }
.kb-btn .kb-btn-chev { color: var(--hint); font-size: 20px; line-height: 1; }
.kb-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.kb-item { position: relative; background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 40px 13px 15px; }
.kb-item .kb-name { font-weight: 600; font-size: 14.5px; line-height: 1.35; word-break: break-word; }
.kb-item .kb-del { position: absolute; top: 8px; right: 8px; color: var(--hint); background: transparent; border: 0; cursor: pointer; font-size: 15px; padding: 4px 8px; }
#kb-paste-save { margin-top: 10px; }

/* ---------- Тосты ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg-1);
  padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 550; z-index: 50;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: toastIn .26s cubic-bezier(.2,.7,.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 380px) {
  .progress-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  /* Без движения: дыхание гаснет, орб и градиентная рамка показываются статично
     ровной прозрачностью; галочка/знак статичны. Смысл несёт текст-таймер
     (он обновляется тикером — это не анимация). */
  .pcard.thinking::after, .verdict-strip.thinking::after { opacity: .6 !important; }
  .pcard.thinking .dot, .verdict-strip.thinking .vs-dot { transform: none !important; box-shadow: 0 0 8px 1px var(--grad-soft); }
}
