/* =====================================================================
   OnAdd Production — «Аппаратная» (Control Room)
   Единая таблица стилей. Заменяет style.css + style_dark.css.

   Тема переключается атрибутом на <html>:  data-theme="light" | "dark"
   Больше НЕ нужно менять href у <link> — никакого мигания при загрузке.
   ===================================================================== */

/* ---------- 1. ШРИФТЫ ---------- */
@font-face {
  font-family: 'Cocogoose';
  src: url('../fonts/Cocogoose.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
  /* Всё, КРОМЕ цифр U+0030–0039: в Cocogoose они пустые.
     Цифры возьмутся из Jost, который идёт следующим. */
  unicode-range: U+0000-002F, U+003A-10FFFF;
}
@font-face {
  font-family: 'Jost';
  src: url('../fonts/Jost/Jost-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ---------- 2. ТОКЕНЫ ---------- */
:root {
  /* Цвет здесь НЕ объявляется — он целиком в onadd-themes.css.
     Раньше палитра дублировалась в двух файлах, и тема применялась
     через раз, в зависимости от того, какой файл загрузился позже. */

  /* Геометрия и типографика */
  --r-panel:   14px;
  --r-unit:    10px;
  --r-chip:    6px;

  --u:         8px;                    /* базовый шаг сетки */
  --rack-w:    1320px;


  --font-display: 'Cocogoose', 'Jost', system-ui, sans-serif;
  --font-body:    'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Mono', Menlo, monospace;

  --ease:      cubic-bezier(.2, .7, .3, 1);
  --dur:       .22s;

}

/* ---------- 3. СБРОС И БАЗА ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Атрибут hidden обязан скрывать элемент, даже если у него задан
   display в правилах ниже. Без этого hidden молча не работает. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* Матовая фактура панели — очень слабая, только чтобы фон не был «пластиковым» */
  background-image:
    repeating-linear-gradient(115deg,
      var(--bg-grain) 0 1px, transparent 1px 4px);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Текст выделяется свободно. Запрет ставим только на элементы управления. */
#navbar, .rack-label, .led-meter, .btn, .carousel-arrow,
.srv-item, .stat-btn { user-select: none; -webkit-user-select: none; }

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -.01em;
}

/* Фокус виден всегда — это не украшение, это доступность */
:focus-visible {
  outline: 2px solid var(--record);
  outline-offset: 2px;
  border-radius: var(--r-chip);
}

::selection { background: var(--record); color: #fff; }

.rack { width: 100%; max-width: var(--rack-w); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

/* ---------- 4. СИЛКСКРИН-ЛЕЙБЛ ----------
   Мелкая гравировка на панели прибора. Ключевая деталь стиля:
   все служебные подписи набраны так. */
.rack-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Таймкод / числовые данные — всегда моноширинные, табличные */
.tc, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ---------- 5. ЗАГОЛОВКИ СТРАНИЦ ---------- */
.page-head { padding: clamp(32px, 6vw, 64px) 0 24px; }
.page-head h1,
.main-title-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  letter-spacing: -.02em;
  color: var(--ink-1);
  /* Никаких градиентных заливок текста — гравировка, а не глянец */
  background: none;
  -webkit-text-fill-color: currentColor;
}
.page-head p, .main-desc { color: var(--ink-2); margin: 10px 0 0; max-width: 62ch; }

/* Красная риска слева от заголовка — метка дорожки */
.page-head h1::before {
  content: '';
  display: block;
  width: 48px; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--ember));
  margin-bottom: 16px;
  border-radius: 3px;
}

/* ---------- 6. ПАНЕЛИ (RACK UNIT) ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-1);
  position: relative;
}
/* Блик по верхней кромке — металл ловит свет */
.panel::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 1px;
  background: var(--edge-hi);
  border-radius: var(--r-panel) var(--r-panel) 0 0;
  pointer-events: none;
}
.panel__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge);
}
.panel__body { padding: 18px; }

/* ---------- 7. КНОПКИ ---------- */
.btn {
  --btn-bg: var(--panel-2);
  --btn-fg: var(--ink-1);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--panel-3); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn--rec { --btn-bg: var(--record); --btn-fg: #fff; border-color: transparent; }
.btn--rec:hover { --btn-bg: var(--record-dim); border-color: transparent; }
.btn--ghost { --btn-bg: transparent; }
.btn--sm { padding: 7px 12px; font-size: 11px; }
.btn--block { width: 100%; }

/* ---------- 8. СВЕТОДИОД ---------- */
.led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: var(--led-glow);
  flex: none;
}
.led--ok   { color: var(--signal); }
.led--warn { color: var(--warn); }
.led--bad  { color: var(--bad); }
.led--off  { color: var(--dead); box-shadow: none; }

/* Пульсация «REC» */
.led--rec { color: var(--record); animation: rec-pulse 1.8s var(--ease) infinite; }
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- 9. ★ ПОДПИСЬ СТИЛЯ: СЕГМЕНТНЫЙ ИЗМЕРИТЕЛЬ ★ ----------
   Индикатор уровня как на пульте. Сегменты гаснут слева направо
   по мере роста задержки. Это главный визуальный приём сайта. */
.led-meter {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 22px;
}
.led-meter__seg {
  width: 5px;
  background: var(--dead);
  border-radius: 1px;
  opacity: .25;
  transition: opacity .3s var(--ease), background .3s var(--ease);
}
/* Лесенка: сегменты растут по высоте, как настоящая шкала */
.led-meter__seg:nth-child(1) { height: 40%; }
.led-meter__seg:nth-child(2) { height: 52%; }
.led-meter__seg:nth-child(3) { height: 64%; }
.led-meter__seg:nth-child(4) { height: 76%; }
.led-meter__seg:nth-child(5) { height: 88%; }
.led-meter__seg:nth-child(6) { height: 100%; }

.led-meter__seg.is-lit { opacity: 1; box-shadow: var(--led-glow); }
.led-meter[data-grade="ok"]   .is-lit { background: var(--signal); color: var(--signal); }
.led-meter[data-grade="warn"] .is-lit { background: var(--warn);   color: var(--warn); }
.led-meter[data-grade="bad"]  .is-lit { background: var(--bad); color: var(--bad); }

/* Замер идёт — бегущий огонёк */
.led-meter.is-probing .led-meter__seg {
  animation: probe-sweep 1.1s var(--ease) infinite;
  background: var(--ink-3);
}
.led-meter.is-probing .led-meter__seg:nth-child(1) { animation-delay: 0s; }
.led-meter.is-probing .led-meter__seg:nth-child(2) { animation-delay: .08s; }
.led-meter.is-probing .led-meter__seg:nth-child(3) { animation-delay: .16s; }
.led-meter.is-probing .led-meter__seg:nth-child(4) { animation-delay: .24s; }
.led-meter.is-probing .led-meter__seg:nth-child(5) { animation-delay: .32s; }
.led-meter.is-probing .led-meter__seg:nth-child(6) { animation-delay: .40s; }
@keyframes probe-sweep { 0%, 70%, 100% { opacity: .2; } 35% { opacity: .9; } }

/* Значение задержки */
.ping-val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ping-good, .ping-val--ok   { color: var(--signal); }
.ping-medium, .ping-val--warn { color: var(--warn); }
.ping-bad, .ping-val--bad   { color: var(--bad); }
.ping-loading { color: var(--ink-3); }

/* ---------- 10. КАРТОЧКА УЗЛА (СТОЙКА) ---------- */
.node-list { display: flex; flex-direction: column; gap: 10px; }

.node {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid transparent;
  border-radius: var(--r-unit);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.node:hover { background: var(--panel-2); }
.node.is-active { border-left-color: var(--record); }
.node.is-auto   { border-left-color: var(--signal); }

.node__id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  min-width: 2.5ch;
}
.node__name { font-size: 16px; font-weight: 600; }
.node__desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.node__readout { display: flex; align-items: center; gap: 12px; }
.node__badge {
  font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-chip);
  background: var(--panel-3); color: var(--ink-2);
}
.node__badge--live { background: color-mix(in srgb, var(--signal) 18%, transparent); color: var(--signal); }

@media (max-width: 720px) {
  .node { grid-template-columns: auto 1fr; gap: 10px 14px; }
  .node__readout { grid-column: 1 / -1; justify-content: space-between; }
  .node > .btn { grid-column: 1 / -1; width: 100%; }
}

/* ---------- 11. ★ ДОРОЖКА ЭТАПОВ ДУБЛЯЖА ★ ----------
   Не декоративная нумерация — это реальный конвейер студии,
   поэтому последовательность здесь оправдана. */
/* Показываем ТОЛЬКО текущий этап.
   Полоса из семи ячеек на карточке не читалась: подписи ужимались
   до двух-трёх букв в столбик. */
.stage-now {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 8px 14px 8px 11px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--stage-color, var(--ink-3));
  border-radius: var(--r-unit);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
}
.stage-now__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--stage-color, var(--ink-3));
  flex: none;
}
.stage-now__step {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-3);
}

/* Цвет по смыслу этапа: от «ещё не вышла» до «на сайте» */
.stage-now[data-stage="0"] { --stage-color: var(--ink-3); }
.stage-now[data-stage="1"] { --stage-color: var(--ink-2); }
.stage-now[data-stage="2"] { --stage-color: var(--warn); }
.stage-now[data-stage="3"] { --stage-color: var(--accent); }
.stage-now[data-stage="4"] { --stage-color: var(--ember); }
.stage-now[data-stage="5"] { --stage-color: #8B5CF6; }
.stage-now[data-stage="6"] { --stage-color: var(--ok); }

/* Этап в работе — дышит */
.stage-now.is-active .stage-now__dot { animation: stage-pulse 2s var(--ease) infinite; }
@keyframes stage-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.82); }
}

/* Совместимость со старой разметкой этапов */
.stage-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--r-chip);
  background: var(--panel-3); color: var(--ink-2);
}
.stage-indicator::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 12. СЕТКА СЕРИЙ / РАСПИСАНИЕ ---------- */
.episodes-grid, .grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.episode-card {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.episode-card:hover { border-color: var(--ink-3); transform: translateY(-2px); }
.episode-thumbnail { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--panel-3); }
.episode-info { padding: 14px 16px 16px; }
.episode-info h4 {
  font-size: 12px; font-weight: 600;
  letter-spacing: .02em; color: var(--accent);
  margin-bottom: 4px;
}
.episode-info h3 { font-size: 16px; margin-bottom: 8px; }
.episode-info p { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; }

.countdown {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-chip);
  padding: 6px 10px;
  margin-top: 6px;
}
.countdown b { color: var(--ink-1); font-weight: 600; }

/* ---------- 13. ТАБЛИЦА ДОСТУПНОСТИ ---------- */
.matrix { margin-top: 48px; }
.matrix table { width: 100%; border-collapse: collapse; font-size: 14px; }
.matrix thead th {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
.matrix tbody td { padding: 11px 12px; border-bottom: 1px solid var(--edge); }
.matrix tbody tr:hover { background: var(--panel-2); }
.matrix .col-num { font-family: var(--font-mono); color: var(--ink-3); width: 1%; white-space: nowrap; }
.matrix .col-server { text-align: center; width: 1%; }
.status-ok { color: var(--signal); }
.status-no { color: var(--dead); }

.matrix__project {
  font-family: var(--font-display);
  font-size: 15px;
  padding: 16px 12px 8px;
  color: var(--ink-1);
}
.matrix-wrap { overflow-x: auto; }

/* ---------- 14. МОДАЛЬНЫЕ ОКНА ---------- */
.server-modal-overlay, .modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 7, 9, .72);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 9000;
}
.server-modal-overlay.active, .modal-overlay.active { display: flex; }

.server-modal, .modal {
  width: 100%; max-width: 520px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: modal-in .2s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--edge);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--ink-2); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--ink-1); }
.modal-list, .modal-body { padding: 14px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }

.srv-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--edge);
  border-left: 3px solid transparent;
  border-radius: var(--r-unit);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.srv-item:hover { background: var(--panel-2); }
.srv-item.active { border-left-color: var(--record); background: var(--panel-2); }
.srv-name { font-size: 14px; font-weight: 600; }
.srv-desc { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.srv-ping { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- 15. УВЕДОМЛЕНИЯ ---------- */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10000;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-unit);
  box-shadow: var(--shadow-2);
  font-size: 14px;
  max-width: 360px;
  animation: toast-in .24s var(--ease);
  pointer-events: auto;
}
.toast--ok   { border-left-color: var(--signal); }
.toast--warn { border-left-color: var(--warn); }
.toast--err  { border-left-color: var(--bad); }
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(16px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(16px); } }

@media (max-width: 560px) {
  .toast-stack { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

/* ---------- 16. СОСТОЯНИЯ: ПУСТО / ОШИБКА / СКЕЛЕТОН ---------- */
.state {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--edge);
  border-radius: var(--r-unit);
}
.state h3 { font-size: 17px; color: var(--ink-1); margin-bottom: 6px; }
.state p { font-size: 14px; margin: 0 auto; max-width: 44ch; }
.state .btn { margin-top: 16px; }

.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-chip);
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -135% 0; } }

/* ---------- 17. ФОРМЫ ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input, .fb-input, .fb-select, .time-input,
input[type="text"], input[type="number"], input[type="url"],
input[type="password"], input[type="date"], input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  color: var(--ink-1);
  font-size: 14px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input:focus, textarea:focus, select:focus, input:focus {
  border-color: var(--record);
  background: var(--panel);
}
textarea { resize: vertical; min-height: 84px; }
.time-input { text-align: center; font-family: var(--font-mono); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ---------- 18. НАВИГАЦИЯ ---------- */
#navbar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 14px;
  padding: 10px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--edge);
}
#logo { height: 34px; width: auto; cursor: pointer; }
#name {
  font-family: var(--font-display);
  font-size: 15px; text-transform: uppercase; letter-spacing: .08em;
  cursor: pointer;
}
#menuButton, #menuClose { width: 24px; cursor: pointer; }
#tele { height: 26px; cursor: pointer; }
[data-theme="dark"] #menuButton, [data-theme="dark"] #menuClose { filter: invert(1); }

#navbarOverlay {
  position: fixed; inset: 0;
  background: rgba(6, 7, 9, .6);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: none;
}
#navbarPopup {
  width: min(320px, 84vw); height: 100%;
  background: var(--panel);
  border-right: 1px solid var(--edge);
  padding: 20px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.navbar-tab, .navbar-tab-open {
  padding: 12px 14px;
  border-radius: var(--r-unit);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background var(--dur) var(--ease);
}
.navbar-tab:hover { background: var(--panel-2); }
.navbar-tab-open { background: var(--panel-2); border-left-color: var(--record); font-weight: 600; }

#navbarAd {
  margin-top: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  cursor: pointer;
}
#nav-tele { width: 30px; }
#nav-tele-text { font-size: 13px; color: var(--ink-2); margin: 0; }

/* ---------- 19. ПОДВАЛ ---------- */
.for-footer { margin-top: 80px; }
.footer {
  border-top: 1px solid var(--edge);
  background: var(--panel);
  padding: 36px 0 28px;
  text-align: center;
}
.footer-icon { height: 26px; display: inline-block; margin: 0 8px; opacity: .7; transition: opacity var(--dur) var(--ease); }
.footer-icon:hover { opacity: 1; }
[data-theme="dark"] .footer-icon { filter: invert(1) brightness(1.6); }
.wm { height: 22px; margin-top: 18px; opacity: .4; display: inline-block; }

/* ---------- 20. ПЛЕЕР И СТАТИСТИКА ---------- */
.player-shell {
  position: relative;
  max-width: 1000px;
  margin-inline: auto;
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-2);
}
.player-main, #player, #bigPlayer { width: 100%; aspect-ratio: 16/9; background: #000; }

.episode-stats-overlay {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-top: none;
  border-radius: 0 0 var(--r-panel) var(--r-panel);
  max-width: 1000px;
  margin-inline: auto;
}
.views-mini { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 14px; }
.views-mini svg { width: 17px; height: 17px; fill: currentColor; }
.reactions-mini { display: flex; gap: 8px; }
.reaction-btn-mini {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.reaction-btn-mini svg { width: 16px; height: 16px; fill: currentColor; }
.reaction-btn-mini:hover { background: var(--panel-3); color: var(--ink-1); }
.reaction-btn-mini.active { color: var(--record); border-color: var(--record); }
.reaction-btn-mini.glow { animation: btn-pop .4s var(--ease); }
@keyframes btn-pop { 50% { transform: scale(1.12); } }

/* Индикатор активного узла у плеера */
.signal-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-chip);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
}
.signal-chip:hover { border-color: var(--ink-3); }

/* ---------- 21. КАРУСЕЛЬ СЕРИЙ ---------- */
.carousel-wrapper { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; }
.carousel-wrapper .carousel-arrow { align-self: center; }
.carousel-wrapper--compact { margin-top: 20px; }
.carousel-track { flex: 1; display: flex; align-items: flex-start; overflow-x: hidden; scroll-behavior: smooth; }
.carousel-page {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* фиксировано: неполная страница
                                              больше не растягивает карточки */
  grid-auto-rows: min-content;
  align-content: start;
  gap: 14px;
}
/* Полоса под плеером — один ряд, высота по содержимому */
.carousel-wrapper--compact .carousel-page {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: min-content;
  align-content: start;
}
@media (max-width: 1000px) {
  .carousel-page { grid-template-columns: repeat(2, 1fr); }
  .carousel-wrapper--compact .carousel-page { grid-template-columns: repeat(3, 1fr); }
}
.carousel-arrow {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-2);
}
.carousel-arrow:hover { background: var(--panel-3); color: var(--ink-1); }

.episode-prev { cursor: pointer; }
.thumbnail-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--r-unit);
  overflow: hidden;
  border: 1px solid var(--edge);
  background: var(--panel-3);
}
.thumbnail-wrapper::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px transparent;
  transition: box-shadow var(--dur) var(--ease);
}
.episode-prev:hover .thumbnail-wrapper::after { box-shadow: inset 0 0 0 2px var(--record); }
.preview-image, .preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.preview { opacity: 0; transition: opacity var(--dur) var(--ease); }
.episode-prev:hover .preview { opacity: 1; }
.caption { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.episode-prev:hover .caption { color: var(--ink-1); }

.mobile-episode-menu { display: none; margin-top: 20px; }
.mobile-episodes-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.mobile-episodes-grid.active { display: grid; }
.mobile-episode-card {
  padding: 12px; text-align: center; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--edge);
  border-radius: var(--r-unit); cursor: pointer;
}
@media (max-width: 860px) {
  .carousel-wrapper { display: none; }
  .mobile-episode-menu { display: block; }
}

/* ---------- 22. ОПРОСНИК ---------- */
.survey-panel {
  position: absolute; top: 16px; right: 16px;
  width: 320px; max-height: calc(100% - 32px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-2);
  transform: translateX(115%);
  opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
  z-index: 200;
  text-align: left;
}
.survey-panel.active { transform: translateX(0); opacity: 1; pointer-events: auto; }
.survey-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--edge); }
.survey-header h3 { font-size: 15px; font-weight: 600; }
.survey-close { background: none; border: none; color: var(--ink-2); font-size: 20px; cursor: pointer; }
.survey-body { padding: 18px; overflow-y: auto; }
.survey-q { margin-bottom: 18px; }
.survey-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.star-rating { display: flex; gap: 5px; }
.star { font-size: 24px; color: var(--dead); cursor: pointer; transition: color .15s var(--ease), transform .15s var(--ease); }
.star:hover { transform: scale(1.15); }
.star.active { color: var(--warn); }
.fb-btn {
  width: 100%; padding: 12px;
  flex: none;
  background: var(--record); color: #fff;
  border: none; border-radius: var(--r-unit);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.fb-btn:hover { background: var(--record-dim); }
.fb-btn[disabled] { opacity: .5; cursor: not-allowed; }

@media (max-width: 768px) {
  .survey-panel { position: fixed; inset: auto 8px 8px 8px; width: auto; max-height: 70vh; transform: translateY(115%); }
  .survey-panel.active { transform: translateY(0); }
}

/* ---------- 23. КЛИППЕР ---------- */
.clipper-container {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;   /* без этого flex-элемент не даёт себя сжать,
                      и низ содержимого срезается */
}
.clipper-video-wrapper {
  width: 100%; aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--r-unit);
  overflow: hidden;
  border: 1px solid var(--edge);
  margin-bottom: 16px;
}
.clipper-video { width: 100%; height: 100%; }
.clipper-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  margin-bottom: 14px;
}
.time-group { flex: 0 0 88px; }
.time-group label { display: block; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); text-align: center; margin-bottom: 4px; }
.clip-duration-display { font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--record); }
.clip-info { font-size: 12px; color: var(--ink-3); margin: 10px 0 14px; }
.btn-download, .btn-copy, .btn-reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; margin: 4px;
  border-radius: var(--r-unit);
  border: 1px solid var(--edge);
  background: var(--panel-2);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.btn-download { background: var(--record); color: #fff; border-color: transparent; }

/* Ползунок noUiSlider */
.noUi-target { background: var(--panel-3); border: none; box-shadow: none; height: 5px; margin: 12px 6px 26px; }
.noUi-connect { background: var(--record) !important; }
.noUi-handle {
  background: var(--record) !important;
  border: 2px solid var(--panel) !important;
  border-radius: 50% !important;
  width: 17px !important; height: 17px !important;
  right: -8px !important; top: -7px !important;
  box-shadow: var(--shadow-1) !important;
  cursor: grab;
}
.noUi-handle::before, .noUi-handle::after { display: none !important; }

/* ---------- 24. ГАЛЕРЕЯ КЛИПОВ ---------- */
.clips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.clip-card {
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.clip-card:hover { border-color: var(--record); transform: translateY(-3px); }
.clip-thumb-wrapper { position: relative; aspect-ratio: 16/9; background: #000; cursor: pointer; }
.clip-thumb-video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.play-icon-overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: rgba(0,0,0,.55);
  border: 1.5px solid rgba(255,255,255,.85);
  border-radius: 50%;
  transition: background var(--dur) var(--ease);
}
.play-icon-overlay svg { width: 18px; height: 18px; fill: #fff; margin-left: 2px; }
.clip-card:hover .play-icon-overlay { background: var(--record); border-color: var(--record); }
.clip-meta { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.clip-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-date { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.clip-actions { margin-top: auto; display: flex; gap: 8px; }
.clip-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
  color: var(--ink-2);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.clip-btn svg { width: 15px; height: 15px; fill: currentColor; }
.clip-btn:hover { background: var(--panel-3); color: var(--ink-1); }
.clip-btn.primary { color: var(--record); border-color: var(--record); }
.clip-btn.primary:hover { background: var(--record); color: #fff; }

.viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(6,7,9,.94);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 9500; padding: 20px;
}
.viewer-overlay.active { display: flex; }
.viewer-box { position: relative; width: 100%; max-width: 1000px; background: #000; border-radius: var(--r-panel); overflow: hidden; border: 1px solid var(--edge); }
.viewer-video { width: 100%; max-height: 80vh; }
.viewer-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; z-index: 2; }

/* ---------- 25. ДОСТУПНОСТЬ ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--record); color: #fff;
  padding: 10px 16px; border-radius: var(--r-unit);
  z-index: 10001;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

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

/* ---------- 26. ШАПКА: КНОПКИ-ИКОНКИ ---------- */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-unit);
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink-1); }
#tele { color: var(--ink-2); display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-unit); }
#tele:hover { color: var(--accent); background: var(--panel-2); }

/* ---------- 27. ПОДВАЛ ---------- */
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  text-align: left;
}
.footer-note { font-size: 13px; color: var(--ink-3); margin: 10px 0 0; max-width: 42ch; line-height: 1.6; }
.footer-link {
  display: block;
  font-size: 14px;
  color: var(--ink-2);
  padding: 5px 0;
  transition: color var(--dur) var(--ease);
}
.footer-link:hover { color: var(--accent); }
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- 28. ГЛАВНАЯ: ВИТРИНА ---------- */
.hero { padding: clamp(24px, 5vw, 48px) 0 8px; }
.hero__eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  letter-spacing: -.02em;
  margin-bottom: 10px;
}
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); font-size: 14px; }

/* Полка проектов — постеры работают в полную величину */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.shelf__item { display: block; }
.shelf__art {
  aspect-ratio: 2/3;
  width: 100%;
  object-fit: cover;
  border-radius: var(--r-unit);
  border: 1px solid var(--edge);
  background: var(--panel-2);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.shelf__item:hover .shelf__art { transform: translateY(-4px); border-color: var(--accent); }
.shelf__name { margin-top: 10px; font-size: 14px; font-weight: 600; }
.shelf__sub { font-size: 12px; color: var(--ink-3); }

/* ---------- 29. КОМАНДА ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.member { text-align: center; }
.member__face {
  width: 100%; aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-panel);
  border: 1px solid var(--edge);
  background: var(--panel-2);
  transition: border-color var(--dur) var(--ease);
}
.member:hover .member__face { border-color: var(--accent); }
.member__name { margin-top: 10px; font-size: 15px; font-weight: 600; }
.member__role { font-size: 12px; color: var(--ink-3); }

.character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.character {
  display: flex; align-items: center; gap: 11px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-unit);
}
.character img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--panel-3); }
.character b { display: block; font-size: 14px; }
.character span { font-size: 11px; color: var(--ink-3); }



/* ---------- ЖИВОЙ ЗАМЕР УЗЛОВ ---------- */
/* Строка, которую сейчас опрашивают */
.node.is-measuring { border-left-color: var(--warn); }
.node.is-measuring .node__name::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--warn);
  animation: probe-blink .8s steps(2, start) infinite;
}
@keyframes probe-blink { 0%, 100% { opacity: 1 } 50% { opacity: .15 } }

/* Точки-замеры: заполняются по одной, видно прогресс */
.samples { display: flex; gap: 4px; align-items: center; }
.samples__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dead);
  opacity: .35;
  transition: background .2s var(--ease), opacity .2s var(--ease), transform .2s var(--ease);
}
.samples__dot.is-done { opacity: 1; transform: scale(1.15); }
.samples__dot.is-ok   { background: var(--ok); }
.samples__dot.is-warn { background: var(--warn); }
.samples__dot.is-bad  { background: var(--bad); }

/* Значение подскакивает при обновлении */
.ping-val.is-fresh { animation: val-pop .3s var(--ease); }
@keyframes val-pop { 50% { transform: translateY(-2px); } }

/* Полоса скорости под именем узла */
.speedbar {
  height: 3px;
  border-radius: 2px;
  background: var(--panel-3);
  overflow: hidden;
  margin-top: 7px;
}
.speedbar__fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ok), var(--ember));
  transition: width .45s var(--ease), background .3s var(--ease);
}
.speedbar__fill[data-grade="warn"] { background: linear-gradient(90deg, var(--warn), var(--ember)); }
.speedbar__fill[data-grade="bad"]  { background: var(--bad); }
