/* =============================================================================
   styles.css — глобальные стили приложения Mafia Host.

   Структура (по разделам, ищите по «=== <name> ===»):
     === Reset / base ===                     — html/body, скроллбары, .screen, modal-overlay
     === Cards (раздача ролей) ===            — card-flip/card-grid
     === Players list & slots ===             — .player-cell, .player-slot, foul-pill
     === Timer + role icons ===               — #timer/#timer-pill, .role-icon, анимации
     === Player slot animations ===           — foul-bump, role-classes, и т.п.
     === PC voting layout ===                 — .game-voting, game-side-left/right, vote-slot
     === Inputs / forms ===                   — mafia-checkbox и пр. form controls
     === Music settings ===                   — accordion music-item-* и тип
     === Auto-mode UI bits ===                — auto-back-hold-indicator
     === Desktop shell (lg+) ===              — global timer host, screen-nav-vert, screen offsets
     === Player detail slot (lg+) ===         — inline-slot для unified-panel
     === Unified player panel (lg+) ===       — секции/аккордеон/header/footer
     === MU mode toggles ===                  — body.mu-mode классы видимости элементов
     === MU autocomplete dropdown ===         — .mu-ac-* виджет автокомплита
   ============================================================================= */

/* =================== Reset / base =================== */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  position: relative;
  font-family: 'Manrope', sans-serif;
  user-select: none;
  touch-action: manipulation;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.118s ease-out;
}

#role-screen.screen {
  position: fixed !important;
}

.screen.active {
  pointer-events: auto;
  z-index: 10;
  opacity: 1;
}

.modal-overlay {
  opacity: 0;
  transition: opacity 0.118s ease-out;
}

.modal-overlay[data-open] {
  opacity: 1;
}

.modal-overlay .modal-panel {
  transform: scale(0.98) translateY(8px);
  transition: transform 0.118s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay[data-open] .modal-panel {
  transform: scale(1) translateY(0);
}

.screen-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-flip {
  transform-style: preserve-3d;
}

.card-flip.revealed .card-front {
  transform: rotateY(0deg);
}

.card-flip.revealed .card-back {
  transform: rotateY(-180deg);
}

.card-inner {
  perspective: 1000px;
  width: 100%;
  height: 100%;
}

.card-back,
.card-front {
  backface-visibility: hidden;
  transition: transform 0.5s ease;
}

.card-front {
  transform: rotateY(180deg);
}

.cards-grid {
  display: grid;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  align-items: center;
  justify-items: center;
}

.cards-grid > .card-wrap:nth-child(10) {
  grid-column: 2;
}

.card-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-wrap .card-inner {
  flex: 0 0 auto;
  height: 100%;
  width: auto;
  aspect-ratio: 5/7;
  max-width: 100%;
}

.card-wrap .card-flip {
  width: 100%;
  height: 100%;
  position: relative;
}

#players-list {
  align-items: stretch;
}

.player-cell.player-slot {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Нажатие карточки игрока — управляем классом из координатора жестов, а не :active
   (тот залипал после свайпа/удержания без перерендера). */
#players-list .player-cell.player-slot.is-pressed {
  transform: scale(0.98);
}

/* Жесты таймера (перетаскивание) — Pointer Events в JS; отдаём элементу касания. */
#timer-panel-wrap #timer-pill {
  touch-action: none;
}

/* vote-плитки открываются по click; manipulation убирает задержку тапа на телефоне. */
#vote-candidates [data-action="vote-open-count"] {
  touch-action: manipulation;
}

.player-slot__row {
  align-items: center;
}

.player-slot__foul-pill {
  transform: translateY(0.1875rem);
}

.role-icon {
  display: block;
  flex-shrink: 0;
}
.role-icon--large {
  width: 45vmin;
  height: 45vmin;
  max-width: 280px;
  max-height: 280px;
}
.role-icon--small {
  width: 2.25rem;
  height: 2.25rem;
}
.role-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

#timer-panel-wrap #timer {
  line-height: 1;
  font-weight: 600;
  font-size: clamp(2.75rem, 2rem + 3.2vmin, 4rem);
}

@keyframes timer-pill-shake {
  0%,
  100% {
    transform: translateY(0.1875rem) translateX(0);
  }
  20% {
    transform: translateY(0.1875rem) translateX(-4px);
  }
  40% {
    transform: translateY(0.1875rem) translateX(4px);
  }
  60% {
    transform: translateY(0.1875rem) translateX(-3px);
  }
  80% {
    transform: translateY(0.1875rem) translateX(3px);
  }
}

#timer-panel-wrap .timer-pill.timer-pill--shake {
  animation: timer-pill-shake 0.38s ease-in-out;
}

/* ВАЖНО: у .player-slot__foul-pill базовый transform: translateY(0.1875rem).
   Поэтому каждый кадр должен сохранять этот сдвиг — иначе scale «съедает» его
   и пилюля подскакивает вверх на ~3px. (Ср. timer-pill-shake выше.) */
@keyframes foul-bump {
  0% {
    transform: translateY(0.1875rem) scale(1);
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
  }
  28% {
    transform: translateY(0.1875rem) scale(1.42);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.55);
  }
  60% {
    transform: translateY(0.1875rem) scale(0.94);
  }
  100% {
    transform: translateY(0.1875rem) scale(1);
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
  }
}

.player-slot__foul-pill.foul-bump {
  animation: foul-bump 0.5s ease-out;
}

#game-screen #voting-order.voting-order-queue {
  font-size: clamp(1.125rem, 4.2vmin, 1.5rem);
  line-height: 1.45;
}

/* ПК: голосование прямо на игровом столе (без перехода на отдельную страницу).
   Класс .game-voting ставится только на широком экране (см. enterPcVoting).
   Анимируем раскладку: боковые панели и нижние контролы схлопываются (ширина/высота
   + прозрачность), панель голосования раскрывается; центр едет влево сам (flex-1
   перетекает по мере изменения ширины соседей). display:none не используем — он не
   анимируется; панели остаются в потоке с нулевой шириной. */
#game-side-left,
#game-side-right {
  min-width: 0;
  transition:
    width 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s ease;
}
#game-bottom-controls {
  overflow: hidden;
  max-height: 12rem;
  transition:
    max-height 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s ease,
    padding 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
#game-vote-slot {
  width: 0;
  opacity: 0;
  overflow: hidden;
  /* Negative margin -0.5rem с двух сторон = -1rem суммарно = ровно один
     gap родителя (flex gap=1rem). Сосед стоит как при display:none —
     ни phantom-gap, ни overshoot+snap при закрытии. Тот же приём, что
     в niokit-овской .k-slot (--k-slot-cancel). Здесь не используем
     .k-slot потому, что #game-vote-slot живёт в game-screen с своей
     механикой (.vote-slot-open), отдельной от .player-detail-slot. */
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  transition:
    width 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

#game-screen.game-voting #game-side-left,
#game-screen.game-voting #game-side-right {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
}
#game-screen.game-voting #game-bottom-controls {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}
#game-screen.game-voting #game-vote-slot {
  display: flex;
  flex-direction: column;
}
#game-screen.game-voting #game-vote-slot.vote-slot-open {
  width: 20rem;
  opacity: 1;
  margin-left: 0;
  margin-right: 0;
}
@media (min-width: 1280px) {
  #game-screen.game-voting #game-vote-slot.vote-slot-open {
    width: 22rem;
  }
}

input.mafia-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  flex-shrink: 0;
  border-radius: 2px;
  border: 1px solid rgba(212, 175, 55, 0.32);
  background-color: #0c0a09;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition:
    border-color 0.15s ease-out,
    background-color 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.12s ease-out;
}

input.mafia-checkbox:hover {
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(212, 175, 55, 0.08);
}

input.mafia-checkbox:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.35);
  outline-offset: 2px;
}

input.mafia-checkbox:checked {
  background-color: rgba(127, 29, 29, 0.42);
  border-color: rgba(212, 175, 55, 0.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6.2 5 8.7 9.5 3.3' stroke='%23d4af37' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.7rem auto;
}

input.mafia-checkbox:active:not(:disabled) {
  transform: scale(0.94);
}

.music-item-settings-wrap {
  overflow: hidden;
}

.music-item-settings-inner {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.music-item-settings-panel {
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease-out,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.music-item-settings-wrap.is-open .music-item-settings-panel {
  opacity: 1;
  transform: translateY(0);
}

.music-item-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  flex-shrink: 0;
  font-size: 0.6rem;
  line-height: 1;
  color: rgba(212, 175, 55, 0.72);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.music-item-expanded .music-item-chevron {
  transform: rotate(90deg);
}

/* Плавная смена содержимого блока треков (компактный список ⇆ режим редактирования). */
[data-music-tracks] {
  transition: opacity 0.18s ease;
}

/* Потрековый разворот в режиме редактирования — по аналогии с обычным разворотом песни. */
.music-track-settings-wrap {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.music-track-settings-panel {
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.2s ease-out,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-music-track-id].is-open .music-track-settings-panel {
  opacity: 1;
  transform: translateY(0);
}
.music-track-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  flex-shrink: 0;
  font-size: 0.55rem;
  line-height: 1;
  color: rgba(212, 175, 55, 0.7);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-music-track-id].is-open .music-track-chevron {
  transform: rotate(90deg);
}

/* Плавный разворот блока заметок ведущего (правая панель игрового стола). */
#game-side-notes-body {
  overflow: hidden;
  transition: max-height 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.music-preview-btn.is-playing {
  border-color: rgba(212, 175, 55, 0.55);
  color: #d4af37;
  background-color: rgba(127, 29, 29, 0.35);
}

.timer-voice-duck-block--inactive {
  opacity: 0.45;
  pointer-events: none;
}

#timer-voice-duck-mul-wrap.timer-voice-duck-mul-wrap--inactive {
  opacity: 0.45;
  pointer-events: none;
}

.auto-reveal-hold-btn {
  touch-action: none;
  position: relative;
  overflow: hidden;
}
.auto-reveal-hold-btn.auto-reveal-active {
  border-color: rgba(212, 175, 55, 0.95);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18);
}

#auto-reveal-overlay.is-open {
  display: flex !important;
}

.auto-count-btn,
.prepare-toggle-btn {
  flex: 1;
  padding: 0.7rem 0.6rem;
  border: 1px solid #44403c;
  background-color: #292524;
  color: rgba(250, 248, 245, 0.85);
  font-weight: 600;
  border-radius: 0.25rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  line-height: 1.2;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.auto-count-btn.auto-count-active,
.prepare-toggle-btn.prepare-toggle-active {
  border-color: rgba(212, 175, 55, 0.6);
  background-color: rgba(127, 29, 29, 0.4);
  color: #d4af37;
}

.auto-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.25rem, 1fr));
  gap: 0.5rem;
}
.auto-target-tile {
  position: relative;
  border: 1px solid #44403c;
  background-color: #292524;
  color: #d4af37;
  border-radius: 0.375rem;
  padding: 0.5rem 0.4rem;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  line-height: 1;
  text-align: center;
}
.auto-target-tile:active {
  transform: scale(0.96);
}
.auto-target-tile.auto-target-selected {
  border-color: rgba(212, 175, 55, 0.9);
  background-color: rgba(127, 29, 29, 0.55);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.35);
}
.auto-target-tile .auto-target-nick {
  display: block;
  margin-top: 0.15rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(250, 248, 245, 0.7);
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auto-target-tile .auto-target-leader {
  position: absolute;
  top: 0.15rem;
  right: 0.25rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(212, 175, 55, 0.85);
}

.auto-night-section + .auto-night-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(68, 64, 60, 0.6);
}
.auto-night-result-banner {
  border: 1px solid rgba(212, 175, 55, 0.45);
  background-color: rgba(127, 29, 29, 0.25);
  border-radius: 0.375rem;
  padding: 0.65rem 0.85rem;
  text-align: center;
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

#auto-night-action-done.auto-done-ready {
  background-color: #7f1d1d;
  border-color: #d4af37;
  color: #d4af37;
  cursor: pointer;
}
#auto-night-action-done.auto-done-ready:hover {
  background-color: #991b1b;
}

#auto-day-screen #auto-day-timer {
  line-height: 1;
  font-weight: 600;
  font-size: clamp(2.75rem, 2rem + 3.2vmin, 4rem);
}
#auto-day-screen #auto-day-nominees.voting-order-queue {
  font-size: clamp(1.125rem, 4.2vmin, 1.5rem);
  line-height: 1.45;
}

#auto-last-words-screen #auto-last-words-countdown {
  line-height: 1;
  font-weight: 600;
  font-size: clamp(2.5rem, 1.75rem + 3vmin, 3.5rem);
}

.auto-section-locked {
  opacity: 0.45;
  pointer-events: none;
  position: relative;
}
.auto-section-locked::after {
  content: 'Сначала выбери жертву';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 175, 55, 0.85);
  background-color: rgba(12, 10, 9, 0.55);
  border-radius: 0.25rem;
  pointer-events: none;
}

#auto-back-hold-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right, #d4af37, #f0d875);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
#auto-back-hold-indicator.is-active {
  opacity: 0.95;
}

/* ============================================================
   Десктоп: глобальный timer-panel + вертикальный screen-nav слева
   ============================================================ */
#timer-panel-host {
  display: none;
}
@media (min-width: 1024px) {
  /* Когда JS перенёс timer-panel в global host — фиксируем его сверху.
     Боковые отступы совпадают с p-6 контента экранов, чтобы по ширине
     таймер бился с гармошкой игроков и остальным контентом. */
  #timer-panel-host {
    display: block;
    position: fixed;
    top: 16px;
    left: 24px;
    right: 24px;
    z-index: 50;
  }
  /* Внутри глобального хоста timer-panel разворачивается. */
  #timer-panel-host > .timer-panel-wrap {
    width: 100%;
  }
  /* Сдвигаем все screen вниз ровно настолько, насколько занимает global timer.
     Без коррекции height экраны вытекали бы за viewport — поэтому уменьшаем
     высоту на ту же величину. */
  body.has-global-timer .screen {
    top: var(--global-timer-h, 96px);
    height: calc(100vh - var(--global-timer-h, 96px));
    height: calc(100dvh - var(--global-timer-h, 96px));
  }
  body.has-global-timer #role-screen,
  body.has-global-timer #vote-screen {
    top: 0;
    height: 100vh;
    height: 100dvh;
  }
  /* В шапках экранов прячем «← Меню» — навигация переехала в timer-panel. */
  [data-goto="menu-screen"] {
    display: none !important;
  }
}

/* Вертикальный screen-nav внутри timer-panel (только lg+). */
.screen-nav-vert {
  display: none;
}
@media (min-width: 1024px) {
  .screen-nav-vert {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
    min-width: 9rem;
    /* Растягиваем кнопки по высоте таймера: контейнер absolute с top:3/bottom:3
       занимает всю высоту, кнопки делят её поровну через flex:1. */
  }
  .screen-nav-vert__btn {
    flex: 1 1 0;
    min-height: 0;
    background: transparent;
    color: rgba(230, 225, 214, 0.62);
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  }
  .screen-nav-vert__btn:hover {
    color: #f3d68f;
    background: rgba(200, 169, 106, 0.08);
  }
  .screen-nav-vert__btn.is-active {
    color: #f3d68f;
    background: rgba(200, 169, 106, 0.14);
    border-color: rgba(200, 169, 106, 0.35);
  }
}

/* ============================================================
   Десктоп: панель деталей игрока — flex-сестра гармошки игроков.
   Базовая механика (width:0 ⇄ width:N, negative-margin gap-cancel,
   transition) пришла из niokit: .k-slot / .k-slot.is-open. Здесь —
   только наши специфичные размеры через --k-slot-w и стили контента.
   ============================================================ */
/* Ширины открытого слота: 22rem default (из niokit), 24rem на xl+,
   28-30rem для setup-slot (там сетка карт max-w-md). */
@media (min-width: 1280px) {
  .player-detail-slot { --k-slot-w: 24rem; }
}
#setup-slot { --k-slot-w: 28rem; }
@media (min-width: 1280px) {
  #setup-slot { --k-slot-w: 30rem; }
}

/* На lg+ полноэкранный показ роли не нужен — карточка уже flip'ается
   inline и показывает роль на своей лицевой стороне. role-screen
   всё ещё получает .active внутри showRole, но visually скрыт. */
@media (min-width: 1024px) {
  #role-screen { display: none !important; }
}

.player-detail-slot > .modal-panel,
.player-detail-slot > .unified-player-panel {
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100%;
  margin: 0;
  border-radius: 8px;
  overflow-y: auto;
  /* Когда slot ещё не раскрыт, контент не должен ловить клики — иначе
     абсолютно-позиционированные кнопки (×, и т.п.) ловят клики за
     пределами слота поверх соседних элементов (например, гармошки). */
  pointer-events: none;
}
.player-detail-slot.is-open > .modal-panel,
.player-detail-slot.is-open > .unified-player-panel {
  pointer-events: auto;
}

/* ============================================================
   Унифицированная панель игрока с разворачиваемыми секциями
   ============================================================ */
.unified-player-panel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.unified-player-panel__header {
  position: relative;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(200, 169, 106, 0.18);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.unified-player-panel__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.unified-player-panel__header > .modal-panel__close-x {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  color: rgba(230, 225, 214, 0.6);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  z-index: 4;
}
.unified-player-panel__header > .modal-panel__close-x:hover {
  color: #f3d68f;
  background: rgba(200, 169, 106, 0.1);
  border-color: rgba(200, 169, 106, 0.3);
}
/* Контейнер аккордеон-секций — flex-child, скроллится по vertical-overflow. */
.unified-sections {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Базовая разметка/анимация (.k-accordion__item / __header / __body / __inner)
 * приходит из niokit v0.3.0. Здесь — только проектные оверрайды под mafia-тему:
 * акцент header'а в наш золотой (вместо niokit-овского --k-text-2), chevron
 * тоже золотой через ::before currentColor. */
.unified-section.k-accordion__item > .k-accordion__header {
  color: rgba(243, 214, 143, 0.9);
}
.unified-section.k-accordion__item > .k-accordion__header:hover {
  color: rgba(243, 214, 143, 1);
  background: rgba(200, 169, 106, 0.06);
}
/* В секцию «Итоги» переносится целый .modal-panel modal-summary-player.
   Сбрасываем его собственные рамки/фон/тень/паддинги — иначе он выглядит
   как вложенная карточка внутри унифицированной панели. */
.unified-section .modal-panel {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  max-width: none !important;
  max-height: none !important;
  width: 100% !important;
  padding: 0 !important;
  overflow: visible !important;
}
.unified-section .modal-panel > h2,
.unified-section .modal-panel > .modal-panel__close-x {
  display: none !important;
}
/* Прячем встроенные Save-кнопки внутри секций — у unified-панели свой
   универсальный Save в подвале. */
.unified-section [data-action="player-modal-save"],
.unified-section [data-action="summary-modal-save"] {
  display: none !important;
}
/* Роль в секции «Итоги» дублирует «Подготовку» на десктопе — прячем. */
.unified-section #modal-summary-role-section {
  display: none !important;
}
/* Поле «Псевдоним» в секции «Итоги» дублирует header'ный input unified-панели —
 * прячем. distributeSummaryPlayerContent() ставит inline display:none, но
 * подстраховываемся CSS'ом на случай динамических ре-рендеров. */
.unified-section .modal-panel :has(> #modal-summary-nick) {
  display: none !important;
}

/* Подвал унифицированной панели с универсальным Save. Стиль самой кнопки
   приходит через Tailwind-классы из JS — как у оригинальных Save в модалках. */
.unified-player-panel__footer {
  flex-shrink: 0;
  padding: 4px 18px 12px;
}

.modal-panel__close-x {
  display: none;
}
@media (min-width: 1024px) {
  .player-detail-slot .modal-panel__close-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: transparent;
    color: rgba(230, 225, 214, 0.6);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
    z-index: 2;
  }
  .player-detail-slot .modal-panel__close-x:hover {
    color: #f3d68f;
    background: rgba(200, 169, 106, 0.1);
    border-color: rgba(200, 169, 106, 0.3);
  }

  /* На декстопе подписи экранов в шапках не нужны — они дублируют
     активную вкладку в навигации внутри таймера. */
  .screen-title-label {
    display: none !important;
  }
}

/* ============================================================
   MU-режим: видимость элементов в iframe внутри расширения
   ============================================================ */
.mu-show-in-mu {
  display: none !important;
}
body.mu-mode .mu-show-in-mu {
  display: flex !important;
}
body.mu-mode .mu-hide-in-mu {
  display: none !important;
}
/* В MU-режиме экспериментальные режимы (включая авто-ведущего) всегда
   отключены через app.experimentalModesEnabled=false; экран выбора режима
   подготовки скипается. Здесь также прячем настройку самого тогглера. */
body.mu-mode #setting-experimental-modes,
body.mu-mode #setting-experimental-modes + span,
body.mu-mode label:has(#setting-experimental-modes) {
  display: none !important;
}

/* ============================================================
   Автокомплит игроков из базы MafiaUniverse
   ============================================================ */
.mu-ac-dropdown {
  position: absolute;
  z-index: 100;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  background: #1c1c1f;
  border: 1px solid rgba(200, 169, 106, 0.4);
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  font-family: 'Manrope', sans-serif;
}
.mu-ac-dropdown::-webkit-scrollbar {
  display: block;
  width: 6px;
}
.mu-ac-dropdown::-webkit-scrollbar-thumb {
  background: rgba(200, 169, 106, 0.45);
  border-radius: 3px;
}
.mu-ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e6e1d6;
  font-size: 13px;
}
.mu-ac-item:last-child {
  border-bottom: none;
}
.mu-ac-item.is-active,
.mu-ac-item:hover {
  background: rgba(200, 169, 106, 0.16);
}
.mu-ac-item__avatar {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  background: #2a2a30;
  flex-shrink: 0;
}
.mu-ac-item__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(230, 225, 214, 0.5);
}
.mu-ac-item__text {
  min-width: 0;
  flex: 1 1 auto;
}
.mu-ac-item__nick {
  font-weight: 600;
  color: #f3d68f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mu-ac-item__note {
  font-size: 11px;
  color: rgba(230, 225, 214, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mu-ac-empty,
.mu-ac-loading,
.mu-ac-error {
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(230, 225, 214, 0.55);
  font-style: italic;
}
.mu-ac-error {
  color: #e2786a;
  font-style: normal;
}

/* Привязка к учётке MU — input получает золотистый текст,
   и справа поверх него — мини-аватарка привязанного игрока. */
input.is-mu-bound {
  color: #f3d68f !important;
  border-color: rgba(200, 169, 106, 0.55) !important;
  padding-right: 40px !important;
}
input.is-mu-bound::placeholder {
  color: rgba(243, 214, 143, 0.4);
}
/* Обёртка вокруг автокомплит-инпута — нужна, чтобы badge позиционировался
   именно у границ input-а, а не у границ модалки/контейнера выше. */
.mu-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.mu-ac-input-badge {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
  background: #2a2a30;
  box-shadow: 0 0 0 1px rgba(200, 169, 106, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mu-ac-input-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mu-ac-input-badge__placeholder {
  font-size: 12px;
  font-weight: 700;
  color: rgba(243, 214, 143, 0.85);
}
