/* ============================================================================
   Тема «КБП//SLAY» — публичная часть сайта премии.

   Источник: макет issue #3 (`docs/design/slay-mockup.html`), экраны
   «стыковка» и «комната». Палитра, сетка, рамки-блоки, ASCII-корабль,
   корона лидера и живое табло перенесены оттуда.

   Всё скоупится `body.tui`: админка этот файл не грузит и живёт на app.css.
   Префикс классов `tui-`, чтобы не пересекаться с app.css.

   Правила файла:
   * анимируются только transform и opacity;
   * `prefers-reduced-motion` глушит всё;
   * без JS страница читаема: секции номинаций видны, вкладки — якоря.
   ========================================================================= */

/* JetBrains Mono лежит в static/fonts: CSP `font-src 'self'` не пускает CDN.
   Лицензия (SIL OFL 1.1) — static/fonts/OFL.txt. */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-700-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-800-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Сабсет символов для ASCII-графики: рамки, блоки, стрелки, звёзды, корона.
   Без него `█ ░ ═ ║ ▸ ◈ ★ ♛ ◆ ⏎ ← → ✓` брались из пропорционального
   fallback и ломали моно-сетку корабля, короны и гейджей (D-13).
   Файл получен через Google Fonts CSS API с параметром `text=` (сабсет только
   этих глифов), лицензия та же — static/fonts/OFL.txt. */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-symbols-normal.woff2") format("woff2");
  unicode-range: U+2014, U+2026, U+2190-2193, U+2212, U+2298, U+23ce, U+2502,
    U+251c, U+2524, U+2550-2551, U+2554, U+2557, U+255a, U+255d, U+2581-2588,
    U+2591, U+2593, U+25b8, U+25c6, U+25c8, U+25cb, U+25cf-25d0, U+2605, U+265b,
    U+2713, U+2716, U+271a, U+2726, U+276f;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-symbols-normal.woff2") format("woff2");
  unicode-range: U+2014, U+2026, U+2190-2193, U+2212, U+2298, U+23ce, U+2502,
    U+251c, U+2524, U+2550-2551, U+2554, U+2557, U+255a, U+255d, U+2581-2588,
    U+2591, U+2593, U+25b8, U+25c6, U+25c8, U+25cb, U+25cf-25d0, U+2605, U+265b,
    U+2713, U+2716, U+271a, U+2726, U+276f;
}

body.tui {
  /* палитра макета */
  --tui-bg: #07090d;
  --tui-panel: rgba(9, 13, 20, 0.86);
  --tui-fg: #c9d4e3;
  /* Вторичный текст: #56627a давал 3.25:1 на #07090d (WCAG AA требует 4.5).
     #7c8aa3 — 5.71:1 на фоне страницы и 5.61:1 на композите панели
     rgba(9,13,20,.86); иерархия с основным текстом сохраняется. */
  --tui-dim: #7c8aa3;
  /* Рамки блоков: #1d5f6a давал 2.69:1 на композите панели — ниже 3:1 для
     границ (D2-17). #2a7d8a — 4.10:1. Токен красят и рамки, и ползунки. */
  --tui-line: #2a7d8a;
  --tui-line-soft: #12202a;
  --tui-cyan: #3ee6f0;
  --tui-mag: #ff4fd8;
  --tui-yel: #ffd34d;
  --tui-grn: #6dff9e;
  --tui-red: #ff5c7a;
  --tui-org: #ff9f43;
  --tui-vio: #b48cff;
  --tui-ink: #001014;

  /* каркас: body — это `.term` макета */
  box-sizing: border-box;
  max-width: 1320px;
  /* Страница всегда ровно по высоте экрана и не прокручивается: прокручиваются
     её панели (раздел «Каркас по высоте экрана»). `min-height: 0` перебивает
     `body { min-height: 100vh }` из app.css. */
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--tui-bg);
  color: var(--tui-fg);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* `hidden` создавал скролл-контейнер и маскировал переполнение: страница
     «не скроллилась», а элементы уезжали за край. Здесь он и нужен — высота
     зафиксирована, — но контейнером остаётся браузер: элемент, получивший
     фокус, всё равно можно доскроллить. */
  overflow: hidden;
}

body.tui *,
body.tui *::before,
body.tui *::after {
  box-sizing: border-box;
}

/* Всё содержимое выше звёздного поля, оверлеи — выше всего. */
body.tui > * {
  position: relative;
  z-index: 1;
}

body.tui ::selection {
  background: var(--tui-mag);
  color: #000;
}

body.tui a {
  color: var(--tui-cyan);
  text-decoration: none;
}

body.tui a:hover {
  color: var(--tui-grn);
  text-decoration: underline;
}

/* Подписи блоков (`tui-ttl`) висят над рамкой: основному содержимому нужен
   отступ, иначе первая подпись упирается в шапку. */
body.tui main {
  padding-top: 10px;
}

body.tui h1,
body.tui h2,
body.tui h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.04em;
}

body.tui p {
  margin: 0 0 10px;
}

body.tui pre {
  margin: 0;
  font-family: inherit;
}

body.tui .tui-dim {
  color: var(--tui-dim);
}

body.tui .tui-small {
  font-size: 12px;
}

/* цвета текста макета */
body.tui .tui-c-cyan { color: var(--tui-cyan); }
body.tui .tui-c-mag { color: var(--tui-mag); }
body.tui .tui-c-yel { color: var(--tui-yel); }
body.tui .tui-c-grn { color: var(--tui-grn); }
body.tui .tui-c-dim { color: var(--tui-dim); }

/* ============================================================================
   Оверлеи: звёздное поле, CRT, бегущая линия, boot
   ========================================================================= */

body.tui > .tui-stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.tui > .tui-crt {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.22) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
}

body.tui > .tui-crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

body.tui > .tui-vline {
  position: fixed;
  left: 0;
  right: 0;
  top: -120px;
  height: 120px;
  z-index: 39;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(62, 230, 240, 0.04),
    transparent
  );
  animation: tui-vline 7s linear infinite;
}

@keyframes tui-vline {
  from { transform: translateY(0); }
  to { transform: translateY(calc(100vh + 240px)); }
}

/* без JS эффекты не включаются: класс ставит theme-init.js */
body.tui:not(.tui-fx) > .tui-crt,
body.tui:not(.tui-fx) > .tui-vline,
body.tui:not(.tui-fx) > .tui-stars-canvas {
  display: none;
}

body.tui > .tui-boot {
  position: fixed;
  inset: 0;
  z-index: 45;
  padding: clamp(14px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Непрозрачный фон: раньше было 0.94 и контент просвечивал призраком. */
  background: #07090d;
  transition: opacity 0.18s, filter 0.18s;
  /* Boot показывается с первого кадра: `tui-js` ставит theme-init.js в <head>,
     поэтому правило действует ещё до отрисовки body. */
  animation: tui-boot-guard 0.01s linear 2.6s forwards;
}

@keyframes tui-boot-guard {
  to { opacity: 0; visibility: hidden; }
}

html.tui-js body.tui > .tui-boot[hidden] {
  display: flex !important;
}

/* Без скриптов и при `prefers-reduced-motion` boot не показываем. */
html:not(.tui-js) body.tui > .tui-boot {
  display: none !important;
}

/* Отработавший boot убираем окончательно — правило должно перебивать
   `[hidden]`-показ выше по специфичности. */
html.tui-js body.tui > .tui-boot[hidden].is-done,
body.tui > .tui-boot.is-done {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html.tui-js body.tui > .tui-boot[hidden] {
    display: none !important;
  }
}

body.tui > .tui-boot.is-out {
  opacity: 0;
  filter: blur(6px) brightness(2);
}

body.tui .tui-boot-out {
  margin: 0;
  white-space: pre-wrap;
  font-size: clamp(11px, 1.6vw, 14px);
  color: var(--tui-fg);
}

body.tui .tui-boot-out .tui-boot-ok { color: var(--tui-grn); }
body.tui .tui-boot-out .tui-boot-dm { color: var(--tui-dim); }
body.tui .tui-boot-out .tui-boot-cy { color: var(--tui-cyan); }
body.tui .tui-boot-out .tui-boot-yl { color: var(--tui-yel); }

body.tui .tui-skip {
  margin-top: auto;
  color: var(--tui-dim);
  font-size: 12px;
  animation: tui-blink 1.4s steps(1) infinite;
}


@keyframes tui-blink {
  50% { opacity: 0; }
}

/* ============================================================================
   Шапка, телеметрия, статус-строка
   ========================================================================= */

body.tui .tui-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  font-size: 12px;
  font-weight: 700;
  background: var(--tui-cyan);
  color: var(--tui-ink);
  border-radius: 3px;
  overflow: hidden;
  animation: tui-bar-in 0.5s both;
}

@keyframes tui-bar-in {
  from { transform: translateY(-110%); opacity: 0; }
  to { transform: none; opacity: 1; }
}

body.tui .tui-topbar > * {
  padding: 3px 10px;
  white-space: nowrap;
}

body.tui .tui-tb-brand {
  letter-spacing: 0.06em;
}

body.tui .tui-tb-sg {
  background: var(--tui-ink);
  color: var(--tui-cyan);
  font-weight: 500;
}

body.tui .tui-tb-sg b {
  color: var(--tui-yel);
  font-weight: 700;
}

body.tui .tui-tb-nav {
  display: flex;
  gap: 0;
  margin-left: auto;
}

body.tui .tui-tb-nav a,
body.tui .tui-tb-nav button {
  padding: 3px 9px;
  color: var(--tui-ink);
  font: inherit;
  font-weight: 700;
  background: none;
  border: 0;
  cursor: pointer;
}

body.tui .tui-tb-nav a:hover,
body.tui .tui-tb-nav button:hover {
  background: var(--tui-ink);
  color: var(--tui-cyan);
  text-decoration: none;
}

body.tui .tui-tb-nav a.is-active {
  background: var(--tui-ink);
  color: var(--tui-yel);
}

body.tui .tui-tb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--tui-ink);
}

body.tui .tui-tb-actions form {
  margin: 0;
}

body.tui .tui-tb-btn {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  background: none;
  border: 1px solid var(--tui-line);
  color: var(--tui-cyan);
  padding: 1px 7px;
  border-radius: 2px;
  cursor: pointer;
}

body.tui .tui-tb-btn:hover {
  border-color: var(--tui-cyan);
  color: #fff;
}

body.tui .tui-telemetry {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  padding: 6px 2px 2px;
  border-top: 1px solid var(--tui-line-soft);
  font-size: 12px;
  color: var(--tui-dim);
}

body.tui .tui-telemetry b {
  color: var(--tui-cyan);
  font-weight: 500;
}

body.tui .tui-telemetry .tui-tm-right {
  margin-left: auto;
  color: var(--tui-mag);
}

body.tui .tui-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  padding: 6px 2px 2px;
  border-top: 1px solid var(--tui-line-soft);
  margin-top: auto;
  font-size: 12px;
  color: var(--tui-dim);
  animation: tui-bar-in 0.5s 0.2s both;
}

body.tui .tui-key {
  background: var(--tui-dim);
  color: #000;
  padding: 0 5px;
  margin-right: 4px;
  font-weight: 700;
  border-radius: 2px;
}

body.tui .tui-statusbar button {
  all: unset;
  cursor: pointer;
  color: var(--tui-dim);
}

body.tui .tui-statusbar button:hover,
body.tui .tui-statusbar button:hover .tui-key {
  color: var(--tui-cyan);
}

body.tui .tui-statusbar button:hover .tui-key {
  background: var(--tui-cyan);
  color: #000;
}

body.tui .tui-status-right {
  margin-left: auto;
  color: var(--tui-mag);
}

/* ============================================================================
   Блок (рамка ratatui из макета)
   ========================================================================= */

body.tui .tui-blk {
  position: relative;
  border: 1px solid var(--tui-line);
  border-radius: 5px;
  padding: 18px 14px 12px;
  background: var(--tui-panel);
  min-width: 0;
  animation: tui-blk-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--d, 0s);
  transition: border-color 0.25s, box-shadow 0.25s;
}

body.tui .tui-blk:hover,
body.tui .tui-blk.is-focus {
  border-color: var(--tui-cyan);
  box-shadow: 0 0 0 1px rgba(62, 230, 240, 0.18),
    0 0 28px -8px rgba(62, 230, 240, 0.55);
}

@keyframes tui-blk-in {
  0% { opacity: 0; transform: scaleY(0.01) scaleX(0.2); }
  45% { opacity: 1; transform: scaleY(0.01) scaleX(1); }
  100% { opacity: 1; transform: none; }
}

body.tui .tui-ttl,
body.tui .tui-ttr {
  position: absolute;
  top: -0.8em;
  background: var(--tui-bg);
  padding: 0 5px;
  /* Подписи блоков — это <h2>: гасим браузерные поля заголовка. */
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  /* Длинное название премии не должно ломать рамку блока: обрезаем. */
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tui-cyan);
}

/* Заголовок страницы для скринридера: визуально скрыт, но читается. */
body.tui .tui-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip-link: первым в Tab-цепочке, виден только при фокусе. */
body.tui .tui-skip {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--tui-bg);
  color: var(--tui-cyan);
  border: 1px dashed var(--tui-cyan);
  text-decoration: none;
  font-size: 13px;
  transition: top 0.12s;
}

body.tui .tui-skip:focus,
body.tui .tui-skip:focus-visible {
  top: 8px;
}

body.tui .tui-ttl { left: 10px; }
body.tui .tui-ttr { right: 10px; color: var(--tui-mag); }

body.tui .tui-ttr button,
body.tui .tui-ttr a {
  all: unset;
  cursor: pointer;
  color: var(--tui-mag);
}

body.tui .tui-ttr button:hover,
body.tui .tui-ttr a:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--tui-mag);
}

/* `all: unset` снимает и outline: у «[+] выдвинуть» и «Выдвинуть коллегу →»
   не было видимого фокуса (D2-03). Правило специфичнее сброса. */
body.tui .tui-ttr button:focus-visible,
body.tui .tui-ttr a:focus-visible,
body.tui .tui-addhint button:focus-visible {
  outline: 2px dashed var(--tui-cyan);
  outline-offset: 2px;
}

/* Нулевая специфичность: входная анимация блоков — значение по умолчанию,
   любая собственная анимация элемента обязана её перебивать. Раньше здесь
   стояло `body.tui .tui-blk > *:not(...)` со специфичностью (0,4,1): оно
   глушило `tui-float` у короны и `tui-shine` у логотипа — элементы получали
   `tui-fade-in` вместо своей анимации. */
:where(body.tui .tui-blk > :not(.tui-ttl):not(.tui-ttr)) {
  animation: tui-fade-in 0.45s both;
  animation-delay: calc(var(--d, 0s) + 0.5s);
}

@keyframes tui-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================================
   Кнопки, поля, переключатели
   ========================================================================= */

body.tui .tui-cta {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--tui-mag);
  border: 1px solid var(--tui-mag);
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  animation: tui-pulse 2.4s ease-in-out infinite;
  transition: color 0.2s;
}

body.tui .tui-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tui-mag);
  transform: translateX(-101%);
  transition: transform 0.25s;
  z-index: -1;
}

body.tui .tui-cta:hover,
body.tui .tui-cta:focus-visible {
  color: #000;
  outline: 0;
}

body.tui .tui-cta:hover::before,
body.tui .tui-cta:focus-visible::before {
  transform: none;
}

@keyframes tui-pulse {
  50% { box-shadow: 0 0 22px -4px var(--tui-mag); }
}

body.tui .tui-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--tui-cyan);
  border: 1px solid var(--tui-line);
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

body.tui .tui-btn:hover {
  border-color: var(--tui-cyan);
  color: #fff;
}

body.tui .tui-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

body.tui .tui-btn-primary {
  color: var(--tui-mag);
  border-color: var(--tui-mag);
}

body.tui .tui-btn-primary:hover {
  background: var(--tui-mag);
  color: #000;
}

body.tui .tui-btn-sm {
  font-size: 11px;
  padding: 3px 8px;
}

body.tui .tui-fld {
  display: block;
  margin-bottom: 14px;
}

body.tui .tui-lbl {
  display: block;
  font-size: 11px;
  color: var(--tui-dim);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

body.tui .tui-lbl b {
  color: var(--tui-mag);
}

body.tui .tui-inp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Единственная граница поля: #2a4656 давал 1.96:1 (WCAG 1.4.11 требует
     3:1). #456f84 — 3.60:1 на композите панели. */
  border-bottom: 1px dashed #456f84;
  padding: 4px 2px;
  transition: border-color 0.2s;
}

body.tui .tui-inp-row:focus-within {
  border-bottom: 1px solid var(--tui-cyan);
  box-shadow: 0 6px 14px -12px var(--tui-cyan);
}

body.tui .tui-inp-row .tui-pr {
  color: var(--tui-mag);
  animation: tui-blink 1.2s steps(1) infinite;
}

body.tui .tui-inp-row input,
body.tui .tui-inp-row textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: #fff;
  font: inherit;
  font-size: 15px;
  caret-color: var(--tui-cyan);
}

body.tui .tui-inp-row textarea {
  resize: vertical;
  min-height: 2.4em;
}

/* Placeholder: #3a4a5e давал 2.16:1 на панели. #77859c — 5.23:1,
   и всё ещё заметно тусклее введённого текста (#fff). */
body.tui .tui-inp-row input::placeholder,
body.tui .tui-inp-row textarea::placeholder {
  color: #77859c;
  opacity: 1;
}

body.tui .tui-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.tui .tui-chip {
  border: 1px solid #23384a;
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--tui-dim);
}

body.tui .tui-chip b {
  color: var(--tui-yel);
  font-weight: 700;
}



body.tui .tui-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border: 1px solid var(--tui-line);
  border-radius: 2px;
  color: var(--tui-cyan);
  letter-spacing: 0.04em;
}

body.tui .tui-badge-warn { color: var(--tui-yel); border-color: rgba(255, 211, 77, 0.45); }

body.tui .tui-alert {
  border: 1px solid rgba(255, 92, 122, 0.45);
  background: rgba(255, 92, 122, 0.08);
  color: var(--tui-red);
  padding: 8px 10px;
  border-radius: 3px;
  font-size: 13px;
}

body.tui .tui-alert-ok {
  border-color: rgba(109, 255, 158, 0.45);
  background: rgba(109, 255, 158, 0.08);
  color: var(--tui-grn);
}

body.tui .tui-alert-err {
  border-color: rgba(255, 92, 122, 0.45);
  background: rgba(255, 92, 122, 0.08);
  color: var(--tui-red);
}

body.tui .tui-notice {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px dashed var(--tui-line);
  padding: 8px 10px;
  border-radius: 3px;
  color: var(--tui-yel);
  font-size: 13px;
}

body.tui .tui-empty {
  border: 1px dashed var(--tui-line-soft);
  padding: 18px;
  border-radius: 3px;
  text-align: center;
  color: var(--tui-dim);
}

body.tui .tui-hint {
  font-size: 12px;
  color: var(--tui-dim);
}

body.tui :focus-visible {
  outline: 1px dashed var(--tui-cyan);
  outline-offset: 2px;
}

/* ============================================================================
   Журнал, спарклайн, гейджи
   ========================================================================= */

body.tui .tui-log {
  height: 150px;
  overflow: auto;
  font-size: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--tui-line) transparent;
}

body.tui .tui-ln {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: tui-ln-in 0.35s both;
}

body.tui .tui-ln .tui-ts { color: #3c4a5f; }
body.tui .tui-ln.is-ok { color: var(--tui-grn); }
body.tui .tui-ln.is-warn { color: var(--tui-yel); }
body.tui .tui-ln.is-err { color: var(--tui-red); }
body.tui .tui-ln.is-dim { color: var(--tui-dim); }
body.tui .tui-ln.is-mag { color: var(--tui-mag); }
body.tui .tui-ln b { color: var(--tui-fg); }

@keyframes tui-ln-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

body.tui .tui-spark {
  font-size: 18px;
  line-height: 1;
  color: var(--tui-cyan);
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
}

body.tui .tui-spark.is-mag { color: var(--tui-mag); }

body.tui .tui-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--tui-dim);
  margin: 4px 0 10px;
}

body.tui .tui-gauge {
  white-space: pre;
  font-size: 12px;
  color: var(--tui-grn);
}

body.tui .tui-gauge .tui-gauge-empty { color: #1d2b36; }

/* «СИГНАЛ МОСТИКА» на /join: реальные числа из базы, без фейковых шкал. */
body.tui .tui-sig-val {
  color: var(--tui-cyan);
  font-weight: 700;
  text-align: right;
}

body.tui .tui-grow {
  display: grid;
  grid-template-columns: 8ch 1fr;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--tui-dim);
  margin-top: 4px;
}

/* ============================================================================
   Всплывающее окно
   ========================================================================= */

body.tui .tui-popup-wrap {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(3, 5, 8, 0.72);
  backdrop-filter: blur(3px);
  animation: tui-fade-in 0.25s both;
}

body.tui .tui-popup {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: visible;
  background: #080c12;
  border-color: var(--tui-mag);
  box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.25),
    0 0 60px -10px rgba(255, 79, 216, 0.55);
}

body.tui .tui-popup .tui-ttl { color: var(--tui-mag); }

body.tui .tui-popup.is-conn {
  border-color: var(--tui-cyan);
  box-shadow: 0 0 60px -10px rgba(62, 230, 240, 0.6);
}

body.tui .tui-popup.is-conn .tui-ttl { color: var(--tui-cyan); }






body.tui .tui-pbody {
  font-size: 14px;
}

body.tui .tui-pbody .tui-big {
  font-size: 18px;
  color: #fff;
  font-weight: 700;
}

body.tui .tui-pbtns {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

body.tui .tui-pbtns button {
  flex: 1;
  min-width: 140px;
  font: inherit;
  font-weight: 700;
  padding: 9px;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--tui-dim);
  color: var(--tui-fg);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

body.tui .tui-pbtns button:hover { border-color: var(--tui-fg); }

body.tui .tui-pbtns button.is-yes {
  border-color: var(--tui-grn);
  color: var(--tui-grn);
}

body.tui .tui-pbtns button.is-yes:hover {
  background: var(--tui-grn);
  color: #000;
}

body.tui .tui-pbtns u {
  text-decoration: none;
  background: var(--tui-dim);
  color: #000;
  padding: 0 4px;
  margin-right: 4px;
  border-radius: 2px;
}

body.tui .tui-pbtns button.is-yes u {
  background: var(--tui-grn);
}



/* ============================================================================
   Экран стыковки (/join)
   ========================================================================= */

body.tui .tui-grid-join {
  display: grid;
  gap: 18px 14px;
  grid-template-columns: 1.05fr 1fr;
  grid-template-areas:
    "logo logo"
    "ship form"
    "log sig";
}

body.tui .tui-logo-blk {
  grid-area: logo;
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 36px);
  flex-wrap: wrap;
}

body.tui .tui-ship-blk { grid-area: ship; }
body.tui .tui-form-blk { grid-area: form; }
body.tui .tui-log-blk { grid-area: log; }
body.tui .tui-sig-blk { grid-area: sig; }

body.tui .tui-logo {
  /* На 320-390px прежний clamp(6px, 1.55vw, 14px) давал 6px — ASCII «SLAY»
     не читался. Нижняя граница поднята, лишнее уезжает в горизонтальный скролл. */
  font-size: clamp(9px, 3.2vw, 14px);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  line-height: 1.05;
  font-weight: 800;
  background: linear-gradient(
    90deg,
    var(--tui-cyan),
    var(--tui-mag),
    var(--tui-yel),
    var(--tui-mag),
    var(--tui-cyan)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: tui-shine 6s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 79, 216, 0.35));
}

@keyframes tui-shine {
  to { background-position: 300% 0; }
}

body.tui .tui-logo-side {
  flex: 1;
  min-width: 220px;
}

body.tui .tui-logo-side h1 {
  margin: 0 0 6px;
  font-size: clamp(15px, 2vw, 20px);
  letter-spacing: 0.05em;
}

body.tui .tui-logo-side h1 span { color: var(--tui-mag); }

body.tui .tui-logo-side p {
  margin: 0 0 8px;
  max-width: 52ch;
  opacity: 0.85;
}

body.tui .tui-ship {
  font-size: clamp(10px, 1.25vw, 14px);
  line-height: 1.15;
  display: flex;
  justify-content: center;
  overflow: hidden;
  /* Запас под покачивание: корабль уходит на 4px вверх, иначе overflow:hidden
     срезал бы первую строку. Высота блока от этого не меняется. */
  padding-block: 6px;
  margin-block: -6px;
}

/* Корабль — это камера: по горизонтали он не дрейфует вместе с фоном
   (issue #6, баг 1), но и не замирает. Вертикальное покачивание читается как
   «висит в вакууме», звёзды при этом летят навстречу. */
@keyframes tui-hover {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

body.tui .tui-ship pre {
  animation: tui-hover 4s ease-in-out infinite;
  will-change: transform;
}

/* Выхлоп двигателя: корабль не дрейфует по горизонтали вместе с фоном, но и
   не выглядит мёртвым — сопла пульсируют. */
@keyframes tui-engine {
  0%,
  100% { opacity: 0.72; text-shadow: 0 0 6px rgba(255, 79, 216, 0.45); }
  50% { opacity: 1; text-shadow: 0 0 16px rgba(255, 79, 216, 0.95); }
}

body.tui .tui-engine {
  animation: tui-engine 1.8s ease-in-out infinite;
}

body.tui .tui-telem {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 10px;
  margin-top: 10px;
  font-size: 12px;
  border-top: 1px dashed #1b3340;
  padding-top: 8px;
}

body.tui .tui-telem div { color: var(--tui-dim); }
body.tui .tui-telem b {
  display: block;
  color: var(--tui-cyan);
  font-weight: 500;
}

body.tui .tui-pass {
  font-size: 12px;
  line-height: 1.2;
  color: var(--tui-cyan);
  margin: 6px 0 14px;
  overflow: hidden;
  white-space: pre;
}

body.tui .tui-pass .tui-c-mag { color: var(--tui-mag); }
body.tui .tui-pass .tui-c-yel { color: var(--tui-yel); }

/* ============================================================================
   Комната (/)
   ========================================================================= */

body.tui .tui-grid-room {
  display: grid;
  gap: 18px 14px;
  grid-template-columns: 270px minmax(0, 1fr) 320px;
  grid-template-areas:
    "tabs tabs tabs"
    "ballot noms side"
    "log log act";
}

body.tui .tui-tabs-blk { grid-area: tabs; padding: 14px 10px 10px; }
body.tui .tui-ballot-blk { grid-area: ballot; }
/* Секции номинаций занимают свою область грида явно. Раньше правило висело
   на несуществующем `.tui-noms-blk`, и секции ставились автоплейсментом. */
body.tui .tui-noms-stack { grid-area: noms; min-width: 0; }
body.tui .tui-side { grid-area: side; display: grid; gap: 18px; align-content: start; }
body.tui .tui-board-blk { min-width: 0; }
body.tui .tui-rlog-blk { grid-area: log; }
body.tui .tui-act-blk { grid-area: act; }
/* Правый чип шапки (экран /screen): прижимается вправо без inline-стиля. */
body.tui .tui-tb-right { margin-left: auto; text-align: right; }

body.tui .tui-tabs {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

body.tui .tui-tabs::-webkit-scrollbar { display: none; }

body.tui .tui-tab {
  /* `all: unset` убирал и outline — рамка фокуса у вкладок пропадала.
     Сбрасываем только то, что нужно, явно. */
  appearance: none;
  display: inline-block;
  border: 0;
  margin: 0;
  background: none;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  text-decoration: none;
  color: var(--tui-fg);
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
  flex: none;
}

body.tui .tui-tab:focus-visible {
  outline: 1px dashed var(--tui-cyan);
  outline-offset: 2px;
}

body.tui .tui-tab:hover { color: var(--tui-cyan); }

body.tui .tui-tab.is-active {
  background: var(--tui-yel);
  color: #000;
  font-weight: 800;
}

body.tui .tui-tab .tui-vk { color: var(--tui-grn); }
body.tui .tui-tab.is-active .tui-vk { color: #064; }
body.tui .tui-tabs .tui-sep { color: #2a3a4a; flex: none; }

/* мой бюллетень */
body.tui .tui-ballot-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 6px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

body.tui .tui-ballot-row:hover { background: rgba(255, 255, 255, 0.03); }

body.tui .tui-ballot-row.is-current {
  background: rgba(255, 211, 77, 0.1);
  box-shadow: inset 2px 0 0 var(--tui-yel);
}

body.tui .tui-ballot-row .tui-ic {
  color: var(--tui-yel);
  width: 1.4em;
  text-align: center;
}

body.tui .tui-ballot-row .tui-dots {
  flex: 1;
  border-bottom: 1px dotted #2a3a4a;
  transform: translateY(-3px);
  min-width: 8px;
}

body.tui .tui-ballot-row .tui-st { color: var(--tui-dim); white-space: nowrap; }
body.tui .tui-ballot-row .tui-st.is-v { color: var(--tui-grn); }

body.tui .tui-pilot {
  margin-top: 12px;
  border-top: 1px dashed #1b3340;
  padding-top: 10px;
  font-size: 12px;
  color: var(--tui-dim);
}

body.tui .tui-pilot b { color: #fff; }

/* кандидаты */
body.tui .tui-ndesc {
  color: var(--tui-dim);
  font-size: 12px;
  margin-bottom: 10px;
  border-left: 2px solid var(--tui-mag);
  padding-left: 8px;
}

body.tui .tui-ndesc b {
  color: var(--tui-mag);
  font-size: 14px;
  display: block;
}

body.tui .tui-nlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 430px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tui-line) transparent;
}

body.tui .tui-ni {
  display: grid;
  grid-template-columns: 2ch 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

body.tui .tui-ni:hover { background: rgba(62, 230, 240, 0.05); }

body.tui .tui-ni.is-sel {
  background: linear-gradient(
    90deg,
    rgba(62, 230, 240, 0.16),
    rgba(62, 230, 240, 0.02)
  );
  box-shadow: inset 2px 0 0 var(--tui-cyan);
}

body.tui .tui-ni .tui-cur { color: var(--tui-cyan); font-weight: 800; }
body.tui .tui-ni.is-sel .tui-cur { animation: tui-nudge 0.8s ease-in-out infinite; }

@keyframes tui-nudge {
  50% { transform: translateX(3px); }
}

body.tui .tui-ava {
  width: 40px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--c, var(--tui-cyan));
  color: var(--c, var(--tui-cyan));
  font-weight: 800;
  font-size: 13px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--c, var(--tui-cyan)) 10%, transparent);
}

body.tui .tui-who { min-width: 0; }
body.tui .tui-who b { color: #fff; font-weight: 600; }
body.tui .tui-who em {
  font-style: normal;
  font-size: 11px;
  color: var(--tui-dim);
  margin-left: 4px;
}
body.tui .tui-who small {
  display: block;
  color: var(--tui-dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.tui .tui-ni.is-sel .tui-who small { color: var(--tui-fg); }

body.tui .tui-vbtn {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  background: none;
  border: 1px solid var(--tui-mag);
  color: var(--tui-mag);
  padding: 3px 8px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}

body.tui .tui-vbtn:hover { background: var(--tui-mag); color: #000; }

body.tui .tui-ni .tui-okv {
  color: var(--tui-grn);
  font-weight: 700;
  font-size: 12px;
  font-style: normal;
}

/* Иконка «голосование закрыто»: #33404f давал 1.85:1 и была почти невидима
   (D2-18). --tui-dim — 5.61:1 на композите панели. */
body.tui .tui-ni .tui-lock { color: var(--tui-dim); font-style: normal; }

body.tui .tui-ni.is-mine {
  background: linear-gradient(90deg, rgba(109, 255, 158, 0.14), transparent);
  box-shadow: inset 2px 0 0 var(--tui-grn);
}

body.tui .tui-ni.is-muted .tui-who b { opacity: 0.6; }

body.tui .tui-addhint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--tui-dim);
}

body.tui .tui-addhint button {
  all: unset;
  cursor: pointer;
  color: var(--tui-mag);
}

body.tui .tui-addhint button:hover { text-decoration: underline; }

/* табло и корона */
body.tui .tui-board {
  font-size: 13px;
}

body.tui .tui-board-row {
  display: grid;
  /* Имя — не фамилия: в номинациях бывают события и точки, поэтому колонка
     имени шире полосы и обрезается многоточием, полный текст — в title. */
  grid-template-columns: minmax(0, 1.25fr) minmax(5ch, 1fr) 4ch;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
  white-space: pre;
}

body.tui .tui-board-name { color: var(--tui-fg); overflow: hidden; text-overflow: ellipsis; }

body.tui .tui-board-bar {
  color: var(--tui-cyan);
  overflow: hidden;
  text-shadow: 0 0 6px rgba(62, 230, 240, 0.4);
}

body.tui .tui-board-value { text-align: right; color: var(--tui-dim); }

/* Пустая дорожка полосы — приглушённая: при 0 голосов «░» в цвете и с
   подсветкой выглядел как полностью заполненная полоса. */
body.tui .tui-bar-track {
  color: rgba(62, 230, 240, 0.18);
  text-shadow: none;
}

body.tui .tui-board-row.is-lead .tui-board-bar {
  color: var(--tui-yel);
  text-shadow: 0 0 8px rgba(255, 211, 77, 0.6);
}

body.tui .tui-board-row.is-lead .tui-board-name { color: var(--tui-yel); }

body.tui .tui-board-row.is-mine .tui-board-name::before {
  content: "✓";
  color: var(--tui-grn);
}

body.tui .tui-board-total {
  margin-top: 8px;
  font-size: 11px;
  color: var(--tui-dim);
  display: flex;
  justify-content: space-between;
}

body.tui .tui-board-total b { color: #fff; }

body.tui .tui-board-locked {
  font-size: 12px;
  color: var(--tui-dim);
  margin: 4px 0 0;
}

body.tui .tui-crown-blk { text-align: center; }

/* Табло и лидер обновляются по таймеру (htmx, каждые 20 с). Входная анимация
   на каждом обновлении — это «схлопывание» панели, которое при долгом
   просмотре утомляет: панели не трогаем, а подсвечиваем изменившиеся строки
   (класс `is-updated` ставит initBoardRefresh в tui.js). */
body.tui .tui-side .tui-blk,
body.tui .tui-side .tui-blk > *:not(.tui-crown) {
  animation: none;
}

@keyframes tui-updated {
  0% { background-color: rgba(62, 230, 240, 0.22); }
  100% { background-color: transparent; }
}

body.tui .tui-side .tui-blk > .is-updated,
body.tui .tui-side .is-updated {
  animation: tui-updated 0.9s ease-out;
}

body.tui .tui-crown {
  font-size: 15px;
  line-height: 1.1;
  display: inline-block;
  text-align: left;
  color: var(--tui-yel);
  text-shadow: 0 0 10px rgba(255, 211, 77, 0.45);
  animation: tui-float 3.6s ease-in-out infinite,
    tui-crown-glow 3.6s ease-in-out infinite;
}

@keyframes tui-float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes tui-crown-glow {
  0%,
  100% { text-shadow: 0 0 10px rgba(255, 211, 77, 0.45); }
  50% { text-shadow: 0 0 20px rgba(255, 211, 77, 0.8); }
}

body.tui .tui-crown-name {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.03em;
}

body.tui .tui-crown-sub { font-size: 12px; color: var(--tui-dim); }
body.tui .tui-crown-sub b { color: var(--tui-yel); }

/* ============================================================================
   Правила, итоги, архив, вход
   ========================================================================= */

body.tui .tui-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.tui .tui-shell-narrow {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.tui .tui-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.tui .tui-rules-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

body.tui .tui-rules-list li { color: var(--tui-fg); }

body.tui .tui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Таблица архива шире мобильного экрана (549px при 390px): обёртка со своим
   горизонтальным скроллом, чтобы страница не получала прокрутку (D2-05).
   Обёртка фокусируема — область прокручивается с клавиатуры (WCAG 2.1.1). */
body.tui .tui-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

body.tui .tui-table-wrap:focus-visible {
  outline: 1px dashed var(--tui-cyan);
  outline-offset: 2px;
}

body.tui .tui-table th,
body.tui .tui-table td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--tui-line-soft);
}

body.tui .tui-table th {
  color: var(--tui-dim);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.tui .tui-table tr.is-winner td { color: var(--tui-yel); }

body.tui .tui-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--tui-line-soft);
}

body.tui .tui-result-name { color: #fff; }
body.tui .tui-result-bar {
  color: var(--tui-cyan);
  font-size: 12px;
  white-space: pre;
}
body.tui .tui-result-value { color: var(--tui-dim); font-size: 12px; }
body.tui .tui-result-row.is-winner .tui-result-name { color: var(--tui-yel); }
body.tui .tui-result-row.is-winner .tui-result-bar { color: var(--tui-yel); }

body.tui .tui-auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px 0;
}

body.tui .tui-auth-card {
  width: min(520px, 100%);
}

body.tui .tui-auth-head { text-align: center; margin-bottom: 14px; }

body.tui .tui-auth-head .tui-logo {
  display: inline-block;
  font-size: clamp(9px, 2.4vw, 12px);
  line-height: 1.1;
  margin-bottom: 8px;
}

body.tui .tui-auth-head h1 { font-size: 18px; }

body.tui .tui-auth-body { display: flex; flex-direction: column; gap: 12px; }

/* ============================================================================
   Экран (/screen)
   ========================================================================= */

body.tui.tui-screen {
  max-width: none;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 10px;
}

body.tui.tui-screen .tui-screen-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

body.tui .tui-screen-main {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* На проекторе корабль занимает панель целиком и стоит по центру. */
body.tui.tui-screen .tui-screen-main > .tui-blk {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.tui.tui-screen .tui-ship {
  flex: 1;
  align-items: center;
  font-size: clamp(12px, 1.7vw, 22px);
}

body.tui .tui-screen-winners {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

body.tui .tui-screen-card {
  border: 1px solid var(--tui-line);
  border-radius: 4px;
  padding: 8px 12px;
  background: var(--tui-panel);
}

body.tui .tui-screen-cat {
  font-size: 11px;
  color: var(--tui-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.tui .tui-screen-winner {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

body.tui .tui-screen-percent {
  font-size: 12px;
  color: var(--tui-yel);
}

body.tui .tui-screen-offline {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 43;
  border: 1px solid var(--tui-red);
  color: var(--tui-red);
  background: rgba(7, 9, 13, 0.9);
  padding: 4px 10px;
  font-size: 12px;
}

/* ============================================================================
   Мобильная навигация (сохранена из прежней темы)
   ========================================================================= */

body.tui .tui-mobile-nav {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 2;
  gap: 0;
  border-top: 1px solid var(--tui-line);
  background: rgba(7, 9, 13, 0.96);
}

body.tui .tui-mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  font-size: 10px;
  color: var(--tui-dim);
}

body.tui .tui-mobile-nav a.is-active { color: var(--tui-cyan); }
body.tui .tui-mobile-nav .icon { width: 16px; height: 16px; }

@media (max-width: 767px) {
  body.tui .tui-mobile-nav { display: flex; }
  body.tui .tui-statusbar { display: none; }

  /* Шапка в один ряд и не выше 56px: навигация ушла в нижнюю панель
     (там те же ссылки), остались бренд, пилот и действия. */
  body.tui .tui-topbar {
    flex-wrap: nowrap;
    font-size: 11px;
    min-height: 44px;
  }
  body.tui .tui-tb-nav { display: none; }
  body.tui .tui-tb-brand { font-size: 11px; padding: 0 8px; }
  body.tui .tui-tb-sg {
    font-size: 10px;
    padding: 0 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.tui .tui-tb-actions {
    margin-left: auto;
    padding: 0 6px;
  }
  body.tui .tui-tb-btn { font-size: 10px; padding: 0 6px; }

  /* Навигация прижата к низу окна: `sticky` висел в середине коротких
     страниц (/results, /join), потому что прилипал к концу main. */
  body.tui .tui-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
  }
  body.tui { padding-bottom: 64px; }

  body.tui .tui-mobile-nav a { justify-content: center; }
  body.tui .tui-tabs { scrollbar-width: thin; }
}

/* Тач-цели: не меньше 44px по короткой стороне (WCAG 2.5.5). Планшеты
   (768–1060px) — тоже тач: на 768×1024 кнопки были 17–27px (D2-09), поэтому
   брейкпоинт шире мобильного. Плотность десктопного макета не меняется:
   на 1061px и выше правила не действуют. */
@media (max-width: 1060px) {
  body.tui .tui-tb-nav a,
  body.tui .tui-tb-btn,
  body.tui .tui-tab,
  body.tui .tui-vbtn,
  body.tui .tui-ballot-row,
  body.tui .tui-mobile-nav a,
  body.tui .tui-btn,
  body.tui .tui-btn-sm,
  body.tui .tui-cta,
  body.tui .tui-ttr button,
  body.tui .tui-ttr a,
  body.tui .tui-addhint button {
    min-height: 44px;
  }

  body.tui .tui-tb-nav a,
  body.tui .tui-tb-btn,
  body.tui .tui-tab,
  body.tui .tui-vbtn,
  body.tui .tui-btn,
  body.tui .tui-btn-sm,
  body.tui .tui-ttr button,
  body.tui .tui-ttr a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
  }

  body.tui .tui-ballot-row { align-items: center; }
}

/* ============================================================================
   Секции номинаций: вкладки включаются только со скриптом
   ========================================================================= */

/* Секции номинаций скрываются ТОЛЬКО после того, как скрипт успешно
   синхронизировал вкладку и секцию и выставил `data-tui-ready`. Без атрибута
   видны все секции (как без JS) — «пустой экран после голоса» невозможен
   by construction: сначала CSS не прячет ничего, потом JS включает режим. */
body.tui .tui-noms-stack[data-tui-ready] .tui-category {
  display: none;
}

body.tui .tui-noms-stack[data-tui-ready] .tui-category.is-active {
  display: block;
}

/* Без JS htmx-триггер `load` не срабатывает: панель табло навсегда осталась
   бы на «загрузка счёта…» (D2-10). Прячем её, пока скрипты не подтвердили
   работу классом `tui-js` (его ставит static/js/theme-init.js до отрисовки).
   Комната без табло перекладывается в две колонки — пустой правой колонки
   не остаётся. */
html:not(.tui-js) body.tui #room-board {
  display: none;
}

@media (min-width: 1061px) {
  html:not(.tui-js) body.tui .tui-grid-room {
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-areas:
      "tabs tabs"
      "ballot noms"
      "log act";
  }
}




/* ============================================================================
   Каркас по высоте экрана
   ========================================================================= */

/* `body` — колонка высотой в экран, `main` забирает остаток, а прокручиваются
   панели внутри. Ни одна публичная страница не должна давать полосу прокрутки
   страницы: на дисплее она съедает ширину и рвёт рамку макета. */

body.tui > main {
  flex: 1 1 auto;
  min-height: 0;
}

body.tui .tui-stack {
  min-height: 0;
}

/* Комната: вкладки сверху, середина тянется, журнал — нижняя треть. */
body.tui .tui-grid-room {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 0.42fr);
}

body.tui .tui-ballot-blk,
body.tui .tui-noms-stack,
body.tui .tui-side,
body.tui .tui-rlog-blk,
body.tui .tui-act-blk {
  min-height: 0;
}

/* Прокручивается не блок с висящим ярлыком, а его содержимое: `overflow` на
   самом блоке срезал бы верхушки букв `.tui-ttl`/`.tui-ttr` (они висят на
   0.8em выше рамки). Обёртка `.tui-scroll` забирает остаток высоты. */
body.tui .tui-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

body.tui .tui-ballot-blk,
body.tui .tui-act-blk,
body.tui .tui-side .tui-board-blk,
body.tui .tui-form-blk,
body.tui .tui-sig-blk {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Без JS видны все секции номинаций — прокручивается стопка. */
body.tui .tui-noms-stack {
  overflow: auto;
  /* Ярлык секции висит на 0.8em выше её рамки: без запаса сверху `overflow`
     срезает верхушки букв. Отрицательный margin возвращает стопку на место. */
  padding-top: 14px;
  margin-top: -14px;
}

/* С JS видна одна секция: она занимает высоту, а прокручивается её список. */
body.tui .tui-noms-stack[data-tui-ready] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.tui .tui-noms-stack[data-tui-ready] .tui-category.is-active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body.tui .tui-noms-stack[data-tui-ready] .tui-category.is-active .tui-nlist {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* Табло тянется, корона прижата к низу и видна всегда. Первой строке нужен
   минимум: на 1024×768 корона забирала всю высоту панели, и табло
   схлопывалось в ноль (D2-01). */
body.tui .tui-side {
  display: grid;
  grid-template-rows: minmax(120px, 1fr) auto;
  gap: 18px;
  align-content: stretch;
}

/* Корона — самый высокий блок правой колонки. Когда сама панель ниже 340px,
   ASCII-арт скрывается, а поля и строки поджимаются: табло сохраняет свои
   120px, корона остаётся с именем лидера и подписью. Проверяем высоту
   контейнера, а не вьюпорта: на низком, но широком экране (1366×768) места
   хватает и арт остаётся. */
@media (min-width: 761px) and (min-height: 621px) {
  body.tui .tui-side {
    container-type: size;
    container-name: tui-side;
  }
}

@container tui-side (max-height: 340px) {
  body.tui .tui-crown { display: none; }
  body.tui .tui-crown-blk { padding-top: 14px; padding-bottom: 6px; }
  body.tui .tui-crown-name { margin-top: 2px; font-size: 15px; line-height: 1.2; }
  body.tui .tui-crown-sub { line-height: 1.2; }
}

body.tui .tui-rlog-blk {
  display: flex;
  flex-direction: column;
}

body.tui .tui-log {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

/* Стыковка: логотип сверху, корабль и форма тянутся, журнал снизу. */
body.tui .tui-grid-join {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 0.3fr);
}

body.tui .tui-logo-blk,
body.tui .tui-ship-blk,
body.tui .tui-form-blk,
body.tui .tui-log-blk,
body.tui .tui-sig-blk {
  min-height: 0;
}

body.tui .tui-ship-blk,
body.tui .tui-log-blk {
  display: flex;
  flex-direction: column;
}

/* Корабль стоит по центру своей панели, телеметрия — у нижней границы:
   иначе на высоком экране он прилипает к заголовку, а под ним пусто. */
body.tui .tui-ship-blk .tui-ship {
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
}

/* Текстовые страницы: прокручивается содержимое, а не страница. */
body.tui .tui-shell,
body.tui .tui-shell-narrow,
body.tui .tui-auth-shell {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Центрирование карточки входа не должно прятать её верх при переполнении:
   auto-поля вместо `align-items: center` не уводят содержимое в минус. */
body.tui .tui-auth-shell {
  align-items: flex-start;
}

body.tui .tui-auth-card {
  margin-block: auto;
}

/* Полосы прокрутки — тонкие и в палитре темы. */
body.tui * {
  scrollbar-width: thin;
  scrollbar-color: var(--tui-line) transparent;
}

body.tui ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

body.tui ::-webkit-scrollbar-thumb {
  background: var(--tui-line);
  border-radius: 3px;
}

body.tui ::-webkit-scrollbar-thumb:hover {
  background: var(--tui-cyan);
}

body.tui ::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================================
   Адаптив
   ========================================================================= */

@media (max-width: 1060px) {
  body.tui .tui-grid-room {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "tabs tabs"
      "noms noms"
      "side ballot"
      "log act";
  }

  /* Без JS панели табло нет — не оставляем пустую половину строки. */
  html:not(.tui-js) body.tui .tui-grid-room {
    grid-template-areas:
      "tabs tabs"
      "noms noms"
      "ballot act"
      "log log";
  }
}

@media (max-width: 760px) {
  body.tui {
    font-size: 13px;
    padding: 8px 8px 4px;
  }

  body.tui .tui-grid-join {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "form"
      "ship"
      "sig"
      "log";
  }

  body.tui .tui-grid-room {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tabs"
      "noms"
      "side"
      "ballot"
      "act"
      "log";
  }

  body.tui .tui-topbar { font-size: 11px; }
  body.tui .tui-tb-nav { margin-left: 0; width: 100%; }
  body.tui .tui-telemetry .tui-hide-m { display: none; }

  body.tui .tui-ni {
    grid-template-columns: 1.5ch 34px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 4px;
  }

  body.tui .tui-ava { width: 34px; font-size: 12px; }
  body.tui .tui-nlist { max-height: none; }
  body.tui .tui-telem { grid-template-columns: repeat(3, 1fr); }

  body.tui .tui-screen-main { grid-template-columns: 1fr; }
}

/* 761–1060 px: у комнаты четыре строки — высоты задаём под них. */
@media (min-width: 761px) and (max-width: 1060px) {
  body.tui .tui-grid-room {
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 0.4fr);
  }
}

/* Короткий экран (768–900 px по высоте): на стыковке прячем декор — описание
   премии и предпросмотр пропуска, — иначе кнопка «Начать стыковку» уезжает
   под нижнюю границу блока. На высоком экране всё остаётся на месте. */
@media (min-width: 761px) and (max-height: 900px) {
  body.tui .tui-grid-join {
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 0.26fr);
  }

  body.tui .tui-logo-side p,
  body.tui .tui-pass {
    display: none;
  }

  body.tui .tui-fld {
    margin-bottom: 8px;
  }
}

/* Мобильный и очень низкий экран: возвращаем обычную прокрутку страницы.
   Фиксированная высота там режет контент и мешает экранной клавиатуре. */
@media (max-width: 760px), (max-height: 620px) {
  body.tui {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body.tui > main {
    flex: none;
  }

  body.tui .tui-stack,
  body.tui .tui-grid-room,
  body.tui .tui-grid-join {
    flex: none;
    grid-template-rows: none;
  }

  body.tui .tui-noms-stack[data-tui-ready] {
    display: block;
    overflow: visible;
  }

  body.tui .tui-noms-stack {
    padding-top: 0;
    margin-top: 0;
  }

  body.tui .tui-noms-stack[data-tui-ready] .tui-category.is-active {
    display: block;
  }

  body.tui .tui-noms-stack[data-tui-ready] .tui-category.is-active .tui-nlist {
    flex: none;
    max-height: none;
  }

  body.tui .tui-side {
    grid-template-rows: none;
    align-content: start;
  }

  body.tui .tui-log {
    flex: none;
    height: 150px;
  }

  /* Блоки снова обычные, прокрутка — страницы. */
  body.tui .tui-ballot-blk,
  body.tui .tui-act-blk,
  body.tui .tui-side .tui-board-blk,
  body.tui .tui-form-blk,
  body.tui .tui-sig-blk,
  body.tui .tui-ship-blk,
  body.tui .tui-log-blk,
  body.tui .tui-rlog-blk {
    display: block;
  }

  body.tui .tui-scroll {
    flex: none;
    overflow: visible;
  }

  body.tui .tui-shell,
  body.tui .tui-shell-narrow,
  body.tui .tui-auth-shell {
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.tui *,
  body.tui *::before,
  body.tui *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------- тосты */
/* Тост в публичной теме — терминальная плашка, а не красная «пилюля» админки:
   успех — зелёная рамка и «✓», ошибка — красная и «✖». Появление — сдвиг и
   прозрачность (transform/opacity), без анимации при reduced-motion. */
body.tui .toast-root {
  bottom: calc(56px + env(safe-area-inset-bottom));
}

body.tui .toast {
  font-family: var(--tui-font, inherit);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--tui-grn);
  background: rgba(7, 9, 13, 0.94);
  border: 1px solid var(--tui-grn);
  border-radius: 0;
  padding: 8px 16px;
  box-shadow: 0 0 18px rgba(109, 255, 158, 0.25), inset 0 0 12px rgba(109, 255, 158, 0.08);
  animation: tui-toast-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body.tui .toast::before {
  content: "✓ ";
}

body.tui .toast.is-error {
  color: var(--tui-red);
  border-color: var(--tui-red);
  box-shadow: 0 0 18px rgba(255, 92, 122, 0.3), inset 0 0 12px rgba(255, 92, 122, 0.08);
}

body.tui .toast.is-error::before {
  content: "✖ ";
}

@keyframes tui-toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ============================================================================
   Раунд 3: фиксы дизайн-аудита и пакет анимаций (docs/audits/round3/design.md)
   Только transform/opacity в анимациях; reduced motion гасится ниже.
   ========================================================================= */

/* --- D3-02. Тост и спрайт — вне потока: `body.tui > *` давал им relative --- */
body.tui > #toast-root {
  position: fixed;
  left: 50%;
  bottom: 44px;
  z-index: 60;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
}
body.tui > .sprite { position: absolute; }
body.tui .toast.is-hiding {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}
@media (max-width: 767px) {
  body.tui > #toast-root { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* --- D3-01. Подсказка boot-экрана — свой класс, skip-link не мигает -------- */
body.tui .tui-boot-skip {
  margin-top: auto;
  color: var(--tui-dim);
  font-size: 12px;
  animation: tui-blink 1.4s steps(1) infinite;
}
body.tui a.tui-skip { animation: none; margin-top: 0; }

/* --- D3-05. Видимый фокус в шапке ----------------------------------------- */
body.tui .tui-tb-nav a:focus-visible,
body.tui .tui-topbar a:focus-visible,
body.tui .tui-topbar button:focus-visible {
  background: var(--tui-ink);
  color: var(--tui-yel);
  outline: 2px dashed var(--tui-yel);
  outline-offset: -3px;
}

/* --- D3-13. Подпись рамки на тач-экранах не раздувается ------------------- */
@media (max-width: 1060px) {
  body.tui .tui-ttr { overflow: visible; }
  body.tui .tui-ttr button,
  body.tui .tui-ttr a { min-height: 0; min-width: 0; display: inline; position: relative; }
  body.tui .tui-ttr button::after,
  body.tui .tui-ttr a::after { content: ""; position: absolute; inset: -14px -8px; }
}
body.tui .tui-blk:has(> .tui-ttr) > .tui-ttl { max-width: calc(62% - 10px); }
body.tui .tui-ttr { max-width: 36%; }

/* --- D3-14. Попап прокручивается на маленьком экране; без blur (D3-25) ----- */
body.tui .tui-popup-wrap {
  overflow-y: auto;
  align-items: flex-start;
  padding: 24px 14px;
  backdrop-filter: none;
  background: rgba(3, 5, 8, 0.86);
}
body.tui .tui-popup { margin-block: auto; max-height: none; }

/* --- П1. Вход «кинескоп» — только первый кадр страницы (D3-04) ------------- */
html.tui-entered body.tui .tui-blk { animation: none; }
:where(html.tui-entered body.tui .tui-blk > :not(.tui-ttl):not(.tui-ttr)) { animation: none; }

html.tui-js body.tui .tui-category.is-switch {
  animation: tui-sect-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
:where(html.tui-js body.tui .tui-category.is-switch > *) { animation: none; }
html.tui-js body.tui .tui-category.is-switch .tui-ni {
  animation: tui-ni-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(min(var(--i, 0), 10) * 28ms);
}
@keyframes tui-sect-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes tui-ni-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

html.tui-js body.tui .tui-popup-wrap .tui-popup {
  animation: tui-pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
:where(html.tui-js body.tui .tui-popup > *) { animation: none; }
@keyframes tui-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* --- П3. Момент голоса ----------------------------------------------------- */
body.tui .tui-ni.is-voted { animation: tui-voted 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
body.tui .tui-ni.is-voted::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 79, 216, 0.55), rgba(255, 79, 216, 0));
  animation: tui-flash 0.9s ease-out both;
}
body.tui .tui-ni.is-voted .tui-okv {
  display: inline-block;
  animation: tui-stamp 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) 0.1s both;
}
body.tui .tui-ballot-row .tui-st.is-new {
  display: inline-block;
  animation: tui-stamp 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes tui-voted { from { transform: scale(1.025); } to { transform: none; } }
@keyframes tui-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes tui-stamp {
  from { opacity: 0; transform: scale(2.4) rotate(-10deg); }
  to { opacity: 1; transform: none; }
}

/* --- П4. Прогресс бюллетеня ------------------------------------------------ */
body.tui .tui-meter {
  position: relative;
  display: block;
  height: 5px;
  margin-top: 6px;
  overflow: hidden;
  background: repeating-linear-gradient(90deg,
    var(--tui-grn) 0 calc(100% / 20 - 2px), transparent calc(100% / 20 - 2px) calc(100% / 20));
}
body.tui .tui-meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg,
    #1b3340 0 calc(100% / 20 - 2px), #090c13 calc(100% / 20 - 2px) calc(100% / 20));
  transform: translateX(calc(var(--p, 0) * 1%));
}
body.tui .tui-meter.is-moving::after {
  animation: tui-meter 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes tui-meter { from { transform: translateX(calc(var(--from, 0) * 1%)); } }
body.tui .tui-meter.is-full { box-shadow: 0 0 14px -2px rgba(109, 255, 158, 0.6); }

/* --- П5. Финал «БЮЛЛЕТЕНЬ ОТПРАВЛЕН» ---------------------------------------- */
body.tui .tui-finale-crown { display: block; width: max-content; margin: 0 auto 10px; }
body.tui .tui-finale-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  max-height: 34vh;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  font-size: 12px;
}
body.tui .tui-finale-list li { display: contents; }
body.tui .tui-finale-list span { color: var(--tui-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.tui .tui-finale-list b { color: #fff; text-align: right; }

/* --- П6. Частицы ------------------------------------------------------------ */
body.tui .tui-fx-layer {
  position: fixed;
  inset: 0;
  z-index: 44;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}
body.tui .tui-floater,
body.tui .tui-confetti {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  will-change: transform, opacity;
}
body.tui .tui-floater {
  font-size: 18px;
  color: var(--tui-mag);
  text-shadow: 0 0 12px var(--tui-mag);
  animation: tui-floater 1.2s cubic-bezier(0.2, 0.7, 0.3, 1) var(--delay, 0ms) both;
}
body.tui .tui-floater.is-alt { color: var(--tui-yel); text-shadow: 0 0 12px var(--tui-yel); }
@keyframes tui-floater {
  from { opacity: 1; transform: translate(var(--x), var(--y)) scale(1); }
  to { opacity: 0; transform: translate(calc(var(--x) + var(--dx, 0px)), calc(var(--y) - 70px)) scale(1.6); }
}
body.tui .tui-confetti {
  font-size: 16px;
  color: var(--c, var(--tui-mag));
  animation:
    tui-conf-x var(--t, 1.8s) linear var(--delay, 0ms) both,
    tui-conf-y var(--t, 1.8s) cubic-bezier(0.3, -0.9, 0.75, 0.9) var(--delay, 0ms) both,
    tui-conf-o var(--t, 1.8s) ease-in var(--delay, 0ms) both;
}
@keyframes tui-conf-x {
  from { transform: translateX(var(--x0)) rotate(0deg); }
  to { transform: translateX(calc(var(--x0) + var(--dx))) rotate(var(--r)); }
}
@keyframes tui-conf-y {
  from { translate: 0 var(--y0); }
  to { translate: 0 calc(var(--y0) + var(--dy)); }
}
@keyframes tui-conf-o { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* --- П7. Конверт на /results?reveal=1 и акцент победителя (D3-42) ---------- */
body.tui .is-sealed .tui-result-row { display: none; }
body.tui .tui-envelope { display: grid; justify-items: center; gap: 8px; padding: 6px 0 2px; }
body.tui .tui-env-flap,
body.tui .tui-env-body {
  margin: 0;
  line-height: 1.05;
  color: var(--tui-yel);
  text-shadow: 0 0 10px rgba(255, 211, 77, 0.35);
}
body.tui .tui-env-flap { transform-origin: 50% 0; }
body.tui .tui-env-open { width: auto; }
body.tui .tui-drum { position: relative; display: block; width: 27ch; max-width: 100%; height: 0.6em; overflow: hidden; opacity: 0; }
body.tui .tui-drum::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg,
    var(--tui-mag) 0 calc(100% / 14 - 2px), transparent calc(100% / 14 - 2px) calc(100% / 14));
  transform: translateX(-100%);
}
body.tui .is-opening .tui-envelope { animation: tui-env-shake 0.6s linear both; }
body.tui .is-opening .tui-env-flap { animation: tui-env-flap 0.5s cubic-bezier(0.5, 0, 0.2, 1) 0.6s both; }
body.tui .is-opening .tui-drum { opacity: 1; }
body.tui .is-opening .tui-drum::before { animation: tui-drum 1.5s steps(14) 1.1s forwards; }
body.tui .is-opening .tui-env-open { opacity: 0; pointer-events: none; transition: opacity 0.2s; }
@keyframes tui-env-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-4px) rotate(-1.5deg); }
  40% { transform: translateX(4px) rotate(1.5deg); }
  60% { transform: translateX(-3px) rotate(-1deg); }
  80% { transform: translateX(3px) rotate(1deg); }
}
@keyframes tui-env-flap { to { transform: perspective(400px) rotateX(180deg); opacity: 0.35; } }
@keyframes tui-drum { to { transform: none; } }

body.tui .is-revealed .tui-result-row {
  transform-origin: 0 50%;
  animation: tui-row-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc((var(--n, 1) - 1 - var(--i, 0)) * 140ms);
}
body.tui .is-revealed .tui-result-row.is-winner {
  animation: tui-winner-in 0.8s cubic-bezier(0.2, 1.3, 0.3, 1) both;
  animation-delay: calc(var(--n, 1) * 140ms + 250ms);
}
@keyframes tui-row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tui-winner-in {
  0% { opacity: 0; transform: scale(1.9); }
  55% { opacity: 1; transform: scale(0.97); }
  100% { opacity: 1; transform: none; }
}
body.tui .tui-result-row.is-winner {
  padding: 8px 6px;
  margin: 2px -6px;
  background: linear-gradient(90deg, rgba(255, 211, 77, 0.12), transparent 70%);
  box-shadow: inset 2px 0 0 var(--tui-yel);
}
body.tui .tui-result-row.is-winner .tui-result-name { font-size: 16px; font-weight: 800; }

/* --- П8а. /screen читается с 3–5 м; 19 карточек без скрытого скролла (D3-07) */
body.tui.tui-screen { font-size: clamp(14px, 0.95vw, 36px); }
body.tui.tui-screen .tui-topbar,
body.tui.tui-screen .tui-statusbar,
body.tui.tui-screen .tui-telem,
body.tui.tui-screen .tui-ttl,
body.tui.tui-screen .tui-ttr { font-size: clamp(12px, 0.8vw, 30px); }
body.tui.tui-screen .tui-screen-main { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); }
body.tui.tui-screen .tui-ship { font-size: clamp(10px, 1.15vw, 40px); }
body.tui.tui-screen .tui-screen-winners {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24ch), 1fr));
  grid-auto-rows: min-content;
  align-content: start;
  gap: clamp(6px, 0.6vw, 20px);
  overflow: hidden;
}
body.tui.tui-screen .tui-screen-card { position: relative; overflow: hidden; padding: 0.5em 0.8em; }
body.tui.tui-screen .tui-screen-cat { font-size: clamp(11px, 0.75vw, 28px); }
body.tui.tui-screen .tui-screen-winner { font-size: clamp(16px, 1.5vw, 56px); line-height: 1.15; overflow-wrap: anywhere; }
body.tui.tui-screen .tui-screen-percent { font-size: clamp(12px, 0.9vw, 32px); }
body.tui.tui-screen .tui-screen-offline { font-size: clamp(14px, 1.1vw, 40px); padding: 0.3em 0.8em; }
body.tui.tui-screen.is-offline .tui-screen-card { opacity: 0.45; transition: opacity 0.4s; }

/* --- П8б. Церемония /screen?ceremony=1 ------------------------------------- */
body.tui.tui-screen .is-sealed [data-screen-winner],
body.tui.tui-screen .is-sealed [data-screen-percent] { opacity: 0; }
body.tui.tui-screen .tui-screen-card.is-sealed::after {
  content: "◆ ◆ ◆  ЗАПЕЧАТАНО  ◆ ◆ ◆";
  position: absolute;
  left: 0.8em;
  right: 0.8em;
  bottom: 0.9em;
  color: var(--tui-dim);
  letter-spacing: 0.1em;
  font-size: 0.8em;
}
body.tui.tui-screen .tui-screen-card.is-next { border-color: var(--tui-yel); }
body.tui.tui-screen .tui-screen-card.is-opening {
  border-color: var(--tui-mag);
  animation: tui-card-pulse 0.55s ease-in-out 4 alternate;
}
@keyframes tui-card-pulse { from { transform: scale(1); } to { transform: scale(1.03); } }
body.tui.tui-screen .tui-screen-card .tui-drum {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: 4px;
}
body.tui.tui-screen .tui-screen-card.is-opening .tui-drum { opacity: 1; }
body.tui.tui-screen .tui-screen-card.is-opening .tui-drum::before { animation: tui-drum 2s steps(16) forwards; }
body.tui.tui-screen .is-revealed [data-screen-winner] { animation: tui-glitch-in 0.7s steps(7) both; }
body.tui.tui-screen .is-revealed [data-screen-winner]:not(.tui-c-dim)::before { content: "♛ "; color: var(--tui-yel); }
body.tui.tui-screen .is-revealed [data-screen-percent] { animation: tui-row-in 0.4s 0.5s both; }
@keyframes tui-glitch-in {
  0% { opacity: 0; transform: translateX(-6px) skewX(14deg); }
  30% { opacity: 1; transform: translateX(5px) skewX(-10deg); }
  55% { transform: translateX(-3px) skewX(6deg); }
  100% { opacity: 1; transform: none; }
}

/* --- П9. Табло: вспышка строки на opacity, glitch смены лидера ------------- */
body.tui .tui-side .tui-board-row { position: relative; }
body.tui .tui-side .tui-board-row.is-updated { animation: none; }
body.tui .tui-side .tui-board-row.is-updated::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
  background: rgba(62, 230, 240, 0.22);
  pointer-events: none;
  animation: tui-flash 0.9s ease-out both;
}
body.tui .tui-side .tui-blk > .tui-crown-name.is-new-leader {
  color: var(--tui-mag);
  animation: tui-glitch-in 0.6s steps(6) both;
}

/* --- П10. Микро-взаимодействия (D3-19, D3-40) ------------------------------ */
body.tui .tui-ni .tui-cur { display: inline-block; width: 2ch; }
body.tui .tui-ni:hover .tui-cur::before { content: "❯"; opacity: 0.45; }
body.tui .tui-ni.is-sel .tui-cur::before,
body.tui .tui-ni:focus-within .tui-cur::before { content: "❯"; opacity: 1; color: var(--tui-mag); }

body.tui .tui-vbtn { position: relative; isolation: isolate; overflow: hidden; transition: color 0.15s, transform 0.08s; }
body.tui .tui-vbtn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tui-mag);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.tui .tui-vbtn:hover,
body.tui .tui-vbtn:focus-visible { background: none; color: #000; }
body.tui .tui-vbtn:hover::before,
body.tui .tui-vbtn:focus-visible::before { transform: none; }
body.tui .tui-vbtn:active { transform: scale(0.95); }
body.tui .tui-vbtn.htmx-request,
body.tui .tui-vbtn:disabled { color: transparent; cursor: progress; }
body.tui .tui-vbtn.htmx-request::after,
body.tui .tui-vbtn:disabled::after {
  content: "[ ··· ]";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--tui-mag);
  animation: tui-blink 0.6s steps(1) infinite;
}

body.tui .tui-tab { position: relative; }
body.tui .tui-tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 1px;
  background: var(--tui-cyan);
  transform: scaleX(0);
  transition: transform 0.18s;
}
body.tui .tui-tab:hover::after { transform: none; }
body.tui .tui-tab.is-active::after { content: none; }

body.tui .tui-ballot-row .tui-ic { display: inline-block; transition: transform 0.15s; }
body.tui .tui-ballot-row:hover .tui-ic { transform: scale(1.25); }
body.tui .tui-pbtns button:active,
body.tui .tui-btn:active,
body.tui .tui-cta:active { transform: scale(0.97); }

/* --- П11. Шлюз стыковки на /join (D3-20) ----------------------------------- */
body.tui .tui-dock {
  display: flex;
  justify-content: center;
  white-space: pre;
  line-height: 1.1;
  margin-bottom: 12px;
  font-size: clamp(10px, 2.6vw, 14px);
  color: var(--tui-cyan);
}
body.tui .tui-dock-r { color: var(--tui-yel); animation: tui-dock 1s steps(8) 0.1s both; }
@keyframes tui-dock { from { transform: translateX(6ch); } to { transform: none; } }
body.tui .tui-steps { list-style: none; margin: 0; padding: 0; font-size: 12px; min-height: 6.5em; }
body.tui .tui-steps li { opacity: 0.4; transition: opacity 0.2s; }
body.tui .tui-steps li::before { content: "[ .. ] "; color: var(--tui-yel); }
body.tui .tui-steps li.is-done { opacity: 1; }
body.tui .tui-steps li.is-done::before { content: "[ OK ] "; color: var(--tui-grn); }
body.tui .tui-cta[aria-busy="true"] { color: #000; cursor: progress; }
body.tui .tui-cta[aria-busy="true"]::before { transform: none; }

/* --- П12. Тряска при ошибке ------------------------------------------------- */
html.tui-js body.tui .tui-popup-wrap .tui-popup.is-shake {
  animation: tui-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
body.tui .tui-form-blk > .tui-alert,
body.tui .tui-auth-body > .tui-alert { animation: tui-shake 0.4s 0.3s both; }
@keyframes tui-shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* --- П13. Живой отсчёт ------------------------------------------------------ */
body.tui [data-tui-countdown].is-urgent { color: var(--tui-red); animation: tui-blink 1s steps(1) infinite; }

/* --- П14а. Дешёвые свечения, FX: ВЫКЛ, виньетка под контентом -------------- */
/* CTA: тень статична, пульсирует только opacity псевдоэлемента (D3-25). */
body.tui .tui-cta { overflow: visible; isolation: isolate; animation: none; }
body.tui .tui-cta::before { transform: scaleX(0); transform-origin: 0 50%; }
body.tui .tui-cta:hover::before,
body.tui .tui-cta:focus-visible::before { transform: none; }
body.tui .tui-cta::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 22px -4px var(--tui-mag);
  opacity: 0;
  animation: tui-glow 2.4s ease-in-out infinite;
}
@keyframes tui-glow { 50% { opacity: 1; } }

/* FX: ВЫКЛ гасит и бесконечные CSS-анимации (D3-27, WCAG 2.2.2). */
/* Без псевдоэлементов внутри :is(): с ними правило отбрасывалось целиком. */
html.tui-js body.tui.tui-fx-off :is(.tui-crown, .tui-logo, .tui-cta, .tui-engine,
  .tui-ship pre, .tui-pr, .tui-cur, .tui-boot-skip) { animation: none; }
html.tui-js body.tui.tui-fx-off .tui-cta::after { animation: none; }

/* Виньетка — под контентом, над звёздами (D3-18). */
body.tui > .tui-crt::after { content: none; }
body.tui.tui-fx::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.6) 100%);
}

/* ============================================================================
   Космос за ракетой и плавные анимации
   Только transform/opacity в движении; фон — статичные градиенты.
   ========================================================================= */

body.tui {
  /* Плавные кривые: «выход» без отскока и мягкая пружина для штампов. */
  --tui-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tui-ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --tui-ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* --- Сцена: ракета поверх космоса ----------------------------------------- */
body.tui .tui-ship {
  position: relative;
  isolation: isolate;
  border-radius: 4px;
}
body.tui .tui-ship pre { position: relative; z-index: 1; }

body.tui .tui-space {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  contain: strict;
  background:
    radial-gradient(ellipse 55% 42% at 28% 30%, rgba(180, 140, 255, 0.2), transparent 70%),
    radial-gradient(ellipse 50% 40% at 76% 70%, rgba(255, 79, 216, 0.16), transparent 72%),
    radial-gradient(ellipse 40% 30% at 62% 22%, rgba(62, 230, 240, 0.1), transparent 70%),
    radial-gradient(ellipse 90% 70% at 50% 55%, #0a1020 0%, #05070d 70%);
  /* Края растворяются в панели — без жёсткой рамки вокруг «окна». */
  -webkit-mask-image: radial-gradient(ellipse 80% 85% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 85% at 50% 50%, #000 62%, transparent 100%);
}

/* Обёртка слоёв: в режиме «стыковки» звёзды растягиваются в штрихи (warp). */
body.tui .tui-space-warp {
  position: absolute;
  inset: 0;
  transform-origin: 50% 40%;
  transition: transform 1.1s var(--tui-ease-io), opacity 1.1s var(--tui-ease-io);
}

/* Три слоя звёзд: плитка повторяется, слой сдвигается ровно на одну плитку —
   цикл бесшовный. Чем ближе слой, тем крупнее звёзды и быстрее движение. */
body.tui .tui-starlayer {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(-1 * var(--tile));
  height: calc(100% + var(--tile));
  background-size: var(--tile) var(--tile);
  background-repeat: repeat;
  animation: tui-starfall var(--speed) linear infinite;
  will-change: transform;
}
body.tui .tui-starlayer.is-far {
  --tile: 140px;
  --speed: 26s;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12px 18px, #fff, transparent),
    radial-gradient(1px 1px at 58px 92px, #cfe9ff, transparent),
    radial-gradient(1px 1px at 101px 41px, #fff, transparent),
    radial-gradient(1px 1px at 33px 121px, #e8d9ff, transparent),
    radial-gradient(1px 1px at 124px 112px, #fff, transparent),
    radial-gradient(1px 1px at 81px 7px, #cfe9ff, transparent),
    radial-gradient(1px 1px at 47px 63px, #fff, transparent),
    radial-gradient(1px 1px at 112px 79px, #e8d9ff, transparent),
    radial-gradient(1px 1px at 6px 97px, #fff, transparent);
}
body.tui .tui-starlayer.is-mid {
  --tile: 210px;
  --speed: 15s;
  opacity: 0.8;
  background-image:
    radial-gradient(1.4px 1.4px at 40px 60px, #fff, transparent),
    radial-gradient(1.4px 1.4px at 150px 20px, #bff7fb, transparent),
    radial-gradient(1.4px 1.4px at 95px 170px, #fff, transparent),
    radial-gradient(1.4px 1.4px at 190px 120px, #ffd6f6, transparent),
    radial-gradient(1.4px 1.4px at 15px 190px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 120px 95px, #fff, transparent),
    radial-gradient(1.2px 1.2px at 178px 196px, #bff7fb, transparent);
}
body.tui .tui-starlayer.is-near {
  --tile: 300px;
  --speed: 8.5s;
  background-image:
    radial-gradient(2px 2px at 70px 40px, var(--tui-cyan), transparent),
    radial-gradient(2px 2px at 230px 150px, #fff, transparent),
    radial-gradient(1.8px 1.8px at 140px 260px, var(--tui-mag), transparent),
    radial-gradient(2px 2px at 280px 30px, #fff, transparent),
    radial-gradient(1.8px 1.8px at 20px 220px, var(--tui-yel), transparent);
}
@keyframes tui-starfall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, var(--tile), 0); }
}

/* Мерцающие звёзды — крестики-«искры» поверх слоёв. */
body.tui .tui-twinkle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  background:
    radial-gradient(circle, currentColor 0 1px, transparent 2.5px),
    linear-gradient(90deg, transparent 44%, currentColor 50%, transparent 56%),
    linear-gradient(0deg, transparent 44%, currentColor 50%, transparent 56%);
  color: #e9f7ff;
  border-radius: 50%;
  filter: drop-shadow(0 0 3px currentColor);
  opacity: 0.2;
  animation: tui-twinkle var(--t, 4s) var(--tui-ease-io) var(--w, 0s) infinite;
}
body.tui .tui-twinkle.is-mag { color: #ffb3f0; }
body.tui .tui-twinkle.is-yel { color: #ffe9a3; }
@keyframes tui-twinkle {
  0%, 100% { opacity: 0.12; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Метеор: тонкий штрих раз в несколько секунд пересекает окно по диагонали. */
body.tui .tui-meteor {
  position: absolute;
  top: 8%;
  left: 78%;
  width: 90px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(62, 230, 240, 0.5) 30%, transparent);
  border-radius: 1px;
  opacity: 0;
  transform-origin: 0 50%;
  animation: tui-meteor 9s var(--tui-ease-out) 2.5s infinite;
}
body.tui .tui-meteor.is-late {
  top: 30%;
  left: 92%;
  width: 60px;
  animation-duration: 13s;
  animation-delay: 7s;
}
@keyframes tui-meteor {
  0% { opacity: 0; transform: rotate(152deg) translateX(0) scaleX(0.3); }
  2% { opacity: 1; }
  9% { opacity: 0; transform: rotate(152deg) translateX(260px) scaleX(1); }
  100% { opacity: 0; transform: rotate(152deg) translateX(260px) scaleX(1); }
}

/* --- Ракета: мягкое парение и живой выхлоп ------------------------------- */
@keyframes tui-hover {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  25% { transform: translate3d(0, -3px, 0) rotate(-0.6deg); }
  50% { transform: translate3d(0, -6px, 0) rotate(0deg); }
  75% { transform: translate3d(0, -3px, 0) rotate(0.6deg); }
}
body.tui .tui-ship pre {
  animation: tui-hover 6s var(--tui-ease-io) infinite;
  transform-origin: 50% 70%;
}

/* Свечение сопла: пятно под ракетой, «дышит» масштабом и прозрачностью. */
body.tui .tui-ship pre::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.9em;
  width: 7em;
  height: 3.2em;
  margin-left: -3.5em;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 211, 77, 0.55), rgba(255, 79, 216, 0.28) 45%, transparent 72%);
  transform-origin: 50% 0;
  animation: tui-flame 1.6s var(--tui-ease-io) infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes tui-flame {
  0%, 100% { opacity: 0.65; transform: scale(0.9, 0.85); }
  35% { opacity: 1; transform: scale(1.05, 1.15); }
  60% { opacity: 0.8; transform: scale(0.96, 0.95); }
}

/* Огонь в сопле — прозрачность, без анимации тени (D3-25). */
body.tui .tui-engine {
  display: inline-block;
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.75);
  animation: tui-engine 1.6s var(--tui-ease-io) infinite;
}
@keyframes tui-engine {
  0%, 100% { opacity: 0.75; }
  35% { opacity: 1; }
  60% { opacity: 0.85; }
}

/* Стыковка (/join, после «НАЧАТЬ СТЫКОВКУ»): прыжок в гиперпространство. */
body.tui .tui-ship-blk.is-warp .tui-space-warp { transform: scaleY(7); opacity: 0.9; }
body.tui .tui-ship-blk.is-warp .tui-starlayer { animation-duration: 2.2s; }
body.tui .tui-ship-blk.is-warp .tui-ship pre {
  animation: tui-warp-shake 0.18s linear infinite;
}
body.tui .tui-ship-blk.is-warp .tui-ship pre::after {
  animation-duration: 0.35s;
  transform: scale(1.4, 1.8);
}
@keyframes tui-warp-shake {
  0%, 100% { transform: translate3d(0, -6px, 0); }
  50% { transform: translate3d(0.6px, -7px, 0); }
}

/* --- Плавнее: вход блоков, попапы, переключения -------------------------- */
/* Было «схлопывание кинескопа» (scaleY 0.01 → 1) — резко на больших панелях.
   Теперь мягкое проявление с подъёмом. */
@keyframes tui-blk-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.985); }
  to { opacity: 1; transform: none; }
}
body.tui .tui-blk {
  animation-duration: 0.75s;
  animation-timing-function: var(--tui-ease-out);
}
@keyframes tui-fade-in {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to { opacity: 1; transform: none; }
}

html.tui-js body.tui .tui-category.is-switch {
  animation: tui-sect-in 0.38s var(--tui-ease-out) both;
}
html.tui-js body.tui .tui-category.is-switch .tui-ni {
  animation: tui-ni-in 0.45s var(--tui-ease-out) both;
  animation-delay: calc(min(var(--i, 0), 10) * 40ms);
}
@keyframes tui-sect-in {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes tui-ni-in {
  from { opacity: 0; transform: translate3d(10px, 0, 0); }
  to { opacity: 1; transform: none; }
}

html.tui-js body.tui .tui-popup-wrap .tui-popup {
  animation: tui-pop-in 0.32s var(--tui-ease-out) both;
}
body.tui .tui-popup-wrap { animation: tui-fade-in 0.28s var(--tui-ease-out) both; }
@keyframes tui-pop-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* Голос: штамп мягче, вспышка дольше гаснет. */
body.tui .tui-ni.is-voted { animation: tui-voted 0.6s var(--tui-ease-out); }
body.tui .tui-ni.is-voted::after { animation: tui-flash 1.1s var(--tui-ease-out) both; }
body.tui .tui-ni.is-voted .tui-okv { animation: tui-stamp 0.55s var(--tui-ease-spring) 0.1s both; }
body.tui .tui-ballot-row .tui-st.is-new { animation: tui-stamp 0.5s var(--tui-ease-spring) both; }
@keyframes tui-stamp {
  from { opacity: 0; transform: scale(1.8) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}
body.tui .tui-floater { animation-duration: 1.5s; animation-timing-function: var(--tui-ease-out); }
body.tui .toast { animation: tui-toast-in 0.4s var(--tui-ease-out) both; }
body.tui .toast.is-hiding { transition: opacity 0.35s var(--tui-ease-io), transform 0.35s var(--tui-ease-io); }

/* Ступенчатые эффекты — плавными: glitch и стыковка без «рывков» steps(). */
@keyframes tui-glitch-in {
  0% { opacity: 0; transform: translate3d(-8px, 0, 0) skewX(10deg); }
  40% { opacity: 1; transform: translate3d(4px, 0, 0) skewX(-5deg); }
  70% { transform: translate3d(-1.5px, 0, 0) skewX(2deg); }
  100% { opacity: 1; transform: none; }
}
body.tui .tui-side .tui-blk > .tui-crown-name.is-new-leader { animation: tui-glitch-in 0.7s var(--tui-ease-out) both; }
body.tui.tui-screen .is-revealed [data-screen-winner] { animation: tui-glitch-in 0.9s var(--tui-ease-out) both; }
body.tui .tui-dock-r { animation: tui-dock 1.1s var(--tui-ease-out) 0.1s both; }

/* Полоса прогресса и смена вкладок — мягче. */
body.tui .tui-meter.is-moving::after { animation: tui-meter 0.9s var(--tui-ease-out) both; }
body.tui .tui-vbtn::before,
body.tui .tui-tab::after { transition-timing-function: var(--tui-ease-out); transition-duration: 0.28s; }
body.tui .tui-blk { transition: border-color 0.4s var(--tui-ease-out), box-shadow 0.4s var(--tui-ease-out); }

/* FX: ВЫКЛ — космос замирает, метеоры не летают. */
html.tui-js body.tui.tui-fx-off :is(.tui-starlayer, .tui-twinkle) { animation: none; }
html.tui-js body.tui.tui-fx-off .tui-ship pre::after { animation: none; }
html.tui-js body.tui.tui-fx-off .tui-meteor { display: none; }
@media (prefers-reduced-motion: reduce) {
  body.tui .tui-meteor { display: none; }
  body.tui .tui-space-warp { transition: none; }
}

/* Reduced motion: задержки тоже, и без кроссфейда View Transitions (D3-16). */
@media (prefers-reduced-motion: reduce) {
  body.tui *,
  body.tui *::before,
  body.tui *::after { animation-delay: 0s !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  body.tui .tui-fx-layer { display: none; }
}
