:root {
  --bg: #0e1016;
  --bg-2: #161a24;
  --card: #1c2230;
  --card-2: #232a3a;
  --line: #2a3242;
  --text: #eef1f7;
  --muted: #8b93a7;
  --accent: #f5c542;
  --accent-2: #ff8a3d;
  --win: #4ade80;
  --lose: #f87171;
  --cell: 84px;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Общая плавность: нажатия, подсветка активных кнопок и смена состояний
   не должны переключаться рывком. Анимации при этом короткие — интерфейс
   остаётся отзывчивым. */
button, .mode, .pick, .cellbtn, .chip-btn, .step, .wide-btn, .action {
  transition: transform .12s ease, background-color .18s ease,
              border-color .18s ease, color .18s ease, opacity .18s ease,
              box-shadow .18s ease;
}

/* Кто просил систему не анимировать — тому не анимируем. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Правила вроде .boot { display: grid } перебивают браузерный [hidden],
   поэтому возвращаем атрибуту силу явно. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  /* Вебаппка никогда не прокручивается вбок: любой случайно вылезший
     за край элемент не должен уводить весь интерфейс влево-вправо. */
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
  user-select: none;
}

body {
  background:
    radial-gradient(120% 60% at 50% 0%, #232b3d 0%, rgba(35,43,61,0) 60%),
    var(--bg);
}

.boot {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
}

/* Размеры тянутся за экраном: на узком телефоне отступы и шрифты сжимаются,
   на широком окне макет не расползается, а упирается в комфортную ширину. */
#shell {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2.2vw, 14px);
  min-height: 100dvh;
  padding: max(clamp(8px, 2.5vw, 12px), env(safe-area-inset-top))
           clamp(10px, 4vw, 16px)
           max(clamp(10px, 3vw, 16px), env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2.2vw, 14px);
  flex: 1;
  animation: screen-in .22s cubic-bezier(.16, .84, .26, 1);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* Барабаны слота и крупные цифры тоже масштабируются. */
@media (max-width: 380px) {
  :root { --cell: 68px; }
  .cell { font-size: 34px; }
}

/* Низкие окна (альбомная ориентация, свёрнутая вебаппка): режем вертикаль,
   чтобы главная кнопка оставалась на виду без прокрутки. */
@media (max-height: 620px) {
  :root { --cell: 62px; }
  .cell { font-size: 30px; }
  .crash-mult { font-size: clamp(24px, 7vw, 32px); }
  .dice-roll { font-size: clamp(26px, 8vw, 34px); }
  .sky { padding-bottom: 8px; }
  .bets-list { max-height: 120px; }
}

/* --- шапка --- */

.top {
  display: flex;
  align-items: center;
  gap: clamp(5px, 2vw, 10px);
}

/* Баланс уступает место кнопкам на узком экране, а не выталкивает их за край:
   пилюля сжимается, а число внутри неё при нужде обрезается многоточием. */
.balance {
  display: flex;
  /* По базовой линии значок валюты и стрелка разъезжались по вертикали:
     у эмодзи и у картинки она своя. Выравниваем по центру. */
  align-items: center;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 8px clamp(9px, 3vw, 14px);
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.balance:active { transform: scale(.97); }

.balance-value {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(18px, 5.5vw, 22px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Чем длиннее сумма, тем мельче цифры: шестизначный баланс иначе съедал
   половину шапки и выпихивал кнопки за экран. */
.balance-value.long { font-size: clamp(15px, 4.4vw, 18px); }
.balance-value.xlong { font-size: clamp(13px, 3.8vw, 16px); }

.balance-cur {
  display: flex;
  flex: none;
  align-items: center;
  font-size: 15px;
  line-height: 1;
}
.balance-caret { flex: none; font-size: 9px; line-height: 1; color: var(--muted); }

/* Логотип валюты в разметке: размер привязан к шрифту, чтобы в шапке он был
   крупным, а в строке ставки — мелким, как знак рядом с числом. */
.cur-logo {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
  object-fit: contain;
}
.balance-cur .cur-logo { width: 17px; height: 17px; vertical-align: 0; }
.wallet-icon .cur-logo { width: 22px; height: 22px; }

/* Выбор кошелька в шторке. */
.wallets { display: grid; gap: 8px; margin-bottom: 12px; }

.wallet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.wallet-row.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card-2)); }
.wallet-icon { font-size: 20px; }
.wallet-title { flex: 1; font-weight: 600; }
.wallet-sum { font-weight: 700; font-variant-numeric: tabular-nums; }

.balance-value.bump { animation: bump .45s ease; }
@keyframes bump {
  40% { transform: scale(1.18); color: var(--win); }
  100% { transform: scale(1); }
}

.top-actions {
  display: flex;
  gap: clamp(4px, 1.6vw, 8px);
  margin-left: auto;
}

.chip-btn {
  flex: none;
  white-space: nowrap;
  padding: 9px clamp(8px, 3vw, 12px);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.chip-btn:active { transform: scale(.96); }
.chip-btn:disabled { opacity: .45; }
.chip-btn.back { font-size: 18px; line-height: 1; padding: 8px 13px; }

/* Бонус готов — точка на кнопке: текст отсчёта в шапке не помещается. */
.chip-btn.ready { position: relative; border-color: var(--accent); }
.chip-btn.ready::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

/* --- главное меню --- */

.title {
  margin: 4px 0 0;
  font-size: clamp(18px, 5.5vw, 22px);
  font-weight: 700;
}

/* Режимы — плитки, а не список. Два столбца держим жёстко: auto-fit на узком
   телефоне схлопывался бы обратно в одну колонку. Шире 560px влезает три. */
.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* Ряды равной высоты: иначе ряд с плашкой «идёт партия» выше соседних. */
  grid-auto-rows: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.mode {
  /* Одно место под значок на все плитки: и под эмодзи, и под анимацию, и
     под пустоту у плиток-картинок. Из него и берётся общая линия названий. */
  --icon-slot: clamp(48px, 14vw, 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 130px;
  padding: 16px 12px;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  /* Коротко: на нажатие плитка должна отвечать сразу, а не вползать. */
  transition: transform .18s cubic-bezier(.2, .8, .25, 1),
              border-color .18s ease, box-shadow .18s ease;
}
/* Наведение и клавиатурный фокус подсвечивают плитку золотом — тем же,
   каким нарисованы сами значки. На телефоне наведения нет, поэтому то же
   самое повторяется на нажатии. */
.mode:hover,
.mode:focus-visible,
.mode:active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, .35);
}
.mode:focus-visible { outline: none; }

/* Под курсором плитка чуть подаётся вперёд. Три процента — намеренно
   мало: рост заметен краем глаза, но плитка остаётся в своих границах и
   не наезжает на соседнюю, зазор между ними как раз это позволяет. */
.mode:hover,
.mode:focus-visible { transform: scale(1.03); }

/* Нажатие важнее наведения и должно его перебивать: палец давит — плитка
   проседает, даже если курсор над ней. Правило идёт последним, потому
   что вес у всех трёх одинаковый и решает порядок. */
.mode:active { transform: scale(.97); }

/* Движение выключено системно — оставляем только подсветку рамкой.
   Подсказка «сюда можно нажать» никуда не девается, а шевеления нет. */
@media (prefers-reduced-motion: reduce) {
  .mode { transition: none; }
  .mode:hover,
  .mode:focus-visible,
  .mode:active { transform: none; }
}

/* У значка своё место фиксированной высоты. Без него плитка с эмодзи и
   плитка с анимацией имеют разную высоту верхушки, и названия в одном ряду
   разъезжаются на пару пикселей — заметно, потому что их шесть подряд. */
.mode-icon {
  display: grid;
  place-items: center;
  width: var(--icon-slot);
  height: var(--icon-slot);
  font-size: clamp(32px, 10vw, 42px);
  line-height: 1;
}

/* Плитка-картинка: арт на всю площадь, поверх — затемнение снизу, чтобы
   название и подпись читались на любом кадре. Сам арт и точку кадрирования
   задаёт плитка через --art и --art-at: у каждой картинки интересное место
   своё, а общий каркас один. */
.mode-art {
  background-image:
    linear-gradient(180deg, rgba(14,16,22,.1) 35%, rgba(14,16,22,.82) 78%, rgba(14,16,22,.94)),
    var(--art);
  background-size: cover;
  background-position: var(--art-at, 50% 44%);
  background-repeat: no-repeat;
}
.mode-art[data-go="crash"] { --art: url('crash.webp'); }
/* Арт апгрейда широкий: в квадрат плитки влезает середина со стрелкой,
   мишка и Пепе по краям подрезаются — и это ровно то, что нужно показать. */
.mode-art[data-go="upgrade"] { --art: url('upgrade.webp'); --art-at: 50% 42%; }
/* Место под значок пустое, но занятое: название встаёт туда же, где у
   соседей по ряду, а не ниже. */
.mode-art::before {
  content: '';
  display: block;
  height: var(--icon-slot);
}
.mode-art .mode-name,
.mode-art .mode-desc { text-shadow: 0 2px 6px rgba(0,0,0,.8); }
.mode-art .mode-desc { color: #c9d1e2; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.mode-art .badge { margin-top: 6px; }
.mode-name { font-size: 16px; font-weight: 700; }
.mode-desc {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  /* Иначе длинное слово распирает плитку и ломает сетку. */
  overflow-wrap: anywhere;
}
/* Плашка «идёт партия» прижата к низу плитки, чтобы не прыгала по центру,
   когда появляется. */
.mode .badge { margin: auto 0 0; }

.badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #221a05;
  background: var(--accent);
  border-radius: 999px;
}

.profile {
  margin-top: auto;
  padding: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-title { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 500; }

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0 0 14px;
}
.profile-grid div { display: flex; justify-content: space-between; gap: 8px; }
.profile-grid dt { font-size: 13px; color: var(--muted); }
.profile-grid dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.wide-btn {
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}
.wide-btn:active { transform: scale(.98); }
.wide-btn:disabled { opacity: .5; }

/* --- барабаны --- */

.machine {
  position: relative;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.reel {
  height: var(--cell);
  overflow: hidden;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 8px 14px rgba(0,0,0,.6), inset 0 -8px 14px rgba(0,0,0,.6);
}

.strip { will-change: transform; }

.cell {
  height: var(--cell);
  display: grid;
  place-items: center;
  font-size: 42px;
  line-height: 1;
}

.payline {
  position: absolute;
  left: 14px;
  right: 14px;
  top: calc(18px + var(--cell) / 2);
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(245,197,66,.55), transparent);
  pointer-events: none;
}

.machine.win { animation: glow .8s ease; }
@keyframes glow {
  0%, 100% { box-shadow: 0 18px 40px rgba(0,0,0,.45); }
  40% { box-shadow: 0 0 0 2px var(--accent), 0 18px 50px rgba(245,197,66,.35); }
}

.result {
  transition: color .2s ease;
  margin-top: 14px;
  min-height: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
.result.win { color: var(--win); font-weight: 600; }
.result.lose { color: var(--lose); font-weight: 600; }
.result.big { color: var(--accent); font-weight: 700; font-size: 18px; }

/* --- бонус слота --- */

.bonus {
  padding: clamp(10px, 3vw, 14px);
  background: linear-gradient(180deg, rgba(245,197,66,.10), var(--card));
  border: 1px solid rgba(245,197,66,.45);
  border-radius: var(--radius);
  animation: screen-in .25s ease;
}

.bonus-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
.bonus-head b { color: var(--accent); white-space: nowrap; }

.bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(5px, 2vw, 8px);
}

/* Клетка — карта: у неё рубашка и лицо, и она переворачивается. Фон и
   рамка живут на гранях, а не на самой кнопке: иначе рубашка была бы уже
   покрашена под то, что под ней лежит. */
.bonus-cell {
  aspect-ratio: 1;
  padding: 0;
  font: inherit;
  font-size: clamp(15px, 5vw, 20px);
  font-weight: 800;
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  perspective: 600px;
}
.bonus-cell:disabled { cursor: default; }

.bc-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform .45s cubic-bezier(.2, .7, .3, 1);
  transition-delay: var(--flip-delay, 0ms);
  transform-style: preserve-3d;
}
.bonus-cell.flip .bc-inner { transform: rotateY(180deg); }
/* Нажатие чувствуется только пока карта закрыта. */
.bonus-cell:active:not(:disabled) .bc-inner { transform: scale(.94); }

.bc-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  /* Обратная сторона грани не должна просвечивать сквозь лицевую. */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.bc-back {
  color: var(--muted);
  background: linear-gradient(180deg, var(--card-2), var(--card));
}
.bc-front {
  color: var(--text);
  background: var(--bg-2);
  transform: rotateY(180deg);
}

.bonus-cell.open .bc-front { background: var(--bg-2); color: var(--muted); }
/* Клетки с призовым иксом подсвечиваются — по ним и собирается тройка. */
.bonus-cell.hit .bc-front { background: rgba(74,222,128,.16); border-color: rgba(74,222,128,.5); color: var(--win); }
.bonus-cell.bomb .bc-front { background: rgba(248,113,113,.28); border-color: var(--lose); }

/* --- кости --- */

.dice-box {
  padding: 22px 16px 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dice-cube {
  display: block;
  /* На грани теперь стоит число, поэтому шар крупнее прежнего кубика. */
  width: clamp(84px, 26vw, 116px);
  height: auto;
  margin: 0 auto 10px;
}
.dice-cube .cube-body {
  fill: var(--card-2);
  stroke: #3a4459;
  stroke-width: 2;
}
/* Рёбра граней: тонкие и приглушённые, иначе шар превращается в паутину. */
.dice-cube .cube-edge {
  stroke: #39435a;
  stroke-width: 1.2;
}
.dice-cube .cube-top {
  fill: #2b3346;
  stroke: #3f4a61;
  stroke-width: 1.5;
}
.dice-cube .cube-value {
  fill: var(--text);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
}
/* Бросок целиком считает dice.js: один угол, посчитанный от времени.
   Ни transition, ни keyframes тут быть не должно — раньше они дрались
   с покадровой анимацией, и кубик дёргался. Центр вращения задаём явно:
   у корневого svg transform-box: fill-box трактуется браузерами по-разному. */
.dice-cube {
  transform-origin: 50% 50%;
  will-change: transform;
}

.dice-roll {
  text-align: center;
  font-size: clamp(30px, 11vw, 46px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.dice-roll.win { color: var(--win); }
.dice-roll.lose { color: var(--lose); }

.dice-track {
  position: relative;
  height: 10px;
  margin: 16px 0 0;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.dice-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(74,222,128,.5), rgba(74,222,128,.85));
  transition: left .18s ease, width .18s ease;
}

.dice-pin {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 16px;
  margin-left: -1px;
  background: var(--text);
  border-radius: 2px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.seg button {
  padding: 11px 0;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.seg button.active { color: #10131a; background: var(--accent); font-weight: 700; }
.seg button:disabled { opacity: .55; }

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}
.slider-head b { color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: 999px;
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
}
input[type="range"]:disabled { opacity: .5; }

/* --- краш --- */

.sky {
  position: relative;
  padding: 12px 12px 14px;
  background:
    radial-gradient(90% 70% at 50% 100%, rgba(245,197,66,.08), transparent 70%),
    linear-gradient(180deg, #0b0e14, var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Координатная плоскость: по горизонтали секунды, по вертикали множитель.
   Обе оси растягиваются под текущий полёт, поэтому и 2x, и 50x одинаково
   наглядны, а кривая показывает весь путь ракеты. */
.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart .grid path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.chart .grid text {
  fill: var(--muted);
  font-size: 9px;
  font-family: inherit;
}

.chart .curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .ship {
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: central;
}

.crash-mult {
  transition: color .2s ease;
  margin-top: 6px;
  text-align: center;
  font-size: clamp(30px, 11vw, 46px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--win);
}
.crash-mult.boom { color: var(--lose); animation: shake .4s ease; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Взрыв: вспышка на том месте, где ракету настиг конец раунда.
   transform-box: fill-box обязателен — иначе CSS отсчитывает масштаб
   от центра viewBox, и кольца расходились бы не от точки взрыва. */
.boom-group .boom-ring,
.boom-group .boom-emoji {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.boom-group .boom-ring {
  fill: none;
  stroke: var(--lose);
  stroke-width: 2;
}
.boom-group .boom-emoji {
  font-size: 30px;
  text-anchor: middle;
  dominant-baseline: central;
}
.boom-group.play .boom-ring { animation: boom-ring .7s ease-out forwards; }
.boom-group.play .boom-ring-2 { animation-delay: .12s; stroke: var(--accent); }
.boom-group.play .boom-emoji { animation: boom-pop .7s ease-out forwards; }

@keyframes boom-ring {
  0% { opacity: .9; transform: scale(.2); }
  100% { opacity: 0; transform: scale(4.5); }
}
@keyframes boom-pop {
  0% { opacity: 0; transform: scale(.3); }
  25% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

/* --- колесо --- */

.wheel-box {
  position: relative;
  padding: clamp(10px, 3vw, 16px);
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Показана верхняя половина диска: viewBox обрезает низ чуть ниже оси,
   поэтому ступица выглядит полукругом, как в барабанных колёсах. */
.wheel {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
}

/* Секторы одинаковые: каждый — один шанс из 65. */
.wheel-disc path { stroke: rgba(0,0,0,.35); stroke-width: .5; }

.wheel-rim {
  fill: none;
  stroke: var(--line);
  stroke-width: 6;
}

.wheel-hub {
  fill: var(--card-2);
  stroke: var(--line);
  stroke-width: 2;
  transition: fill .3s ease;
}

/* Крупный множитель в ступице. */
.wheel-count {
  fill: var(--text);
  font-size: 34px;
  font-weight: 800;
  text-anchor: middle;
  /* Текст сидит в нижней половине ступицы — в видимой её части. */
  dominant-baseline: middle;
}

/* Указатель стоит сверху и не вращается вместе с диском. */
.wheel-mark {
  fill: var(--accent);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}

.wheel-phase {
  margin-top: 6px;
  text-align: center;
  font-size: clamp(9px, 2.6vw, 11px);
  letter-spacing: .16em;
  color: var(--muted);
}

/* Колонки множителей: заголовок с иксом и списком тех, кто на него поставил.
   Цвет берётся из --pick, заданного в разметке. */
.wheel-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(5px, 1.8vw, 8px);
}
@media (min-width: 520px) {
  .wheel-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.wheel-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-top: 3px solid var(--pick);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.wheel-col:active { transform: scale(.98); }
.wheel-col.active { border-color: var(--pick); background: color-mix(in srgb, var(--pick) 12%, var(--card)); }
.wheel-col.hit { box-shadow: 0 0 0 2px var(--pick) inset; }

.wheel-col-head {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 0 6px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}
.wheel-col-mult { font-size: clamp(15px, 4.6vw, 19px); font-weight: 800; color: var(--pick); }
.wheel-col-chance { font-size: 11px; color: var(--muted); justify-self: end; }
.wheel-col-pool { font-size: 12px; font-weight: 600; }
.wheel-col-players { font-size: 11px; color: var(--muted); justify-self: end; }

.wheel-col-list {
  min-height: 34px;
  max-height: 168px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wheel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,.04);
}
.wheel-row:first-child { border-top: 0; }
.wheel-row.me { background: rgba(245,197,66,.1); }
.wheel-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}
.wheel-row.me .wheel-row-name { color: var(--text); }
.wheel-row-sum { font-variant-numeric: tabular-nums; }

/* --- джекпот --- */

/* Комнаты: на телефоне столбиком, на широком экране в ряд. Карточка живая —
   котёл соседней комнаты тикает, даже пока игрок не внутри. */
.jp-rooms {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
@media (min-width: 560px) {
  .jp-rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.jp-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 10px;
  padding: 7px 12px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.jp-room:active { transform: scale(.985); }
.jp-room.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, var(--card-2)), var(--card));
}

.jp-room-title {
  grid-column: 1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--muted);
}
.jp-room.active .jp-room-title { color: var(--accent); }

.jp-room-total {
  grid-column: 1;
  font-size: clamp(15px, 4.6vw, 19px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.jp-room-range { grid-column: 1; font-size: 10px; color: var(--muted); }

/* Значок состояния: пауза, отсчёт, колесо или корона победителя. */
.jp-room-mark {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  border: 2px solid var(--line);
  border-radius: 50%;
}
.jp-room.active .jp-room-mark { color: var(--text); border-color: var(--accent); }

.jp-room-players {
  grid-column: 2;
  grid-row: 3;
  justify-self: center;
  font-size: 10px;
  color: var(--muted);
}
/* Своя ставка в котле — точка на карточке, чтобы не потерять комнату. */
.jp-room.mine .jp-room-total::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  vertical-align: middle;
  background: var(--accent);
  border-radius: 50%;
}

.jp-box {
  position: relative;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.jp-wheel { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto; }
#jp-ring path { fill: none; stroke-width: 13; }
#jp-ring path.jp-winner { stroke-width: 19; }
.jp-empty { fill: none; stroke: var(--line); stroke-width: 13; stroke-dasharray: 6 8; }

/* Крутится кольцо, а не указатель: так видно, что выбор идёт по долям.
   Вращаем SVG-атрибутом transform — rotate() без центра всегда вращает
   вокруг начала координат, то есть вокруг центра кольца. */
.jp-mark { fill: var(--text); filter: drop-shadow(0 2px 5px rgba(0,0,0,.6)); }

.jp-center {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-70%);
  text-align: center;
  pointer-events: none;
}
.jp-total { font-size: clamp(22px, 8vw, 30px); font-weight: 800; font-variant-numeric: tabular-nums; }
.jp-prize { font-size: 12px; color: var(--muted); }
.jp-prize b { color: var(--win); }

/* --- маркет подарков --- */

.gift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
}
@media (min-width: 520px) {
  .gift-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.gift {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1.5px solid var(--line);
  border-radius: 14px;
}
button.gift { cursor: pointer; }
button.gift:active { transform: scale(.97); }
.gift.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
/* Не по карману — карточка гаснет, но остаётся читаемой. */
.gift.poor { opacity: .55; }

/* Кадр подарка во всю ширину плитки и со скруглением. Эмодзи лежит снизу
   и виден, пока картинка не доехала: у контейнера поэтому свой размер
   шрифта и фон-заглушка. */
.gift-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  font-size: clamp(26px, 8vw, 34px);
  line-height: 1;
  background: rgba(255,255,255,.03);
  border-radius: 12px;
}
.gift-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  /* Показываем только догрузившуюся картинку, иначе поверх эмодзи мигает
     пустой прямоугольник. */
  opacity: 0;
  transition: opacity .18s ease;
}
.gift-icon img.ok { opacity: 1; }
.gift-icon.small { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; }
.gift-name {
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.gift-price { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gift-odds { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }

.gift-btn {
  width: 100%;
  margin-top: auto;
  padding: 6px 4px;
  font: inherit;
  font-size: 12px;
  color: #221a05;
  background: var(--accent);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.gift-btn:active { transform: scale(.97); }
.gift-btn:disabled { opacity: .45; }
.gift-btn.sell { color: var(--text); background: var(--card-2); border: 1px solid var(--line); }

.market-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Лента своих подарков в «Апгрейдере»: выбирать удобнее в строку. */
.gift-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
}

.gift-chip {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
  padding: 7px;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.gift-chip:active { transform: scale(.96); }
.gift-chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }

/* --- апгрейдер --- */

.up-box {
  position: relative;
  padding: 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.up-ring { display: block; width: min(62vw, 240px); height: auto; margin: 0 auto; }

/* Насечки по кругу — шкала, по которой читается, куда встала стрелка. */
.up-tick { stroke: var(--line); stroke-width: 1.2; }
.up-tick.long { stroke: #3a4459; stroke-width: 2; }

.up-track { fill: none; stroke: #232a3a; stroke-width: 9; }

/* Дуга шанса: её длина и есть вероятность апгрейда. */
.up-arc {
  fill: none;
  stroke: url(#up-grad);
  stroke-width: 9;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(245,197,66,.35));
}

.up-needle { fill: var(--accent); filter: drop-shadow(0 2px 5px rgba(0,0,0,.6)); }

.up-center {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: min(62vw, 240px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Оригинальная анимация цели в центре шкалы. Скругляем: у подарков Telegram
   фон с узором, и в круглой шкале квадрат смотрелся бы вырезкой. */
.up-art {
  width: clamp(72px, 24vw, 104px);
  height: clamp(72px, 24vw, 104px);
  overflow: hidden;
  border-radius: 16px;
}
.up-art svg, .up-art img { width: 100%; height: 100%; }

.up-chance {
  margin-top: 2px;
  font-size: clamp(20px, 6.5vw, 28px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Две ячейки «вкладываешь → получаешь». */
.up-slots {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

.up-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 116px;
  padding: 10px 8px;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.up-slot:active { transform: scale(.98); }
/* Открытая ячейка — та, чей список показан снизу. */
.up-slot.active { border-style: solid; border-color: var(--accent); }

.up-slot-head {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.up-slot-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
}
.up-slot-name {
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.up-slot-price { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.up-arrow { font-size: 18px; color: var(--muted); }

/* --- вывод Gram --- */

.wd { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.wd-head { margin: 0 0 10px; font-size: 15px; font-weight: 700; }

.wd-field { display: block; margin-bottom: 8px; }
.wd-field span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.wd-field input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.wd-send { margin-top: 4px; }
.wd-note { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }

.wd-list { display: grid; gap: 6px; margin-top: 12px; }
.wd-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--card-2);
  border-radius: 10px;
}
.wd-status { color: var(--muted); }
.wd-row.paid .wd-status { color: var(--win); }
.wd-row.rejected .wd-status { color: var(--lose); }

/* Адрес выплаты: моноширинный, чтобы не путать символы при сверке. */
.wd-address {
  margin: 6px 0;
  padding: 7px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  background: var(--bg-2);
  border-radius: 8px;
  user-select: text;
}

/* Счётчик необработанных заявок на вкладке админки. */
.wd-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: #221a05;
  background: var(--accent);
  border-radius: 999px;
}

.admin-actions button.wd-ok { border-color: var(--win); color: var(--win); }
.admin-card.quiet { opacity: .65; }

/* Сорвавшаяся выплата: деньги у игрока списаны, а перевод не ушёл —
   такую карточку админ должен замечать первой. */
.admin-card.wd-bad { border-color: var(--lose); }
.wd-warn {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--lose);
}
.wd-tx { color: var(--accent); }

/* Состояние горячего кошелька над списком заявок. */
.wd-wallet {
  margin: 0 0 10px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--card-2);
  border-radius: 10px;
}
.wd-wallet b { color: var(--text); }
.wd-wallet-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: text;
}

/* --- админская подкрутка --- */

.admin-crash {
  padding: 12px 14px 14px;
  background: var(--card);
  border: 1px solid rgba(245,197,66,.35);
  border-radius: 14px;
}
.admin-crash-row { display: flex; gap: 6px; margin-bottom: 8px; }
.admin-crash-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.admin-crash-row button {
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

/* --- поле с ручным вводом --- */

.field-row {
  display: grid;
  grid-template-columns: auto 92px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.field-row:focus-within { border-color: var(--accent); }
.field-label { font-size: 14px; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); text-align: right; }

.field-row input {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.field-row input:disabled { color: var(--muted); }

/* --- список ставок раунда --- */

.bets {
  padding: 12px 14px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.bets-head { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); }

.bets-list { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow-y: auto; }

.bet-row-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  font-size: 14px;
  border-radius: 9px;
}
.bet-row-item.me { background: rgba(245,197,66,.10); }
.bet-row-item.out .bet-out { color: var(--win); }
.bet-row-item.lost { opacity: .5; }

.bet-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-amount { color: var(--muted); font-variant-numeric: tabular-nums; }
.bet-out { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }

.history {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.history::-webkit-scrollbar { display: none; }

.history span {
  flex: none;
  padding: 5px 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--lose);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.history span.mid { color: var(--muted); }
.history span.hi { color: var(--win); border-color: rgba(74,222,128,.35); }

/* --- мины --- */

.mines-head {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mines-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 8px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.mines-stat span { font-size: 11px; color: var(--muted); }
.mines-stat b { font-size: 16px; font-variant-numeric: tabular-nums; }

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.cellbtn {
  aspect-ratio: 1;
  font: inherit;
  font-size: 24px;
  line-height: 1;
  color: var(--text);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.cellbtn:active:not(:disabled) { transform: scale(.94); }
.cellbtn:disabled { cursor: default; }
.cellbtn.safe { background: rgba(74,222,128,.16); border-color: rgba(74,222,128,.45); opacity: 1; }
.cellbtn.mine { background: rgba(248,113,113,.10); border-color: rgba(248,113,113,.3); opacity: 1; }
.cellbtn.boom { background: rgba(248,113,113,.3); border-color: var(--lose); opacity: 1; }

/* --- ставка --- */

.bet-panel { display: flex; flex-direction: column; gap: 10px; }

.bet-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 10px;
}

.step {
  font: inherit;
  font-size: 26px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.step:active:not(:disabled) { transform: scale(.94); }
.step:disabled { opacity: .35; }

.bet-box {
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  cursor: text;
}
.bet-box:focus-within { border-color: var(--accent); }

.bet-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Ставку можно и набрать руками, и накликать кнопками. */
input.bet-value {
  width: 100%;
  padding: 0;
  font: inherit;
  font-size: clamp(19px, 6vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}
input.bet-value:disabled { color: var(--muted); }

.quick { display: grid; grid-auto-flow: column; gap: clamp(5px, 1.8vw, 8px); }

.quick button {
  padding: 9px 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}
.quick button:active:not(:disabled) { transform: scale(.94); background: var(--card-2); }
.quick button:disabled { opacity: .35; }

/* --- главная кнопка режима --- */

.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  padding: clamp(11px, 3.4vw, 15px);
  font: inherit;
  font-weight: 700;
  font-size: clamp(16px, 5vw, 19px);
  color: #221a05;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 16px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 10px 24px rgba(245,197,66,.25);
}
.action:active { transform: translateY(2px); box-shadow: 0 4px 14px rgba(245,197,66,.2); }
.action:disabled { opacity: .5; box-shadow: none; }
.action-sub { font-size: 12px; font-weight: 600; opacity: .72; }

/* Автоспин: кнопка меняет вид, чтобы режим был виден с одного взгляда. */
.action.auto {
  color: var(--text);
  background: linear-gradient(180deg, #2f3a52, #232a3a);
  box-shadow: 0 0 0 2px var(--accent) inset;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 2px var(--accent) inset, 0 0 22px rgba(245,197,66,.35); }
}

.action.cash {
  color: #06240f;
  background: linear-gradient(180deg, #6ee7a0, #34d07a);
  box-shadow: 0 10px 24px rgba(74,222,128,.22);
}

/* --- админка --- */

.admin-mode { border-color: rgba(245,197,66,.35); }

/* Выбранный кошелёк в админке. */
.admin-actions button.on { border-color: var(--accent); color: var(--accent); }

.search {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}
.search:focus { border-color: var(--accent); }

.admin-note { font-size: 13px; color: var(--muted); }

.admin-list { display: flex; flex-direction: column; gap: 10px; }

.admin-card {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.admin-card.banned { border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.06); }

.admin-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.admin-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-balance { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.dim { color: var(--muted); font-weight: 400; }
.dim-red { color: var(--lose); }

.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.admin-actions button {
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.admin-actions button:active { transform: scale(.96); }
.admin-actions button.ban { color: var(--lose); border-color: rgba(248,113,113,.35); }
.admin-actions button.unban { color: var(--win); border-color: rgba(74,222,128,.35); }

/* --- шторка --- */

.sheet {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: rgba(0,0,0,.55);
  z-index: 20;
}

.sheet-card {
  width: 100%;
  max-height: 82vh;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px max(18px, env(safe-area-inset-bottom));
  background: var(--bg-2);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  overflow-y: auto;
  animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 18px; }

.sheet-close {
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

.sheet-body { margin-top: 12px; font-size: 15px; }
.sheet-body p { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 4px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
th:first-child { text-align: left; }
td:first-child { text-align: left; font-size: 24px; }
tr.me td { color: var(--accent); font-weight: 700; }

/* --- тост --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 11px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  z-index: 30;
  animation: rise .2s ease;
}

/* --- вкладка «Кошелёк» --- */

.wallet-block {
  margin: 0 0 14px;
  padding: 14px;
  background: var(--card);
  border-radius: 16px;
}
.wallet-head {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

/* Готовые суммы: выбрать взглядом быстрее, чем набрать. */
.packs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.packs .pack {
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid transparent;
  border-radius: 12px;
}
.packs .pack.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* Строка, которую нужно скопировать целиком. Моноширинная и с большой
   областью нажатия: попасть пальцем важнее, чем сэкономить высоту. */
.copy-row {
  display: block;
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-2);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.copy-row:active { background: var(--card-2); }
.copy-label {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--muted);
}
.copy-value {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.copy-row.big .copy-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}

/* --- бонусное колесо --- */

.bw-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
.bw {
  width: min(260px, 72vw);
  height: auto;
}
.bw-slice {
  stroke: var(--bg);
  stroke-width: 1.5;
}
.bw-s0 { fill: var(--card-2); }
.bw-s1 { fill: #2a3142; }
.bw-label {
  fill: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
}
.bw-hub {
  fill: var(--card);
  stroke: var(--accent);
  stroke-width: 2;
}
.bw-hub-text {
  font-size: 16px;
  text-anchor: middle;
}
/* Указатель снизу: сверху его перекрывал бы заголовок шторки. */
.bw-pin { fill: var(--accent); }

/* --- личный кабинет --- */

.menu-bonus { margin-top: 4px; }

/* Двери в кошелёк и маркет: строками, а не плитками — плитка обещает
   игру, а тут её нет. */
.cab-links {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}
.cab-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
  background: var(--card);
  border: none;
  border-radius: 16px;
  color: var(--text);
}
.cab-link:active { background: var(--card-2); }
.cab-icon { font-size: 22px; }
.cab-text { flex: 1; display: flex; flex-direction: column; }
.cab-text b { font-size: 15px; }
.cab-text i {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}
.cab-caret {
  font-size: 20px;
  color: var(--muted);
}

.cab-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
}
.cab-row b { color: var(--text); }
.cab-big {
  margin: 2px 0 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  color: var(--accent);
}

/* Полоска отыгрыша: цифры рядом есть, но глазами доля читается быстрее. */
.wager-bar {
  height: 6px;
  margin: 6px 0 2px;
  overflow: hidden;
  background: var(--bg-2);
  border-radius: 999px;
}
.wager-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

/* Результат последнего фриспина. */
.free-last {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
  margin: 8px 0;
}
.free-reels { font-size: 24px; letter-spacing: 4px; }
.free-win { font-weight: 700; color: var(--win); }
.free-miss { font-size: 13px; color: var(--muted); }

/* Лестница партнёрских процентов: пройденные ступени подсвечены, чтобы
   было видно, где ты и сколько до следующей. */
.tiers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.tiers .tier {
  padding: 8px 4px;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: 10px;
}
.tiers .tier span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.tiers .tier b {
  font-size: 15px;
  color: var(--text);
}
.tiers .tier.done {
  border-color: var(--accent);
}
.tiers .tier.done b { color: var(--accent); }

/* QR для пополнения. Белая подложка не для красоты: тёмный код на тёмном
   фоне сканируется плохо, а наводят на него обычно второпях. */
.qr {
  display: block;
  width: min(210px, 56vw);
  margin: 12px auto 4px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
}
.qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.qr-note {
  margin: 0 0 10px;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}

/* Живой значок на плитке: lottie рисует svg внутрь, и ему нужен размер —
   у текстового эмодзи его задавал кегль, у картинки задавать нечему. */
/* Анимация занимает всё отведённое значку место: lottie рисует svg, и
   размер ему надо задать — у текстового эмодзи его определял кегль. */
.mode-icon-anim svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Нарисованные значки вместо эмодзи. Размер задаётся здесь, а не в файле:
   один и тот же значок стоит и в круглой кнопке шапки, и в строке
   кабинета, и размеры у них разные. */
.ico {
  display: block;
  width: 1.35em;
  height: 1.35em;
  /* Значок нарисован градиентом и не наследует цвет текста, но выравнивать
     его по строке всё равно нужно как букву. */
  vertical-align: -.28em;
}
/* В строке рядом с текстом значок должен стоять в потоке, а не блоком. */
.wallet-head .ico,
.wide-btn .ico { display: inline-block; }
.cab-icon .ico { width: 26px; height: 26px; }

/* В шапке значок — единственное содержимое кнопки, поэтому он крупнее
   строчного: 1.35em от 14px давали мелкую марку. Отступы заодно ужимаем
   сильнее, чем выросли значки: иначе на узком экране кнопки съедают
   баланс и «199 279» схлопывается в «1..». */
.chip-btn { padding: 7px clamp(5px, 1.6vw, 9px); }
.chip-btn .ico { width: 26px; height: 26px; }
.chip-btn.back { padding: 8px 13px; }

/* Сгоревший или отыгранный бонус уходит с экрана, а не висит вскрытым. */
.bonus-gone {
  animation: bonus-out .34s ease forwards;
  pointer-events: none;
}
@keyframes bonus-out {
  to { opacity: 0; transform: scale(.96); }
}
@media (prefers-reduced-motion: reduce) {
  .bonus-gone { animation-duration: .01s; }
}

/* --- Блэкджек --------------------------------------------------------- */

.bj-table {
  display: grid;
  gap: 10px;
  padding: 16px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  /* --radius, а не выдуманная --r: с несуществующей переменной правило
     целиком невалидно, и стол стоял с прямыми углами среди скруглённых
     блоков. */
  border-radius: var(--radius);
  /* Стол не должен прыгать по высоте от раздачи к раздаче: две руки по
     одному ряду карт — это минимум, который на нём всегда помещается. */
  min-height: 232px;
  align-content: center;
}

.bj-side { display: grid; gap: 8px; }

.bj-who {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.bj-who b {
  font-size: 20px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bj-split { height: 1px; background: var(--line); }

.bj-hand {
  display: flex;
  flex-wrap: wrap;
  /* По центру: одна карта лежит посреди стола, а каждая следующая раздвигает
     руку в обе стороны. Разъезд доводит bjSlideOld — сам по себе флексбокс
     переставляет карты мгновенно. */
  justify-content: center;
  gap: 6px;
  min-height: 84px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Без flex: none пятая карта не переносится на новую строку, а ужимает
     всю руку — карты наезжают друг на друга и мельчают. */
  flex: none;
  width: 58px;
  height: 84px;
  padding: 7px 8px;
  background: #f4f1ea;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  color: #15171d;
  font-weight: 700;
  line-height: 1;
}
.card b { font-size: 17px; }
.card i { font-size: 20px; font-style: normal; align-self: flex-end; }
.card.red { color: #c02a3a; }

/* Рубашка: та же карта, только со спины. */
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .10) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, #2b3350, #161b2c);
  border: 1px solid rgba(255, 255, 255, .12);
}

/* Новая карта прилетает из колоды и замедляется, ложась на стол. Уже
   лежащие не трогаем: перерисовка после каждого хода иначе заставляла бы
   весь стол дёргаться.

   Кривая — с притормаживанием в конце: карта должна успокаиваться, а не
   останавливаться как вкопанная. */
.card.deal {
  animation: card-deal .36s cubic-bezier(.16, .84, .26, 1) both;
  animation-delay: var(--deal-delay, 0ms);
}
@keyframes card-deal {
  from {
    opacity: 0;
    transform: translate(48px, -34px) rotate(11deg) scale(.88);
  }
  60% { opacity: 1; }
  to { opacity: 1; transform: none; }
}

/* Закрытая карта дилера не подменяется лицевой, а переворачивается: иначе
   в конце руки на столе просто без объяснений появляется новая карта. */
.card.flip {
  animation: card-flip .38s cubic-bezier(.3, .7, .2, 1) both;
  animation-delay: var(--deal-delay, 0ms);
  transform-origin: center;
}
@keyframes card-flip {
  from { transform: rotateY(88deg) scale(.94); }
  55% { box-shadow: 0 8px 20px rgba(0, 0, 0, .55); }
  to { transform: none; }
}

.bj-rules {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.bj-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bj-actions .action { padding: 14px 6px; font-size: 15px; }
.bj-double { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.bj-double.dim { opacity: .4; }

/* Рука лежит в перспективе — без неё переворот выглядит плоским сжатием. */
.bj-hand { perspective: 700px; }

/* Сумма очков меняется рывком, и без этого кивка её легко не заметить. */
.bj-who b { transition: transform .18s cubic-bezier(.2, .8, .25, 1), color .18s ease; }
.bj-who b.bump { transform: scale(1.18); color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .card.deal, .card.flip { animation-duration: .01s; }
  .bj-who b { transition: none; }
}

/* --- подарки в кабинете ------------------------------------------------ */

/* Плитка инвентаря — витринная .gift плюс кнопки снизу. Кнопки прижаты
   к низу: у подарков разной длины названия, и без этого они прыгали бы
   по высоте от плитки к плитке. */
.cab-gift { justify-content: flex-start; }
.cab-gift-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  margin-top: auto;
  padding-top: 6px;
}

.mini {
  padding: 8px 4px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.mini:disabled { opacity: .45; }
.mini.gold { border-color: var(--accent); color: var(--accent); }

/* Причина отказа переносится на свою строку — рядом со статусом ей тесно. */
.wd-row { flex-wrap: wrap; }
.wd-why { width: 100%; font-size: 12px; color: var(--muted); font-style: normal; }

/* Адрес в админке: моноширинный, чтобы не путать цифры при сверке. */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
/* Имя-ссылка: кнопка, которая выглядит как текст. */
.link {
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Подозрительный аккаунт: обводка и метки словами. Мягкая — просто повод
   посмотреть, жёсткая — почти наверняка злоупотребление. */
.admin-card.suspect { border-color: rgba(248, 113, 113, .45); }
.admin-card.suspect.hard { border-color: var(--lose); box-shadow: 0 0 0 1px var(--lose) inset; }

.suspect-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suspect-flags .flag {
  padding: 3px 8px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(248, 113, 113, .10);
  border: 1px solid rgba(248, 113, 113, .30);
  border-radius: 999px;
}
.suspect-flags .flag.hard { color: var(--lose); border-color: var(--lose); }
