/* =========================================================================
   Ragdoll Football — main.css
   Палитра "Sunny Stadium Toybox" + обязательные защиты Яндекс Игр.
   ========================================================================= */

:root {
  /* --- Палитра мира --- */
  --grass: #4FB85A;
  --grass-dark: #46A851;
  --line: rgba(255, 255, 255, .92);
  --sky-top: #2E7BD6;
  --sky-bottom: #7FC4F5;
  --stand: #3A4A63;
  --roof: #2A3447;

  /* --- Палитра UI --- */
  --bg: #14233B;
  --surface: #1E3354;
  --surface-2: #27406A;
  --ink: #0E1726;
  --ink-soft: #44516B;
  --paper: #F6F8FC;

  /* --- Акценты (не более 2 на экран) --- */
  --primary: #FFB020;
  --primary-hi: #FFC95C;
  --accent: #FF4D6D;
  --accent-cool: #21D0C3;
  --success: #34D399;
  --warn: #FF8A3D;

  /* --- Сетка/радиусы --- */
  --r-card: 12px;
  --r-btn: 24px;
  --gap: 8px;

  --font: "Nunito", "Baloo 2", system-ui, "Segoe UI", Roboto, Arial, sans-serif;

  /* Реальная высота вьюпорта (выставляется из JS, см. main.js) */
  --app-height: 100%;

  /* Безопасная зона слева (сайдбар платформы в ландшафте + системные вырезы-нотчи) */
  --safe-left: env(safe-area-inset-left, 0px);
}

/* --- Глобальный сброс + защиты выделения/контекстного меню (п.1.6.1.8) --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100%);
  overflow: hidden;                 /* нет браузерного скролла (п.1.10.2) */
  touch-action: manipulation;       /* запрет пинч-зума/двойного тапа */
  overscroll-behavior: none;        /* нет pull-to-refresh (Android/Chrome/Яндекс/Samsung) */
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}

#ui-root, .screen, #game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
}

#game-canvas {
  display: block;
  touch-action: none;               /* полная блокировка жестов на canvas */
  background: var(--bg);
  z-index: 0;
}

/* Контейнер UI пропускает клики к canvas; ловят только активные экраны. */
#ui-root {
  z-index: 10;
  pointer-events: none;
}

/* ========================= Экраны (screen) ============================== */
/* Класс-селекторы вместо #ui-root>* — иначе специфичность ломает
   pointer-events и невидимые экраны перехватывают клики (баг 15.1). */
.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-left: max(24px, var(--safe-left));
  opacity: 0;
  visibility: hidden;               /* блокирует клики + убирает из a11y-дерева */
  pointer-events: none;
  transition: opacity .28s ease, visibility .28s;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================ Виджеты =================================== */
.btn {
  pointer-events: auto;
  touch-action: none;               /* свайп по кнопке не скроллит страницу */
  font-family: var(--font);
  font-weight: 800;
  color: var(--ink);
  background: var(--primary);
  border: none;
  border-radius: var(--r-btn);
  min-height: 56px;
  min-width: 56px;
  padding: 14px 34px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 0 #C9851A;      /* "тойбокс" объём без размытых теней */
  transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #C9851A;
  background: var(--primary-hi);
}
.btn--ghost {
  background: var(--surface-2);
  color: var(--paper);
  box-shadow: 0 4px 0 #16243C;
}
.btn--ghost:active { background: var(--surface); box-shadow: 0 1px 0 #16243C; }

.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

/* Верхняя панель экрана (кнопка "назад" слева) */
.topbar {
  position: absolute;
  top: 16px;
  left: max(16px, var(--safe-left));
  right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.topbar .btn { pointer-events: auto; }

/* ---------------------------- Меню ------------------------------------- */
.title {
  font-weight: 800;
  font-size: clamp(40px, 9vw, 84px);
  line-height: .96;
  letter-spacing: .5px;
  color: var(--paper);
  text-align: center;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  margin-bottom: 32px;
}
.title .title__accent { color: var(--primary); }

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  width: min(360px, 84vw);
}
.menu-actions .btn { width: 100%; }

.menu-bottom {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}
.menu-bottom .btn { pointer-events: auto; }

.lang-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface);
  color: var(--paper);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  opacity: .85;
}

/* ------------------------ Настройки ------------------------------------ */
.panel {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 22px;
  width: min(420px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto;
}
.panel h2 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.row__label { font-size: 18px; font-weight: 700; }

/* Тогл вкл/выкл */
.toggle {
  pointer-events: auto;
  touch-action: none;
  position: relative;
  width: 64px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease;
}
.toggle[data-on="1"] { background: var(--success); }
.toggle::after {
  content: "";
  position: absolute;
  top: 4px; left: 4px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform .15s ease;
}
.toggle[data-on="1"]::after { transform: translateX(28px); }

/* Ползунок громкости (звук/музыка): 0=выкл слева, центр=дефолт, право=макс */
.vol-slider {
  -webkit-appearance: none; appearance: none;
  pointer-events: auto;
  touch-action: none;               /* перетаскивание не вызывает браузерный скролл/жесты (п.1.10.2) */
  width: 170px; max-width: 48vw; height: 10px;
  border-radius: 999px;
  background: var(--ink-soft);
  outline: none; cursor: pointer;
}
.vol-slider[data-off="1"] { background: #3a2230; }   /* выключено — приглушённый трек */
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--ink);
  cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.vol-slider[data-off="1"]::-webkit-slider-thumb { background: var(--ink-soft); }
.vol-slider::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); border: 3px solid var(--ink);
  cursor: pointer;
}
.vol-slider[data-off="1"]::-moz-range-thumb { background: var(--ink-soft); }
.vol-slider:focus-visible { box-shadow: 0 0 0 3px rgba(255,176,32,.4); }

/* ------------------------- Экран "скоро" ------------------------------- */
.soon-card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 28px;
  width: min(420px, 88vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}
.soon-card h2 { font-size: 26px; font-weight: 800; color: var(--primary); }
.soon-card p { font-size: 16px; font-weight: 600; color: var(--paper); opacity: .9; }

/* --------------------------- Загрузка ---------------------------------- */
#screen-loading { background: var(--bg); }
.loader {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 6px solid var(--surface-2);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
.loader-text {
  margin-top: 18px;
  font-size: 16px;
  font-weight: 700;
  color: var(--paper);
  opacity: .85;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------- Подсказка повернуть устройство ---------------------- */
.rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  text-align: center;
  padding: 24px;
}
.rotate-hint.active { display: flex; }
.rotate-hint__text { font-size: 18px; font-weight: 700; max-width: 320px; }
.rotate-hint__btn {
  pointer-events: auto;
  touch-action: none;
  margin-top: 6px;
  background: var(--surface-2);
  color: var(--paper);
  border: none;
  border-radius: var(--r-btn);
  min-height: 48px;
  padding: 10px 26px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}

/* ============================ HUD матча ================================= */
#screen-match { display: block; padding: 0; justify-content: initial; align-items: initial; }
#screen-match.active { pointer-events: none; } /* контейнер пропускает, ловят кнопки */

.hud-top { position: absolute; top: 8px; left: 0; right: 0; height: 50px; pointer-events: none; }
.score-pill {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: rgba(14,23,40,.72); border-radius: 999px;
  padding: 6px 16px; pointer-events: none;
}
.team-dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.score-num { font-weight: 800; font-size: 30px; min-width: 22px; text-align: center; color: var(--paper); }
.timer-txt { font-weight: 800; font-size: 22px; color: var(--paper); opacity: .92; min-width: 56px; text-align: center; }
.timer-txt.urgent { color: var(--accent); transform: scale(1.12); }
.hud-pause {
  position: absolute; right: 12px; top: 0; pointer-events: auto;
  width: 50px; height: 50px; border: none; border-radius: 50%;
  background: rgba(14,23,40,.72); display: flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: none;
}

.special-bar {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  width: 180px; height: 8px; border-radius: 999px; background: rgba(14,23,40,.55);
  overflow: hidden; pointer-events: none;
}
.special-fill { height: 100%; width: 0%; border-radius: 999px; transition: width .12s linear; }
.special-bar.ready { box-shadow: 0 0 0 2px var(--primary); }

/* экранные кнопки управления (ZERO-G: плавающий стик тяги + рывок + тормоз) */
.controls { position: absolute; inset: 0; display: none; pointer-events: none; }
.controls.show { display: block; }
/* левый плавающий стик: зона ловит палец, база+ручка появляются под ним */
.stick-zone { position: absolute; left: 0; bottom: 0; width: 48%; height: 78%; pointer-events: auto; touch-action: none; }
.stick-base {
  position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: rgba(246,248,252,.08); border: 3px solid rgba(246,248,252,.22);
  opacity: 0; transition: opacity .12s ease; pointer-events: none;
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; background: rgba(246,248,252,.42); border: 2px solid rgba(255,255,255,.55); pointer-events: none;
}
.pad-right { position: absolute; right: max(20px, env(safe-area-inset-right, 0px)); bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pad-btn {
  pointer-events: auto; touch-action: none;
  border: none; border-radius: 50%;
  background: rgba(246,248,252,.18);
  display: flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer;
  transition: background .08s ease, transform .08s ease;
}
.pad-btn.pressed { background: rgba(246,248,252,.42); transform: scale(.92); }
.pad-dash { width: 86px; height: 86px; background: rgba(255,77,109,.32); }
.pad-dash.cooling { opacity: .45; }
.pad-brake { width: 62px; height: 62px; background: rgba(33,208,195,.42); }
.pad-super { width: 58px; height: 58px; background: rgba(255,176,32,.30); opacity: .7; }
.pad-super.ready { opacity: 1; background: rgba(255,176,32,.4); box-shadow: 0 0 0 3px var(--primary), 0 0 18px rgba(255,176,32,.6); animation: pulse 1.2s ease-in-out infinite; }

/* тост «спецудар готов» */
.super-toast {
  position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none;
  font-weight: 800; font-size: 20px; color: var(--primary); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease;
}
.super-toast.show { opacity: 1; transform: translateY(0); }
@media (hover: hover) and (pointer: fine) { .controls { display: none !important; } }

/* подсказки управления (первый матч) — не мешают игре, плавно гаснут */
.match-hints {
  position: absolute; left: 0; right: 0; bottom: 14%; display: flex; flex-direction: column;
  align-items: center; gap: 6px; pointer-events: none; opacity: 0; transition: opacity .4s ease;
}
.match-hints.show { opacity: 1; }
.hint-line {
  display: flex; align-items: center; gap: 8px;
  background: rgba(14,23,40,.74); color: var(--paper); font-weight: 800; font-size: 15px;
  padding: 6px 14px; border-radius: 999px; -webkit-text-stroke: 0;
}
.hint-line svg { flex: 0 0 auto; opacity: .92; }

/* кнопка «?» (повтор подсказок) — рядом с паузой */
.hud-help {
  position: absolute; right: 70px; top: 0; pointer-events: auto;
  width: 50px; height: 50px; border: none; border-radius: 50%;
  background: rgba(14,23,40,.72); display: flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: none;
}
/* контекстная подсказка Тренировки (по центру сверху) */
.train-prompt {
  position: absolute; left: 0; right: 0; top: 17%; text-align: center; pointer-events: none;
  font-weight: 800; font-size: clamp(20px, 4vw, 28px); color: var(--primary-hi);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease;
}
.train-prompt.show { opacity: 1; transform: translateY(0); }

/* ===================== Оверлеи (пауза/результат) ======================= */
.screen.overlay { z-index: 5; background: rgba(11,18,34,.74); }
/* Карточки оверлеев не должны обрезаться на низких ландшафтных экранах — прокручиваем при нехватке высоты */
.screen.overlay .panel { max-height: calc(var(--app-height, 100vh) - 18px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.screen.overlay .panel::-webkit-scrollbar { display: none; }
.result-card, [data-screen="pause"] .panel { width: min(380px, 86vw); }
.result-title { font-size: 30px; font-weight: 800; text-align: center; }
.result-score { font-size: 46px; font-weight: 800; text-align: center; color: var(--paper); margin-bottom: 6px; }
[data-screen="pause"] .panel .btn, .result-card .btn { width: 100%; }

/* Модалка подтверждения инап-покупки */
.confirm-card { width: min(360px, 86vw); text-align: center; align-items: center; }
.confirm-get { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(14,23,40,.45); border-radius: var(--r-card); padding: 14px 18px; width: 100%; }
.confirm-get__label { font-size: 14px; font-weight: 700; color: var(--paper); opacity: .78; }
.confirm-get__amt { display: inline-flex; align-items: center; gap: 8px; font-size: 34px; font-weight: 800; color: var(--paper); }
.confirm-get__ic { display: inline-flex; align-items: center; }
.confirm-cost { font-size: 17px; font-weight: 700; }
.confirm-cost b { color: var(--paper); display: inline-flex; align-items: center; gap: 5px; }
.confirm-cost .cur-img { height: 18px; width: auto; vertical-align: middle; }
.confirm-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.confirm-actions .btn { width: 100%; }

/* Низкие ландшафтные экраны (телефон в игре): компактные оверлеи, чтобы карточка результата/паузы/
   подтверждения влезала без прокрутки (прокрутка из .screen.overlay .panel остаётся страховкой). */
@media (orientation: landscape) and (max-height: 480px) {
  .screen.overlay .panel { padding: 12px 18px; gap: 6px; }
  .panel h2 { font-size: 20px; margin-bottom: 0; }
  .result-title { font-size: 20px; }
  .result-score { font-size: 28px; margin-bottom: 0; }
  .result-line { font-size: 12.5px; }
  .screen.overlay .panel .btn { min-height: 40px; padding: 7px 14px; font-size: 15px; }
  .daily-card .daily-amount { font-size: 26px; }
  .confirm-get__amt { font-size: 28px; }
}

/* ===================== Экраны режимов (M4) ============================= */
.screen-title { font-size: clamp(22px, 5vw, 30px); font-weight: 800; color: var(--paper); text-align: center; margin-bottom: 14px; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* выбор режима */
.mode-grid { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.mode-card {
  pointer-events: auto; touch-action: none; cursor: pointer;
  width: 200px; height: 200px; border: none; border-radius: 20px;
  background: var(--surface); box-shadow: 0 5px 0 #16243C;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  border-bottom: 5px solid var(--mc, var(--primary));
}
.mode-card:active { transform: translateY(3px); box-shadow: 0 2px 0 #16243C; }
.mode-card__icon { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.mode-card__label { font-size: 22px; font-weight: 800; color: var(--paper); }

/* выбор персонажа */
.char-list {
  display: flex; gap: 12px; overflow-x: auto; max-width: 96vw; padding: 8px 12px;
  touch-action: pan-x; overscroll-behavior: contain; scrollbar-width: none;
}
.char-list::-webkit-scrollbar { display: none; }
.char-card {
  pointer-events: auto; touch-action: none; cursor: pointer; flex: 0 0 auto;
  width: 118px; border: 3px solid transparent; border-radius: 14px;
  background: var(--surface); padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative;
}
.char-card.sel { border-color: var(--primary); }
.char-card.locked { opacity: .55; }
.char-card__name { font-size: 15px; font-weight: 800; color: var(--paper); }
.char-card__stats { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.stat-chip { font-size: 10px; font-weight: 800; padding: 2px 5px; border-radius: 6px; background: var(--ink-soft); color: var(--paper); }
.stat-chip.up { background: var(--success); color: var(--ink); }
.stat-chip.down { background: var(--accent); color: var(--paper); }
.char-card__lock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(14,23,40,.45); border-radius: 12px; font-weight: 800; font-size: 13px; color: var(--paper);
}
.screen-foot { margin-top: 16px; }
.screen-foot .btn { min-width: 200px; }

/* выбор персонажа: герой-превью + полоса-селектор */
.char-hero {
  display: flex; align-items: center; gap: 20px; background: var(--surface);
  border-radius: 16px; padding: 14px 22px; pointer-events: auto; max-width: 92vw;
}
.char-hero__art { width: 132px; height: 150px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.char-hero__art canvas { display: block; }
.char-hero__info { display: flex; flex-direction: column; gap: 6px; }
.char-hero__name { font-size: clamp(22px, 5vw, 28px); font-weight: 800; color: var(--paper); }
.char-hero__splabel { font-size: 15px; font-weight: 700; color: var(--accent-cool); }
.char-hero__splabel b { color: var(--primary-hi); }
.char-hero__spdesc { font-size: 14px; font-weight: 600; color: var(--paper); opacity: .85; max-width: 240px; }
.char-strip {
  display: flex; gap: 8px; overflow-x: auto; max-width: 94vw; padding: 10px 8px; margin-top: 12px;
  touch-action: pan-x; overscroll-behavior: contain; scrollbar-width: none;
}
.char-strip::-webkit-scrollbar { display: none; }
.char-thumb {
  position: relative; flex: 0 0 auto; width: 58px; height: 70px; border: 3px solid transparent;
  border-radius: 12px; background: var(--surface-2); padding: 2px; cursor: pointer; touch-action: none;
}
.char-thumb.sel { border-color: var(--primary); }
.char-thumb.locked { opacity: .5; }
.char-thumb canvas { display: block; width: 100%; height: auto; }
.char-thumb__lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
@media (orientation: landscape) and (max-height: 460px) {
  .char-hero__art { width: 104px; height: 118px; }
  .char-strip { margin-top: 6px; }
  /* на низком ландшафте ограничиваем сетку магазина, чтобы подвал (кнопки) не обрезался */
  .shop-grid { max-height: 42vh; }
}

/* карьера */
.career-card, .ranked-card {
  background: var(--surface); border-radius: var(--r-card); padding: 22px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: auto;
  width: min(380px, 88vw);
}
.round-dots { display: flex; gap: 8px; }
.round-dots .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-soft); }
.round-dots .dot.done { background: var(--success); }
.round-dots .dot.cur { background: var(--primary); transform: scale(1.25); }
.round-label { font-size: 15px; font-weight: 700; color: var(--accent-cool); }
.vs-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vs-name { font-size: 18px; font-weight: 800; color: var(--paper); }
.career-card .btn, .ranked-card .btn { min-width: 200px; margin-top: 4px; }

/* рейтинг */
.league-badge { width: 56px; height: 56px; }
.rating-big { font-size: 48px; font-weight: 800; color: var(--paper); line-height: 1; }
.rating-sub { font-size: 13px; font-weight: 700; color: var(--accent-cool); text-transform: uppercase; letter-spacing: 1px; }
.wl { font-size: 18px; font-weight: 800; color: var(--paper); opacity: .85; }
.trophy { width: 56px; height: 56px; }

/* строки результата */
.result-line { font-size: 16px; font-weight: 700; color: var(--paper); text-align: center; }
.btn--reward { background: var(--success); box-shadow: 0 4px 0 #1F8F5E; }
.btn--reward:active { background: #4FE0AB; box-shadow: 0 1px 0 #1F8F5E; }

/* ====================== Экономика / магазин (M5) ======================= */
.btn--sm { min-height: 44px; padding: 8px 18px; font-size: 16px; }
.menu-row { display: flex; gap: 12px; width: 100%; }
.menu-row .btn { flex: 1; }

.currency-bar { position: absolute; top: 16px; left: max(16px, var(--safe-left)); display: flex; gap: 10px; }
.cur { display: inline-flex; align-items: center; gap: 5px; background: rgba(14,23,40,.6); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 800; font-size: 15px; color: var(--paper); }
.cur__ic { display: inline-flex; align-items: center; }

.shop-head { display: flex; justify-content: center; margin-bottom: 6px; }
.shop-head .currency-bar { position: static; }
.shop-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.shop-tab {
  pointer-events: auto; cursor: pointer; touch-action: manipulation;
  border: none; border-radius: 12px; padding: 8px 18px; min-height: 44px;
  font-weight: 800; font-size: 15px; color: var(--paper); background: var(--surface-2);
}
.shop-tab.active { background: var(--primary); color: var(--ink); }
.shop-grid {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  max-width: 96vw; max-height: 56vh; overflow-y: auto; padding: 8px;
  touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: none;
}
.shop-grid::-webkit-scrollbar { display: none; }
.shop-card { width: 112px; background: var(--surface); border: 3px solid transparent; border-radius: 14px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.shop-card.sel { border-color: var(--primary); }
.shop-card--wide { width: 124px; }
.arena-thumb { display: block; border-radius: 8px; box-shadow: 0 0 0 2px rgba(14,23,40,.35); }
/* имя арены: ровно 2 строки (длинные RU-названия не растят карточку и не срезают кнопку) */
.shop-card--wide .char-card__name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.15; min-height: 2.3em; text-align: center;
}
.shop-card .btn { width: 100%; }
.shop-tag { font-size: 13px; font-weight: 800; color: var(--accent-cool); padding: 6px; }
.shop-tag.locked-tag { color: var(--ink-soft); }
.btn.price { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.btn.price.dim { opacity: .55; }
.shop-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* ежедневная награда */
.daily-card { width: min(340px, 86vw); text-align: center; align-items: center; }
.daily-day { font-size: 15px; font-weight: 700; color: var(--accent-cool); }
.daily-amount { display: inline-flex; align-items: center; gap: 8px; font-size: 40px; font-weight: 800; color: var(--primary); }
.daily-card .btn { min-width: 180px; }

/* уровень игрока (меню) */
.level-pill { position: absolute; top: 52px; left: max(16px, var(--safe-left)); display: flex; align-items: center; gap: 8px; background: rgba(14,23,40,.6); border-radius: 999px; padding: 4px 12px; }
.level-pill__lv { font-weight: 800; font-size: 14px; color: var(--primary-hi); }
.level-pill__bar { width: 70px; height: 7px; border-radius: 999px; background: var(--ink-soft); overflow: hidden; }
.level-pill__bar i { display: block; height: 100%; background: var(--accent-cool); border-radius: 999px; transition: width .3s ease; }

/* бейдж «есть награда» на кнопке заданий */
.has-badge { position: relative; }
.nav-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; align-items: center; justify-content: center; padding: 0 5px; }

/* ежедневные задания */
.quest-list { width: min(440px, 92vw); display: flex; flex-direction: column; gap: 10px; pointer-events: auto; max-height: 70vh; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: none; }
.quest-list::-webkit-scrollbar { display: none; }
.quest-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 12px; padding: 12px 16px; }
.quest-row.done { opacity: .55; }
.quest-row__main { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.quest-row__text { font-weight: 800; font-size: 15px; color: var(--paper); }
.quest-bar { height: 8px; border-radius: 999px; background: var(--ink-soft); overflow: hidden; }
.quest-bar i { display: block; height: 100%; background: var(--success); border-radius: 999px; transition: width .3s ease; }
.quest-row__prog { font-size: 12px; font-weight: 700; color: var(--accent-cool); }
.quest-row__rew { display: flex; align-items: center; gap: 4px; font-weight: 800; color: var(--primary-hi); flex: 0 0 auto; }
.quest-claimed { display: flex; align-items: center; color: var(--success); }

/* лидерборд */
.lb-list { width: min(420px, 92vw); max-height: 64vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; touch-action: pan-y; overscroll-behavior: contain; scrollbar-width: none; pointer-events: auto; }
.lb-list::-webkit-scrollbar { display: none; }
.lb-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 10px; padding: 10px 16px; }
.lb-row.you { background: var(--surface-2); box-shadow: 0 0 0 2px var(--primary); }
.lb-rank { font-weight: 800; color: var(--accent-cool); min-width: 36px; }
.lb-name { flex: 1; font-weight: 700; color: var(--paper); }
.lb-score { font-weight: 800; color: var(--paper); }

/* ===================== Дуэль / матчмейкинг (M4) ======================== */
.avatar {
  width: 60px; height: 60px; border-radius: 16px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.18); color: #fff;
}
.avatar svg { width: 32px; height: 32px; }
.avatar--sm { width: 38px; height: 38px; border-radius: 11px; }
.avatar--sm svg { width: 20px; height: 20px; }

@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

.mm-card {
  background: var(--surface); border-radius: var(--r-card); padding: 24px;
  width: min(440px, 90vw); display: flex; flex-direction: column; align-items: center; gap: 16px; pointer-events: auto;
}
.mm-status { font-size: 20px; font-weight: 800; color: var(--paper); text-align: center; min-height: 26px; }
.mm-candidates { width: 100%; height: 132px; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.mm-cand { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; opacity: .5; transition: opacity .2s; }
.mm-cand__name { flex: 1; font-weight: 700; font-size: 14px; color: var(--paper); }
.mm-cand__rt { font-weight: 800; font-size: 13px; color: var(--accent-cool); }

.vs-row { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 130px; }
.vs-side__name { font-size: 16px; font-weight: 800; color: var(--paper); text-align: center; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-side__rt { font-size: 13px; font-weight: 700; color: var(--accent-cool); }
.vs-side__ping { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.vs-mid { font-size: 32px; font-weight: 800; color: var(--accent); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }

/* дуэль: карточка рейтинга */
.duel-card { background: var(--surface); border-radius: var(--r-card); padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: auto; width: min(380px, 88vw); }
.duel-rating { font-size: 50px; font-weight: 800; color: var(--paper); line-height: 1; }
.duel-league { font-size: 14px; font-weight: 800; color: var(--accent-cool); text-transform: uppercase; letter-spacing: 1.5px; }
.duel-wl { font-size: 16px; font-weight: 800; color: var(--paper); opacity: .85; }
.duel-card .btn { min-width: 210px; margin-top: 4px; }

/* турнирная лесенка-сетка */
.bracket {
  display: flex; align-items: stretch; gap: 0; max-width: min(420px, 90vw);
  overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; touch-action: pan-x;
}
.bracket::-webkit-scrollbar { display: none; }
.bracket-slot {
  flex: 0 0 auto; width: 78px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface-2); border: 2px solid transparent; border-radius: 12px; padding: 7px 5px; opacity: .65;
}
.bracket-slot.done { opacity: 1; border-color: var(--success); }
.bracket-slot.cur { opacity: 1; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.bracket-round { font-size: 11px; font-weight: 800; color: var(--accent-cool); text-transform: uppercase; letter-spacing: .5px; }
.bracket-name { font-size: 11px; font-weight: 700; color: var(--paper); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bracket-diff { width: 56px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.16); overflow: hidden; }
.bracket-diff span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bracket-mark { height: 16px; }
.bracket-conn { flex: 0 0 auto; align-self: center; width: 12px; height: 3px; border-radius: 2px; background: var(--ink-soft); }
.bracket-trophy { flex: 0 0 auto; align-self: center; display: flex; align-items: center; }

/* =================== Перекрытие сайдбаром платформы ===================== */
/* В ландшафте на мобильных слева панель ЯИ (~60px). Сдвигаем краевые
   элементы как минимум на 68px (п.1.10.3). */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --safe-left: calc(68px + env(safe-area-inset-left, 0px)); }
}

/* =================== Showcase / демо-бот (промо-видео, ?bot=1) =========== */
/* Чистый кадр для записи: прячем все интерактивные/служебные элементы.
   Счёт (.score-pill) оставляем (knob hud=1); ?bot=1&hud=0 → body.no-hud прячет и его. */
body.showcase .hud-help,
body.showcase .hud-pause,
body.showcase .special-bar,
body.showcase .controls,
body.showcase .match-hints,
body.showcase .super-toast,
body.showcase .train-prompt { display: none !important; }
body.showcase.no-hud .hud-top { display: none !important; }
