/* Шрифт подключён локально: CDN в мини-приложениях режется политикой CSP.
   Inter — интерфейсный гротеск с ровной кириллицей и настоящими табличными
   цифрами; в игре весь текст набран им, разница между заголовком и подписью
   держится на весе и трекинге, а не на втором шрифте. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-400-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-500-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-600-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter-700-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/inter-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/inter-800-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/inter-800-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Аркана — оформление.

   Вёрстка вертикальная, под телефон: стол занимает высоту экрана целиком,
   рука прокручивается вбок. На широком экране всё просто центрируется
   колонкой в 560 px — отдельного «десктопного» макета нет намеренно,
   площадка у игры мобильная (ВК и ОК). */

/* Палитра — тёплое дерево, бронза и свечной свет, как у настольной карточной
   игры. Холодным остаётся только то, что должно читаться как «магия»:
   мана, кристаллы и пыль. */
:root {
  --bg: #1a1009;
  --bg-2: #2a1a0f;
  --panel: rgba(48, 30, 17, 0.94);
  --panel-line: rgba(206, 158, 84, 0.3);
  --ink: #f6e9d2;
  --ink-dim: #c4ab85;
  --gold: #f0c260;
  --gold-deep: #96661a;
  --crystal: #7ad4ff;
  --dust: #cbb2ff;
  --danger: #ff6a5a;
  --ok: #8fd97a;

  --fire: #ff6b4a;
  --water: #4ac4ff;
  --nature: #5ddc8a;
  --light: #ffd45e;
  --dark: #b07bff;
  --neutral: #9fb4d0;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Фон собран слоями: сверху тёплое пятно света, снизу виньетка, между ними
   сильно затемнённая и размытая карточная комната. Размытие обязательно —
   резкий фон спорит с портретом героини и мешает читать интерфейс. */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  overscroll-behavior: none;
}

/* Отдельный слой, чтобы размывать картинку, не трогая содержимое страницы. */
body::before {
  content: '';
  position: fixed; inset: -40px;
  z-index: -2;
  background: url('art/bg_menu.webp') center / cover no-repeat;
  filter: blur(7px) saturate(0.75) brightness(0.42);
  transform: scale(1.06);
}

/* Свет сверху, виньетка по краям, лёгкий шум — чтобы фон не был «пластиковым». */
body::after {
  content: '';
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90% 60% at 50% -10%, rgba(240, 160, 32, 0.16), transparent 60%),
    radial-gradient(120% 100% at 50% 50%, transparent 45%, rgba(6, 3, 1, 0.85) 100%),
    linear-gradient(180deg, rgba(16, 11, 7, 0.55), rgba(10, 6, 3, 0.85));
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
}

h1, h2, h3 {
  margin: 0 0 6px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
}
p { margin: 0 0 8px; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------------- шапка ---------------- */

.app-header {
  width: min(100%, 620px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(20, 12, 6, 0.96), rgba(20, 12, 6, 0.55));
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, #f6cf7a, #b3782a);
  font-size: 17px; font-weight: 700; color: #1a0f2c;
}
.brand-name { font-weight: 700; letter-spacing: 0.06em; }

.currencies { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cur-box {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.cur-crystal { color: var(--crystal); }
.cur-dust { color: var(--dust); }
.leader-box { cursor: pointer; }

/* ---------------- общие элементы ---------------- */

.screen {
  width: min(100%, 620px);
  flex: 1;
  padding: 8px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.screen-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 4px;
}
.screen-head h2 { flex: 1; font-size: 18px; }
.head-note, .deck-status { font-size: 12px; color: var(--ink-dim); }
.deck-status.ok { color: var(--ok); }
.deck-status.warn { color: var(--gold); }

.btn {
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-gold {
  background: linear-gradient(160deg, #ffd977, #d99a25);
  color: #2a1a04;
  border-color: rgba(255, 220, 140, 0.5);
  font-weight: 700;
}
.btn-ghost { background: transparent; }
.btn-small { padding: 7px 11px; font-size: 12px; border-radius: 10px; }
.btn-big {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 14px 16px; font-size: 16px; font-weight: 600; text-align: left;
}
.btn-big small { font-size: 12px; font-weight: 400; opacity: 0.75; }

.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(12, 7, 3, 0.8);
  backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(100%, 420px);
  max-height: 88dvh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.panel-emblem { font-size: 38px; margin-bottom: 6px; }
.panel-title { font-size: 22px; }
.panel-sub { color: var(--ink-dim); font-size: 13px; }
.panel-note { margin-top: 10px; font-size: 12px; color: var(--ink-dim); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.panel-reward { display: flex; gap: 14px; justify-content: center; margin-top: 12px; font-size: 15px; }
.reward-row { display: flex; align-items: center; gap: 6px; }

.ad-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); font-size: 11px; letter-spacing: 0.08em;
}
.ad-timer { margin: 12px auto; width: 54px; height: 54px; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--panel-line); font-size: 20px; }

/* ---------------- карта ---------------- */

.card {
  position: relative;
  width: 96px;
  height: 132px;
  border-radius: 12px;
  overflow: hidden;
  background: #2b1a0e;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  flex: 0 0 auto;
  user-select: none;
}
.card.compact { width: 72px; height: 100px; }

.card-art { position: absolute; inset: 0; display: grid; place-items: center; }
/* Лицо на портретах в верхней трети — держим кроп там же, иначе на маленькой
   карточке видно только одежду. */
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; }
.card-art.has-art .card-emblem { display: none; }
.card-emblem { font-size: 40px; opacity: 0.34; color: #fff; }

.card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14, 8, 3, 0.05) 40%, rgba(14, 8, 3, 0.93) 100%);
}
.card > *:not(.card-art) { position: relative; z-index: 2; }

.card-cost {
  position: absolute; top: 4px; left: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #63b8ff, #2a5ecb);
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.card-elem { position: absolute; top: 5px; right: 5px; font-size: 12px; opacity: 0.9; }
.card-gem { position: absolute; top: 30px; right: 6px; font-size: 11px; color: var(--gold); }
/* Имя — на тёмной ленте: портреты светлые, без подложки подпись пропадает. */
.card-name {
  position: absolute; bottom: 33px; left: 0; right: 0;
  padding: 1px 4px;
  font-size: 10.5px; font-weight: 700; text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  background: linear-gradient(90deg, transparent, rgba(14, 8, 3, 0.78) 15%, rgba(14, 8, 3, 0.78) 85%, transparent);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
/* Метка вместо описания: «Провокация», «Боевой клич» и т. п. Полный текст
   показывается плашкой над рукой — на 96 px он всё равно нечитаем. */
.card-text {
  position: absolute; bottom: 15px; left: 4px; right: 4px;
  font-size: 8.5px; line-height: 1.2; text-align: center;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-atk, .card-hp {
  position: absolute; bottom: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.card-atk { left: 4px; background: linear-gradient(160deg, #ffd06a, #c07a12); color: #2a1a04; }
.card-hp { right: 4px; background: linear-gradient(160deg, #ff8a8a, #b52a3a); color: #fff; }
.card-atk.buffed, .card-hp.buffed { box-shadow: 0 0 8px var(--ok); }
.card-hp.hurt { background: linear-gradient(160deg, #ff6a6a, #7a1020); }
.card-count {
  position: absolute; top: 4px; right: 24px;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); font-size: 10px;
}

.rarity-2 { border-color: rgba(90, 169, 255, 0.75); }
.rarity-3 { border-color: rgba(195, 123, 255, 0.8); }
.rarity-4 { border-color: rgba(255, 201, 77, 0.9); box-shadow: 0 0 16px rgba(255, 201, 77, 0.35); }

/* Блик по верхней кромке — карта перестаёт выглядеть плоской наклейкой. */
.card::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.22), transparent 42%);
  pointer-events: none;
}
.rarity-4::before {
  background:
    linear-gradient(150deg, rgba(255, 235, 180, 0.35), transparent 45%),
    radial-gradient(circle at 85% 12%, rgba(255, 220, 130, 0.35), transparent 40%);
}

.card.locked { filter: grayscale(0.85) brightness(0.6); }
.card.playable { box-shadow: 0 0 0 2px rgba(120, 255, 190, 0.55), 0 6px 16px rgba(0, 0, 0, 0.45); }
.card.selected { transform: translateY(-14px) scale(1.06); z-index: 5; }
.card-back {
  background:
    repeating-linear-gradient(45deg, #5a3418 0 6px, #3d2210 6px 12px),
    #3d2210;
  border-color: rgba(255, 255, 255, 0.14);
}
.card-back::after { content: '華'; display: grid; place-items: center; height: 100%; font-size: 26px; opacity: 0.35; background: none; }

/* ---------------- портрет ----------------

   Общий блок для всех мест, где показывается героиня. Кандзи под картинкой —
   заглушка: как только портрет загрузился, ставится has-art и эмблема уходит.
   object-position смещён вверх: на сгенерированных портретах лицо в верхней
   трети кадра, и центральный кроп срезал бы его. */

.portrait {
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--c1, #6a5a8a), var(--c2, #241638));
}
.portrait img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
}
.portrait-emblem { font-size: 42px; opacity: 0.4; color: #fff; }
.portrait.has-art .portrait-emblem { display: none; }

/* ---------------- экран лидеров ---------------- */

.screen-leaders { align-items: center; }
.leaders-head { text-align: center; max-width: 460px; }
.leaders-head h1 { font-size: 26px; }
.leaders-head p { color: var(--ink-dim); font-size: 13px; }
.leader-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; width: 100%; }

.leader-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--panel-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.leader-card:hover { transform: translateY(-3px); border-color: var(--accent, var(--gold)); }
.leader-card:active { transform: scale(0.985); }

.leader-frame { position: relative; }
.leader-art { height: 230px; }
/* Затемнение снизу, чтобы имя читалось на любом портрете. */
.leader-frame::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14, 8, 3, 0) 45%, rgba(16, 9, 4, 0.94) 100%);
  pointer-events: none;
}
.leader-caption {
  position: absolute; left: 12px; right: 12px; bottom: 8px; z-index: 2;
  display: flex; flex-direction: column;
}
.leader-name { font-weight: 700; font-size: 19px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9); }
.leader-title { font-size: 11.5px; color: var(--gold); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9); }

.elem-chip {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(18, 10, 4, 0.7);
  border: 1px solid var(--accent, var(--panel-line));
  font-size: 11px;
  backdrop-filter: blur(4px);
}

.leader-body { padding: 9px 12px 11px; display: flex; flex-direction: column; gap: 6px; }
.leader-power, .menu-hero-power {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px; line-height: 1.35; color: #e2d6ff;
}
.leader-power b, .menu-hero-power b { color: #fff; }
.power-pill {
  flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: linear-gradient(160deg, #63b8ff, #2a5ecb); color: #fff;
}
.leader-lore { font-size: 11px; color: var(--ink-dim); font-style: italic; line-height: 1.35; }
.leader-flag { font-size: 10.5px; color: var(--gold); }

/* Стили главного экрана вынесены ниже, в блок «главный экран». */

/* ---------------- кампания ---------------- */

.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage {
  display: flex; align-items: center; gap: 10px;
  padding: 9px; text-align: left;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  color: var(--ink);
}
.stage.locked { opacity: 0.45; }
.stage.done { border-color: rgba(110, 240, 168, 0.45); }
.stage-index {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}
.stage.done .stage-index { background: rgba(110, 240, 168, 0.25); color: var(--ok); }
.stage-art {
  width: 46px; height: 58px; border-radius: 10px; flex: 0 0 auto;
}
.stage-art .portrait-emblem { font-size: 22px; }
.stage.locked .stage-art { filter: grayscale(0.9) brightness(0.7); }
.stage-body { flex: 1; min-width: 0; }
.stage-title { font-weight: 700; font-size: 14px; }
.stage-sub { font-size: 11.5px; color: var(--gold); }
.stage-text { font-size: 11.5px; color: var(--ink-dim); }
.stage-reward { font-size: 11px; text-align: right; color: var(--crystal); flex: 0 0 auto; }

/* ---------------- коллекция ---------------- */

.collection-body { display: flex; gap: 10px; align-items: flex-start; min-height: 0; }
.catalog { flex: 1; min-width: 0; }
.filters { display: flex; gap: 6px; margin-bottom: 8px; }
.chip {
  padding: 6px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--panel-line); background: transparent; color: var(--ink-dim);
}
.chip.active { background: rgba(255, 210, 120, 0.16); color: var(--gold); border-color: rgba(255, 210, 120, 0.4); }

.catalog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px; max-height: 62dvh; overflow-y: auto; padding-right: 4px;
}
.catalog-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
/* Карта тянется по ширине колонки, но пропорции держит — иначе портрет плющит. */
.catalog-item .card { width: 100%; height: auto; aspect-ratio: 24 / 33; }
.catalog-foot { font-size: 9.5px; color: var(--ink-dim); text-align: center; }
.catalog-item.unowned { opacity: 0.55; }
.catalog-item.exhausted .card { filter: brightness(0.7); }
.catalog-item.off-class .card { opacity: 0.5; }

.deck-panel {
  width: 190px; flex: 0 0 auto;
  border: 1px solid var(--panel-line); border-radius: 14px;
  padding: 8px; background: rgba(255, 255, 255, 0.03);
  display: flex; flex-direction: column; gap: 6px;
}
.deck-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.deck-count-big { font-weight: 700; font-size: 15px; color: var(--gold); }
.deck-count-big.ok { color: var(--ok); }
.deck-list { display: flex; flex-direction: column; gap: 3px; max-height: 54dvh; overflow-y: auto; }
.deck-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 8px; font-size: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border-left: 3px solid var(--accent, #888);
  cursor: pointer;
}
.row-cost {
  width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  background: linear-gradient(160deg, #63b8ff, #2a5ecb);
}
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-count { color: var(--gold); font-size: 11px; }
.deck-actions { display: flex; gap: 6px; }
.deck-actions .btn { flex: 1; }

.card-details { display: flex; gap: 12px; text-align: left; align-items: flex-start; }
.details-title { font-weight: 700; font-size: 16px; }
.details-sub { font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; }
.details-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; margin-bottom: 6px; }
.details-keywords { font-size: 11.5px; color: #ded0ff; line-height: 1.35; }

/* ---------------- свитки ---------------- */

.screen-packs { align-items: center; }
.pack-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pack-visual {
  position: relative; width: 132px; height: 176px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #8a4a1c, #3a1c08);
  border: 1.5px solid rgba(255, 210, 130, 0.5);
  box-shadow: 0 0 40px rgba(240, 170, 70, 0.4);
}
.pack-emblem { font-size: 58px; color: rgba(255, 230, 180, 0.85); }
.pack-glow { position: absolute; inset: -20%; background: radial-gradient(circle, rgba(255, 200, 110, 0.35), transparent 65%); animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.pack-note { font-size: 11.5px; color: var(--ink-dim); text-align: center; }
.pack-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pack-hint { font-size: 12px; color: var(--gold); min-height: 16px; }
.pack-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.pack-slot {
  opacity: 0; transform: translateY(14px) scale(0.9) rotateY(40deg);
  transition: all 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.pack-slot.revealed { opacity: 1; transform: none; }
.pack-slot.legendary .card { box-shadow: 0 0 26px rgba(255, 201, 77, 0.75); }
.pack-dup { font-size: 10px; color: var(--dust); }
.pack-total { text-align: center; margin-top: 8px; font-size: 12px; color: var(--dust); }
body.no-ads [data-role="ad"] { display: none; }

/* ---------------- бой ---------------- */

.screen-battle { padding: 4px 8px 10px; gap: 0; }

/* Стол: тёмное сукно с виньеткой, чтобы карты и портреты читались поверх,
   и тёплая подсветка снизу — она отмечает половину игрока. */
.battle {
  position: relative;
  display: flex; flex-direction: column;
  gap: 4px;
  min-height: calc(100dvh - 72px);
  padding: 6px 6px 4px;
  border-radius: 20px;
  /* Столешница из art/bg_board.webp: сверху затемнение под вражескую половину,
     снизу тёплый свет — своя сторона стола видна сразу. */
  background:
    linear-gradient(180deg, rgba(12, 7, 3, 0.72) 0%, rgba(12, 7, 3, 0.42) 45%, rgba(40, 22, 8, 0.48) 100%),
    url('art/bg_board.webp') center / cover no-repeat;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(206, 158, 84, 0.2);
}

.side { display: flex; flex-direction: column; gap: 3px; }
.side-enemy { order: 0; }
.side-player { order: 0; margin-top: auto; }
.hero-row { display: flex; align-items: center; gap: 10px; }
.side-enemy .hero-row { justify-content: flex-start; }
.hero-side { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-dim); }

.hero {
  position: relative;
  width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  overflow: visible;
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(10, 5, 20, 0.55), 0 6px 18px rgba(0, 0, 0, 0.5);
}
.hero.elem-fire { border-color: rgba(255, 140, 90, 0.8); }
.hero.elem-water { border-color: rgba(110, 200, 255, 0.8); }
.hero.elem-nature { border-color: rgba(120, 230, 160, 0.8); }
.hero.elem-light { border-color: rgba(255, 220, 120, 0.85); }
.hero.elem-dark { border-color: rgba(190, 140, 255, 0.85); }
/* Чей сейчас ход — видно по свечению вокруг портрета. */
.my-turn .hero-player { animation: heroTurn 2.2s ease-in-out infinite; }
.battle:not(.my-turn) .hero-enemy { animation: heroTurn 2.2s ease-in-out infinite; }
@keyframes heroTurn {
  0%, 100% { box-shadow: 0 0 0 4px rgba(10, 5, 20, 0.55), 0 0 12px rgba(255, 210, 120, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(10, 5, 20, 0.55), 0 0 26px rgba(255, 210, 120, 0.75); }
}
.hero-art { position: absolute; inset: 0; border-radius: 50%; }
.hero-art img { object-position: 50% 8%; }
.hero-art .portrait-emblem { font-size: 32px; }
.hero-hp {
  position: absolute; right: -6px; bottom: -4px; z-index: 3;
  min-width: 28px; height: 28px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: linear-gradient(160deg, #ff8a8a, #b52a3a); color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}
.hero-armor {
  position: absolute; left: -6px; bottom: -4px; z-index: 3;
  min-width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: linear-gradient(160deg, #cfe0ff, #6c86b8); color: #16233a;
}
.hero-atk {
  position: absolute; left: -6px; top: -4px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(160deg, #ffd06a, #c07a12); color: #2a1a04;
}
.hero-name {
  position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%);
  font-size: 10px; color: var(--ink-dim);
  max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.hero.targetable, .minion.targetable { animation: target 1s ease-in-out infinite; cursor: pointer; }
@keyframes target {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 120, 150, 0.7); }
  50% { box-shadow: 0 0 18px 4px rgba(255, 120, 150, 0.55); }
}

/* Сила героя — круглая печать рядом с портретом, как и ожидается в карточной игре. */
.hero-power {
  width: 78px; height: 78px; border-radius: 50%;
  padding: 6px 6px 0; text-align: center;
  border: 1.5px dashed rgba(206, 158, 84, 0.5);
  background: radial-gradient(circle at 50% 35%, rgba(255, 235, 190, 0.14), rgba(28, 16, 6, 0.72));
  font-size: 9px; line-height: 1.1; color: var(--ink-dim);
  flex: 0 0 auto; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.hero-power.usable {
  border-style: solid;
  border-color: rgba(255, 210, 120, 0.85);
  color: var(--ink);
  box-shadow: 0 0 16px rgba(255, 200, 100, 0.35);
}
.hero-power.usable:active { transform: scale(0.94); }
.hero-power.used { opacity: 0.35; }
.power-cost {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: linear-gradient(160deg, #63b8ff, #2a5ecb); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.power-name { font-weight: 700; font-size: 10px; color: var(--gold); }
.power-desc { font-size: 8px; overflow: hidden; max-height: 20px; }

.mana-row { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; max-width: 156px; }
.mana-gem {
  width: 13px; height: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(120, 190, 255, 0.35);
  /* Ромб вместо кружка: мана в игре — кристалл */
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  border-radius: 2px;
}
.mana-gem.full {
  background: linear-gradient(160deg, #9fe0ff, #2f6ede);
  box-shadow: 0 0 8px rgba(90, 180, 255, 0.75);
  border-color: transparent;
}
.mana-gem.temp { background: linear-gradient(160deg, #ffe08a, #c08a20); }
.mana-label { font-size: 11px; margin-left: 4px; color: var(--crystal); font-weight: 600; }

.hand { display: flex; gap: 4px; overflow-x: auto; overflow-y: visible; padding: 6px 2px; scrollbar-width: none; }
.hand::-webkit-scrollbar { display: none; }
.hand-enemy { justify-content: center; gap: 2px; }
.hand-enemy .card-back { width: 34px; height: 48px; }
.hand-player { min-height: 146px; align-items: flex-end; justify-content: center; padding-top: 14px; }
/* Лёгкий веер: карта приподнимается и распрямляется при выборе. */
.hand-player .card {
  transform-origin: 50% 120%;
  transform: rotate(calc((var(--i) - (var(--n) - 1) / 2) * 2.2deg));
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}
.hand-player .card.playable { box-shadow: 0 0 0 2px rgba(120, 255, 190, 0.6), 0 8px 18px rgba(0, 0, 0, 0.5); }
.hand-player .card.selected { transform: translateY(-16px) scale(1.08) rotate(0deg); z-index: 5; }

.board {
  display: flex; gap: 5px; justify-content: center; align-items: center;
  min-height: 100px; padding: 6px 4px;
  border-radius: 16px;
  transition: background 0.2s ease, outline-color 0.2s ease;
  outline: 1px solid transparent;
}
.board-enemy { background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent); }
.board-player { background: linear-gradient(0deg, rgba(240, 194, 96, 0.12), transparent); }
.board.empty { opacity: 0.9; }
.board.placing {
  background: rgba(120, 255, 190, 0.1);
  outline: 1px dashed rgba(120, 255, 190, 0.55);
}

/* Центральная линия — «граница» стола с ромбом посередине. */
.table-line {
  position: relative;
  height: 24px; display: grid; place-items: center;
  background: linear-gradient(90deg, transparent, rgba(240, 194, 96, 0.32), transparent);
  border-radius: 999px;
}
.table-line::before, .table-line::after {
  content: '◆';
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 9px; color: rgba(240, 194, 96, 0.65);
}
.table-line::before { left: 10px; }
.table-line::after { right: 10px; }
.turn-banner {
  font-size: 11px; letter-spacing: 0.06em; color: var(--ink-dim);
  background: rgba(18, 10, 4, 0.8); padding: 2px 12px; border-radius: 999px;
  max-width: 82%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.my-turn .turn-banner { color: var(--gold); }

.minion {
  position: relative;
  width: 68px; height: 84px; border-radius: 12px; overflow: visible;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
  transition: transform 0.14s ease, box-shadow 0.18s ease;
}
/* Анимация выхода играет только у только что выставленного существа:
   раньше она висела на .minion и переигрывалась при каждой перерисовке — стол
   моргал на любое действие. */
.minion.is-new { animation: summon 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes summon { from { opacity: 0; transform: translateY(12px) scale(0.85); } }
.minion .card-art { border-radius: 10px; overflow: hidden; }
/* Затемнение под именем: без него подпись теряется на светлых портретах. */
.minion::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 42%;
  background: linear-gradient(180deg, transparent, rgba(14, 8, 3, 0.9));
  border-radius: 0 0 10px 10px;
  pointer-events: none;
}
.minion-name {
  position: absolute; left: 2px; right: 2px; bottom: 9px; z-index: 2;
  font-size: 8.5px; font-weight: 600; text-align: center;
  text-shadow: 0 1px 3px #000;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.minion-atk, .minion-hp {
  position: absolute; bottom: -6px; z-index: 3;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
}
.minion-atk { left: -5px; background: linear-gradient(160deg, #ffd06a, #c07a12); color: #2a1a04; }
.minion-hp { right: -5px; background: linear-gradient(160deg, #ff8a8a, #b52a3a); color: #fff; }
.minion-atk.buffed, .minion-hp.buffed { box-shadow: 0 0 8px var(--ok); }
.minion-hp.hurt { background: linear-gradient(160deg, #ff6a6a, #7a1020); }

.minion.ready { box-shadow: 0 0 0 2px rgba(120, 255, 190, 0.6); cursor: pointer; }
.minion.selected { transform: translateY(-8px) scale(1.06); box-shadow: 0 0 0 2px var(--gold); }
.minion.has-taunt { border-color: rgba(190, 210, 255, 0.9); box-shadow: inset 0 0 12px rgba(150, 190, 255, 0.5); }
.minion.has-shield { box-shadow: 0 0 0 2px rgba(255, 230, 150, 0.8), 0 0 14px rgba(255, 220, 120, 0.5); }
.minion.has-stealth { opacity: 0.62; }
.minion.is-frozen { filter: saturate(0.5) brightness(1.15); box-shadow: inset 0 0 14px rgba(140, 220, 255, 0.8); }
.minion.has-poison { border-color: rgba(120, 240, 150, 0.9); }
.minion.has-lifesteal { border-color: rgba(255, 140, 190, 0.9); }
.minion.dying { animation: die 0.3s ease forwards; }
@keyframes die { to { opacity: 0; transform: scale(0.7) rotate(8deg); filter: blur(2px); } }
.shaken { animation: shake 0.28s ease; }
@keyframes shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.pop {
  position: absolute; z-index: 40;
  transform: translate(-50%, -50%);
  font-weight: 800; font-size: 19px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  animation: pop 0.9s ease-out forwards;
}
.pop-dmg { color: #ff8090; }
.pop-heal { color: var(--ok); }
.pop-buff { color: var(--gold); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.7); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

.deck-info { white-space: nowrap; }
.battle-hint {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 168px; z-index: 20;
  font-size: 12px; color: var(--gold);
  background: rgba(24, 14, 6, 0.88); padding: 4px 12px; border-radius: 999px;
  border: 1px solid rgba(255, 210, 120, 0.35);
  pointer-events: none;
}
.battle-hint:empty { display: none; }
.btn-flee { position: absolute; top: 4px; right: 4px; font-size: 11px; padding: 5px 9px; opacity: 0.5; z-index: 10; }

.btn-turn {
  min-width: 124px; font-weight: 700; font-size: 13px;
  border-color: rgba(255, 210, 120, 0.3);
}
.my-turn .btn-turn {
  background: linear-gradient(160deg, #ffd977, #d99a25);
  color: #2a1a04;
  border-color: rgba(255, 220, 140, 0.6);
  box-shadow: 0 0 16px rgba(255, 190, 80, 0.35);
}
.my-turn .btn-turn:disabled { box-shadow: none; }

/* цветовые акценты стихий */
.elem-fire { --accent: var(--fire); }
.elem-water { --accent: var(--water); }
.elem-nature { --accent: var(--nature); }
.elem-light { --accent: var(--light); }
.elem-dark { --accent: var(--dark); }
.elem-neutral { --accent: var(--neutral); }
.card.elem-fire, .minion.elem-fire { border-color: rgba(255, 107, 74, 0.55); }
.card.elem-water, .minion.elem-water { border-color: rgba(74, 196, 255, 0.55); }
.card.elem-nature, .minion.elem-nature { border-color: rgba(93, 220, 138, 0.55); }
.card.elem-light, .minion.elem-light { border-color: rgba(255, 212, 94, 0.55); }
.card.elem-dark, .minion.elem-dark { border-color: rgba(176, 123, 255, 0.55); }

@media (max-width: 420px) {
  .collection-body { flex-direction: column; }
  .deck-panel { width: 100%; }
  .deck-list { max-height: 30dvh; }
  .catalog-grid { max-height: 40dvh; }
  .card { width: 84px; height: 118px; }
  .hero { width: 72px; height: 72px; }
  .minion { width: 62px; height: 78px; }
}

/* ---------------- правила ---------------- */

.rules { display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; line-height: 1.45; }
.rules section { border-left: 2px solid var(--panel-line); padding-left: 10px; }
.rules h3 { font-size: 14px; color: var(--gold); margin-bottom: 3px; }
.rules p { color: var(--ink-dim); margin: 0; }
.rules-keywords { margin: 0; padding-left: 16px; color: var(--ink-dim); }
.rules-keywords li { margin-bottom: 2px; }
.rules-keywords b { color: var(--ink); }

/* Кривая маны в панели колоды */
.deck-curve {
  display: flex; align-items: flex-end; gap: 3px;
  height: 46px; padding: 4px 2px 0;
  border-bottom: 1px solid var(--panel-line);
}
.curve-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.curve-bar {
  width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #7fd0ff, #2f6ede);
  transition: height 0.2s ease;
}
.curve-label { font-size: 8.5px; color: var(--ink-dim); margin-top: 1px; }

/* Мягкое появление экрана: резкая подмена содержимого выглядит как сбой. */
.screen { animation: screenIn 0.22s ease; }
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } }
.screen-battle { animation: none; }

/* Карточки лидеров въезжают по очереди — экран выбора это оживляет. */
.leader-card { animation: leaderIn 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards; }
.leader-card:nth-child(2) { animation-delay: 0.06s; }
.leader-card:nth-child(3) { animation-delay: 0.12s; }
.leader-card:nth-child(4) { animation-delay: 0.18s; }
.leader-card:nth-child(5) { animation-delay: 0.24s; }
@keyframes leaderIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }

@media (prefers-reduced-motion: reduce) {
  .screen, .leader-card, .minion, .pack-slot { animation: none; }
}

/* ---------------- плашка описания карты ---------------- */

.card-tip {
  position: absolute; left: 50%; bottom: 176px; z-index: 25;
  transform: translate(-50%, 8px);
  width: min(300px, 92%);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px;
  border-radius: 12px;
  background: rgba(28, 16, 7, 0.96);
  border: 1px solid var(--panel-line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  font-size: 12px; line-height: 1.35;
  opacity: 0; pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.card-tip.shown { opacity: 1; transform: translate(-50%, 0); }
.tip-head { display: flex; align-items: center; gap: 7px; }
.tip-head b { font-size: 13.5px; }
.tip-cost {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: linear-gradient(160deg, #63b8ff, #2a5ecb); color: #fff;
}
.tip-kind { margin-left: auto; font-size: 11px; color: var(--ink-dim); }
.tip-text { color: var(--ink); }
.tip-words { font-size: 11px; color: var(--gold); }
.tip-words b { color: var(--gold); }
.details-text { font-size: 12.5px; line-height: 1.4; color: var(--ink); margin-bottom: 6px; }
.rules-credits p { font-size: 12px; }
