/* ============================================================
 * Blood on the Clocktower — панель ведущего
 * Тема: тёмная готика (полночь / кровь / латунь свечей / пергамент)
 * Mobile-first. Стол по центру, панель ведущего — в центре стола.
 * ============================================================ */

/* Самохостинг Cinzel (готический акцент) — БЕЗ внешних запросов к Google Fonts.
   Провайдер режет внешние HTTPS (грабли #8), а render-blocking <link> на
   fonts.googleapis.com подвешивал ПЕРВУЮ отрисовку страницы на 5-6с.
   Шрифт лежит локально в assets/fonts → грузится с того же сервера, мгновенно.
   Кириллицы у Cinzel нет — русские заголовки штатно берут Georgia/serif. */
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("assets/fonts/cinzel-latin.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: "Cinzel";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("assets/fonts/cinzel-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Поверхности */
  --bg: #0a0a11;
  --surface: #15131f;
  --surface-2: #1e1a2b;
  --surface-3: #272138;
  --inset: #100e18;
  --felt: #1c1226;
  --felt-edge: #0a070f;

  /* Пергамент (текст) */
  --ink: #ece4d2;
  --ink-2: #cabfa6;
  --ink-dim: #9a8f78;

  /* Акценты */
  --blood: #a51226;
  --blood-2: #c81b32;
  --blood-bright: #e83349;
  --gold: #c7a14a;
  --gold-soft: #e8d191;
  --town: #6ea2ef;
  --evil: #e8485c;

  --border: #2f2a44;
  --border-soft: #251f37;
  --gold-line: rgba(199, 161, 74, .34);
  --ring: #c7a14a;

  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  /* Тело — системный шрифт ОС (на телефоне = родной шрифт системы): мгновенно,
     без внешних запросов. Inter не тащим — на throttled-сети он только тормозил. */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-gold: 0 0 0 1px var(--gold-line), 0 8px 26px rgba(0, 0, 0, .55);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 50% -8%, rgba(165, 18, 38, .22), transparent 60%),
    radial-gradient(900px 700px at 80% 110%, rgba(80, 50, 120, .16), transparent 60%),
    linear-gradient(180deg, #0c0a14 0%, var(--bg) 60%);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.muted { color: var(--ink-dim); }
.small { font-size: 12.5px; }
.text-center { text-align: center; }
.error { color: #ff8a7a; font-size: 14px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .5px;
  line-height: 1.2;
  color: var(--ink);
}

a { color: var(--gold-soft); }

::selection { background: rgba(199, 161, 74, .35); color: #fff; }

/* Focus visibility (accessibility) */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.screen {
  min-height: 100dvh;
  padding: calc(14px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
  max-width: 1280px;
  margin: 0 auto;
}

/* ---------- Panels / cards ---------- */
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .015), transparent 30%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Auth / room-select / cabinet ---------- */
.auth-card {
  max-width: 440px;
  margin: 6vh auto 18px;
  border-top: 2px solid var(--gold-line);
}
.auth-card h1 {
  margin: 0 0 2px;
  font-size: clamp(22px, 6vw, 30px);
  text-align: center;
  text-shadow: 0 2px 18px rgba(165, 18, 38, .4);
}
.auth-card > .muted { text-align: center; }

/* TPI compliance: скромная строка о неофициальности (низ экрана входа).
   Статична в потоке (не fixed) — не перекрывает кнопки на любой ширине. */
.footer-disclaimer {
  max-width: 440px;
  margin: 14px auto 0;
  padding: 0 10px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.45;
  opacity: .8;
}

/* TPI compliance: сворачиваемый блок «Права» (credits). Приглушённый, мелкий,
   статичен в потоке под футером — с интерфейсом не конкурирует. */
.legal-block {
  max-width: 440px;
  margin: 8px auto 0;
  padding: 0 10px 6px;
  color: var(--ink-dim);
  font-size: 12px;
  line-height: 1.5;
}
.legal-block > summary {
  cursor: pointer;
  text-align: center;
  padding: 4px 0;
  opacity: .8;
}
.legal-block > summary:hover { color: var(--gold-soft); }
.legal-block p { margin: 8px 0 0; }
.legal-block a { color: var(--gold-soft); text-decoration: underline; }
.legal-version { opacity: .7; }

/* Официальный бейдж Community Created Content (селф-хостится в assets/community);
   клик → страница политики. Графика TPI — не оборачиваем в рамку/подложку. */
.ccc-badge {
  display: block;
  margin: 10px auto 2px;
  text-align: center;
  text-decoration: none !important;
}
.ccc-badge .ccc-badge-img {
  display: block;
  width: 220px;
  max-width: 80%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-sm);
}
.ccc-badge:hover .ccc-badge-img { filter: brightness(1.08); }
.ccc-badge .ccc-badge-sub {
  display: block;
  color: var(--ink-dim);
  font-size: 11px;
  margin-top: 4px;
}

.tabs { display: flex; gap: 6px; margin: 16px 0; }
.tab {
  flex: 1;
  min-height: 44px;
  background: var(--surface-2);
  color: var(--ink-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.tab.active {
  color: var(--ink);
  border-color: var(--gold-line);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  box-shadow: inset 0 0 0 1px rgba(199, 161, 74, .15);
}
/* Разделы кабинета (2026-09-27): четыре вкладки в ряд, на узком экране переносятся. */
.cab-tabs { flex-wrap: wrap; margin-bottom: 0; }
.cab-tabs .tab { min-width: 72px; padding: 0 6px; font-size: 13px; }
/* Два входа в конструктор: «Создать сценарий» и «уникальный» (пока «скоро»). */
.cab-script-entries { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.cab-script-entries button { flex: 1 1 220px; }
.cab-script-entries button:disabled { opacity: .55; cursor: not-allowed; }

label, .field-label {
  display: block;
  margin: 12px 0 5px;
  font-size: 13px;
  letter-spacing: .2px;
  color: var(--ink-2);
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--ink);
  font-size: 16px; /* >=16px: предотвращает авто-зум iOS */
  font-family: var(--font-body);
}
input::placeholder { color: #6f6782; }
input:focus, select:focus { border-color: var(--gold-line); outline: none; box-shadow: 0 0 0 3px rgba(199, 161, 74, .14); }
input[type="range"] { min-height: 0; padding: 0; accent-color: var(--blood-2); }
input[type="number"] { width: 96px; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--gold); }
/* Радиокнопки — как флажки: иначе общий стиль полей растягивал их на всю ширину
   («Да / Нет» в форме информации игроку, 2026-10-09). */
input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--gold); }

/* ---------- Buttons ---------- */
button {
  min-height: 44px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14.5px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: transform .12s, filter .15s, border-color .15s, background .15s;
  touch-action: manipulation;
}
button:hover { filter: brightness(1.12); border-color: var(--gold-line); }
button:active { transform: scale(.97); }

button.primary {
  background: linear-gradient(180deg, var(--blood-2), var(--blood));
  border-color: #6e0f1d;
  color: #fff5ef;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(165, 18, 38, .35);
}
button.primary:hover { filter: brightness(1.08); }
button.big { width: 100%; margin-top: 16px; min-height: 50px; font-size: 16px; }
button.ghost { background: transparent; color: var(--ink-2); }
button.ghost:hover { background: rgba(255, 255, 255, .04); }
button.danger {
  background: linear-gradient(180deg, #4a1620, #38101a);
  border-color: #6e2230;
  color: #ffd9d2;
}
button:disabled { opacity: .42; cursor: not-allowed; transform: none; filter: none; }

.row { display: flex; gap: 8px; margin: 10px 0; align-items: center; flex-wrap: wrap; }
/* Кнопки в ряду делят ширину, но НЕ сжимаются до нечитаемого: `min-width: 0` позволял
   тексту вылезать за границы, и на телефоне подписи налезали друг на друга — «Раздать
   оставшиеся» и «Отменить раздачу» в панели розыгрыша (жалоба владельца 2026-09-21 п.1).
   Теперь у кнопки есть минимальная ширина: не влезли — переносятся на новую строку. */
.row button { flex: 1 1 auto; min-width: 150px; white-space: normal; }
.row input { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input { width: auto; }

details > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--gold-soft);
  padding: 6px 0;
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--gold); }
details[open] > summary::before { content: "▾ "; }

/* Разделы выбора режима игры в лобби (онлайн / гримуар) — открыт ровно один. */
.mode-section {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 4px 12px;
  margin: 10px 0;
}
.mode-section[open] {
  border-color: var(--gold);
  background: rgba(255, 215, 130, 0.04);
}
.mode-section > summary { font-size: 15px; }

/* Странники «с нуля» (2026-07-29): блок в модалке старта — стол больше состава игры */
.start-travellers {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 10px 0;
}
.start-travellers .trav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}
.start-travellers .trav-row select { flex: 1 1 130px; min-width: 110px; }
.start-travellers .trav-row .ghost { flex: 0 0 auto; }

hr { border: none; border-top: 1px solid var(--border-soft); margin: 14px 0; }

/* ---------- Room header ---------- */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
}
.room-code-block, .room-status-block, .room-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.room-code {
  font-family: var(--font-display);
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold-soft);
  text-shadow: 0 0 16px rgba(199, 161, 74, .35);
}
.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  white-space: nowrap;
}
#gamePhaseBadge { border-color: var(--gold-line); color: var(--gold-soft); }
#observerBadge { border-color: var(--blood); color: #ffb3a8; }

/* ---------- Room layout (single column, mobile-first) ---------- */
.room-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}

/* «Ещё» сверху (вынесено из центра) + подсказка под столом */
.more-bar {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}
.more-bar > summary { color: var(--ink-dim); font-size: 13px; }
.more-bar .row { margin: 8px 0 4px; }
.table-hint { text-align: center; margin: 0; opacity: .75; }

/* ---------- The table ---------- */
.board {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 20px auto 46px; /* запас сверху/снизу под жетоны, вылезающие за круг */
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  padding: 0;
  background:
    radial-gradient(circle at 50% 42%, #2a1733 0%, var(--felt) 46%, var(--felt-edge) 100%);
  border: 1px solid rgba(199, 161, 74, .22);
  box-shadow:
    inset 0 0 0 2px rgba(199, 161, 74, .12),
    inset 0 0 60px rgba(0, 0, 0, .6),
    0 18px 50px rgba(0, 0, 0, .55);
  overflow: visible;
}
/* тонкое латунное кольцо-«циферблат» */
.board::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 1px dashed rgba(199, 161, 74, .18);
  pointer-events: none;
}
.circle-board { position: absolute; inset: 0; }

/* ===== Жетоны-гримуар: пергаментный диск + иконка роли ===== */
.seat-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(62px, 18vw, 94px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  z-index: 2;
  transition: transform .12s;
}

/* 1.3j: много игроков — стол вытягивается по ВЕРТИКАЛИ (JS ставит aspect-ratio по
   числу мест: мобильный экран узкий, растём вниз — страница скроллится), а жетоны
   и подписи слегка ужимаются, чтобы текст не накладывался. */
.board.dense .seat-node { width: clamp(56px, 14vw, 80px); }
.board.dense .token { width: clamp(48px, 12.5vw, 68px); }
.board.dense .token-name { font-size: 10.5px; max-width: clamp(56px, 14vw, 80px); }
.board.dense .token-meta { font-size: 9px; max-width: clamp(56px, 14vw, 80px); }
.board.xdense .seat-node { width: clamp(50px, 12vw, 72px); }
.board.xdense .token { width: clamp(44px, 11vw, 60px); }
.board.xdense .token-name { max-width: clamp(50px, 12vw, 72px); }
.board.xdense .token-meta { max-width: clamp(50px, 12vw, 72px); }
.seat-node:active { transform: translate(-50%, -50%) scale(.93); }

/* пергаментный диск */
.token {
  position: relative;
  width: clamp(54px, 15.5vw, 80px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 30%, #f1e5c6 0%, #e4d0a1 52%, #cbb079 80%, #a98a55 100%);
  border: 2px solid rgba(120, 92, 48, .72);
  box-shadow:
    inset 0 2px 6px rgba(255, 248, 224, .5),
    inset 0 -7px 13px rgba(110, 80, 38, .38),
    0 4px 11px rgba(0, 0, 0, .55);
  transition: box-shadow .15s, border-color .15s, filter .15s;
}
.token.town { box-shadow: inset 0 2px 6px rgba(255,248,224,.5), inset 0 -7px 13px rgba(110,80,38,.38), 0 0 0 2px rgba(110,162,239,.5), 0 4px 11px rgba(0,0,0,.5); }
.token.evil { box-shadow: inset 0 2px 6px rgba(255,248,224,.5), inset 0 -7px 13px rgba(110,80,38,.38), 0 0 0 2px rgba(206,42,58,.62), 0 4px 13px rgba(120,10,20,.45); }
.seat-node:hover .token { filter: brightness(1.06); }
.token.dead { filter: grayscale(.7) brightness(.78); }

.token-icon { width: 72%; height: 72%; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); pointer-events: none; }
.token-num { font-family: var(--font-display); font-size: clamp(17px, 5vw, 25px); font-weight: 700; color: #6e5430; }
.token-dead {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 28px; color: rgba(150, 16, 28, .92); text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
/* мини-значок (напр. Пьяница) в углу жетона */
.token-badge {
  position: absolute;
  right: -3px; bottom: -3px;
  width: 42%; height: 42%;
  object-fit: contain;
  background: radial-gradient(circle at 40% 35%, #f1e5c6, #cbb079);
  border: 1.5px solid rgba(120, 92, 48, .85);
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .55);
}
/* №13/№14 (батч 1.3): несколько мини-жетонов на роли — второй уходит влево */
.token-badge.pos1 { right: auto; left: -3px; }
/* №8 (батч C): третий жетон — вверх-вправо (раньше накрывал первый → виден 2 из 3) */
.token-badge.pos2 { bottom: auto; top: -3px; }
.token-badge.pos3 { right: auto; left: -3px; bottom: auto; top: -3px; }
/* 5-й и 6-й жетоны (Вор/Чиновник добавились 2026-08-04) — по бокам, по центру */
.token-badge.pos4 { right: -5px; bottom: auto; top: 50%; transform: translateY(-50%); }
.token-badge.pos5 { right: auto; left: -5px; bottom: auto; top: 50%; transform: translateY(-50%); }
/* №14: отметка Лжедемона — мини-жетон Гадалки с красной каймой (оф. стиль reminder) */
.token-badge.rh { border-color: #d9534f; box-shadow: 0 0 0 1.5px rgba(217, 83, 79, .6), 0 2px 5px rgba(0, 0, 0, .55); }
/* Защита Монаха («Protected») — мини-жетон Монаха с синей каймой */
.token-badge.mp { border-color: #5b9bd5; box-shadow: 0 0 0 1.5px rgba(91, 155, 213, .6), 0 2px 5px rgba(0, 0, 0, .55); }
/* №13: «способность потрачена» — текстовый мини-жетон 🚫 */
.token-badge.txt {
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
}
/* Двухсимвольные жетоны-числа (Вор −1 / Чиновник ×3): мельче и жирнее, чтобы влезали */
.token-badge.txt.num {
  font-size: 10px;
  font-weight: 700;
  color: #2a2010;
  letter-spacing: -0.5px;
}

/* №19 (батч E): плавающая панель действий превью гримуара (стол — настоящий) */
.preview-bar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 180;               /* ниже модалок (200), выше стола */
  width: min(92vw, 520px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(16, 18, 28, 0.97);
  border: 1px solid rgba(231, 201, 106, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.preview-bar .row { justify-content: center; }
.preview-bar .row button { flex: 1; }

/* Таймер дня (фича 2026-07-27) — «часовая башня»: круглый циферблат под фазой */
.day-timer { margin: 8px 0 2px; }

/* --- Настройка: пресеты минут + свой ввод --- */
.clock-setup { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 8px; }
.clock-presets { display: inline-flex; gap: 6px; }
.preset-chip {
  min-width: 40px; min-height: 40px; padding: 0 10px;
  background: rgba(20, 22, 32, 0.7); color: #f1e5c6;
  border: 1px solid rgba(231, 201, 106, 0.35); border-radius: 999px;
  font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.preset-chip:hover { background: rgba(231, 201, 106, 0.16); border-color: rgba(231, 201, 106, 0.7); }
.preset-chip:active { transform: scale(0.94); }
.clock-custom { display: inline-flex; align-items: center; gap: 6px; }
.clock-custom input {
  width: 62px; min-height: 40px; text-align: center; font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* --- Идёт отсчёт: SVG-циферблат с убывающим золотым кольцом --- */
.clock-timer { position: relative; width: 128px; height: 128px; margin: 6px auto 2px; }
.clock-face { width: 100%; height: 100%; transform: rotate(-90deg); }  /* старт кольца — 12 часов */
.clock-track { fill: rgba(18, 20, 30, 0.9); stroke: rgba(255, 255, 255, 0.10); stroke-width: 5; }
.clock-progress {
  fill: none; stroke: #e7c96a; stroke-width: 6; stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(231, 201, 106, 0.5));
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.clock-tick { stroke: rgba(231, 201, 106, 0.45); stroke-width: 2; }
.clock-tick.major { stroke: rgba(231, 201, 106, 0.9); stroke-width: 3; }
.clock-timer.warn .clock-progress { stroke: #ff6b61; filter: drop-shadow(0 0 4px rgba(255, 107, 97, 0.6)); animation: clockPulse 1s ease-in-out infinite; }
.clock-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.clock-time {
  font-size: 27px; font-weight: 700; letter-spacing: 1px;
  font-variant-numeric: tabular-nums;   /* цифры не «прыгают» при отсчёте */
  color: #f1e5c6;
}
.clock-timer.warn .clock-time { color: #ff9d96; }
.clock-paused { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.clock-cancel {
  position: absolute; top: -2px; right: -2px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18, 20, 30, 0.92); color: #b9bcc9;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 50%;
  cursor: pointer; font-size: 13px; line-height: 1;
}
.clock-cancel:hover { color: #ff9d96; border-color: rgba(255, 157, 150, 0.5); }
@keyframes clockPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .clock-timer.warn .clock-progress { animation: none; } }

/* №6 (батч E): режим «стрелки» — активная кнопка + подсветка стола */
#arrowsModeBtn.active { background: #c9a24a; color: #12131a; border-color: #c9a24a; }
.circle-board.arrows-mode { outline: 2px dashed rgba(231, 201, 106, .5); outline-offset: 4px; border-radius: 12px; }

/* №16: SVG-слой стрелок гримуара (наведение на жетон) */
#arrowsOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

.seat-node.queue-current .token {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(199, 161, 74, .8), inset 0 -7px 13px rgba(110, 80, 38, .38);
}
.seat-node.queue-pending .token { border-color: var(--blood-2); }
.seat-node.empty { opacity: .5; cursor: default; }
.seat-node.empty .token { background: rgba(230, 210, 170, .1); border-style: dashed; box-shadow: none; }
.seat-node.empty .token-num { color: var(--ink-dim); }

/* подпись под жетоном (имя + место·роль) */
.token-cap { text-align: center; max-width: 100%; line-height: 1.16; }
.token-name {
  font-weight: 600; font-size: 11.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: clamp(62px, 18vw, 94px);
}
.token-meta {
  font-size: 10px; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: clamp(62px, 18vw, 94px);
}

/* ---------- Центр стола: панель ведущего ---------- */
.table-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(164px, 52%, 268px);
  max-height: 62%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(40, 33, 56, .96), rgba(21, 19, 31, .98));
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(2px);
  z-index: 3;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-line) transparent;
}
.hub-phase { text-align: center; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); margin-bottom: 8px; }
.hub-phase h2 { margin: 0; font-size: clamp(16px, 4.5vw, 21px); color: var(--gold-soft); }
.hub-phase .stats { font-size: 12px; color: var(--ink-dim); margin-top: 3px; }
#centerSubtitle { margin: 2px 0 0; font-size: 13px; }

.host-controls { font-size: 13.5px; }
.host-controls h2 { font-size: 16px; margin: 4px 0 8px; }
.host-controls h3 { font-size: 13.5px; margin: 12px 0 5px; color: var(--gold-soft); }
.host-controls .row { margin: 8px 0; }
.host-controls .row button { min-height: 42px; font-size: 13px; padding: 8px 10px; }
.host-controls .muted.small { line-height: 1.45; }

/* ---------- Night banner ---------- */
.night-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: var(--gold-line);
  background: linear-gradient(90deg, rgba(40, 23, 51, .9), var(--surface));
}
#nightQueueText { font-size: 14.5px; }
#nightQueueText b { color: var(--gold-soft); }

/* ---------- Timeline / logs (снизу) ---------- */
.timeline-header { display: flex; justify-content: space-between; align-items: center; gap: 8px;
                   flex-wrap: wrap; }   /* иначе значок голосования раздвигал экран телефона: окна шире экрана */
.timeline-header h2 { margin: 0; font-size: 17px; }
#openVoteBadge.badge { font-size: 12px; }
.events-list {
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 10px;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.event-item { padding: 7px 9px; border-bottom: 1px solid var(--border-soft); border-radius: 6px; }
.event-item:hover { background: rgba(255, 255, 255, .02); }
.event-item .ts { color: var(--ink-dim); font-size: 11px; margin-right: 7px; font-variant-numeric: tabular-nums; }
.event-item.chat-event { color: var(--gold-soft); background: rgba(199, 161, 74, .06); font-style: italic; }

.observer-box {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 8px 0;
  font-size: 13px;
  white-space: pre-wrap;
}

/* unseated chips */
#unseatedList { display: flex; flex-wrap: wrap; gap: 6px; }
#unseatedList button { flex: 0 0 auto; min-height: 38px; }

/* vote host rows */
.vote-host-row { display: flex; gap: 6px; align-items: center; padding: 5px 0; }
.vote-host-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vote-host-row button { flex: 0 0 auto; min-height: 38px; padding: 6px 12px; }

/* admin room list rows */
.admin-room-item { cursor: pointer; }
.admin-room-item:hover { border-color: var(--gold-line); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 10, .72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 14px;
  animation: fade .18s ease-out;
}
.modal {
  width: 440px;
  max-width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  border-top: 2px solid var(--gold-line);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: 640px; }
.modal h2 { margin-top: 0; }
.modal-close { width: 100%; margin-top: 12px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.seat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 10px 0;
}
.seat-grid button { padding: 0; min-height: 46px; }
.seat-grid button.occupied { border-color: var(--blood-2); }

.roles-list { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; max-height: 50vh; overflow-y: auto; }
.role-row {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  gap: 8px;
  align-items: center;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
}
.role-row .seat-n { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.role-row select { min-height: 40px; padding: 6px; font-size: 14px; }

.valid-ok { color: #87e0ac; }
.valid-bad { color: #ff9d96; }
/* П7.6: джинкс — предупреждение (не ошибка): жёлтый, старт не блокирует */
.valid-warn { color: #e7c96a; margin-top: 4px; }

/* №2 (батч 1.3): подсветка игроков выбранной категории на экране старта */
.role-row.hl {
  border-color: #e7c96a;
  box-shadow: 0 0 0 2px rgba(231, 201, 106, 0.35);
  background: rgba(231, 201, 106, 0.12);
}
.setup-cat.hl { text-decoration: underline; filter: brightness(1.25); }
/* Галочка «кому какая роль» выключена → столбец игроков недоступен */
.no-assign .player-col { opacity: 0.3; pointer-events: none; }
.checkbox-line {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0; cursor: pointer; font-size: 14px;
}
.checkbox-line input[type="checkbox"] { width: auto; min-height: auto; }

/* ---------- Toast ---------- */
/* Уведомление сверху (под шапкой комнаты): не закрывает кнопки внизу (2026-10-09). */
.toast.toast-top { top: 64px; bottom: auto; }
.toast {
  position: fixed;
  bottom: calc(22px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  padding: 12px 22px;
  z-index: 300;
  font-size: 14px;
  box-shadow: var(--shadow);
  max-width: 92vw;
  text-align: center;
}

/* ---------- Scrollbars (webkit) ---------- */
.events-list::-webkit-scrollbar, .table-hub::-webkit-scrollbar, .roles-list::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; }
.events-list::-webkit-scrollbar-thumb, .table-hub::-webkit-scrollbar-thumb, .roles-list::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px;
}
.table-hub::-webkit-scrollbar-thumb { background: var(--gold-line); }

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .room-layout { max-width: 1180px; }
  .board { max-width: 660px; }
  .events-list { max-height: 320px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
 * Переключатель языка RU/EN (i18n) — фиксированный, верхний правый угол.
 * ============================================================ */
.lang-toggle {
  position: fixed;
  top: 8px;
  right: 8px;
  /* №2 (батч D): ниже модалок (backdrop z-index 200) — раньше 1000 перекрывал их. */
  z-index: 150;
  display: flex;
  gap: 2px;
  background: rgba(10, 11, 18, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 2px;
}
/* №2 (батч D): на телефоне переключатель НЕ висит поверх всего и не едет при
   прокрутке — уходит в поток вверху страницы (absolute), не мешает игре. */
@media (max-width: 768px) {
  .lang-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0.85;
  }
}
.lang-btn {
  background: transparent;
  border: none;
  color: #b9bcc9;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 34px;
}
.lang-btn.active {
  background: #c9a24a;
  color: #12131a;
}

/* ---------- Странники: +место во время игры ---------- */
.traveller-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.traveller-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
}
.traveller-option img {
  width: 64px;
  height: 64px;
}
.traveller-chosen {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 6px;
}
.traveller-chosen-icon {
  width: 40px;
  height: 40px;
}
.traveller-neighbors {
  align-items: flex-end;
}
.traveller-neighbor {
  flex: 1;
  min-width: 0;
}
.traveller-neighbor select,
.traveller-neighbor input {
  width: 100%;
}

/* ---------- Кнопки мест в шапке (лобби) ---------- */
.header-seats {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-seats button {
  padding: 4px 12px;
}

/* Баннер текущего шага — в центре стола, под фазой */
.table-hub .night-banner {
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

/* Обучалка ведущего (2026-08-07): разделы-аккордеон внутри модалки */
.guide-section {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 6px 12px;
  margin: 8px 0;
}
.guide-section[open] { border-color: var(--gold); background: rgba(255, 215, 130, 0.04); }
.guide-section > summary { font-size: 15px; cursor: pointer; padding: 4px 0; }
.guide-section ul { margin: 6px 0 10px; padding-left: 18px; }
.guide-section li { margin: 6px 0; line-height: 1.5; }

/* Справочник ведущего — выдвижная панель СБОКУ (2026-08-07). Ведущий читает шаг и тут
   же нажимает кнопки страницы, поэтому это НЕ модалка: подложки нет, клики проходят. */
.guide-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 190;                /* ниже модалок (200), выше стола */
  width: 40px;
  min-height: 64px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border: 1px solid var(--gold-line);
  border-right: none;
  border-radius: 12px 0 0 12px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  color: var(--ink);
  cursor: pointer;
  box-shadow: -4px 0 16px rgba(0, 0, 0, .45);
}
.guide-tab:hover { color: var(--gold-soft); }
.guide-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 195;
  width: min(94vw, 400px);
  overflow-y: auto;
  padding: calc(12px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
  background: var(--surface);
  border-left: 1px solid var(--gold-line);
  box-shadow: -10px 0 34px rgba(0, 0, 0, .6);
  -webkit-overflow-scrolling: touch;
}
.guide-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.guide-drawer-head h3 { margin: 0; font-size: 17px; }
/* Панель открыта → «язычок» уезжает вместе с ней, чтобы не наезжать на текст */
body.guide-open .guide-tab { right: min(94vw, 400px); }
/* Кнопка справочника в шапке — шире цифр языка, чтобы эмодзи не жалось */
.guide-btn-top { font-size: 15px; padding-left: 8px; padding-right: 8px; }
/* Телефон: боковой «язычок» убираем совсем — он наезжал на стол (жалоба 2026-08-11).
   Справочник открывается кнопкой 📖 рядом с переключателем языка. */
@media (max-width: 520px) {
  /* Телефон: кнопки ряда занимают всю ширину — подписи не режутся и не наезжают. */
  .row button { flex: 1 1 100%; min-width: 0; }
}

@media (max-width: 820px) {
  .guide-tab { display: none; }
  .guide-drawer { width: 100vw; max-width: 100vw; }
}
/* Бейдж тренировочной комнаты в шапке (партия не идёт в статистику) */
.badge.training { background: rgba(199, 161, 74, .16); border-color: var(--gold-line); color: var(--gold-soft); }

/* Срочные решения рассказчика (Star Pass, отскок Мэра, выстрел Истребителя, Козёл,
   Девственница, Стрелок, ожидание Шпиона). Пока они не решены, игра стоит — поэтому
   панель должна бросаться в глаза, а не теряться среди прочих блоков (2026-08-08). */
.urgent-panel {
  border: 1px solid var(--blood-2);
  border-left: 3px solid var(--blood-bright);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(165, 18, 38, .14), rgba(165, 18, 38, .05));
  box-shadow: 0 0 0 1px rgba(232, 51, 73, .12), 0 6px 18px rgba(0, 0, 0, .4);
  padding: 10px 12px;
  margin: 10px 0;
}
.urgent-panel .field-label { margin-top: 0; color: var(--ink); font-weight: 600; }

/* Список целей в срочной панели — как в панели отскока Мэра (владелец: «у мэра всё
   выглядит красиво»): кнопки по ширине текста, перенос строк внутри кнопки, а на узком
   экране каждая занимает строку целиком. Жёсткая сетка с колонкой в 150px рвала длинные
   подписи («№12 ☠ Игрок 12 (Заклинатель змей)») и текст вылезал за кнопку. */
/* Выборы Демонов в панели смертей Яги (2026-09-05 п.3): ведущий видит их сразу,
   не спускаясь в лог событий. */
.ph-choices { margin: 6px 0 0; padding-left: 18px; }
.ph-choices li { margin: 2px 0; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pick-grid button {
  flex: 0 1 auto;
  max-width: 100%;
  min-height: 40px;
  height: auto;
  padding: 8px 12px;
  text-align: left;
  white-space: normal;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (max-width: 560px) {
  .pick-grid button { flex: 1 1 100%; }
}

/* Розыгрыш ролей (2026-09-07): выбор набора ролей и панель раздачи жетонов. */
.start-mode-row { gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.start-mode-row button { flex: 1 1 240px; }
.role-group-title { margin: 10px 0 4px; font-weight: 600; opacity: .85; }
/* Заголовок ИЗДАНИЯ в наборе ролей микса (2026-09-20): роли группируются
   «издание → команда», иначе в списке из 57 штук не сориентироваться. */

/* Сворачиваемая группа ролей (просьба владельца 2026-09-21): заголовок — кнопка на всю
   ширину, чтобы на телефоне не прокручивать весь список Горожан до Изгоев. */
.role-group { margin: 0 0 6px; }
.role-group .group-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left; background: none; border: 0; padding: 6px 0;
  cursor: pointer; font: inherit; color: inherit;
}
.role-group .group-caret { opacity: .7; width: 1em; }
.role-group .group-body { padding-left: 2px; }

.role-edition-title {
  margin: 16px 0 2px;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold, #d8b25a);
  border-bottom: 1px solid var(--gold-line, rgba(199, 161, 74, .34));
  padding-bottom: 3px;
}
.role-edition-title:first-child { margin-top: 4px; }
.draft-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 10px; }
.draft-roles .checkbox-line { margin: 0; }
.draft-role span { font-size: 14px; }
/* Роль «в раздачу от N игроков» при меньшем числе игроков — серая (2026-10-06). */
.draft-role-off { opacity: 0.5; }
.draft-role-off input:disabled { cursor: not-allowed; }
#roleDraftTokens .draft-token-taken { opacity: .75; }
#roleDraftTokens .draft-token-free { border-style: dashed; }
.draft-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.draft-give { display: inline-flex; gap: 6px; align-items: center; }
.draft-give select { max-width: 220px; }

/* 💬 Личный чат ведущего с игроком (модалка места, 2026-09-19).
   Лента прокручивается внутри себя — модалка не разъезжается на длинной переписке. */
.chat-log {
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  margin: 6px 0;
  border: 1px solid var(--line, #2a2a3a);
  border-radius: 8px;
  background: rgba(0, 0, 0, .18);
  font-size: 13px;
}
.chat-line { margin-bottom: 8px; line-height: 1.35; }
.chat-line:last-child { margin-bottom: 0; }
.chat-line .chat-who { font-weight: 600; }
.chat-line.from-host .chat-who { color: var(--gold, #d8b25a); }
.chat-line.from-player .chat-who { color: var(--accent, #7fb2ff); }
.chat-line .chat-time { opacity: .55; font-size: 11px; }

/* Бейдж «Джинн» в шапке комнаты: обе роли джинкса в партии — у ведущего особое правило. */
.badge.jinx {
  background: rgba(120, 90, 200, 0.22);
  border: 1px solid rgba(160, 130, 240, 0.55);
  color: #d8ccff;
  cursor: pointer;
}

/* 🎭 Роли-шаблоны ночью (docs/role-templates/): пункт на носителя и блок. */
.template-steps { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.tpl-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
            background: var(--surface-2); }
.tpl-item.tpl-done, .tpl-item.tpl-skipped { opacity: .7; }
.tpl-item .row { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tpl-item .tpl-hints button { font-size: 13px; }
.tpl-warn { display: inline-block; font-size: 12px; margin-right: 6px; color: var(--ink); }
.tpl-choice { display: block; margin: 4px 0; }

/* 🎭 Правки 2026-09-28: баннер ведёт ночь, окно пункта, плашки маркеров на жетонах. */
.night-banner { flex-wrap: wrap; }
.nb-sub { flex-basis: 100%; color: var(--ink-2); line-height: 1.5; }
.nb-sub a { color: var(--gold-soft); margin-left: 6px; }
.ns-line { padding: 1px 4px; border-radius: 4px; }
.ns-line.ns-click { cursor: pointer; }
.ns-line.ns-click:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.ns-line.ns-current { color: var(--ink); }
.tpl-ability { white-space: normal; }
.tpl-warns { margin: 6px 0; }
.tpl-step-list { margin: 4px 0 8px; }
.tpl-step-line { font-size: 13px; padding: 2px 0; color: var(--ink-2); }
.tpl-step-line.cur { color: var(--gold-soft); font-weight: 600; }
.tpl-step-line.passed { color: var(--ink); }
.tpl-item-form { margin: 6px 0; }
/* 🎴 Карточка побудки: блок, слепок Telegram, подсказка из Гримуара (батч 2026-10-05). */
.tpl-card-block { margin: 6px 0 2px; }
.tpl-tg { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 8px; background: rgba(42, 171, 238, .06); }
.tpl-tg-msg { margin: 4px 0; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); white-space: normal; line-height: 1.45; }
.tpl-tg-btns { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.tpl-tg-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tpl-tg-btn { flex: 1 1 auto; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-soft); text-align: center; font-size: 13px; }
.tpl-info-ctx, .tpl-info-hint { margin: 4px 0; white-space: normal; }
.tpl-grim-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
button.tpl-hint-big:disabled { opacity: .55; cursor: default; }
.tpl-item-actions { flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tpl-quick { flex-wrap: wrap; gap: 8px; }
button.tpl-quick-btn { min-width: 64px; min-height: 44px; font-size: 16px; }
.tpl-more { margin-top: 8px; }
.tpl-hint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 6px 0; }
button.tpl-hint-big { min-height: 44px; font-size: 14.5px; text-align: left; }
.tpl-auto { white-space: normal; border-color: var(--gold-line); }
.tpl-auto.undone { opacity: .6; }
.tpl-report-row { padding: 4px 0; border-bottom: 1px solid var(--border-soft); white-space: normal; }
.tpl-report { white-space: normal; }
/* Мини-жетон маркера роли-шаблона: иконка источника + короткая подпись под ней. */
.token-badge.tplm { display: flex; align-items: center; justify-content: center; overflow: visible; }
.token-badge.tplm img { width: 100%; height: 100%; object-fit: contain; }
.token-badge.tplm .tplm-glyph { font-size: 12px; line-height: 1; }
.token-badge.tplm .tplm-cap {
  /* Подпись — внутри мини-жетона, по нижнему краю: под жетоном она налезала на имя игрока. */
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  font-size: 7.5px; line-height: 1; white-space: nowrap; padding: 1px 2px; border-radius: 3px;
  background: rgba(20, 14, 8, .82); color: #f1e5c6; pointer-events: none;
}
.token-badge.tplm.pending { opacity: .55; border-style: dashed; }
.token-badge.pos6 { right: auto; left: 50%; bottom: auto; top: -8px; transform: translateX(-50%); }
.token-badge.pos7 { right: auto; left: 50%; bottom: -8px; transform: translateX(-50%); }
.token-badge.pos8 { right: -14px; bottom: auto; top: 10%; }
.token-badge.pos9 { right: auto; left: -14px; bottom: auto; top: 10%; }

/* 🎭 Сработавшие способности (фаза 3): заметки маркеров под списком. */
.tpl-notes { margin-top: 8px; padding: 6px 8px; border-left: 3px solid var(--accent, #c9a227); }

/* 🎭 Конструктор ролей-шаблонов и уникальных сценариев (фаза 4). */
.topline .modal-close, .row .modal-close { width: auto; margin-top: 0; }
.tpl-ed-section { border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 10px; }
.tpl-ed-section > summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
.tpl-ed-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tpl-ed-grid { display: grid; grid-template-columns: 170px 1fr; gap: 6px; align-items: center; margin: 4px 0; }
.tpl-ed-grid > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-ed-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px;
                margin: 8px 0; background: var(--surface-2); }
.tpl-ed-step { border-left: 3px solid var(--gold-line); padding-left: 8px; margin: 6px 0; }
.tpl-ed-hints { display: flex; flex-wrap: wrap; gap: 4px 12px; }
/* Кнопка блока и под ней — галочка «применять автоматически» (маркеры и статусы). */
.tpl-ed-hint { display: inline-flex; flex-direction: column; }
.tpl-ed-auto { font-size: 11.5px; color: var(--ink-2); margin-left: 18px; }
.tpl-ed .row { flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-ed label.chk { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; margin-right: 8px; }
.tpl-ed input[type="number"], .tpl-dist input { width: 64px; }
.tpl-ed button.small, .tpl-order-row button.small { font-size: 12px; padding: 2px 8px; }
.tpl-night-preview { margin-top: 4px; }
.tpl-role-row .row { flex-wrap: wrap; gap: 6px; }
.tpl-order { display: flex; flex-direction: column; gap: 4px; }
.tpl-order-row { display: flex; justify-content: space-between; align-items: center; gap: 8px;
                 padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
                 background: var(--surface-2); cursor: grab; }
.tpl-order-row.meta { cursor: default; border-style: dashed; background: transparent; }
.tpl-dist { border-collapse: collapse; margin: 6px 0; }
.tpl-dist th, .tpl-dist td { padding: 2px 4px; text-align: center; }
.tpl-holds { display: block; font-weight: 600; color: var(--gold-soft); }
.chooser-btn { width: 100%; margin-top: 10px; }
/* ➕ Добавить роли в окне уникального сценария: файл, текст про ИИ, ссылка на «Мои роли». */
.uscript-paths { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 4px 10px; margin: 8px 0; }
.uscript-paths[open] { border-color: var(--gold-line); }
.uscript-path { border-top: 1px solid var(--border-soft); padding: 8px 0; margin: 0; }
.uscript-paths > summary + .uscript-path { border-top: none; }
@media (max-width: 820px) {
  .tpl-ed-pair, .tpl-ed-grid { grid-template-columns: 1fr; }
}

/* 🎭 Подсказки полей редактора роли: строка под полем и «?» с примером (фаза 4, правки). */
.tpl-ed-row { margin: 4px 0 8px; }
.field-hint { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.tpl-help { display: inline-flex; align-items: center; justify-content: center; width: 16px;
            height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--gold-line);
            color: var(--gold-soft); font-size: 11px; cursor: help; position: relative;
            vertical-align: middle; }
.tpl-help:hover::after, .tpl-help:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; top: 120%; transform: translateX(-50%);
  z-index: 50; width: max-content; max-width: min(280px, 80vw); white-space: normal;
  padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-3);
  border: 1px solid var(--border); color: var(--ink); font-size: 12px; line-height: 1.35;
  box-shadow: var(--shadow); }
.tpl-ed-modes { margin-bottom: 8px; }
.tpl-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tpl-ed-mini { display: flex; justify-content: space-between; align-items: center; gap: 8px;
               padding: 4px 8px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
               margin: 4px 0; font-size: 13px; }
#roleImportAiText { width: 100%; font-size: 12px; }

/* 🎭 Роли по сценариям в статистике кабинета (2026-10-05): свёрнутый список на сценарий. */
.cab-roles { margin: 6px 0; }
.cab-roles > div { padding-left: 18px; }

/* 🎬 Сводка «Как это будет в игре» и 🔎 мастер проверки роли (батч 2026-10-05). */
.tpl-ed-summary { margin: 4px 0 10px; padding: 8px 10px; border: 1px solid var(--border-soft);
                  border-radius: var(--radius-sm); background: var(--inset); }
.tpl-ed-summary ul { margin: 4px 0 0; padding-left: 18px; }
.tpl-ed-summary li { margin: 2px 0; font-size: 13px; line-height: 1.35; }
.tpl-role-summary { margin: 2px 0 6px; line-height: 1.35; }
.tpl-ed-review { margin-left: 8px; }
/* Панель мастера «прилипает» к верху окна: ведущий правит поле ниже и видит пункт. */
.tpl-review { position: sticky; top: -1px; z-index: 20; margin: 0 0 10px; padding: 10px 12px;
              border: 1px solid var(--gold-line); border-radius: var(--radius-sm);
              background: var(--surface-3); box-shadow: var(--shadow); }
.tpl-review-head { font-weight: 600; color: var(--gold-soft); margin-bottom: 6px; }
.tpl-review-ability { font-style: italic; margin: 2px 0 8px; }
.tpl-review-item { font-size: 15px; margin: 6px 0; }
.tpl-review .row { flex-wrap: wrap; gap: 6px; }
/* Поле, которое просит исправить мастер. */
.tpl-field-focus { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: var(--radius-sm);
                   background: rgba(199, 161, 74, .08); }
.tpl-step-say { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 2px; }
/* «Ответить за игрока»: кого шаг не даёт выбрать — серым, с причиной (2026-10-07). */
.tpl-choice-off { opacity: 0.55; cursor: not-allowed; }

/* ---------- Закреплённые кнопки окон ведущего (2026-10-07) ----------
 * Кнопки действия внизу окна всегда видны, текст прокручивается над ними: на телефоне
 * (360–414) окно прокручивалось целиком, и до «Да» в мастере проверки было не долистать. */
.modal .modal-actions {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 12px -16px 0; padding: 10px 16px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 16px -12px rgba(0, 0, 0, .7);
}
.modal:has(> .modal-actions) { padding-bottom: 0; }
.modal-actions > .error, .modal-actions > p { flex: 1 0 100%; margin: 0; }
.modal-actions > .row, .modal-actions > div:not(.row) { flex: 1 1 100%; margin: 0; }
.modal-actions > div:empty { display: none; }
.modal-actions .row { margin: 0; gap: 8px; }
.modal-actions .row button { min-width: 96px; }
.modal-actions > .modal-close { width: auto; margin: 0 0 0 auto; }
.tpl-review-bar .error { margin: 0 0 6px; }

/* Мастер проверки: длинный текст свёрнут до 4 строк. */
.clamp4 { display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.clamp4.open { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
.clamp-toggle { background: none; border: 0; padding: 0; margin: 0 0 6px; color: var(--gold-soft);
                font-size: 13px; text-decoration: underline; cursor: pointer; width: auto; min-width: 0; }
.tpl-review-warn { color: var(--gold-soft); }
.tpl-role-warn-list { margin: 4px 0 6px; }
.tpl-role-warns { padding: 2px 8px; }
.tpl-review-bar-head { font-size: 12.5px; color: var(--gold-soft); margin: 0 0 6px; display: flex;
  align-items: center; justify-content: space-between; gap: 8px; }
.tpl-review-bar-head .link-btn, .modal-actions .row .tpl-review-bar-head .link-btn { background: none; border: 0;
  padding: 2px 4px; margin: 0; color: var(--ink-dim); font-size: 12.5px; text-decoration: underline; cursor: pointer;
  width: auto; min-width: 0; min-height: 0; height: auto; line-height: 1.3; flex: 0 0 auto; }
/* Кнопки мастера — одной строкой: длинная подпись переносится внутри кнопки, а не уводит
 * вторую кнопку на новую строку (панель не съедает экран над правимым полем). */
#roleEdReviewBar .row { flex-wrap: nowrap; }
#roleEdReviewBar .row button { flex: 1 1 0; min-width: 0; white-space: normal; line-height: 1.2; }
.tpl-review [data-clamp].clamp-cut { cursor: pointer; }
/* Окно старта: роли, которые ждут проверки, — по строке с кнопкой «Проверить». */
#startUnreviewed { margin: 0 0 8px; }
.start-unreviewed { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.start-unreviewed li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.start-unreviewed li button { flex: 0 0 auto; width: auto; }
.tpl-review .tpl-review-ability { font-size: 13.5px; margin: 4px 0 6px; }
/* На телефоне панель мастера не «прилипает» к верху: место нужно полю, которое правят.
 * Кнопки нижней панели — в строку, а не каждая на всю ширину (иначе панель занимала
 * полэкрана). */
@media (max-width: 560px) {
  .tpl-review { position: static; }
  .modal .modal-actions { padding: 8px 16px 10px; }
  .modal-actions .row button { flex: 1 1 auto; min-width: 72px; padding: 9px 10px; }
}

/* ---------- 🌙 Пошаговый экран ночи (2026-10-08) ----------
 * Телефон (360–414): вкладки «Очередь / Стол / События», одна главная кнопка «что делать
 * сейчас». Широкий экран: очередь слева, стол и события справа. */
.nf-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.nf-tab { flex: 1 1 0; min-width: 0; padding: 10px 6px; }
.nf-tab.active { border-color: var(--gold-line); color: var(--gold-soft); background: var(--surface-3); }
.nf-queue { padding: 14px; }
.nf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nf-title { font-weight: 600; color: var(--gold-soft); font-size: 16px; }
.nf-start { width: 100%; margin: 12px 0 10px; min-height: 52px; font-size: 16px; }
.nf-return, .nf-return-card { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--gold-line); background: rgba(199, 161, 74, .12); color: var(--gold-soft); font-size: 14px; }
.nf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nf-row { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; padding: 9px 10px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2, rgba(255,255,255,.02));
  cursor: pointer; }
.nf-row .nf-seat { grid-row: 1 / span 2; text-align: center; font-weight: 600; color: var(--gold-soft); }
.nf-row .nf-who { font-size: 14.5px; line-height: 1.3; }
.nf-row .nf-st { font-size: 12.5px; color: var(--ink-dim); }
.nf-row.nf-now { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-line) inset; }
.nf-row.nf-now .nf-st { color: var(--gold-soft); font-weight: 600; }
.nf-row.nf-waiting .nf-st { color: #9cc7ff; }
.nf-row.nf-done { opacity: .62; }
.nf-row.nf-done .nf-st::before { content: "✓ "; }
.nf-row.nf-skipped, .nf-row.nf-sleep { opacity: .5; font-style: italic; }
.nf-row.nf-deferred .nf-st { color: #f0c27a; }
.nf-row.nf-static { cursor: default; }
.nf-classic { margin-top: 12px; font-size: 13px; color: var(--ink-dim); }
#nfModernBtn { display: block; margin: 0 auto 8px; }
/* Карточка-мастер */
.nf-card-top { display: flex; align-items: flex-start; gap: 8px; }
.nf-card-head { flex: 1 1 auto; min-width: 0; }
.nf-card-head h2 { margin: 0 0 4px; font-size: 18px; }
.nf-ability { font-size: 13.5px; color: var(--ink-dim); font-style: italic; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2.open { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }
.nf-menu-wrap { position: relative; }
.nf-menu-btn { font-size: 20px; line-height: 1; padding: 6px 12px; width: auto; }
.nf-menu { position: absolute; right: 0; top: 100%; z-index: 60; min-width: 240px; display: flex; flex-direction: column;
  gap: 4px; padding: 6px; background: var(--surface-3); border: 1px solid var(--gold-line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); }
.nf-menu button { text-align: left; width: 100%; }
.nf-close { width: auto; margin: 0; }
.nf-step-head { margin: 12px 0 8px; font-weight: 600; color: var(--gold-soft); font-size: 14px; }
.nf-card-body { font-size: 15px; }
.nf-card-body .observer-box { margin: 6px 0; }
.nf-wait { font-size: 16px; margin: 8px 0; }
.nf-chosen { margin: 6px 0; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.nf-check { margin: 4px 0 10px; padding: 8px 10px; border-left: 3px solid var(--gold); background: rgba(199,161,74,.08); }
.nf-eff { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); }
.nf-eff .nf-eff-text { flex: 1 1 auto; }
.nf-eff .nf-eff-note { display: block; font-size: 12px; color: var(--ink-dim); }
.nf-switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.nf-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.nf-switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--border); transition: background .15s; }
.nf-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #ddd; transition: transform .15s; }
.nf-switch input:checked + span { background: var(--gold); }
.nf-switch input:checked + span::after { transform: translateX(20px); }
.nf-switch input:disabled + span { opacity: .5; }
.nf-summary { font-size: 16px; margin: 10px 0; }
/* Раскладка: телефон — вкладки */
@media (max-width: 1023px) {
  .room-layout.nf-on[data-nf-tab="queue"] > :not(#nightFlow) { display: none; }
  .room-layout.nf-on[data-nf-tab="table"] > .timeline { display: none; }
  .room-layout.nf-on[data-nf-tab="table"] #nfQueue,
  .room-layout.nf-on[data-nf-tab="events"] #nfQueue { display: none; }
  .room-layout.nf-on[data-nf-tab="events"] > :not(#nightFlow):not(.timeline) { display: none; }
}
/* Широкий экран — всё рядом */
@media (min-width: 1024px) {
  .nf-tabs { display: none; }
  .room-layout.nf-on { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
    column-gap: 18px; align-items: start; }
  .room-layout.nf-on > #nightFlow { grid-column: 1; grid-row: 1 / span 30; position: sticky; top: 8px; }
  .room-layout.nf-on > :not(#nightFlow) { grid-column: 2; }
}
.room-layout.nf-on #nightQueueBanner { display: none !important; }
/* Карточка на телефоне — во весь экран */
@media (max-width: 560px) {
  #nfCardModal { padding: 0; }
  #nfCardModal .modal { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0;
    display: flex; flex-direction: column; }
  #nfCardModal .nf-card-body { flex: 1 1 auto; }
}

/* ---------- Шапка комнаты одной строкой + «⋯» (2026-10-09) ---------- */
body:has(#roomScreen:not(.hidden)) #langToggle { display: none; }
.room-header { flex-wrap: wrap; row-gap: 6px; }
/* Код комнаты не ломает строку ни при каком наборе букв (2026-10-09, ночь): блок кода не
   участвует в переносе (основа 0 — «⋯» не уезжает вниз из-за широкого кода), шрифт кода
   подгоняет `fitRoomCode` (не меньше 14 px), а дальше код обрезается многоточием — кнопка
   копирования и фаза остаются в строке целиком. */
.room-header .room-code-block { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; overflow: hidden; }
.room-header .room-code-block > * { flex: 0 0 auto; }
.room-header .room-code-block > .room-code { flex: 0 1 auto; min-width: 0; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }
.room-menu-wrap { position: relative; margin-left: auto; flex: 0 0 auto; }
.room-menu-btn { font-size: 20px; line-height: 1; padding: 6px 12px; width: auto; }
.room-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 170; min-width: 250px; display: flex;
  flex-direction: column; gap: 6px; padding: 8px; background: var(--surface-3); border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.room-menu > button { width: 100%; text-align: left; }
.room-menu-lang { display: flex; gap: 6px; }
.room-menu-lang button { flex: 1 1 0; }
.room-status-block { flex: 1 1 100%; }
.room-status-block:not(:has(#headerSeatControls:not(.hidden))) { display: none; }
@media (max-width: 560px) {
  .room-header { padding: 8px 10px; }
  .room-header .room-code-prefix { display: none; }
  .room-header .room-code { font-size: 20px; letter-spacing: 2px; }
  .room-header .badge { padding: 4px 9px; font-size: 12px; }
}
/* Карточка: способность — две строки, нажатие раскрывает; выбор — в шапке. */
.nf-ability { cursor: pointer; }
.nf-choice { margin-top: 6px; padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(156, 199, 255, .1);
  border: 1px solid rgba(156, 199, 255, .35); font-size: 14px; }
.nf-preview { margin-top: 4px; }
.nf-row.nf-marker { cursor: default; grid-template-columns: 34px 1fr auto; }
.nf-row.nf-marker .nf-seat { grid-row: auto; }
.nf-ack { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; }
#nfDayWait ul { margin: 6px 0 0; padding-left: 18px; }
/* Старое окно хода: крестик в строке заголовка, кнопки — одной строкой. */
.modal .topline { flex-wrap: nowrap; align-items: flex-start; }
.modal .topline h2 { flex: 1 1 auto; min-width: 0; }
.modal .topline > button { flex: 0 0 auto; }
#tplItemModal .modal-actions { flex-wrap: nowrap; }
#tplItemModal .modal-actions > #tplItemActions { flex: 1 1 auto; }
#tplItemModal #tplItemActions .row { margin: 0; flex-wrap: nowrap; }
#tplItemModal #tplItemActions .row button { min-width: 0; }
#tplItemModal .modal-actions > .modal-close { margin: 0; }

.tpl-sel-wrap { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 100%; }
.tpl-sel-wrap select { max-width: 100%; }
.tpl-select-note { font-size: 12px; color: var(--ink-dim); line-height: 1.3; }

/* ---------- 2026-10-09 (вечер): правки по скриншотам ---------- */
/* Итог прошлого хода — под шапкой карточки, 3 секунды. */
.nf-note { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: rgba(212, 175, 55, .12);
  border: 1px solid var(--gold-line); font-size: 14px; }
/* Подсказка из Гримуара — обычным шрифтом, отдельной плашкой. */
.nf-hint { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); font-size: 15px; line-height: 1.4; }
.nf-hint-h { font-size: 12.5px; color: var(--gold-soft); margin-bottom: 4px; }
/* Отметки трат (разовый шаг, «потрачено») на последнем шаге карточки. */
.nf-spend .nf-eff-text { color: var(--gold-soft); }
/* Экран «День»: напоминания — подсказки, конец дня от них не зависит. */
.nf-row.nf-hintrow { opacity: .85; }
/* Мастер: пока ведущий правит, вопрос закреплён сверху окна. */
.tpl-review.fixing { position: sticky; top: -1px; z-index: 20; }
.tpl-review.fixing .tpl-review-item { -webkit-line-clamp: 3; line-clamp: 3; }
#roleEditorModal.rv-fixing #roleEdBody [data-field] { scroll-margin-top: 170px; }
@media (max-width: 560px) {
  .tpl-review.fixing { position: sticky; }
}

/* «Дополнительно» блока и маркера — технические id свёрнуты (2026-10-09). */
.tpl-ed-more { margin: 6px 0 0; flex: 1 1 100%; }
.tpl-ed-more > summary { cursor: pointer; color: var(--ink-dim); font-size: 13px; }
.tpl-ed-more[open] > summary { margin-bottom: 6px; }

/* Б14 п.9: «Дополнительно» в карточке игрока — группы по изданиям. */
.gp-more { margin-top: 10px; }
.gp-more > summary, .gp-group > summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.gp-group { margin: 4px 0 4px 6px; padding-left: 10px; border-left: 2px solid rgba(255, 255, 255, 0.15); }

/* Б16: способность самого игрока — сверху карточки, рядом с ходом этой ночи. */
.gp-own { margin: 8px 0; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px; }
.gp-own-title { color: var(--ink-dim); font-size: 13px; margin-bottom: 4px; }
#gpOwnTools > * + * { margin-top: 8px; }
#gpOwnTools > div > hr:first-child { display: none; }

/* 📄 лист персонажей для ведущего и 🐞 отчёт о баге (2026-10-24) */
.sheet-bar { margin: 6px 0 2px; }
/* 📚 Библиотека листов (2026-10-24): группы как в списке выбора, строка — название и кнопки. */
.sheet-lib-group { margin: 10px 0 2px; font-weight: 600; }
.sheet-lib-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.sheet-lib-title { flex: 1 1 200px; }
.sheet-lib-actions { margin: 0; gap: 4px; }
.start-sheet-row { margin: 4px 0 8px; gap: 6px; }
/* 🔗 Привязка Telegram в кабинете (2026-10-24): код крупно, чтобы переписать с экрана. */
.tg-link-box { margin: 12px 0 4px; }
.tg-link-code {
  display: inline-block; margin: 6px 10px 6px 0; padding: 6px 12px; border-radius: 8px;
  font-size: 18px; letter-spacing: 1px; background: var(--surface-2); user-select: all;
}
.sheet-btn {
  display: inline-block; padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
  color: var(--ink-2); text-decoration: none; border: 1px solid transparent;
}
.sheet-btn:hover { background: rgba(255, 255, 255, .04); }
.sheet-link { display: block; text-decoration: none; }
.room-menu-wrap { display: flex; gap: 2px; align-items: center; }
.bug-btn { font-size: 16px; }
/* На телефоне шапка одной строкой и так впритык (код из восьми широких букв, TPL37B):
   🐞 шапки прячем, кнопка есть в ряду под столом и в меню «⋯». */
@media (max-width: 560px) { .bug-btn { display: none; } }
#bugReportText { width: 100%; box-sizing: border-box; margin-top: 6px; }
