:root {
  /* Фон — тёмно-синий графит (не чёрный) */
  --bg: #151A2E;
  --bg-2: #1A2038;
  /* Поверхности/карточки */
  --surface: #1F2540;
  --card: rgba(31, 37, 64, 0.72);
  --card-solid: #1F2540;
  --stroke: rgba(255, 255, 255, 0.08);
  /* Текст */
  --text: #F5F6FA;
  --muted: #9CA3B8;
  /* Основные (3): синий — бренд/навигация, зелёный — прогресс/XP, оранжевый — акценты/награды */
  --primary: #2E5EFF;
  --primary-2: #1B44D6;
  --accent: #2E5EFF;
  --green: #3DD16F;
  --orange: #FF7A00;
  /* Функциональные */
  --red: #FF4757;      /* только здоровье/предупреждения */
  --gold: #FFC93C;     /* редкие достижения, топ-ранги */
  --purple: #8B5CF6;   /* способности, RPG-слой */
  --radius: 18px;
  --nav-h: 74px;
  --maxw: 520px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ---------- Icons ---------- */
.ic { display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.btn--icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
h2.row, h3.row { display: flex; align-items: center; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(46, 94, 255, 0.30), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(139, 92, 246, 0.16), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.screen {
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  animation: fade 0.28s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Typography ---------- */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  cursor: pointer;
  width: 100%;
  transition: transform 0.08s ease, filter 0.2s ease, opacity 0.2s;
  box-shadow: 0 10px 24px -8px rgba(46, 94, 255, 0.65);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; filter: grayscale(1); box-shadow: none; cursor: not-allowed; pointer-events: none; }
.btn--ghost { background: var(--card); box-shadow: none; border: 1px solid var(--stroke); }
.btn--accent { background: linear-gradient(135deg, var(--orange), #FF9A3C); box-shadow: 0 10px 24px -8px rgba(255, 122, 0, 0.6); }
.btn--gold { background: linear-gradient(135deg, var(--gold), #F5A623); color: #3a2a00; box-shadow: 0 10px 24px -8px rgba(255, 201, 60, 0.6); }
.btn--sm { padding: 9px 14px; font-size: 14px; width: auto; border-radius: 11px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(8px);
}
.card + .card { margin-top: 12px; }
.section { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar__title { display: flex; flex-direction: column; }
.topbar__title small { color: var(--muted); font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--stroke);
  padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 14px;
}
.chip--gold { color: var(--gold); }

/* ---------- Hero card ---------- */
.hero-card {
  position: relative;
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(150deg, rgba(46,94,255,0.55), rgba(27,68,214,0.35) 45%, rgba(139,92,246,0.32));
  border: 1px solid rgba(255,255,255,0.16);
  overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 90% 0%, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
}
.hero-avatar {
  width: 84px; height: 84px; border-radius: 20px;
  display: grid; place-items: center; font-size: 46px;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.2);
  position: relative;
}
.hero-avatar .pet { position: absolute; bottom: -6px; right: -6px; font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.hero-avatar .fx { position: absolute; top: -8px; left: -8px; font-size: 22px; }
.hero-avatar--sprite { width: auto; height: auto; background: transparent; border: none; }
.hero-avatar__sprite { height: 96px; width: auto; max-width: 130px; display: block; image-rendering: pixelated; filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.45)); }
.level-ring {
  position: absolute; top: 12px; right: 12px;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--pct, 0) * 1%), rgba(0,0,0,0.4) 0);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45));
  transition: background 0.7s cubic-bezier(.2,.8,.2,1);
}
.level-ring__inner {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(12,16,34,0.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1;
}
.level-ring__lvl { font-weight: 900; font-size: 19px; color: #fff; }
.level-ring__lbl { font-size: 8px; font-weight: 700; letter-spacing: 1.5px; color: var(--gold); margin-top: 2px; }

.level-ring--up { animation: lvlpop 1s cubic-bezier(.2,.8,.2,1); }
@keyframes lvlpop {
  0% { transform: scale(1); }
  30% { transform: scale(1.28); filter: drop-shadow(0 0 18px var(--gold)); }
  100% { transform: scale(1); }
}
.level-ring--up .level-ring__lvl { animation: lvlnum 0.8s ease; }
@keyframes lvlnum {
  0% { transform: translateY(7px) scale(0.6); opacity: 0; }
  60% { transform: translateY(0) scale(1.15); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
.level-ring--up::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--gold);
  animation: lvlripple 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes lvlripple {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- XP / progress bars ---------- */
.bar { height: 10px; border-radius: 999px; background: rgba(0,0,0,0.3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--purple)); transition: width 0.6s cubic-bezier(.2,.8,.2,1); }
.bar--xp .bar__fill { background: linear-gradient(90deg, var(--green), #6EE79A); }

/* ---------- Stats ---------- */
.stat { background: var(--card); border: 1px solid var(--stroke); border-radius: 14px; padding: 12px; }
.stat__top { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.stat__val { font-size: 20px; font-weight: 800; }
.statbar { height: 6px; border-radius: 999px; background: rgba(0,0,0,0.3); margin-top: 8px; overflow: hidden; }
.statbar__fill { height: 100%; border-radius: 999px; }

/* ---------- Selectable tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
  border: 1px solid var(--stroke); background: var(--card);
  border-radius: 14px; padding: 12px 8px; text-align: center; cursor: pointer;
  transition: all 0.15s ease; font-weight: 600; font-size: 13px;
}
.tile .emoji { display: flex; justify-content: center; margin-bottom: 6px; }
.tile.selected { border-color: var(--primary); background: linear-gradient(135deg, rgba(46,94,255,0.35), rgba(139,92,246,0.22)); box-shadow: 0 0 0 2px rgba(46,94,255,0.45); transform: translateY(-2px); }
.tile:active { transform: scale(0.96); }

/* ---------- Model / section picker (крупные безрамочные модели) ---------- */
.model-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
.model-tile {
  border: none; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 8px; border-radius: 22px;
  transition: transform 0.15s ease, background 0.2s ease;
}
.model-tile__img {
  height: 140px; width: auto; image-rendering: pixelated; display: block;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,0.5));
  transition: transform 0.15s ease;
}
.model-tile__name { font-weight: 700; font-size: 16px; color: var(--muted); transition: color 0.15s ease; }
.model-tile.selected {
  background: radial-gradient(circle closest-side at 50% 45%, rgba(46,94,255,0.42), rgba(46,94,255,0.12) 52%, transparent 100%);
}
.model-tile.selected .model-tile__img { transform: scale(1.1); }
.model-tile.selected .model-tile__name { color: var(--text); }
.model-tile:active { transform: scale(0.96); }

/* ---------- Кастомные подсказки ---------- */
.tip-pop {
  position: fixed; z-index: 400; display: none;
  background: var(--card-solid); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 8px 11px; font-size: 12px; font-weight: 500; line-height: 1.35;
  max-width: 220px; text-align: center;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.tip-pop--in { opacity: 1; transform: translateY(0); }
[data-tip] { cursor: help; }
.level-ring--btn { cursor: pointer; }
.level-ring--btn:active { transform: scale(0.94); }

/* ---------- Пошаговая регистрация ---------- */
.input-confirm { position: relative; }
.input-confirm .input { padding-right: 56px; }
.input-confirm__btn {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--card-solid); color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.input-confirm__btn:active { transform: translateY(-50%) scale(0.9); }
.input-confirm__btn--on {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
}

.auth-step[hidden] { display: none; }
.auth-step--in { animation: stepIn 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes stepIn {
  0% { opacity: 0; transform: translateY(26px); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Inputs ---------- */
.input {
  width: 100%; padding: 14px 16px; font-size: 16px;
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 14px; color: var(--text); outline: none;
}
.input:focus { border-color: var(--primary); }
.label { font-size: 13px; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }

/* ---------- List items ---------- */
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--stroke); }
.item + .item { margin-top: 10px; }
.item__ico { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: rgba(0,0,0,0.25); }
.item__body { flex: 1; min-width: 0; }
.item__title { font-weight: 700; font-size: 15px; }
.item__sub { color: var(--muted); font-size: 13px; }
.locked { opacity: 0.5; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.badge--ok { background: rgba(61,209,111,0.2); color: var(--green); }
.badge--lock { background: rgba(255,255,255,0.08); color: var(--muted); }
.badge--new { background: rgba(46,94,255,0.2); color: #7DA0FF; }

/* ---------- Quests progress ---------- */
.quest__prog { font-size: 12px; color: var(--muted); }

/* ---------- Bottom nav ---------- */
.nav[hidden] { display: none; }
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(21, 26, 46, 0.88);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--stroke);
  z-index: 50;
}
.nav__btn {
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; cursor: pointer; flex: 1; padding: 6px 0;
  transition: color 0.15s; position: relative;
}
.nav__badge {
  position: absolute; top: 2px; left: 50%; margin-left: 4px;
  min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
  animation: navpulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes navpulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.nav__ico { display: grid; place-items: center; height: 24px; }
.nav__btn--fab .nav__ico svg { width: 26px; height: 26px; }
.nav__btn.active { color: var(--text); }
.nav__btn.active .nav__ico { filter: drop-shadow(0 0 8px rgba(46,94,255,0.9)); transform: translateY(-1px); }
.nav__btn--fab .nav__ico {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  margin-top: -22px; box-shadow: 0 8px 20px -4px rgba(46,94,255,0.8); font-size: 24px;
  border: 3px solid var(--bg);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px);
  transform: translateX(-50%) translateY(20px);
  background: var(--card-solid); border: 1px solid var(--stroke);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px;
  z-index: 100; opacity: 0; transition: all 0.3s ease; pointer-events: none;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.6); max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Hero stage (главный экран боя) ---------- */
.hero-stage {
  position: relative;
  padding: 8px 16px 4px;
  margin-top: 2px;
  background: transparent;
  text-align: center;
}
.hero-stage__figure { position: relative; height: 240px; display: flex; align-items: flex-end; justify-content: center; }
.hero-stage__sprite {
  position: relative; z-index: 1; display: block; margin: 0 auto;
  height: 230px; width: auto; max-width: 88%; object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 14px 10px rgba(0, 0, 0, 0.45));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.hero-stage__platform {
  position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  width: 170px; height: 22px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5), transparent 72%);
  z-index: 0;
}
.hero-stage__name { font-size: 22px; font-weight: 800; margin-top: 10px; }
.hero-stage__power {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 5px 14px; border-radius: 999px;
  font-weight: 800; color: var(--accent);
  background: rgba(46, 94, 255, 0.12); border: 1px solid rgba(46, 94, 255, 0.3);
}
.sprite-sm { height: 64px; width: auto; image-rendering: pixelated; display: block; }
.sprite-fighter { height: 84px; width: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)); }

/* ---------- Big Battle button (Clash-Royale style) ---------- */
.battle-cta {
  position: sticky;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 20;
  margin-top: 22px;
}
.btn--battle {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 16px;
  border: none;
  cursor: pointer;
  color: #fff;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #FF9A3C 0%, #FF7A00 60%, #EE6A00 100%);
  box-shadow: 0 8px 0 0 #B85600, 0 18px 30px -8px rgba(255, 122, 0, 0.75), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn--battle:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 0 #B85600, 0 8px 16px -8px rgba(255, 122, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.4);
}
.btn--battle::after {
  content: "";
  position: absolute; top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 140%; } }
.btn--battle__ico { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); opacity: 0.9; }
.btn--battle__txt { font-size: 30px; font-weight: 900; letter-spacing: 0.08em; line-height: 1; }
.btn--battle__sub { font-size: 11px; font-weight: 700; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.14em; }

/* ---------- Battle ---------- */
.battle-arena { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 18px 0; }
.fighter { text-align: center; }
.fighter__ava { font-size: 54px; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5)); position: relative; }
.fighter__name { font-weight: 700; margin-top: 6px; }
.fighter__hp { height: 10px; border-radius: 999px; background: rgba(0,0,0,0.35); overflow: hidden; margin-top: 8px; }
.fighter__hp .fill { height: 100%; background: linear-gradient(90deg, var(--green), #6EE79A); transition: width 0.25s ease; }
.fighter__hp.enemy .fill { background: linear-gradient(90deg, var(--red), #FF7A6B); }
.vs { font-size: 22px; font-weight: 900; color: var(--gold); }
.battle-log { margin-top: 14px; min-height: 120px; }
.log-line { padding: 7px 12px; border-radius: 10px; background: var(--card); margin-top: 7px; font-size: 14px; border-left: 3px solid transparent; animation: fade 0.2s ease; }
.log-line--e { border-left-color: var(--green); }
.log-line--p { border-left-color: var(--red); }
.log-line.crit { color: var(--gold); font-weight: 700; border-left-color: var(--gold); background: linear-gradient(90deg, rgba(255,201,60,0.16), var(--card)); }
.shake { animation: shake 0.22s; }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* Всплывающие цифры урона над моделью */
.dmg-float {
  position: absolute; left: 50%; top: 0;
  font-weight: 900; font-size: 26px; line-height: 1;
  color: var(--red); text-shadow: 0 2px 6px rgba(0,0,0,0.65);
  pointer-events: none; z-index: 5; will-change: transform, opacity;
  animation: dmgFloat 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.dmg-float--crit { font-size: 36px; color: #FFD84D; text-shadow: 0 0 12px rgba(255,140,0,0.85), 0 2px 6px rgba(0,0,0,0.65); }
@keyframes dmgFloat {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -8px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(1); }
}

/* ---------- Icon button ---------- */
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid var(--stroke); background: var(--card);
  color: var(--text); cursor: pointer; transition: transform 0.12s ease, border-color 0.15s ease;
}
.icon-btn:hover { border-color: var(--primary); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Modal (bottom sheet) ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6, 9, 20, 0.62); backdrop-filter: blur(3px); animation: fade 0.2s ease; }
.modal__sheet {
  position: relative; width: 100%; max-width: var(--maxw); max-height: 86vh;
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: 22px 22px 0 0; box-shadow: 0 -14px 44px rgba(0,0,0,0.55);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; border-bottom: 1px solid var(--stroke); }
.modal__close { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: none; background: var(--card); color: var(--muted); cursor: pointer; transition: color 0.15s ease; }
.modal__close:active { color: var(--text); transform: scale(0.92); }
.modal__body { padding: 14px 18px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.item--tap { cursor: pointer; transition: transform 0.12s ease, background 0.15s ease; }
.item--tap:hover { background: var(--card-solid); }
.item--tap:active { transform: scale(0.98); }
.item__chevron { color: var(--muted); display: inline-flex; }

/* ---------- Reward animations ---------- */
.coin-fly {
  position: fixed; z-index: 200; pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}
.chip--pop { animation: chipPop 0.34s ease; }
@keyframes chipPop { 0%, 100% { transform: none; } 40% { transform: scale(1.18); } }

.quest-out {
  height: 0 !important; opacity: 0; transform: translateX(28px);
  margin-top: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;
  border-width: 0 !important;
  transition: height 0.42s ease, opacity 0.32s ease, transform 0.32s ease,
    margin 0.42s ease, padding 0.42s ease;
}

/* ---------- Current section ---------- */
.current-section {
  background: linear-gradient(135deg, rgba(46,94,255,0.28), rgba(139,92,246,0.16));
  border-color: rgba(46,94,255,0.4);
}
.current-section__ico {
  width: 60px; height: 60px; flex: 0 0 60px; border-radius: 16px;
  display: grid; place-items: center; background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.14);
}
.item--current { border-color: rgba(46,94,255,0.45); box-shadow: 0 0 0 1px rgba(46,94,255,0.35) inset; }

/* ---------- Battle loadout ---------- */
.loadout-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.loadout-chip { border-color: rgba(255,122,0,0.4); }

/* ---------- Stat allocation (registration) ---------- */
.alloc { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.alloc__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.alloc__name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.alloc__ctrl { display: flex; align-items: center; gap: 12px; }
.alloc__btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--stroke);
  background: var(--card); color: var(--text); font-size: 20px; font-weight: 800;
  display: grid; place-items: center; cursor: pointer; transition: transform 0.1s ease, border-color 0.15s ease;
}
.alloc__btn:hover:not(:disabled) { border-color: var(--primary); }
.alloc__btn:active:not(:disabled) { transform: scale(0.9); }
.alloc__btn:disabled { opacity: 0.3; cursor: default; }
.alloc__val { min-width: 28px; text-align: center; font-weight: 800; font-size: 17px; }

/* ---------- Section chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.chat__list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 46vh; overflow-y: auto; padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
}
.chat__empty { text-align: center; padding: 22px 8px; }
.chat__input { display: flex; gap: 8px; align-items: center; }
.chat__input .input { flex: 1; }
.chat__input .btn { flex: 0 0 auto; width: 48px; height: 48px; padding: 0; }

.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; animation: fade 0.2s ease; }
.msg--me { margin-left: auto; flex-direction: row-reverse; }
.msg__ava {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card);
  border: 1px solid var(--stroke); color: var(--muted);
}
.msg__bubble { background: var(--card); border: 1px solid var(--stroke); border-radius: 14px; padding: 8px 12px; }
.msg--me .msg__bubble { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; }
.msg__name { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.msg__text { font-size: 14px; line-height: 1.35; word-break: break-word; }
.msg__time { font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.msg--me .msg__time { color: rgba(255, 255, 255, 0.7); }

/* ---------- Result banner ---------- */
.result { text-align: center; padding: 26px 16px; border-radius: 20px; margin-bottom: 14px; }
.result--win { background: linear-gradient(135deg, rgba(61,209,111,0.32), rgba(46,94,255,0.18)); border: 1px solid rgba(61,209,111,0.4); }
.result--lose { background: linear-gradient(135deg, rgba(255,71,87,0.28), rgba(255,122,0,0.14)); border: 1px solid rgba(255,71,87,0.4); }
.result__title { font-size: 30px; font-weight: 900; }
.result__emoji { font-size: 56px; }

/* ---------- Misc ---------- */
.spacer { height: 8px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--stroke); margin: 16px 0; }
.owned-tag { color: var(--green); font-weight: 700; font-size: 13px; }
.price { color: var(--gold); font-weight: 800; }
.streak-flame { font-size: 15px; }
.info-note { font-size: 12px; color: var(--muted); background: rgba(46,94,255,0.08); border: 1px solid rgba(46,94,255,0.2); padding: 10px 12px; border-radius: 12px; line-height: 1.5; }
.link { color: var(--accent); text-decoration: underline; cursor: pointer; background: none; border: none; font: inherit; padding: 0; }
.premium-banner { background: linear-gradient(135deg, rgba(255,201,60,0.22), rgba(255,122,0,0.12)); border: 1px solid rgba(255,201,60,0.4); }
.tag-primary { font-size: 10px; background: rgba(46,94,255,0.25); color: #7DA0FF; padding: 2px 6px; border-radius: 6px; font-weight: 700; }

/* ---------- Auth ---------- */
.auth-tabs { display: flex; background: var(--card); border: 1px solid var(--stroke); border-radius: 14px; padding: 4px; gap: 4px; }
.auth-tab {
  flex: 1; border: none; background: none; color: var(--muted);
  padding: 11px; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; box-shadow: 0 6px 16px -6px rgba(46,94,255,0.7); }
.consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.5; cursor: pointer; }
.consent input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; accent-color: var(--primary); }

.avatar-preview { display: flex; align-items: center; gap: 14px; margin-top: 8px; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(46,94,255,0.3), rgba(139,92,246,0.18)); border: 1px solid var(--stroke); }
.avatar-preview__ava { width: 72px; height: 72px; flex: 0 0 72px; border-radius: 18px; display: grid; place-items: center; font-size: 42px; background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.2); }

/* ---------- Onboarding ---------- */
.onb-logo { font-size: 64px; text-align: center; margin: 30px 0 10px; filter: drop-shadow(0 0 30px rgba(46,94,255,0.8)); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

/* ---------- Расписание тренировок ---------- */
.week-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.day-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px; border-radius: 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--stroke); color: var(--muted);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.day-cell:active { transform: scale(0.94); }
.day-cell__name { font-weight: 700; font-size: 13px; }
.day-cell__time { font-size: 10px; opacity: 0.85; }
.day-cell--on {
  color: #fff; border-color: var(--primary);
  background: linear-gradient(135deg, rgba(46,94,255,0.4), rgba(139,92,246,0.25));
  box-shadow: 0 0 0 1px rgba(46,94,255,0.4);
}
.sched-times { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.sched-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--stroke);
}
.sched-row__day { font-weight: 600; font-size: 14px; }
.sched-time {
  background: var(--card-solid); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 9px;
  padding: 5px 8px; font-size: 14px; font-family: inherit;
  color-scheme: dark;
}
