/* Монетный двор — тёмная тема.
   Иконки: Kenney Board Game Icons (CC0) — вшиты в разметку как inline SVG. */

:root {
  /* Нейтральный (фон/текст/бордер) */
  --bg: hsl(226, 42%, 7%);
  --bg-soft: hsl(228, 42%, 9%);
  --card: hsl(229, 30%, 13%);
  --card-hi: hsl(230, 30%, 16%);
  --text: hsl(228, 35%, 93%);
  --muted: hsl(226, 13%, 62%);
  --border: hsl(229, 30%, 20%);
  --white: hsl(0, 0%, 100%);

  /* Primary (золото) */
  --gold: hsl(40, 87%, 55%);
  --gold-lo: hsl(38, 82%, 43%);
  --gold-hi: hsl(43, 100%, 75%);

  /* Accent (синий) + status */
  --brand: hsl(221, 100%, 63%);
  --brand-dark: hsl(221, 68%, 55%);
  --danger: hsl(0, 100%, 71%);

  /* Акцент второго уровня — бейдж «Проверка на честность» */
  --fair: hsl(255, 78%, 82%);
  --fair-bg: hsl(255, 72%, 63%);

  --shadow: 0 4px 24px hsla(0, 0%, 0%, 0.45);
  --radius: 16px;

  /* Типографическая шкала — 5 размеров, компоненты берут значения только отсюда. */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: clamp(28px, 5vw, 36px);

  /* Цвета редкости предметов — используются классами .r-common..r-legendary
     (сами классы объявлены локально на каждой странице как --rc:var(--r-*)).
     Отраслевой стандарт для лут-редкости, отдельная шкала сверх 3 брендовых цветов. */
  --r-common: hsl(220, 10%, 63%);
  --r-uncommon: hsl(142, 37%, 51%);
  --r-rare: hsl(213, 68%, 58%);
  --r-epic: hsl(272, 91%, 65%);
  --r-legendary: hsl(38, 100%, 59%);
}

/* Классы редкости — глобально (раньше объявлялись локально на каждой
   странице с тайлами предметов; вынесено сюда, т.к. лента дропов и виджеты
   из app.js подключаются и на страницах без локальных правил, напр. index.html).
   Локальные копии на case.html/cases.html/upgrade.html/inventory.html не мешают —
   cascade просто переопределяет тем же значением. */
.r-common    { --rc: var(--r-common); }
.r-uncommon  { --rc: var(--r-uncommon); }
.r-rare      { --rc: var(--r-rare); }
.r-epic      { --rc: var(--r-epic); }
.r-legendary { --rc: var(--r-legendary); }

/* Лёгкое свечение для редких/легендарных тайлов предметов сайтвайд. */
.item-tile.r-epic, .pick-tile.r-epic, .inv-card.r-epic, .cell.r-epic,
.item-tile.r-legendary, .pick-tile.r-legendary, .inv-card.r-legendary, .cell.r-legendary {
  box-shadow: 0 0 12px -2px var(--rc);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

/* --- Задний фон: свечение + монетный узор --- */

/* Золотое свечение сверху, холодное снизу. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 50% -8%, rgba(240, 180, 41, 0.16), transparent 70%),
    radial-gradient(700px 500px at 90% 100%, rgba(61, 123, 255, 0.10), transparent 70%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 60%);
}

/* Узор из монеток. SVG вшит data-URI — отдельный файл не нужен. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23f0b429' stroke-opacity='.08'%3E%3Ccircle cx='18' cy='18' r='7'/%3E%3Ccircle cx='18' cy='18' r='3'/%3E%3Ccircle cx='54' cy='54' r='7'/%3E%3Ccircle cx='54' cy='54' r='3'/%3E%3Ccircle cx='54' cy='18' r='2'/%3E%3Ccircle cx='18' cy='54' r='2'/%3E%3C/g%3E%3C/svg%3E");
  /* Узор гаснет к низу, чтобы не спорить с контентом. */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
          mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* --- Шапка --- */

header.site {
  background: rgba(14, 18, 32, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.logo svg { width: 26px; height: 26px; flex: none; }

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: var(--text-sm);
}
nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
nav a:hover { color: var(--text); }
#user-area { display: inline-flex; align-items: center; gap: 10px; font-size: var(--text-sm); }
#user-area .who { color: var(--text); }
#user-area a { color: var(--muted); text-decoration: none; white-space: nowrap; }
#user-area a:hover { color: var(--text); }

/* --- Экран --- */

.hero { text-align: center; padding: 54px 0 6px; }
.hero h1 {
  font-size: var(--text-xl);
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.hero p { color: var(--muted); margin: 0; font-size: var(--text-sm); }

.balance-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 26px auto;
  padding: 10px 18px;
  width: fit-content;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
}
.balance-bar svg { width: 18px; height: 18px; }
.balance-bar b { color: var(--gold); font-variant-numeric: tabular-nums; }
.balance-bar.relocated { display: none; }

/* Единая плашка баланса — по центру сверху на каждой странице (app.js
   переносит сюда уже существующий #balance, а не дублирует его). */
.balance-pill {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 16px; box-shadow: var(--shadow);
  font-size: var(--text-sm);
}
.balance-pill svg { width: 17px; height: 17px; }
.balance-pill b { color: var(--gold); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .balance-pill { top: 8px; font-size: var(--text-sm); padding: 6px 12px; } }

/* --- Паки --- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  padding: 18px 0 48px;
}

.pack {
  position: relative;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 18px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform .18s ease, border-color .18s ease;
}
.pack:hover { transform: translateY(-3px); border-color: rgba(240, 180, 41, 0.4); }

.pack .ico { width: 58px; height: 58px; margin-bottom: 10px; }
.pack .ico svg { width: 100%; height: 100%; display: block; }

.pack .amount {
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.pack .coins-label { color: var(--muted); font-size: var(--text-sm); }
.pack .price { font-size: var(--text-lg); font-weight: 700; margin: 14px 0; }

.pack .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(240, 180, 41, 0.15);
  border: 1px solid rgba(240, 180, 41, 0.45);
  color: var(--gold-hi);
}

/* --- Кнопки --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: none;
  cursor: pointer;
  background: var(--brand);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  padding: 11px 18px;
  border-radius: 10px;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.wide { width: 100%; }
.pack .btn { width: 100%; }

/* --- Вход / регистрация --- */

.auth-card {
  max-width: 400px;
  margin: 48px auto;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.tab {
  flex: 1;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
}
.tab.active { background: var(--brand); border-color: var(--brand); color: var(--white); }
.auth-card label { display: block; font-size: var(--text-sm); color: var(--muted); margin-bottom: 14px; }
.auth-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base); /* 16px — иначе iOS зумит страницу при фокусе */
  font-family: inherit;
}
.auth-card input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.hint { color: var(--muted); font-size: var(--text-sm); margin: 0 0 12px; }
.error { color: var(--danger); font-size: var(--text-sm); margin: 0 0 12px; min-height: 18px; }

/* --- История --- */

.history { padding-bottom: 56px; }
.history h2 { font-size: var(--text-lg); }
.history .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.history table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: var(--text-sm);
  min-width: 420px;
}
.history th, .history td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.history th { color: var(--muted); font-weight: 600; }
.history tr:last-child td { border-bottom: none; }
.history td:first-child { white-space: normal; }

/* --- Правовые страницы --- */

.legal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 34px;
  margin: 30px 0;
  box-shadow: var(--shadow);
}
.legal h1 { font-size: var(--text-xl); }
.legal h2 { font-size: var(--text-lg); margin-top: 28px; }
.legal .muted { color: var(--muted); font-size: var(--text-sm); }
.legal a { color: var(--brand); }
.notice {
  background: rgba(61, 123, 255, .10);
  border: 1px solid rgba(61, 123, 255, .35);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: var(--text-sm);
}

/* --- Результат оплаты --- */

.result { text-align: center; padding: 64px 0; }
.result .ico-big { width: 76px; height: 76px; margin: 0 auto 8px; }
.result .ico-big svg { width: 100%; height: 100%; }
.result .muted { color: var(--muted); }

/* --- Подвал --- */

footer.site {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
footer.site a { color: var(--muted); }
footer.site .links { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* ============ Телефоны ============ */

@media (max-width: 720px) {
  .container { padding: 0 14px; }

  /* Шапка в две строки: логотип и профиль сверху, ссылки лентой снизу. */
  header.site .container {
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 6px;
    min-height: 0;
  }
  .logo { font-size: var(--text-base); order: 1; }
  #user-area { order: 2; margin-left: auto; font-size: var(--text-sm); }
  nav {
    order: 3;
    width: 100%;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  nav::-webkit-scrollbar { display: none; }

  .hero { padding: 32px 0 4px; }
  .balance-bar { margin: 20px auto; }

  /* Два пака в ряд — на 360px тоже помещаются. */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 0 36px;
  }
  .pack { padding: 20px 12px 16px; border-radius: 14px; }
  .pack .ico { width: 46px; height: 46px; }
  .pack .amount { font-size: var(--text-xl); }
  .pack .price { font-size: var(--text-base); margin: 10px 0; }
  .pack .btn { padding: 10px 12px; font-size: var(--text-sm); }
  .pack:hover { transform: none; } /* на тапе подпрыгивание ни к чему */

  .legal { padding: 22px 18px; border-radius: 14px; }
  .auth-card { margin: 28px auto; padding: 22px 18px; }
  .result { padding: 44px 0; }
}

@media (max-width: 340px) {
  /* Совсем узкие экраны — один пак в ряд, чтобы цифры не жались. */
  .grid { grid-template-columns: 1fr; }
  .pack .ico { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ============ Боковое меню (app-разделы) ============ */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 210px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
  /* Разделов стало много (Кейсы/Апгрейд/Инвентарь/Баттлы/Профиль/Топ игроков/
     Пополнить + бренд + языковой селектор + виджет дневного бонуса) — на
     невысоких экранах это выше viewport. Без скролла нижние пункты просто
     обрезались и были невидимы. */
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar .sb-title {
  font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 6px 10px 10px;
}
.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: var(--text-sm); font-weight: 600;
}
.sb-link svg { width: 20px; height: 20px; flex: none; stroke: currentColor; }
.sb-link:hover { background: var(--card); color: var(--text); }
.sb-link.active { background: var(--card-hi); color: var(--text); }
.sb-link.active svg { stroke: var(--gold); }

.daily-widget {
  margin-top: auto;
  padding: 12px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.daily-title { font-size: var(--text-xs); color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.daily-dots { display: flex; gap: 4px; margin-bottom: 10px; }
.daily-dot {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--border);
}
.daily-dot.on { background: var(--r-uncommon); }
.daily-widget button[disabled] { opacity: .55; cursor: default; }

.feed-ticker {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.feed-body {
  display: flex; gap: 10px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.feed-body::-webkit-scrollbar { display: none; }
.feed-item {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border); border-bottom: 2px solid var(--rc, var(--border));
  border-radius: 10px;
  padding: 5px 10px 5px 6px;
  font-size: var(--text-xs);
  white-space: nowrap;
  transition: box-shadow .3s ease;
}
.feed-item.r-epic, .feed-item.r-legendary { box-shadow: 0 0 10px -2px var(--rc); }
.feed-item img { width: 26px; height: 26px; object-fit: contain; }
.feed-item .fi-user { color: var(--gold); font-weight: 700; }
.feed-item .fi-item { color: var(--rc, var(--text)); }
.feed-item.feed-in { animation: feed-in .35s ease; }
@keyframes feed-in {
  from { opacity: 0; transform: translateX(-12px) scale(.9); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .feed-item .fi-txt { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
}

/* Контент всегда по центру ОКНА. Панели — фиксированные оверлеи по краям.
   Чтобы центр не съезжал, отступы делаем симметричными: по ширине самой широкой панели. */
@media (max-width: 1560px) {
  /* Видны обе панели (сайдбар 210 + чат 320) — резервируем по 320 с каждой стороны. */
  .has-sidebar.has-chat header.site,
  .has-sidebar.has-chat main.container,
  .has-sidebar.has-chat footer.site { margin-left: 320px; margin-right: 320px; }

  /* Только сайдбар — по 210 с каждой стороны. */
  .has-sidebar header.site,
  .has-sidebar main.container,
  .has-sidebar footer.site { margin-left: 210px; margin-right: 210px; }
}

@media (max-width: 1200px) {
  /* Чат скрыт — остаётся симметрия только под сайдбар. */
  .chat-rail { display: none !important; }
  .has-sidebar.has-chat header.site,
  .has-sidebar.has-chat main.container,
  .has-sidebar.has-chat footer.site { margin-left: 210px; margin-right: 210px; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .has-sidebar header.site,
  .has-sidebar main.container,
  .has-sidebar footer.site { margin-left: 0; }
}

/* ============ Полоса на странице кейса (в стиле референса) ============ */

.case-band {
  position: relative;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 16px 20px;
  margin: 18px 0;
  overflow: hidden;
  text-align: center;
}
.case-band .band-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 190px; margin-bottom: 8px;
}
.case-band .band-row .side {
  flex: 1; display: flex; align-items: center; justify-content: center;
  opacity: .28; filter: grayscale(.5);
}
.case-band .band-row .side img { max-height: 120px; max-width: 90%; }
.case-band .band-row .center img { max-height: 180px; filter: drop-shadow(0 10px 26px rgba(0,0,0,.6)); }
.case-band .band-name { font-size: var(--text-lg); font-weight: 700; }
.case-band .band-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px;
}
.case-band .band-actions .btn.big { font-size: var(--text-base); padding: 13px 26px; }

/* ============ Апгрейдер ============ */

.upg-layout {
  display: grid;
  grid-template-columns: 1fr 300px 1fr;
  gap: 16px;
  padding: 16px 0 40px;
}
.upg-col {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-height: 260px;
}
.upg-col h3 { margin: 0 0 12px; font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.upg-center { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; }

.gauge { position: relative; width: 220px; height: 220px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .g-track { stroke: var(--border); }
.gauge .g-fill { stroke: url(#upgGrad); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.gauge .g-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.gauge .g-pct { font-size: var(--text-xl); font-weight: 800; color: var(--gold); }
.gauge .g-mult { font-size: var(--text-sm); color: var(--muted); }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pick-tile {
  position: relative; cursor: pointer;
  background: var(--bg-soft);
  border: 1px solid var(--border); border-bottom: 3px solid var(--rc, var(--border));
  border-radius: 10px; padding: 8px; text-align: center;
}
.pick-tile.sel { outline: 2px solid var(--gold); }
.pick-tile img { width: 100%; height: 52px; object-fit: contain; }
.pick-tile .nm { font-size: var(--text-xs); color: var(--muted); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pick-tile .vl { font-size: var(--text-xs); color: var(--gold); font-weight: 700; }
.upg-empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: var(--text-sm); }
.upg-slot {
  border: 1px dashed var(--border); border-radius: 12px;
  min-height: 120px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; margin-bottom: 12px; padding: 10px;
}
.upg-slot img { max-height: 100px; }

/* Колонки апгрейда сжимаются из-за боковых панелей — переносим их в столбик заранее. */
@media (max-width: 1400px) {
  .upg-layout { grid-template-columns: 1fr; }
  .upg-center { order: -1; }
  .pick-grid { max-height: 300px; }
}
@media (max-width: 820px) {
  .spinner-wrap { width: 190px; height: 190px; }
}

/* ============ Доработки: логотип, языки, чат, спиннер, инлайн-открытие ============ */

/* Бренд в сайдбаре (слева, у панели) */
.sb-brand{display:flex;align-items:center;gap:10px;padding:2px 10px 16px;font-weight:700;font-size: var(--text-base);color:var(--text);text-decoration:none}
.sb-brand svg{width:26px;height:26px;flex:none}
.has-sidebar header.site .logo{display:none} /* логотип в шапке дублирует — прячем */

/* Переключатель языка внизу сайдбара */
.sidebar{padding-bottom:60px}
.sb-lang{position:absolute;left:12px;right:12px;bottom:14px;display:flex;gap:6px}

/* Апгрейдер: вращающаяся стрелка на круговой шкале */
.spinner-wrap{position:relative;width:230px;height:230px}
.spinner-wrap svg.dial{transform:rotate(0deg)}
.spin-zone-win{stroke:var(--r-uncommon)}
.spin-zone-lose{stroke:var(--danger)}
.spin-pointer{position:absolute;top:50%;left:50%;width:6px;height:96px;transform-origin:50% 100%;transform:translate(-50%,-100%) rotate(0deg);transition:transform 4s cubic-bezier(.15,.6,.15,1)}
.spin-pointer .head{width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:16px solid var(--gold);margin:0 auto}
.spin-pointer .stem{width:4px;height:80px;background:var(--gold);margin:0 auto;border-radius:2px}
.spin-mid{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
.spin-mid .g-pct{font-size: var(--text-xl);font-weight:800;color:var(--gold)}
.spin-mid .g-mult{font-size: var(--text-sm);color:var(--muted)}

/* Инлайн-открытие кейса (без модалки) */
.inline-open{margin-top:18px}
.inline-open .reel-wrap{position:relative;overflow:hidden;border:1px solid var(--border);border-radius:12px;background:var(--bg);height:132px;-webkit-mask-image:linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent);mask-image:linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent)}
.fast-toggle{display:inline-flex;align-items:center;gap:8px;color:var(--muted);font-size: var(--text-sm);cursor:pointer;user-select:none}
.fast-toggle input{width:16px;height:16px;accent-color:var(--gold)}

/* Чат */
.chat-fab{position:fixed;right:18px;bottom:18px;z-index:60;width:52px;height:52px;border-radius:50%;background:var(--brand);border:none;cursor:pointer;box-shadow:var(--shadow);color:var(--white)}
.chat-panel{position:fixed;right:18px;bottom:80px;z-index:60;width:320px;max-width:calc(100vw - 36px);height:460px;max-height:calc(100vh - 120px);background:var(--card);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow);display:none;flex-direction:column;overflow:hidden}
.chat-panel.show{display:flex}
.chat-head{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid var(--border);font-weight:700;font-size: var(--text-sm)}
.chat-head .on{color:var(--r-uncommon);font-size: var(--text-xs);font-weight:600}
.chat-body{flex:1;overflow-y:auto;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.chat-msg{font-size: var(--text-sm);line-height:1.4}
.chat-msg .u{color:var(--gold);font-weight:700;margin-right:6px}
.chat-foot{display:flex;gap:6px;padding:8px;border-top:1px solid var(--border)}
.chat-foot input{flex:1;min-height:44px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font-size: var(--text-sm)}
.chat-foot button{border:none;min-height:44px;min-width:44px;background:var(--brand);color:var(--white);border-radius:8px;padding:0 14px;cursor:pointer}
.chat-guest{color:var(--muted);text-align:center;font-size: var(--text-sm);padding:8px}

/* ============ Чат-рейл (правая колонка) ============ */
.chat-rail{position:fixed;top:0;right:0;bottom:0;width:320px;z-index:40;background:var(--bg-soft);
  border-left:1px solid var(--border);display:none;flex-direction:column}
.chat-rail.show{display:flex}
.chat-rail .chat-head{display:flex;align-items:center;gap:8px;padding:14px 14px;border-bottom:1px solid var(--border);font-weight:700}
.chat-rail .chat-head .on{color:var(--r-uncommon);font-size: var(--text-xs);font-weight:600;margin-left:auto}
.chat-x{background:transparent;border:none;color:var(--muted);cursor:pointer;font-size: var(--text-sm);margin-left:6px;
  min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
.chat-rail .chat-body{flex:1;overflow-y:auto;padding:12px 14px;display:flex;flex-direction:column;gap:8px}
.chat-rail .chat-msg{font-size: var(--text-sm);line-height:1.4}
.chat-rail .chat-msg .u{color:var(--gold);font-weight:700;margin-right:6px}
.chat-rail .chat-foot{display:flex;gap:6px;padding:10px;border-top:1px solid var(--border)}
.chat-rail .chat-foot input{flex:1;min-height:44px;padding:9px 10px;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font-size: var(--text-sm)}
.chat-rail .chat-foot button{border:none;min-height:44px;min-width:44px;background:var(--brand);color:var(--white);border-radius:8px;padding:0 14px;cursor:pointer}
.chat-rail .chat-guest{color:var(--muted);text-align:center;font-size: var(--text-sm);padding:8px;width:100%}
/* Кнопка чата — только на узких экранах, где рейл спрятан */
.chat-fab{display:none}
@media (max-width:1200px){
  .chat-fab{display:block;position:fixed;right:18px;bottom:18px;z-index:60;width:52px;height:52px;border-radius:50%;background:var(--brand);border:none;cursor:pointer;box-shadow:var(--shadow);color:var(--white)}
  .chat-rail{width:300px;max-width:88vw;box-shadow:var(--shadow)}
}

/* ============ Выбор языка (выпадающий список) ============ */
.sb-lang select{width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:8px;
  background:var(--card);color:var(--text);font-size: var(--text-sm);font-family:inherit;cursor:pointer}

/* ============ Богатый подвал ============ */
footer.site.rich{border-top:1px solid var(--border);padding:34px 0 24px;margin-top:20px}
footer.site.rich .container{color:var(--muted)}
.ft-cols{display:grid;grid-template-columns:2fr 1fr 1fr 1fr;gap:24px}
.ft-brand b{color:var(--text);font-size: var(--text-lg)}
.ft-brand p{font-size: var(--text-xs);margin:10px 0 0;line-height:1.5}
.ft-col h4{color:var(--muted);font-size: var(--text-xs);letter-spacing:.08em;text-transform:uppercase;margin:0 0 10px}
.ft-col a{display:block;color:var(--muted);text-decoration:none;font-size: var(--text-sm);margin-bottom:8px}
.ft-col a:hover{color:var(--text)}
.ft-bottom{display:flex;align-items:center;gap:16px;margin-top:26px;padding-top:18px;border-top:1px solid var(--border)}
.ft-fair{display:inline-flex;align-items:center;gap:8px;background:hsla(255, 72%, 63%, .18);border:1px solid hsla(255, 72%, 63%, .5);
  color:var(--fair);text-decoration:none;padding:10px 16px;border-radius:10px;font-weight:600;font-size:var(--text-sm)}
.ft-18{color:var(--muted);font-size: var(--text-sm)}
@media (max-width:720px){ .ft-cols{grid-template-columns:1fr 1fr} }

/* ============ Главная: «Наши игры» ============ */
.games{padding:8px 0 20px}
.games h2{font-size: var(--text-sm);letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:0 0 14px}
.games-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}
.game-card{position:relative;display:block;text-decoration:none;color:var(--text);border-radius:14px;
  border:1px solid var(--border);background:linear-gradient(180deg,var(--card-hi),var(--card));
  padding:24px 20px;min-height:150px;overflow:hidden;transition:transform .15s,border-color .15s}
.game-card:hover{transform:translateY(-3px);border-color:rgba(240,180,41,.4)}
.game-card .gc-ico{width:64px;height:64px;margin-bottom:12px}
.game-card .gc-ico svg{width:100%;height:100%}
.game-card .gc-name{font-size: var(--text-lg);font-weight:700}
.game-card .gc-sub{color:var(--muted);font-size: var(--text-sm);margin-top:4px}

/* ============ Кликабельная карточка кейса ============ */
a.case-card{display:flex;text-decoration:none;color:var(--text);cursor:pointer;transition:transform .15s,border-color .15s}
a.case-card:hover{transform:translateY(-3px);border-color:rgba(240,180,41,.45)}

/* История: свёрнутый список */
#history-section .more-btn{margin:10px 0 0;min-height:44px;background:transparent;border:1px solid var(--border);color:var(--muted);
  padding:9px 16px;border-radius:9px;cursor:pointer;font-family:inherit;font-weight:600}
#history-section .more-btn:hover{color:var(--text);background:var(--card-hi)}


/* ===== Профиль/вход — фиксированно справа сверху, над чатом ===== */
#user-area {
  position: fixed; top: 12px; right: 16px; z-index: 50;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; box-shadow: var(--shadow);
}
@media (max-width: 900px) { #user-area { position: static; background: none; border: none; padding: 0; box-shadow: none; } }

.sound-toggle {
  position: fixed; top: 12px; right: 136px; z-index: 50;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); cursor: pointer; box-shadow: var(--shadow);
}
@media (max-width: 900px) { .sound-toggle { top: 8px; right: 16px; } }

.site-toast {
  position: fixed; top: 70px; left: 50%; z-index: 90;
  transform: translate(-50%, -12px); opacity: 0;
  background: var(--card-hi); border: 1px solid var(--gold); color: var(--text);
  padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: var(--text-sm);
  box-shadow: var(--shadow); transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.site-toast.show { opacity: 1; transform: translate(-50%, 0); }

.chat-rail { top: 56px; }
@media (max-width: 900px) { .chat-rail { top: 0; } }

/* ===== Красивый тумблер «Быстрая прокрутка» ===== */
.fast-toggle { gap: 10px; font-weight: 600; min-height: 44px; }
.fast-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.fast-toggle .sw {
  position: relative; width: 42px; height: 24px; flex: none;
  background: var(--border); border-radius: 999px; transition: background .2s;
}
.fast-toggle .sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: var(--white); border-radius: 50%; transition: transform .2s;
}
.fast-toggle input:checked + .sw { background: var(--gold); }
.fast-toggle input:checked + .sw::after { transform: translateX(18px); }

/* ===== Лента прокрутки внутри полосы кейса ===== */
.case-band .band-reel { margin-top: 8px; }
.case-band .band-reel .reel-wrap { border-radius: 12px; }

/* ===== Апгрейдер: аккуратнее ===== */
.upg-layout { grid-template-columns: minmax(0,1fr) 300px minmax(0,1fr); align-items: start; }
.upg-col { min-height: 320px; }
.upg-center { padding-top: 6px; }
.pick-grid { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.upg-slot { min-height: 132px; flex-direction: column; gap: 6px; font-size: var(--text-sm); }
.upg-slot img { max-height: 84px; }
.upg-slot .sl-name { color: var(--text); font-weight: 600; }

/* Стрелка-указатель как на референсе: широкая, с остриём */
.spin-pointer { width: 20px; height: 104px; }
.spin-pointer .head {
  width: 0; height: 0; margin: 0 auto;
  border-left: 11px solid transparent; border-right: 11px solid transparent;
  border-bottom: 20px solid var(--arrow, var(--danger));
  filter: drop-shadow(0 0 6px rgba(255,59,48,.55));
}
.spin-pointer .stem {
  width: 8px; height: 84px; margin: 0 auto; border-radius: 3px;
  background: var(--arrow, var(--danger));
  filter: drop-shadow(0 0 6px rgba(255,59,48,.45));
}

/* Адаптив апгрейда — в самом конце, чтобы перебить базовые правила выше. */
@media (max-width: 1400px) {
  .upg-layout { grid-template-columns: 1fr !important; }
  .upg-center { order: -1; }
  .pick-grid { max-height: 300px; }
}

/* ============ Мобильная адаптация ============ */

/* Бренд-монета крупнее в сайдбаре */
.sb-brand svg { border-radius: 50%; }

/* Нижняя навигация — только на телефоне */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  /* Панели скрыты — контент во всю ширину */
  .sidebar { display: none; }
  .has-sidebar header.site, .has-sidebar main.container, .has-sidebar footer.site { margin-left: 0; }
  .has-sidebar.has-chat header.site, .has-sidebar.has-chat main.container, .has-sidebar.has-chat footer.site { margin-left: 0; margin-right: 0; }
  .container { padding: 0 14px; }

  /* Профиль/вход — в шапку по центру справа, не перекрывая контент */
  #user-area { position: static; background: none; border: none; padding: 0; box-shadow: none; }
  header.site .container { min-height: 52px; justify-content: space-between; }

  /* Нижняя навигация */
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    background: var(--bg-soft); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mn-link {
    flex: 1; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: none; cursor: pointer;
    color: var(--muted); text-decoration: none; font-size: var(--text-xs); font-weight: 600; font-family: inherit;
  }
  .mn-link svg { width: 22px; height: 22px; stroke: currentColor; }
  .mn-link.on { color: var(--gold); }
  .mn-link.on svg { stroke: var(--gold); }

  /* Место под нижнюю навигацию, чтобы контент не прятался */
  body.has-sidebar { padding-bottom: 64px; }
  .chat-fab { bottom: 74px; }

  /* Сетки компактнее */
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cases-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .games-grid { grid-template-columns: 1fr; }
  .inv-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .hero { padding: 26px 0 4px; }
  .hero h1 { font-size: var(--text-xl); }

  /* Подвал в одну колонку */
  .footer.rich .ft-cols, footer.rich .ft-cols { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 560px) {
  .grid, .cases-grid { grid-template-columns: 1fr; }
  .case-band .band-row { height: 130px; }
  .case-band .band-row .center img { max-height: 120px; }
  .case-band .band-row .side { display: none; }
  .band-actions .btn.big { font-size: var(--text-sm); padding: 12px 18px; }
  .spinner-wrap { width: 190px; height: 190px; }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .has-sidebar header.site .logo { display: inline-flex !important; }
}

/* ============ Клавиатурная навигация (:focus-visible) ============
   Раньше единственный focus-стиль был у .auth-card input — вся остальная
   интерактивность (ссылки, кнопки, табы, чекбоксы, тайлы выбора) была не
   видна при табуляции. Один общий контур на всё, без изменений при клике
   мышью (:focus-visible, не :focus). */
a, button, input, select, textarea, [tabindex] {
  outline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
/* Тайлы предметов и .sel-состояния используют собственный outline цветом
   редкости — фокус поверх него делает тоньше свой контур того же золота,
   но с большим отступом, чтобы оба были различимы. */
.pick-tile:focus-visible, .item-tile:focus-visible, .inv-card:focus-visible, .cell:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
