/* ============================================================
   Аркана: Ставка Судьбы — тёмное фэнтези, AAA-подача
   ============================================================ */
:root {
  --gold: #d8a94b;
  --gold-bright: #ffd97a;
  --ink: #0d0a14;
  --ink-2: #171226;
  --parchment: #e8dcc0;
  --player: #3aa0ff;
  --player-glow: rgba(58, 160, 255, 0.55);
  --enemy: #ff4d5e;
  --enemy-glow: rgba(255, 77, 94, 0.55);
  --rar-common: #8b8fa3;
  --rar-uncommon: #4fc47a;
  --rar-rare: #4f9cf0;
  --rar-legendary: #e8a33d;
  --font-title: Georgia, 'Times New Roman', serif;
  --font-body: 'Segoe UI', Tahoma, Verdana, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }

/* Фоновые слои с кроссфейдом */
.bg-layer {
  position: absolute; inset: -2%;
  background-size: cover; background-position: center;
  filter: brightness(0.55) saturate(0.9);
  opacity: 0; transition: opacity 1.2s ease;
  transform: scale(1.02);
}
.bg-layer.visible { opacity: 1; animation: bgDrift 30s ease-in-out infinite alternate; }
/* лёгкий параллакс-дрейф фона (кен-бёрнс) */
@keyframes bgDrift {
  from { transform: scale(1.02) translate(0, 0); }
  to { transform: scale(1.075) translate(-1.1%, -0.9%); }
}
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(5, 3, 10, 0.72) 100%);
}

/* ---------- Экраны ---------- */
.screen {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.45s ease;
}
.screen.hidden { display: none; }
.screen.fade-out { opacity: 0; }
.screen.fade-in { animation: screenIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(7px); }
  to { opacity: 1; transform: none; filter: none; }
}
/* Направленный wipe при смене экрана: золотая шторка слева направо */
#wipe-layer {
  position: absolute; inset: 0; z-index: 58;
  pointer-events: none; opacity: 0;
}
#wipe-layer.run {
  background: linear-gradient(100deg,
    transparent 32%, rgba(22, 13, 42, 0.9) 44%,
    rgba(216, 169, 75, 0.35) 50%,
    rgba(22, 13, 42, 0.9) 56%, transparent 68%);
  background-size: 320% 100%;
  animation: wipeSweep 0.55s cubic-bezier(0.65, 0, 0.35, 1) both;
}
@keyframes wipeSweep {
  0% { opacity: 1; background-position: 130% 0; }
  85% { opacity: 1; }
  100% { opacity: 0; background-position: -70% 0; }
}

/* ---------- Кнопки ---------- */
.btn {
  font-family: var(--font-title);
  font-size: 1.05rem; letter-spacing: 0.06em;
  color: var(--parchment);
  background: linear-gradient(180deg, #2a2140, #1a1430);
  border: 1px solid #4a3d6b;
  border-radius: 8px;
  padding: 0.7em 1.6em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.btn:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 4px 18px rgba(216, 169, 75, 0.25); }
.btn:active { transform: translateY(1px) scale(0.96); transition-duration: 0.06s; }
.btn-primary {
  background: linear-gradient(180deg, #6d5424, #4a3616);
  border-color: var(--gold);
  color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.hidden { display: none !important; }

/* ---------- SVG-иконки ---------- */
.icn { vertical-align: -0.18em; flex-shrink: 0; }
.ic-coin { color: var(--gold-bright); }
.ic-ante { color: var(--parchment); }
.ic-boss { color: var(--enemy); }
.ic-relic { color: var(--gold-bright); }
.ic-scroll { color: #b79bff; }
.ic-region { color: var(--gold); }
.ic-deck, .ic-lbl { color: var(--parchment); opacity: 0.85; }
.ic-back { color: rgba(216, 169, 75, 0.75); }
.ic-audio { color: var(--parchment); }
.hud-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 14px;
  background: rgba(20, 14, 36, 0.75);
  border: 1px solid rgba(140, 120, 200, 0.28);
  font-size: 0.82rem; letter-spacing: 0.04em;
}
.hud-chip b { color: var(--gold-bright); }

/* ---------- Меню ---------- */
#menu-logo { margin-bottom: 0.6rem; }
#menu-logo .logo-mark {
  color: var(--gold-bright);
  filter: drop-shadow(0 0 14px rgba(216, 169, 75, 0.55));
  animation: logoSpin 26s linear infinite;
}
@keyframes logoSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.menu-box {
  text-align: center; padding: 3rem 2.4rem;
  background: rgba(10, 7, 18, 0.72);
  border: 1px solid rgba(216, 169, 75, 0.35);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7), inset 0 0 40px rgba(216, 169, 75, 0.04);
  max-width: min(92vw, 560px);
  animation: menuIn 1s ease both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.game-title {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 5.5vw, 3.2rem);
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(216, 169, 75, 0.5), 0 2px 4px #000;
  letter-spacing: 0.04em;
}
.title-sep { color: var(--gold); margin: 0 0.3em; font-size: 0.7em; vertical-align: middle; }
.game-subtitle { margin-top: 0.5rem; opacity: 0.75; font-style: italic; letter-spacing: 0.12em; }
.menu-buttons { display: flex; flex-direction: column; gap: 0.8rem; margin: 2rem auto 1rem; max-width: 280px; }
.menu-footer { opacity: 0.5; font-size: 0.85rem; margin-top: 1.4rem; font-style: italic; }

/* ---------- Сюжет ---------- */
.story-box {
  max-width: min(92vw, 640px);
  background: rgba(10, 7, 18, 0.82);
  border: 1px solid rgba(216, 169, 75, 0.3);
  border-radius: 14px;
  padding: 2.4rem 2.2rem;
  text-align: center;
  backdrop-filter: blur(5px);
  animation: menuIn 0.8s ease both;
}
#story-emblem { display: flex; justify-content: center; margin-bottom: 0.7rem; }
.emblem-ring .icn, .story-emblem-ic {
  color: var(--gold-bright);
  padding: 10px; border-radius: 50%;
  border: 1px solid rgba(216, 169, 75, 0.5);
  background: radial-gradient(circle, rgba(216, 169, 75, 0.14), transparent 72%);
  box-shadow: 0 0 22px rgba(216, 169, 75, 0.25);
  box-sizing: content-box;
}
.emblem-ring.boss .icn, .story-emblem-ic.boss {
  color: var(--enemy);
  border-color: rgba(255, 77, 94, 0.55);
  background: radial-gradient(circle, rgba(255, 77, 94, 0.14), transparent 72%);
  box-shadow: 0 0 26px rgba(255, 77, 94, 0.3);
}
.story-portrait {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(216, 169, 75, 0.6);
  box-shadow: 0 0 24px rgba(216, 169, 75, 0.3);
}
.story-portrait.boss {
  border-color: var(--enemy);
  box-shadow: 0 0 30px rgba(255, 77, 94, 0.45);
  animation: bossPortrait 2.2s ease-in-out infinite;
}
@keyframes bossPortrait { 0%,100% { box-shadow: 0 0 18px rgba(255,77,94,0.35);} 50% { box-shadow: 0 0 36px rgba(255,77,94,0.6);} }
.story-badge {
  display: inline-block; margin-bottom: 0.7rem;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 14px; border-radius: 14px;
  border: 1px solid rgba(216, 169, 75, 0.45);
  color: var(--gold-bright);
  background: rgba(216, 169, 75, 0.08);
}
.story-badge.boss { border-color: rgba(255, 77, 94, 0.5); color: #ff9aa5; background: rgba(255, 77, 94, 0.08); }
#story-title { font-family: var(--font-title); color: var(--gold-bright); font-size: 1.6rem; margin-bottom: 1.2rem; letter-spacing: 0.05em; }
/* въезд заголовка региона: расфокус + трекинг схлопывается */
#screen-story.fade-in #story-title { animation: titleIn 0.75s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes titleIn {
  from { opacity: 0; letter-spacing: 0.3em; filter: blur(7px); transform: translateY(-10px); }
  to { opacity: 1; letter-spacing: 0.05em; filter: none; transform: none; }
}
#story-text p { margin: 0.7em 0; line-height: 1.65; font-size: 1.02rem; opacity: 0; animation: lineIn 0.8s ease both; }
#story-text p:nth-child(1) { animation-delay: 0.15s; }
#story-text p:nth-child(2) { animation-delay: 0.7s; }
#story-text p:nth-child(3) { animation-delay: 1.25s; }
#story-text p:nth-child(4) { animation-delay: 1.8s; }
#story-text p:nth-child(5) { animation-delay: 2.35s; }
@keyframes lineIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 0.92; transform: none; } }
#story-text .boss-line { color: var(--enemy); font-style: italic; }
#btn-story-next { margin-top: 1.6rem; }
#btn-story-alt { margin-top: 0.7rem; display: block; margin-left: auto; margin-right: auto; opacity: 0.85; }

/* ---------- Бой: каркас ---------- */
#screen-battle { flex-direction: row; justify-content: stretch; align-items: stretch; padding: 0; }
#battle-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, rgba(8, 5, 15, 0.92), rgba(8, 5, 15, 0.55) 75%, transparent);
  pointer-events: none;
}
#blind-name { font-family: var(--font-title); color: var(--gold-bright); font-size: 1.05rem; letter-spacing: 0.05em; }
#blind-region { font-size: 0.78rem; opacity: 0.65; font-style: italic; }

/* Скоринг-плашки (Balatro-стиль): ЦЕЛЬ | ФИШКИ × МНОЖ = ИТОГ */
#score-panel { display: flex; gap: 8px; align-items: stretch; pointer-events: auto; }
.plate {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 74px; padding: 4px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.plate-label {
  font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  opacity: 0.75;
}
.plate b {
  font-family: 'Consolas', monospace;
  font-size: 1.3rem; line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.plate.p-target { background: linear-gradient(180deg, #3d1420, #240c13); border-color: rgba(255, 77, 94, 0.45); }
.plate.p-target b { color: #ff8b97; }
.plate.p-chips { background: linear-gradient(180deg, #123a63, #0a2340); border-color: rgba(58, 160, 255, 0.5); }
.plate.p-chips b { color: #8fd0ff; }
.plate.p-mult { background: linear-gradient(180deg, #63220f, #3c1206); border-color: rgba(255, 122, 61, 0.5); }
.plate.p-mult b { color: #ffb37a; }
.plate.p-total { background: linear-gradient(180deg, #4d3a12, #2c1f07); border-color: rgba(216, 169, 75, 0.55); }
.plate.p-total b { color: var(--gold-bright); }
.plate.p-total.reached {
  border-color: var(--rar-uncommon);
  box-shadow: 0 0 16px rgba(79, 196, 122, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.plate.p-total.reached b { color: #8ff0b4; }
.score-op {
  align-self: center;
  font-size: 1.3rem; font-weight: 800;
  color: var(--gold); opacity: 0.85;
  text-shadow: 0 1px 3px #000;
}
.score-op.big { font-size: 1.7rem; }
.plate.bump b { animation: plateBump 0.3s ease; display: inline-block; }
@keyframes plateBump { 30% { transform: scale(1.22); } 100% { transform: scale(1); } }
.plate.big { min-width: 110px; padding: 8px 16px; }
.plate.big b { font-size: 1.9rem; }

#run-info { display: flex; gap: 0.6rem; font-size: 0.95rem; align-items: center; }

#boss-rule-banner {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 19; padding: 0.3em 1.2em;
  background: rgba(120, 20, 30, 0.75);
  border: 1px solid var(--enemy);
  border-radius: 20px;
  font-size: 0.82rem; letter-spacing: 0.06em;
  animation: bannerPulse 2.4s ease-in-out infinite;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
@keyframes bannerPulse { 0%, 100% { box-shadow: 0 0 8px rgba(255, 77, 94, 0.4); } 50% { box-shadow: 0 0 22px rgba(255, 77, 94, 0.75); } }

#battle-main {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 3.4rem 0.5rem 0.5rem; min-width: 0;
}
#battle-side {
  width: 300px; flex-shrink: 0; z-index: 15;
  display: flex; flex-direction: column; gap: 0.7rem;
  padding: 3.6rem 0.7rem 0.7rem;
  background: linear-gradient(270deg, rgba(8, 5, 15, 0.85), rgba(8, 5, 15, 0.35));
}

/* ---------- Сетка ---------- */
#board-wrap { display: flex; align-items: center; justify-content: center; flex: 1; width: 100%; min-height: 0; }
#board {
  display: grid; gap: 6px;
  --cell: min(17vh, 19vw, 118px);
  grid-template-columns: repeat(var(--n, 4), var(--cell));
  grid-template-rows: repeat(var(--n, 4), var(--cell));
  padding: 10px;
  background: rgba(12, 8, 22, 0.6);
  border: 1px solid rgba(216, 169, 75, 0.22);
  border-radius: 12px;
  box-shadow: 0 0 44px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(0, 0, 0, 0.5);
}
#board.n5 { --cell: min(13.2vh, 15vw, 96px); }
.cell {
  position: relative; border-radius: 8px;
  background:
    radial-gradient(circle at 50% 40%, rgba(120, 100, 190, 0.14), transparent 70%),
    linear-gradient(160deg, rgba(56, 45, 92, 0.55), rgba(26, 19, 48, 0.7));
  border: 1px solid rgba(150, 130, 215, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
/* Подсветка валидных клеток при поднятой карте */
.cell.free.selectable {
  cursor: pointer;
  border: 1px dashed rgba(216, 169, 75, 0.65);
  animation: cellPulse 1.4s ease-in-out infinite;
}
@keyframes cellPulse {
  0%, 100% { box-shadow: inset 0 0 10px rgba(216, 169, 75, 0.08); }
  50% { box-shadow: inset 0 0 18px rgba(216, 169, 75, 0.25), 0 0 10px rgba(216, 169, 75, 0.2); }
}
.cell.free.selectable:hover, .cell.free.selectable.touch-hover {
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(216, 169, 75, 0.45), inset 0 0 20px rgba(216, 169, 75, 0.18);
}
/* Семантика валидных клеток при выбранной карте:
   зелёный ореол = ход даст ЗАХВАТ без боя, оранжевый = будет БОЙ, золото-пунктир = просто валидная */
.cell.free.selectable.sel-capture {
  border: 1px solid rgba(79, 196, 122, 0.85);
  animation: cellPulseCap 1.2s ease-in-out infinite;
}
@keyframes cellPulseCap {
  0%, 100% { box-shadow: 0 0 8px rgba(79, 196, 122, 0.35), inset 0 0 12px rgba(79, 196, 122, 0.12); }
  50% { box-shadow: 0 0 18px rgba(79, 196, 122, 0.65), inset 0 0 18px rgba(79, 196, 122, 0.28); }
}
.cell.free.selectable.sel-battle {
  border: 1px solid rgba(255, 157, 77, 0.85);
  animation: cellPulseBtl 1.2s ease-in-out infinite;
}
@keyframes cellPulseBtl {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 157, 77, 0.35), inset 0 0 12px rgba(255, 157, 77, 0.12); }
  50% { box-shadow: 0 0 18px rgba(255, 157, 77, 0.65), inset 0 0 18px rgba(255, 157, 77, 0.28); }
}
/* Превью на ховере: помечаем сами карты-цели */
.cell.will-capture {
  border-color: var(--rar-uncommon) !important;
  box-shadow: 0 0 16px rgba(79, 196, 122, 0.55), inset 0 0 14px rgba(79, 196, 122, 0.25) !important;
}
.cell.will-battle {
  border-color: #ff9d4d !important;
  box-shadow: 0 0 16px rgba(255, 157, 77, 0.55), inset 0 0 14px rgba(255, 157, 77, 0.25) !important;
}
/* Тонировка занятых клеток по владельцу */
.cell.own-player { border-color: rgba(58, 160, 255, 0.4); background: linear-gradient(160deg, rgba(24, 52, 96, 0.6), rgba(14, 26, 52, 0.7)); }
.cell.own-enemy { border-color: rgba(255, 77, 94, 0.4); background: linear-gradient(160deg, rgba(88, 22, 34, 0.6), rgba(44, 12, 20, 0.7)); }
/* Блок-клетки: явно мёртвые, с цепью (SVG, без эмодзи) */
.cell.blocked {
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.5) 0 7px, rgba(70, 42, 38, 0.45) 7px 14px),
    linear-gradient(160deg, #1f1412, #0c0806);
  border: 1px solid rgba(150, 84, 66, 0.5);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.75);
}
.cell.blocked::after {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c98a6a' stroke-width='1.9' stroke-linecap='round'%3E%3Crect x='2.5' y='9.5' width='9' height='5' rx='2.5'/%3E%3Crect x='12.5' y='9.5' width='9' height='5' rx='2.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
  background-size: 46% 46%;
  opacity: 0.85;
  filter: drop-shadow(0 1px 2px #000);
}

/* ---------- Карта ---------- */
.card {
  position: absolute; inset: 3px;
  border-radius: 7px;
  overflow: hidden;
  background: #1c1530;
  border: 2px solid var(--rar-common);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
  transform-style: preserve-3d;
}
.card.rarity-common { border-color: #a8adc2; box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 7px rgba(168, 173, 194, 0.28); }
.card.rarity-uncommon { border-color: var(--rar-uncommon); box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 8px rgba(79, 196, 122, 0.25); }
.card.rarity-rare { border-color: var(--rar-rare); box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 10px rgba(79, 156, 240, 0.3); }
.card.rarity-legendary {
  border-color: var(--rar-legendary);
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 14px rgba(232, 163, 61, 0.45);
  animation: legGlow 2.6s ease-in-out infinite;
}
@keyframes legGlow { 0%,100% { box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 10px rgba(232,163,61,0.35);} 50% { box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 20px rgba(232,163,61,0.6);} }

.card img.art {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  filter: saturate(1.05);
}
.card .art-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell, 100px) * 0.42);
  background: radial-gradient(circle at 50% 35%, #3a2d5e, #191128 75%);
  text-shadow: 0 0 18px rgba(216, 169, 75, 0.5);
}
.card .owner-tint { position: absolute; inset: 0; pointer-events: none; transition: background 0.3s, box-shadow 0.3s; }
.card.owner-player .owner-tint { background: linear-gradient(200deg, rgba(58,160,255,0.28), transparent 55%); box-shadow: inset 0 0 0 2px var(--player), inset 0 0 16px var(--player-glow); }
.card.owner-enemy .owner-tint { background: linear-gradient(200deg, rgba(255,77,94,0.28), transparent 55%); box-shadow: inset 0 0 0 2px var(--enemy), inset 0 0 16px var(--enemy-glow); }

/* Стат-блок TM-стиля: [⚔атака][тип][🛡физ][◎маг] — крупно и раздельно */
.card .stats {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1%;
  /* нижний отступ 16% — полоса у края остаётся стрелкам S/SW/SE: статы и стрелки не пересекаются */
  padding: 8% 4.5% 16%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9) 38%);
  z-index: 3;
}
/* центр свободен: атака+тип уходят влево, защиты — вправо */
.card .stats .tchip { margin-right: auto; }
.card .stats .st {
  display: inline-flex; align-items: center; gap: 1px;
  font-family: 'Consolas', monospace;
  line-height: 1;
}
.card .stats .st b {
  font-size: calc(var(--cell, 100px) * 0.155);
  font-weight: 800;
  text-shadow: 0 1px 2px #000, 0 0 5px #000;
}
.card .stats .sti { width: calc(var(--cell, 100px) * 0.095); height: calc(var(--cell, 100px) * 0.095); opacity: 0.9; }
.card .stats .st-atk { color: #ffe9b0; }
.card .stats .st-atk b { color: #fff; }
.card .stats .st-pd { color: #9cc4ef; }
.card .stats .st-pd b { color: #cfe6ff; }
.card .stats .st-md { color: #c9a6ff; }
.card .stats .st-md b { color: #e7d4ff; }
/* Тип атаки — отдельная цветная фишка */
.card .stats .tchip {
  font-family: 'Consolas', monospace;
  font-weight: 800;
  font-size: calc(var(--cell, 100px) * 0.12);
  line-height: 1;
  padding: 6% 4.5%;
  border-radius: 20%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 1px #000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.card .stats .tchip.t-P { background: #7a3b12; color: #ffcf9e; }
.card .stats .tchip.t-M { background: #4a2a86; color: #dcc8ff; }
.card .stats .tchip.t-X { background: #0e5a56; color: #a8f0e6; }
.card .stats .tchip.t-A { background: #7a5c10; color: #ffe9a8; }

/* Имя — плашка ниже верхних стрелок, не пересекается с ними */
.card .cname {
  position: absolute; top: 17%; left: 50%; transform: translateX(-50%);
  max-width: 86%;
  display: flex; align-items: center; gap: 3px;
  font-size: calc(var(--cell, 100px) * 0.1);
  font-weight: 600;
  padding: 1.5% 6%;
  border-radius: 20px;
  background: rgba(6, 4, 12, 0.62);
  border: 1px solid rgba(216, 169, 75, 0.28);
  text-shadow: 0 1px 2px #000;
  white-space: nowrap; z-index: 3;
}
.card .cname span { overflow: hidden; text-overflow: ellipsis; }
.card .cname .clvl { font-style: normal; color: var(--gold-bright); font-size: 0.9em; }

/* Стрелки-руны: у самого края, тёмная обводка + золотое свечение */
.arr {
  position: absolute; width: 20%; height: 20%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell, 100px) * 0.15);
  color: var(--gold-bright);
  text-shadow:
    -1px -1px 0 #14100a, 1px -1px 0 #14100a, -1px 1px 0 #14100a, 1px 1px 0 #14100a,
    0 0 7px rgba(255, 217, 122, 0.95);
  pointer-events: none; z-index: 5;
  line-height: 1;
}
.arr-N  { top: -3%; left: 40%; }
.arr-NE { top: -3%; right: -2%; }
.arr-E  { top: 40%; right: -2%; }
.arr-SE { bottom: -3%; right: -2%; }
.arr-S  { bottom: -3%; left: 40%; }
.arr-SW { bottom: -3%; left: -2%; }
.arr-W  { top: 40%; left: -2%; }
.arr-NW { top: -3%; left: -2%; }
/* Выбранная карта: стрелки пульсируют — читаются направления захвата */
.hand-card.selected .arr { animation: arrGlow 0.9s ease-in-out infinite; }
@keyframes arrGlow {
  0%, 100% { text-shadow: -1px -1px 0 #14100a, 1px -1px 0 #14100a, -1px 1px 0 #14100a, 1px 1px 0 #14100a, 0 0 6px rgba(255, 217, 122, 0.8); }
  50% { text-shadow: -1px -1px 0 #14100a, 1px -1px 0 #14100a, -1px 1px 0 #14100a, 1px 1px 0 #14100a, 0 0 14px rgba(255, 236, 170, 1); }
}

/* ---------- Руки ---------- */
.hand {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  min-height: calc(var(--hand-h, 108px) + 14px);
  padding: 4px 8px; z-index: 14;
  max-width: 100vw; overflow-x: auto; overflow-y: visible;
}
.hand-card {
  position: relative;
  width: calc(var(--hand-h, 108px) * 0.78); height: var(--hand-h, 108px);
  flex-shrink: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  /* масштаб типографики карты = реальная ШИРИНА карты, чтобы 4-й стат не подрезался */
  --cell: calc(var(--hand-h, 108px) * 0.78);
}
/* на узких картах руки иконки статов прячем — числа+цвета читаются полностью */
.hand-card .card .stats .sti { display: none; }
.hand-card .card .stats { padding-left: 6%; padding-right: 6%; }
/* зазор между физ- и маг-защитой, чтобы «6 3» не читалось как «63» */
.card .stats .st-md { margin-left: 3.5%; }
.hand-card .card { position: absolute; inset: 0; }
/* перспективный tilt к курсору (JS ставит --rx/--ry на десктопе) */
#player-hand .hand-card .card {
  transform: perspective(720px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.09s linear, box-shadow 0.22s ease;
  will-change: transform;
}
#player-hand .hand-card:hover { transform: translateY(-12px) scale(1.07); z-index: 5; }
#player-hand .hand-card:hover .card { box-shadow: 0 16px 30px rgba(0, 0, 0, 0.65), 0 0 12px rgba(216, 169, 75, 0.25); }
.hand-card.selected { transform: translateY(-16px) scale(1.11) !important; z-index: 6; }
.hand-card.selected .card { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 26px rgba(216, 169, 75, 0.65), 0 18px 34px rgba(0, 0, 0, 0.7); }
.hand-card.disabled { opacity: 0.45; pointer-events: none; }
.card-back {
  position: absolute; inset: 0; border-radius: 7px;
  background:
    radial-gradient(circle at 50% 42%, rgba(216, 169, 75, 0.16), transparent 58%),
    linear-gradient(160deg, #241a44, #120c24);
  border: 2px solid #443463;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; opacity: 0.95;
}
#enemy-hand { --hand-h: 70px; min-height: 84px; }
#enemy-zone { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.zone-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--enemy); opacity: 0.9;
  background: rgba(30, 8, 12, 0.6);
  border: 1px solid rgba(255, 77, 94, 0.3);
  padding: 2px 12px; border-radius: 12px;
}
.zone-label b { color: #ff9aa5; }
.zone-label i { font-style: normal; color: var(--gold-bright); text-transform: none; letter-spacing: 0; }

/* ---------- Колесо Судьбы: слот-машина (крупная, читаемая) ---------- */
#wheel-box {
  background: linear-gradient(175deg, #2b1f47, #120c22 70%);
  border: 1px solid rgba(216, 169, 75, 0.45);
  border-radius: 14px; padding: 0.65rem;
  text-align: center;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.wheel-title {
  font-family: var(--font-title); font-size: 0.85rem; letter-spacing: 0.14em;
  color: var(--gold-bright); text-transform: uppercase; margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(216, 169, 75, 0.5);
}
/* Объёмная металлическая рама с бликом + пэйлайн */
#wheel-frame {
  position: relative;
  padding: 7px;
  border-radius: 11px;
  background:
    linear-gradient(180deg, #b39a6a, #57492d 14%, #2c2415 48%, #57492d 84%, #b39a6a),
    linear-gradient(90deg, #8a7a58, #262013);
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 244, 200, 0.5),
    inset 0 -1px 0 rgba(255, 244, 200, 0.25),
    0 3px 10px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
/* idle-shimmer: блик пробегает по раме (transform — без layout) */
#wheel-frame::after {
  content: ''; position: absolute; top: -60%; bottom: -60%; width: 34%;
  left: -50%;
  background: linear-gradient(105deg, transparent, rgba(255, 236, 180, 0.17), transparent);
  transform: rotate(12deg);
  animation: wheelShimmer 5.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 4;
  will-change: transform;
}
@keyframes wheelShimmer {
  0%, 62% { transform: translateX(0) rotate(12deg); }
  86%, 100% { transform: translateX(540%) rotate(12deg); }
}
#wheel-reels { display: flex; gap: 5px; justify-content: center; }
/* Рил-барабан: 74×94 на десктопе — портрет и число читаются с расстояния */
.reel {
  width: 74px; height: 94px; overflow: hidden;
  border-radius: 6px;
  border: 1px solid #7a6840;
  background: linear-gradient(90deg, #0d0918, #1d1530 18%, #241a3c 50%, #1d1530 82%, #0d0918);
  position: relative;
  box-shadow:
    inset 0 6px 12px rgba(0, 0, 0, 0.9),
    inset 0 -6px 12px rgba(0, 0, 0, 0.9),
    inset 3px 0 8px rgba(0, 0, 0, 0.55),
    inset -3px 0 8px rgba(0, 0, 0, 0.55);
}
/* Внутренняя тень барабана: затемнение верх/низ (цилиндр);
   нижняя слабее и короче — не подъедает плашку цифры */
.reel::before, .reel::after {
  content: ''; position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none;
}
.reel::before { top: 0; height: 16px; background: linear-gradient(rgba(6, 3, 12, 0.85), transparent); }
.reel::after { bottom: 0; height: 11px; background: linear-gradient(transparent, rgba(6, 3, 12, 0.6)); }
/* Пэйлайн по центру рилов */
#wheel-payline {
  position: absolute; left: 5px; right: 5px; top: 50%;
  height: 2px; margin-top: -1px;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 122, 0.85), transparent);
  box-shadow: 0 0 10px rgba(255, 217, 122, 0.65);
  z-index: 3; pointer-events: none;
}
.reel-strip { transition: none; will-change: transform; }
.reel-item {
  width: 74px; height: 94px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
}
/* Портрет покровителя: светлый кадр + цветная аура-рамка (JS красит по покровителю) */
.reel-item img {
  width: 56px; height: 56px; object-fit: cover; object-position: center top;
  border-radius: 7px;
  border: 2px solid rgba(255, 217, 122, 0.55);
  filter: brightness(1.34) contrast(1.08) saturate(1.18);
  box-shadow: 0 0 10px rgba(216, 169, 75, 0.3), 0 1px 3px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle, #4a3a72, #241a3c);
}
.reel-item .reel-emoji { font-size: 38px; line-height: 56px; }
/* Число — КРУПНОЕ на контрастной плашке */
.reel-item .reel-num {
  min-width: 34px; text-align: center;
  font-size: 21px; line-height: 1.1; font-weight: 800; color: #f2ecdc;
  font-family: 'Consolas', monospace;
  padding: 0 6px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(10, 6, 19, 0.95), rgba(28, 21, 48, 0.95));
  border: 1px solid rgba(216, 169, 75, 0.4);
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.reel-item .reel-num.seven {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(255, 217, 122, 0.95), 0 1px 2px #000;
}
/* Имитация motion blur при быстром вращении; в «дремоте» лента резкая (защёлка на символе) */
.reel.spinning .reel-strip { filter: blur(2.4px); }
#wheel-box.low-sp .reel.spinning .reel-strip { filter: none; }
/* Отскок барабана при остановке (щелчок-стоп) */
.reel.stop-bounce { animation: reelBounce 0.3s cubic-bezier(0.34, 1.8, 0.64, 1); }
@keyframes reelBounce {
  0% { transform: translateY(-3px) scaleY(0.985); }
  55% { transform: translateY(1.5px) scaleY(1.008); }
  100% { transform: none; }
}
/* Вспышка золота на совпавшем портрете/числе */
.reel.match {
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(255, 217, 122, 0.9), inset 0 0 14px rgba(255, 217, 122, 0.35);
  animation: reelMatchFlash 0.6s ease-out;
}
.reel.match .reel-item img { filter: brightness(1.55) contrast(1.1) saturate(1.3); }
.reel.match .reel-item .reel-num { color: var(--gold-bright); border-color: var(--gold-bright); }
@keyframes reelMatchFlash {
  0% { box-shadow: 0 0 4px rgba(255, 217, 122, 0.4); }
  35% { box-shadow: 0 0 30px rgba(255, 236, 170, 1), inset 0 0 22px rgba(255, 217, 122, 0.6); }
  100% { box-shadow: 0 0 18px rgba(255, 217, 122, 0.9), inset 0 0 14px rgba(255, 217, 122, 0.35); }
}
/* Заряд: SP-бар крупнее, с подписью и числом */
#wheel-charge-row { display: flex; align-items: center; gap: 7px; margin-top: 0.6rem; }
#wheel-charge-label {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
  color: var(--gold-bright); font-family: 'Consolas', monospace;
  text-shadow: 0 0 8px rgba(216, 169, 75, 0.5);
}
#wheel-charge-wrap {
  flex: 1; height: 14px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.07); overflow: hidden;
  border: 1px solid rgba(216, 169, 75, 0.35);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
#wheel-charge {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7a5cff, #c77dff 55%, var(--gold-bright));
  transition: width 0.5s cubic-bezier(0.34, 1.35, 0.64, 1);
  border-radius: 7px;
  box-shadow: 0 0 8px rgba(199, 125, 255, 0.45);
}
#wheel-charge-text {
  font-size: 0.8rem; font-family: 'Consolas', monospace; font-weight: 700;
  color: var(--gold-bright);
  min-width: 58px; text-align: right;
}
#wheel-state {
  margin-top: 0.3rem;
  font-size: 0.64rem; letter-spacing: 0.08em;
  color: var(--gold); opacity: 0.75;
  font-style: italic;
}
#wheel-state.low { color: #8b8fa3; animation: lowBlink 1.6s ease-in-out infinite; }
@keyframes lowBlink { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.9; } }
/* SP кончился — Колесо дремлет */
#wheel-box.low-sp #wheel-frame { filter: saturate(0.55) brightness(0.8); }
#wheel-box.low-sp #wheel-payline { opacity: 0.35; }
/* Фаза Модуляции: напряжение — рамка и пэйлайн пульсируют */
#wheel-frame.modulation {
  animation: modulationPulse 0.55s ease-in-out infinite;
}
#wheel-frame.modulation #wheel-payline {
  background: linear-gradient(90deg, transparent, rgba(255, 120, 90, 0.95), transparent);
  box-shadow: 0 0 14px rgba(255, 120, 90, 0.85);
}
@keyframes modulationPulse {
  0%, 100% { box-shadow: inset 0 0 8px rgba(0,0,0,0.8), 0 0 10px rgba(255, 157, 77, 0.35); }
  50% { box-shadow: inset 0 0 8px rgba(0,0,0,0.8), 0 0 26px rgba(255, 157, 77, 0.8); }
}

/* ---------- ПРИЗЫВ: полноценная синематика покровителя ---------- */
.summon-overlay {
  position: absolute; inset: 0; z-index: 46;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.7rem;
  background: radial-gradient(ellipse at center, rgba(30, 16, 50, 0.6), rgba(4, 2, 8, 0.95) 78%);
  animation: summonIn 0.3s ease both;
  pointer-events: none;
}
@keyframes summonIn { from { opacity: 0; } to { opacity: 1; } }
.summon-overlay.leaving { animation: summonOut 0.5s ease both; }
@keyframes summonOut { to { opacity: 0; } }
/* лучи из-за портрета */
.summon-rays {
  position: absolute; width: 130vmax; height: 130vmax;
  background: repeating-conic-gradient(rgba(216, 169, 75, 0.16) 0 7deg, transparent 7deg 18deg);
  animation: raysSpin 9s linear infinite, raysIn 0.9s ease both;
  border-radius: 50%;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }
@keyframes raysIn { from { opacity: 0; } to { opacity: 1; } }
/* световой столб под портретом */
.summon-beam {
  position: absolute; z-index: 1;
  width: min(30vmin, 180px); height: 100%;
  background: linear-gradient(180deg, transparent, rgba(255, 236, 180, 0.22) 30%, rgba(255, 236, 180, 0.3) 50%, rgba(255, 236, 180, 0.22) 70%, transparent);
  filter: blur(6px);
  animation: beamIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes beamIn { from { transform: scaleX(0.05); opacity: 0; } to { transform: none; opacity: 1; } }
.summon-portrait {
  position: relative; z-index: 2;
  width: min(40vmin, 240px); height: min(40vmin, 240px);
  border-radius: 50%;
  border: 3px solid var(--gold-bright);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(216, 169, 75, 0.75), 0 0 140px rgba(216, 169, 75, 0.32);
  animation: portraitIn 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes portraitIn {
  0% { transform: scale(2.6); opacity: 0; filter: blur(14px); }
  60% { opacity: 1; }
  100% { transform: none; opacity: 1; filter: none; }
}
.summon-portrait img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
/* хроматические копии: разъезжаются при ударе */
.summon-portrait img.sp-chroma-r, .summon-portrait img.sp-chroma-b { opacity: 0; mix-blend-mode: screen; }
.summon-portrait img.sp-chroma-r { filter: sepia(1) saturate(6) hue-rotate(-45deg) brightness(1.1); }
.summon-portrait img.sp-chroma-b { filter: sepia(1) saturate(6) hue-rotate(170deg) brightness(1.1); }
.summon-portrait.impact { animation: portraitImpact 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes portraitImpact { 0% { transform: scale(1.12); } 50% { transform: scale(0.97); } 100% { transform: none; } }
.summon-portrait.impact img.sp-chroma-r { animation: chromaR 0.5s ease-out both; }
.summon-portrait.impact img.sp-chroma-b { animation: chromaB 0.5s ease-out both; }
@keyframes chromaR { 0% { opacity: 0.8; transform: translate(7px, 2px); } 100% { opacity: 0; transform: none; } }
@keyframes chromaB { 0% { opacity: 0.8; transform: translate(-7px, -2px); } 100% { opacity: 0; transform: none; } }
.summon-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 5rem; background: #241a44; }
.summon-name {
  position: relative; z-index: 2;
  font-family: var(--font-title);
  font-size: clamp(1.4rem, 5vw, 2.7rem);
  letter-spacing: 0.1em; color: var(--gold-bright);
  text-shadow: 0 0 26px rgba(216, 169, 75, 0.9), 0 3px 8px #000;
  white-space: nowrap;
}
/* имя проявляется по буквам: blur-in волной */
.summon-name .sum-ch {
  display: inline-block; white-space: pre;
  opacity: 0;
  animation: letterIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes letterIn {
  from { opacity: 0; filter: blur(9px); transform: translateY(12px) scale(1.4); }
  to { opacity: 1; filter: none; transform: none; }
}
.summon-desc {
  position: relative; z-index: 2;
  font-size: 0.98rem; opacity: 0.92; font-style: italic;
  max-width: 80vw; text-align: center;
  animation: lineIn 0.5s 1.15s ease both;
}
/* уникальный колорит каждого из 6 покровителей */
.summon-overlay.patron-warlord { background: radial-gradient(ellipse at center, rgba(70, 14, 20, 0.62), rgba(8, 2, 4, 0.95) 78%); }
.summon-overlay.patron-warlord .summon-rays { filter: hue-rotate(-30deg) saturate(1.4); }
.summon-overlay.patron-warlord .summon-portrait { border-color: #ff9aa5; box-shadow: 0 0 60px rgba(255, 77, 94, 0.7), 0 0 140px rgba(255, 77, 94, 0.3); }
.summon-overlay.patron-sorceress { background: radial-gradient(ellipse at center, rgba(48, 20, 76, 0.65), rgba(6, 2, 12, 0.95) 78%); }
.summon-overlay.patron-sorceress .summon-rays { filter: hue-rotate(220deg); }
.summon-overlay.patron-sorceress .summon-portrait { border-color: #c77dff; box-shadow: 0 0 60px rgba(199, 125, 255, 0.75), 0 0 140px rgba(122, 92, 255, 0.35); }
.summon-overlay.patron-shadow { background: radial-gradient(ellipse at center, rgba(16, 12, 30, 0.8), rgba(2, 1, 5, 0.97) 74%); }
.summon-overlay.patron-shadow .summon-rays { opacity: 0.35; filter: saturate(0.3); }
.summon-overlay.patron-shadow .summon-portrait { border-color: #7a6aa8; box-shadow: 0 0 50px rgba(90, 70, 140, 0.7), 0 0 120px rgba(50, 35, 90, 0.5); }
.summon-overlay.patron-priestess { background: radial-gradient(ellipse at center, rgba(64, 58, 40, 0.55), rgba(10, 8, 4, 0.93) 78%); }
.summon-overlay.patron-priestess .summon-rays { filter: brightness(1.5); }
.summon-overlay.patron-priestess .summon-portrait { border-color: #fff2c9; box-shadow: 0 0 70px rgba(255, 242, 201, 0.85), 0 0 150px rgba(255, 217, 122, 0.4); }
.summon-overlay.patron-wildking { background: radial-gradient(ellipse at center, rgba(24, 52, 26, 0.6), rgba(4, 8, 4, 0.95) 78%); }
.summon-overlay.patron-wildking .summon-rays { filter: hue-rotate(80deg); }
.summon-overlay.patron-wildking .summon-portrait { border-color: #8ff0b4; box-shadow: 0 0 60px rgba(79, 196, 122, 0.7), 0 0 140px rgba(79, 196, 122, 0.3); }
.summon-overlay.patron-dragon { background: radial-gradient(ellipse at center, rgba(84, 32, 8, 0.62), rgba(12, 4, 1, 0.95) 78%); }
.summon-overlay.patron-dragon .summon-rays { filter: hue-rotate(-15deg) saturate(1.6) brightness(1.2); }
.summon-overlay.patron-dragon .summon-portrait { border-color: #ff8c5a; box-shadow: 0 0 70px rgba(255, 140, 90, 0.8), 0 0 150px rgba(255, 90, 60, 0.4); }

/* ---------- Сайдбар: секции, реликвии-слоты, свитки, инфо ---------- */
.side-section { display: flex; flex-direction: column; gap: 4px; }
.side-label {
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--gold); opacity: 0.8;
}
#side-info {
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(14, 9, 26, 0.7);
  border: 1px solid rgba(140, 120, 200, 0.22);
  border-radius: 10px; padding: 0.55rem;
}
.region-emblem { display: flex; align-items: center; gap: 8px; }
.region-emblem .ic-region {
  padding: 4px; border-radius: 50%;
  border: 1px solid rgba(216, 169, 75, 0.45);
  background: radial-gradient(circle, rgba(216, 169, 75, 0.12), transparent 75%);
  box-sizing: content-box;
}
.region-name { font-family: var(--font-title); font-size: 0.82rem; color: var(--gold-bright); line-height: 1.2; }
#blind-ladder { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ladder-step {
  font-size: 0.66rem; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 10px;
  border: 1px solid rgba(140, 120, 200, 0.3);
  opacity: 0.55;
}
.ladder-step.done { opacity: 0.8; border-color: rgba(79, 196, 122, 0.5); color: #8ff0b4; }
.ladder-step.now {
  opacity: 1; color: var(--gold-bright);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(216, 169, 75, 0.35);
}
.ladder-sep { opacity: 0.4; font-size: 0.7rem; }
.deck-count { font-size: 0.74rem; opacity: 0.85; display: flex; align-items: center; gap: 5px; }
.deck-count b { color: var(--gold-bright); }

#relic-bar, #scroll-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.relic-chip, .scroll-chip {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(170deg, rgba(38, 27, 66, 0.95), rgba(18, 12, 34, 0.95));
  border: 1px solid rgba(216, 169, 75, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 5px rgba(0, 0, 0, 0.5);
  cursor: help; position: relative;
}
.relic-chip.empty-slot {
  background: rgba(14, 9, 24, 0.6);
  border: 1px dashed rgba(140, 120, 200, 0.3);
  box-shadow: none;
}
.slot-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(140, 120, 200, 0.35); }
.scrolls-none { font-size: 0.68rem; opacity: 0.45; font-style: italic; padding: 4px 0; }
.scroll-chip { cursor: pointer; border-color: rgba(122, 92, 255, 0.55); }
.scroll-chip:hover { border-color: var(--gold-bright); box-shadow: 0 0 10px rgba(216, 169, 75, 0.4); transform: translateY(-1px); }
.relic-chip:hover .tip, .scroll-chip:hover .tip, .relic-chip.tip-open .tip { display: block; }
.tip {
  display: none; position: absolute; right: 105%; top: 50%; transform: translateY(-50%);
  width: 180px; padding: 7px 9px; z-index: 60;
  background: rgba(8, 5, 15, 0.96); border: 1px solid var(--gold);
  border-radius: 8px; font-size: 0.72rem; line-height: 1.4;
  pointer-events: none; text-align: left;
}
.tip b { color: var(--gold-bright); }

#turn-indicator { text-align: center; font-size: 0.85rem; letter-spacing: 0.1em; opacity: 0.85; min-height: 1.4em; }
#turn-indicator.enemy-turn { color: var(--enemy); }
#turn-indicator.player-turn { color: var(--player); }

/* ---------- Лавка ---------- */
.shop-box {
  width: min(94vw, 760px); max-height: 92vh; overflow-y: auto;
  background: rgba(10, 7, 18, 0.88);
  border: 1px solid rgba(216, 169, 75, 0.35);
  border-radius: 14px; padding: 1.6rem;
  backdrop-filter: blur(6px);
}
.shop-box h2 { font-family: var(--font-title); color: var(--gold-bright); text-align: center; letter-spacing: 0.06em; }
#shop-flavor { text-align: center; opacity: 0.6; font-style: italic; font-size: 0.85rem; margin: 0.3rem 0 1rem; }
.shop-gold { text-align: center; font-size: 1.25rem; color: var(--gold-bright); margin-bottom: 1rem; }
#shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.shop-item {
  position: relative;
  background: rgba(24, 17, 44, 0.8);
  border: 1px solid rgba(140, 120, 200, 0.25);
  border-radius: 10px; padding: 0.7rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.shop-item:not(.sold):hover { border-color: var(--gold); box-shadow: 0 0 14px rgba(216, 169, 75, 0.25); transform: translateY(-2px); }
/* карточки лавки прилетают stagger-ом (JS ставит animation-delay) */
.shop-item.enter { animation: shopPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes shopPop {
  from { opacity: 0; transform: translateY(28px) scale(0.88); }
  to { opacity: 1; transform: none; }
}
.shop-item.sold { opacity: 0.35; filter: grayscale(0.8); }
.shop-item .si-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.shop-item .si-icon { display: inline-flex; align-items: center; color: var(--gold-bright); }
.shop-item .si-emoji { font-size: 1.35rem; line-height: 1; }
.shop-item .si-kind { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.55; }
.shop-item .si-desc { font-size: 0.78rem; opacity: 0.8; line-height: 1.45; flex: 1; }
.shop-item .si-buy {
  align-self: stretch; margin-top: 0.4rem;
  font-size: 0.9rem; padding: 0.45em;
}
.shop-item .si-card-mini { font-family: 'Consolas', monospace; font-size: 0.8rem; color: var(--gold-bright); }
.shop-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; }
#shop-deck-info { margin-top: 1rem; font-size: 0.8rem; opacity: 0.65; text-align: center; }
#shop-scrolls { display: flex; gap: 6px; justify-content: center; margin-top: 0.5rem; flex-wrap: wrap; }

/* ---------- Финал ---------- */
.end-box {
  text-align: center; width: min(92vw, 620px); max-height: 92vh; overflow-y: auto;
  background: rgba(10, 7, 18, 0.88);
  border: 1px solid rgba(216, 169, 75, 0.4);
  border-radius: 14px; padding: 2.2rem;
  animation: menuIn 0.9s ease both;
}
#end-title { font-family: var(--font-title); font-size: 2rem; letter-spacing: 0.05em; }
#end-title.victory { color: var(--gold-bright); text-shadow: 0 0 26px rgba(216, 169, 75, 0.6); }
#end-title.defeat { color: var(--enemy); text-shadow: 0 0 26px rgba(255, 77, 94, 0.5); }
#end-story { margin: 1.2rem 0; line-height: 1.65; opacity: 0.9; }
#end-story p { margin: 0.5em 0; }
#end-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px;
  margin: 1.4rem 0;
}
.stat-tile {
  background: rgba(24, 17, 44, 0.8); border: 1px solid rgba(140, 120, 200, 0.25);
  border-radius: 10px; padding: 0.6rem;
}
.stat-tile .sv { font-size: 1.3rem; font-weight: 700; color: var(--gold-bright); }
.stat-tile .sl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.6; }

/* ---------- Оверлеи ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(5, 3, 10, 0.78);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: overlayIn 0.3s ease both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.recap-box, .howto-box {
  width: min(92vw, 520px); max-height: 90vh; overflow-y: auto;
  background: linear-gradient(170deg, #1c1433, #100b1f);
  border: 1px solid var(--gold); border-radius: 14px;
  padding: 1.8rem; text-align: center;
  box-shadow: 0 0 60px rgba(216, 169, 75, 0.2);
}
.recap-box h3, .howto-box h3 { font-family: var(--font-title); color: var(--gold-bright); margin-bottom: 1rem; letter-spacing: 0.08em; }
#recap-plates { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 1rem; }
#recap-steps { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; min-height: 40px; max-height: 34vh; overflow-y: auto; }
.recap-step {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.35em 0.8em; border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.9rem;
  opacity: 0;
}
/* плашка прилетает с пружиной */
.recap-step.shown { animation: stepSpring 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both; opacity: 1; }
@keyframes stepSpring {
  from { opacity: 0; transform: translateX(-34px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
.recap-step .rv { font-weight: 700; font-family: 'Consolas', monospace; }
.recap-step.k-chips .rv { color: var(--player); }
.recap-step.k-mult .rv { color: var(--gold-bright); }
.recap-step.k-xmult .rv { color: #c77dff; }
#recap-total {
  font-size: 2rem; font-weight: 800; font-family: 'Consolas', monospace;
  color: var(--gold-bright); text-shadow: 0 0 20px rgba(216, 169, 75, 0.55);
  margin: 0.6rem 0; min-height: 1.2em;
}
#recap-verdict { font-family: var(--font-title); font-size: 1.2rem; min-height: 1.5em; letter-spacing: 0.1em; }
#recap-verdict.win { color: var(--rar-uncommon); animation: verdictIn 0.5s cubic-bezier(0.22, 1.6, 0.36, 1) both; }
#recap-verdict.lose { color: var(--enemy); animation: verdictIn 0.5s cubic-bezier(0.22, 1.6, 0.36, 1) both; }
@keyframes verdictIn { from { opacity: 0; transform: scale(2); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
/* ×Mult ударяет с зумом */
.plate.xmult-hit { animation: xmultHit 0.48s cubic-bezier(0.34, 1.7, 0.6, 1); }
.plate.xmult-hit b { color: #c77dff; }
@keyframes xmultHit {
  0% { transform: scale(1); }
  32% { transform: scale(1.38) rotate(-2.5deg); box-shadow: 0 0 34px rgba(199, 125, 255, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
  100% { transform: scale(1); }
}
/* итог бьёт панчем */
#recap-total.total-hit { animation: totalHit 0.55s cubic-bezier(0.22, 1.5, 0.36, 1); }
@keyframes totalHit {
  0% { transform: scale(1.75); text-shadow: 0 0 44px rgba(255, 217, 122, 1); }
  100% { transform: scale(1); }
}
.howto-text { text-align: left; font-size: 0.88rem; line-height: 1.6; }
.howto-text p { margin: 0.6em 0; }
.howto-text b { color: var(--gold-bright); }

/* ---------- FX-слои ---------- */
#fx-canvas { position: absolute; inset: 0; z-index: 35; pointer-events: none; }
/* Ударная волна: расширяющееся кольцо */
.fx-ring {
  position: fixed; z-index: 45; pointer-events: none;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 3px solid rgba(255, 217, 122, 0.9);
  animation: ringOut 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes ringOut {
  0% { transform: scale(0.25); opacity: 1; }
  100% { transform: scale(7); opacity: 0; border-width: 1px; }
}
.fx-ring.player { border-color: rgba(58, 160, 255, 0.9); }
.fx-ring.enemy { border-color: rgba(255, 77, 94, 0.9); }
.fx-ring.combo { border-color: rgba(255, 140, 90, 0.95); }
.fx-ring.gold { border-color: rgba(255, 236, 170, 1); }
.fx-ring.summon { animation-duration: 0.9s; border-width: 4px; }
.fx-ring.summon-soft { animation-duration: 0.8s; opacity: 0.7; }
/* Полноэкранные вспышки */
.fx-flash { position: absolute; inset: 0; z-index: 44; pointer-events: none; animation: flashFade 0.75s ease-out both; }
.fx-flash.gold { background: radial-gradient(circle at 50% 42%, rgba(255, 228, 150, 0.6), rgba(255, 195, 70, 0.24) 45%, transparent 78%); }
.fx-flash.red { background: radial-gradient(circle at 50% 50%, rgba(255, 60, 72, 0.32), transparent 72%); }
.fx-flash.white { background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.5), transparent 70%); }
@keyframes flashFade { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
/* Монета для полёта золота */
.fx-coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c9, #ffd97a 45%, #a97b1e 92%);
  border: 1px solid rgba(120, 84, 20, 0.8);
  box-shadow: 0 0 9px rgba(255, 217, 122, 0.85);
}
/* Импакт-панч: композитный оверлей (без filter на всём кадре — дёшево для GPU) */
#app::after {
  content: ''; position: absolute; inset: 0; z-index: 43;
  pointer-events: none; opacity: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 244, 220, 0.28), transparent 55%),
    radial-gradient(ellipse at center, transparent 55%, rgba(10, 5, 20, 0.4) 100%);
}
#app.impact-pulse::after { animation: impactPulse 0.32s ease-out; }
@keyframes impactPulse {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
#shout-layer {
  position: absolute; inset: 0; z-index: 38; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.shout {
  font-family: var(--font-title);
  font-size: clamp(2rem, 7vw, 4.4rem);
  font-weight: 800; letter-spacing: 0.06em;
  color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(216, 169, 75, 0.8), 0 4px 10px #000;
  animation: shoutIn 1.1s cubic-bezier(0.22, 1.4, 0.36, 1) both;
  /* Длинные боссовые выкрики («ДРАКОН ВЫЖИГАЕТ ПОЛЕ!») при nowrap резались по краям экрана
     уже на 1280 px. Перенос по словам с ограничением ширины; короткие комбо-выкрики
     всё равно остаются в одну строку. */
  max-width: 92vw;
  text-align: center;
  line-height: 1.05;
  text-wrap: balance;
}
.shout.combo-2 { color: #ffb86b; }
.shout.combo-3 { color: #ff8c5a; font-size: clamp(2.4rem, 8vw, 5rem); }
.shout.combo-big { color: #ff5a5a; font-size: clamp(2.8rem, 9vw, 5.8rem); }
@keyframes shoutIn {
  0% { opacity: 0; transform: scale(2.4); }
  18% { opacity: 1; transform: scale(1); }
  78% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0; transform: scale(1.08) translateY(-12px); }
}
.float-text {
  position: absolute; z-index: 37; pointer-events: none;
  font-weight: 800; font-family: 'Consolas', monospace;
  text-shadow: 0 1px 3px #000;
  animation: floatUp 1s ease-out both;
}
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-46px); } }

#toast-layer {
  position: absolute; left: 50%; bottom: 14vh; transform: translateX(-50%);
  z-index: 42; display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: rgba(10, 7, 18, 0.92);
  border: 1px solid rgba(216, 169, 75, 0.5);
  color: var(--parchment);
  padding: 0.5em 1.1em; border-radius: 20px;
  font-size: 0.88rem;
  animation: toastIn 3.2s ease both;
  max-width: 92vw; text-align: center;
}
@keyframes toastIn {
  0% { opacity: 0; transform: translateY(12px); }
  8%, 82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* Тряска экрана */
#app.shake-1 { animation: shake1 0.25s; }
#app.shake-2 { animation: shake2 0.4s; }
#app.shake-3 { animation: shake3 0.6s; }
@keyframes shake1 { 25% { transform: translate(3px, -2px); } 50% { transform: translate(-3px, 2px); } 75% { transform: translate(2px, 1px); } }
@keyframes shake2 { 20% { transform: translate(6px, -4px) rotate(0.3deg); } 40% { transform: translate(-6px, 4px); } 60% { transform: translate(4px, -3px) rotate(-0.3deg); } 80% { transform: translate(-3px, 2px); } }
@keyframes shake3 { 15% { transform: translate(10px, -7px) rotate(0.6deg); } 30% { transform: translate(-10px, 7px) rotate(-0.5deg); } 45% { transform: translate(8px, -5px); } 60% { transform: translate(-7px, 4px) rotate(0.4deg); } 75% { transform: translate(5px, -3px); } 90% { transform: translate(-3px, 2px); } }

/* ---------- Карты как физические объекты ---------- */
.card.placing { animation: cardPlace 0.32s cubic-bezier(0.34, 1.5, 0.64, 1) both; }
@keyframes cardPlace {
  0% { transform: translateY(-60px) scale(1.25); opacity: 0.4; }
  70% { transform: translateY(2px) scale(0.97); opacity: 1; }
  100% { transform: none; }
}
/* Карта в полёте (ghost по дуге Безье) */
.card.fx-flying {
  position: fixed; inset: auto; z-index: 46;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.6), 0 0 20px rgba(216, 169, 75, 0.3);
}
/* Приземление: удар со squash-стретчем */
.card.landing { animation: cardLand 0.36s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes cardLand {
  0% { transform: scale(1.22); opacity: 0.85; }
  50% { transform: scale(0.95, 0.9); opacity: 1; }
  100% { transform: none; }
}
/* Клетка вздрагивает от удара карты */
.cell.land-hit { animation: cellLand 0.3s ease-out; }
@keyframes cellLand {
  0% { transform: scale(1.05); }
  45% { transform: scale(0.985) translateY(1.5px); }
  100% { transform: none; }
}
/* Раздача поля на старте боя */
.cell.deal-in { animation: dealIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes dealIn {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to { opacity: 1; transform: none; }
}
/* Раздача руки: карты влетают каскадом (fill backwards — не перебивает .disabled) */
.hand-card.deal-card { animation: handDeal 0.46s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; }
@keyframes handDeal {
  from { opacity: 0; transform: translateY(52px) rotate(5deg) scale(0.86); }
}
/* FLIP-переворот захвата: 3D rotateY, ребро вспыхивает на середине */
.card.flipping { animation: cardFlip3d 0.46s cubic-bezier(0.4, 0.1, 0.3, 1) both; }
@keyframes cardFlip3d {
  0% { transform: perspective(620px) rotateY(0); filter: brightness(1); }
  46% { transform: perspective(620px) rotateY(89deg) scale(1.07); filter: brightness(2.1); box-shadow: 0 0 26px rgba(255, 236, 170, 0.95); }
  54% { transform: perspective(620px) rotateY(89deg) scale(1.07); filter: brightness(2.3); box-shadow: 0 0 30px rgba(255, 236, 170, 1); }
  100% { transform: perspective(620px) rotateY(0); filter: brightness(1); }
}
/* Бой: карты бросаются друг на друга (замах → рывок), возврат пружиной */
.card.clash-att { animation: clashAtt 0.22s cubic-bezier(0.5, -0.4, 0.8, 0.6) both; z-index: 7; }
@keyframes clashAtt {
  0% { transform: none; }
  38% { transform: translate(calc(var(--cdx, 0px) * -0.28), calc(var(--cdy, 0px) * -0.28)) rotate(-3deg) scale(1.05); }
  100% { transform: translate(var(--cdx, 0px), var(--cdy, 0px)) scale(1.03); }
}
.card.clash-def { animation: clashDef 0.22s 0.12s cubic-bezier(0.3, 0.6, 0.5, 1) both; z-index: 6; }
@keyframes clashDef {
  0% { transform: none; }
  100% { transform: translate(var(--cdx, 0px), var(--cdy, 0px)); }
}
.card.clash-back { animation: clashBack 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes clashBack {
  from { transform: translate(var(--cdx, 0px), var(--cdy, 0px)); }
  to { transform: none; }
}
.card.battle-flash { animation: battleFlash 0.5s ease; }
@keyframes battleFlash {
  0%, 100% { filter: none; }
  30% { filter: brightness(2.2) saturate(1.6); }
}
/* Число урона: панч-вылет */
.dmg-num {
  position: fixed; z-index: 47; pointer-events: none;
  transform: translate(-50%, -50%);
  font-family: 'Consolas', monospace; font-weight: 800;
  font-size: 1.75rem;
  text-shadow: 0 2px 4px #000, 0 0 14px rgba(0, 0, 0, 0.65);
  animation: dmgPunch 1.05s cubic-bezier(0.22, 1.6, 0.36, 1) both;
}
.dmg-num.atk { color: var(--gold-bright); }
.dmg-num.def { color: #8fd0ff; }
@keyframes dmgPunch {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.7); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -62%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(0.9); }
}

/* ---------- Аудио-контролы ---------- */
#audio-controls {
  position: absolute; right: 10px; bottom: 10px; z-index: 50;
  display: flex; gap: 6px; align-items: center;
  background: rgba(10, 7, 18, 0.75);
  border: 1px solid rgba(140, 120, 200, 0.3);
  border-radius: 20px; padding: 4px 10px;
}
#btn-mute { background: none; border: none; font-size: 1.1rem; cursor: pointer; }
#vol-slider { width: 64px; accent-color: var(--gold); }
#music-slider { width: 64px; accent-color: #c77dff; }
/* ЭТАП 5 (D4): регулятор ASMR-слоя «Атмосфера» */
#asmr-slider { width: 52px; accent-color: #e8a15c; }
.ac-sep { color: #c77dff; font-size: 0.9rem; opacity: 0.85; }
.ac-sep-asmr { color: #e8a15c; }

/* ---------- Мобильная раскладка (портрет, ≤820px) ----------
   Колесо переезжает компактной лентой вверх боевого экрана (JS перевешивает DOM),
   сайдбар (регион/реликвии/свитки) — в шторку по кнопке. */
#side-toggle {
  position: absolute;
  left: calc(10px + env(safe-area-inset-left, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(14, 9, 26, 0.92);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}
#side-toggle.active { background: rgba(60, 44, 16, 0.95); box-shadow: 0 0 16px rgba(216, 169, 75, 0.5); }

@media (max-width: 820px) {
  #screen-battle { flex-direction: column; }
  #battle-top {
    flex-wrap: wrap; row-gap: 3px;
    padding: 0.35rem calc(0.5rem + env(safe-area-inset-right, 0px)) 0.35rem calc(0.5rem + env(safe-area-inset-left, 0px));
  }
  #blind-info { display: flex; gap: 6px; align-items: baseline; max-width: 55vw; }
  #blind-name { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #score-panel { order: 3; width: 100%; justify-content: center; gap: 4px; }
  .plate { min-width: 0; padding: 3px 7px; }
  .plate b { font-size: 0.95rem; }
  .plate-label { font-size: 0.5rem; letter-spacing: 0.1em; }
  .score-op { font-size: 0.95rem; }
  #run-info { flex-direction: column; gap: 3px; align-items: flex-end; }
  .hud-chip { padding: 2px 7px; font-size: 0.7rem; }
  #blind-region { display: none; }
  #boss-rule-banner { top: 84px; font-size: 0.68rem; }

  /* Нижняя строка-панель для плавающих контролов: рука приподнята,
     кнопка-шторка и аудио живут в собственной зоне — хит-боксы не пересекаются с картами */
  #battle-main { padding: 5.6rem 0.3rem calc(56px + env(safe-area-inset-bottom, 0px)); }
  #screen-battle::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(0deg, rgba(6, 4, 12, 0.95) 60%, transparent);
    border-top: 1px solid rgba(140, 120, 200, 0.18);
    pointer-events: none;
    z-index: 40;
  }

  /* Колесо — лента вверху боевого экрана (всегда видно), рилы ≥48×62 */
  #battle-main > #wheel-box {
    display: flex; align-items: center; gap: 8px;
    padding: 0.3rem 0.55rem;
    margin-bottom: 0.2rem;
    align-self: center;
  }
  #battle-main > #wheel-box .wheel-title { display: none; }
  #battle-main > #wheel-box #wheel-frame { padding: 4px; }
  #battle-main > #wheel-box #wheel-reels { gap: 4px; }
  #battle-main > #wheel-box .reel { width: 50px; height: 64px; }
  #battle-main > #wheel-box .reel-item { width: 50px; height: 64px; gap: 2px; }
  #battle-main > #wheel-box .reel-item img { width: 36px; height: 36px; border-radius: 5px; }
  #battle-main > #wheel-box .reel-item .reel-emoji { font-size: 24px; line-height: 36px; }
  #battle-main > #wheel-box .reel-item .reel-num {
    font-size: 14px; min-width: 26px; padding: 0 4px; border-radius: 4px;
  }
  #battle-main > #wheel-box .reel::before, #battle-main > #wheel-box .reel::after { height: 12px; }
  #battle-main > #wheel-box #wheel-charge-row { margin-top: 0; width: 96px; flex-direction: column; gap: 2px; }
  #battle-main > #wheel-box #wheel-charge-label { display: none; }
  #battle-main > #wheel-box #wheel-charge-wrap { width: 100%; height: 10px; }
  #battle-main > #wheel-box #wheel-charge-text { min-width: 0; text-align: center; font-size: 0.68rem; }
  #battle-main > #wheel-box #wheel-state { display: none; }

  /* Сайдбар — шторка снизу */
  #battle-side.drawer { display: none; }
  #battle-side.drawer.open {
    display: flex; flex-direction: column; gap: 0.8rem;
    position: absolute; left: 0; right: 0; bottom: 0;
    max-height: 62vh; overflow-y: auto;
    width: auto;
    z-index: 54;
    background: rgba(8, 5, 15, 0.97);
    border-top: 1px solid var(--gold);
    border-radius: 14px 14px 0 0;
    padding: 0.9rem 1rem calc(4.2rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.7);
    animation: drawerUp 0.25s ease both;
  }
  @keyframes drawerUp { from { transform: translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }
  /* тап-таргеты в шторке ≥44px */
  #battle-side.drawer.open .relic-chip,
  #battle-side.drawer.open .scroll-chip { width: 44px; height: 44px; }
  #battle-side.drawer.open .tip { right: auto; left: 0; top: auto; bottom: 110%; transform: none; }
  #battle-side.drawer.open #turn-indicator { display: block; text-align: left; }

  /* Руки: горизонтальная лента, центр — авто-полями (без обрезки начала) */
  .hand { --hand-h: 86px; justify-content: flex-start; }
  .hand > :first-child { margin-left: auto; }
  .hand > :last-child { margin-right: auto; }
  #enemy-hand { --hand-h: 50px; min-height: 58px; }
  .zone-label { font-size: 0.6rem; padding: 1px 8px; }

  #board { --cell: min(10.5vh, 20vw, 92px); gap: 5px; padding: 7px; }
  #board.n5 { --cell: min(8.6vh, 16vw, 72px); }

  #recap-plates .plate.big { min-width: 84px; padding: 5px 10px; }
  #recap-plates .plate.big b { font-size: 1.4rem; }
  .summon-portrait { width: 34vmin; height: 34vmin; }
  .summon-rays { display: none; } /* облегчённый вариант на мобиле */

  /* контролы — в нижней строке-панели (НЕ поверх карт руки) */
  #side-toggle {
    width: 42px; height: 42px;
    bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    z-index: 56;
  }
  #audio-controls {
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    z-index: 56;
  }
  #vol-slider, #music-slider { width: 46px; }

  /* читаемость статов на картах руки — крупнее */
  .hand-card .card .stats b { font-size: calc(var(--cell, 100px) * 0.175); }
  .hand-card .card .stats .tchip { font-size: calc(var(--cell, 100px) * 0.135); }
}
@media (max-width: 400px) {
  #board { --cell: min(10vh, 21.5vw, 84px); gap: 4px; padding: 6px; }
  #board.n5 { --cell: min(8.4vh, 17vw, 66px); }
  .hand { --hand-h: 78px; }
  #battle-main { padding-top: 5.4rem; }
  #battle-main > #wheel-box #wheel-charge-row { width: 74px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- ЭТАП 1: сложности (A4), замена реликвий (B1), вердикты (A2) ---------- */
#difficulty-row { margin: 0.6rem 0 0.2rem; }
#difficulty-row .diff-label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65; margin-bottom: 0.35rem; }
#difficulty-btns { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.diff-btn {
  font: inherit; font-size: 0.8rem; padding: 0.4rem 0.65rem; cursor: pointer;
  color: #e8dcc0; background: rgba(28, 21, 48, 0.75); border: 1px solid rgba(216, 169, 75, 0.35);
  border-radius: 8px; transition: border-color 0.15s, background 0.15s, transform 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 74px;
}
.diff-btn .diff-mul { font-size: 0.7rem; opacity: 0.7; }
.diff-btn:hover { border-color: #d8a94b; }
.diff-btn.active { border-color: #ffd97a; background: rgba(216, 169, 75, 0.22); box-shadow: 0 0 10px rgba(255, 217, 122, 0.25); transform: translateY(-1px); }
.diff-btn.diff-rift.active { border-color: #ff6a6a; background: rgba(200, 60, 60, 0.22); box-shadow: 0 0 10px rgba(255, 106, 106, 0.3); }
#difficulty-desc { font-size: 0.72rem; opacity: 0.7; margin-top: 0.35rem; min-height: 1em; }
#run-diff b { color: #ffd97a; }
#run-diff.diff-rift b { color: #ff8a8a; }

.swap-box {
  background: linear-gradient(160deg, #221a38, #14101f); border: 1px solid rgba(216, 169, 75, 0.5);
  border-radius: 14px; padding: 1.1rem 1.2rem; max-width: 560px; width: min(94vw, 560px);
  max-height: 88vh; overflow-y: auto; text-align: center;
}
.swap-box h3 { color: #ffd97a; margin-bottom: 0.3rem; }
.swap-hint { font-size: 0.8rem; opacity: 0.75; margin-bottom: 0.6rem; }
#swap-new { background: rgba(216, 169, 75, 0.12); border: 1px dashed rgba(216, 169, 75, 0.5); border-radius: 10px; padding: 0.5rem 0.7rem; margin-bottom: 0.7rem; font-size: 0.9rem; }
#swap-new .swap-new-desc { font-size: 0.75rem; opacity: 0.75; margin-top: 2px; }
#swap-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.8rem; }
.swap-relic {
  font: inherit; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "ic name sell" "ic desc sell";
  gap: 0 8px; align-items: center; text-align: left; cursor: pointer;
  color: #e8dcc0; background: rgba(28, 21, 48, 0.7); border: 1px solid rgba(216, 169, 75, 0.3);
  border-radius: 10px; padding: 0.45rem 0.6rem; transition: border-color 0.15s, background 0.15s;
}
.swap-relic:hover { border-color: #ffd97a; background: rgba(216, 169, 75, 0.15); }
.swap-relic .si-icon { grid-area: ic; }
.swap-relic-name { grid-area: name; font-weight: 600; font-size: 0.85rem; }
.swap-relic-desc { grid-area: desc; font-size: 0.72rem; opacity: 0.7; }
.swap-relic-sell { grid-area: sell; font-size: 0.75rem; color: #ffd97a; white-space: nowrap; padding-left: 8px; }

#recap-verdict.half { color: #ffd97a; text-shadow: 0 0 12px rgba(255, 217, 122, 0.5); }
#recap-verdict .verdict-cards { display: block; font-size: 0.72rem; font-weight: 400; letter-spacing: 0.04em; opacity: 0.8; margin-top: 3px; }

@media (max-width: 480px) {
  #difficulty-btns { gap: 4px; }
  .diff-btn { min-width: 64px; font-size: 0.72rem; padding: 0.35rem 0.4rem; }
  .swap-relic { grid-template-columns: 24px 1fr; grid-template-areas: "ic name" "ic desc" "sell sell"; }
  .swap-relic-sell { padding: 4px 0 0; }
}


/* ===== Этап 2: SRD-контент ===== */
/* Рамка уникальных карт боссов */
.card.boss-card {
  box-shadow: 0 0 0 2px #7a2a8f, 0 0 10px 2px rgba(160, 60, 200, 0.55), 0 1px 4px rgba(0,0,0,0.6);
}
.card.boss-card::after {
  content: '✦';
  position: absolute; top: 1px; right: 3px;
  font-size: 10px; color: #d98bf0; text-shadow: 0 0 4px #7a2a8f;
  pointer-events: none; z-index: 3;
}
/* DoMT «Визирь»: лучшая клетка */
.cell.vizier-hint {
  outline: 2px dashed #ffd97a;
  outline-offset: -3px;
  animation: vizierPulse 1.2s ease-in-out infinite;
}
@keyframes vizierPulse { 0%,100% { outline-color: #ffd97a; } 50% { outline-color: #fff3c9; } }
/* Подвал меню: атрибуция SRD */
.menu-footer-srd { font-size: 0.62rem; opacity: 0.55; margin-top: 2px; }
.srd-attribution { font-style: italic; opacity: 0.85; border-left: 2px solid #d8a94b; padding-left: 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; }
.btn-mini { font-size: 0.7rem; padding: 2px 8px; }

/* ============================================================
   ЭТАП 3 — Драфт руки (A1), тиры роста и сцена роста (C4-b),
   пикер адресной прокачки (C4-a)
   ============================================================ */

/* ---------- Экран драфта ---------- */
.draft-box {
  position: relative; z-index: 4;
  width: min(1060px, 96vw);
  max-height: 96dvh;
  margin: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(23, 18, 38, 0.94), rgba(13, 10, 20, 0.96));
  border: 1px solid rgba(216, 169, 75, 0.4);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7), inset 0 0 40px rgba(216, 169, 75, 0.05);
  overflow: hidden auto;
}
#screen-draft { display: flex; align-items: center; justify-content: center; }
#screen-draft.hidden { display: none; }
#draft-top { text-align: center; }
#draft-title {
  font-family: var(--font-title); color: var(--gold-bright);
  letter-spacing: 0.08em; font-size: 1.35rem;
  text-shadow: 0 2px 12px rgba(216, 169, 75, 0.35);
}
#draft-sub { font-size: 0.82rem; opacity: 0.85; margin-top: 2px; }
#draft-sub b { color: var(--gold-bright); }
.draft-warn { color: #ff9d7a; }
#draft-hand-label, #draft-pool-label {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.65;
}

/* рука: слоты порядка */
#draft-hand {
  display: flex; gap: 8px; justify-content: center; flex-wrap: nowrap;
}
.draft-slot {
  position: relative;
  flex: 0 1 108px;
  min-width: 64px;
  aspect-ratio: 3 / 4;
  --cell: 100px;
  border-radius: 9px;
  border: 2px dashed rgba(216, 169, 75, 0.35);
  background: rgba(28, 21, 48, 0.45);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s;
}
.draft-slot.filled { border-style: solid; border-color: rgba(216, 169, 75, 0.75); box-shadow: 0 6px 18px rgba(0,0,0,0.5), 0 0 12px rgba(216,169,75,0.2); }
.draft-slot:hover { border-color: var(--gold-bright); }
.draft-slot .slot-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 1.6rem; color: rgba(232, 220, 192, 0.25);
}
.draft-slot .slot-order {
  position: absolute; top: 2px; left: 2px; z-index: 5;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: #1a1020; font-weight: 700; font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* пул подвыборки */
#draft-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  overflow: hidden auto; /* 0 горизонтального скролла (приёмка 3.8) */
  padding: 2px 2px 6px;
  min-height: 120px;
}
.draft-card {
  position: relative;
  cursor: pointer;
  border-radius: 10px;
  padding: 4px 4px 2px;
  background: rgba(28, 21, 48, 0.35);
  border: 1px solid transparent;
  transition: transform 0.14s ease, border-color 0.15s, opacity 0.2s;
  --cell: 110px;
}
.draft-card:hover { transform: translateY(-3px); border-color: rgba(216, 169, 75, 0.5); }
.dc-frame { position: relative; width: 100%; aspect-ratio: 3 / 4; } /* сайзер под absolute .card */
.dc-frame > .card { inset: 0; }
.draft-card.picked { opacity: 0.45; }
.draft-card.picked:hover { opacity: 0.65; }
.draft-card.synergy { border-color: rgba(79, 196, 122, 0.55); box-shadow: 0 0 12px rgba(79, 196, 122, 0.18); }
.draft-card .pick-order {
  position: absolute; top: 2px; right: 2px; z-index: 6;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-bright); color: #1a1020; font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.dc-meta {
  display: flex; flex-wrap: wrap; gap: 3px 7px; align-items: center;
  padding: 3px 2px 2px;
  font-size: 0.62rem; line-height: 1.25; opacity: 0.9;
}
.dc-meta .dc-lvl { color: var(--gold-bright); font-weight: 600; }
.dc-meta .dc-fac { opacity: 0.85; }
.dc-meta .dc-triad { opacity: 0.75; }
.dc-meta .dc-triad.t-P { color: #ffcf9e; }
.dc-meta .dc-triad.t-M { color: #dcc8ff; }
.dc-meta .dc-triad.t-X { color: #a8f0e6; }
.dc-meta .dc-triad.t-A { color: #ffe9a8; }
.dc-meta .dc-syn { color: #6fe09a; font-weight: 600; }

.draft-actions {
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(216, 169, 75, 0.18);
}
.draft-actions .btn { min-height: 44px; } /* тап-таргеты >=44px (приёмка 3.8) */
#draft-auto-always {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem; opacity: 0.8; cursor: pointer;
  min-height: 44px; padding: 0 6px;
}
#draft-auto-always input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }

/* ---------- Тиры роста карт (C4-b): различимы на контакт-листе ---------- */
/* Ур.2: аура + золочение рамки */
.card.tier-2 { border-color: var(--gold); box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 10px rgba(216, 169, 75, 0.45); }
/* Ур.3: корона + руны + свечение */
.card.tier-3 { border-color: var(--gold-bright); box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 16px rgba(255, 217, 122, 0.6); }
.card.tier-3::before, .card.tier-4::before {
  content: '\265B';
  position: absolute; top: 1px; left: 4px; z-index: 3;
  font-size: 11px; color: var(--gold-bright);
  text-shadow: 0 0 6px rgba(255, 217, 122, 0.9);
  pointer-events: none;
}
/* Ур.4+: живой (анимированный) фон рамки */
.card.tier-4 {
  border-color: transparent;
  background:
    linear-gradient(#1c1530, #1c1530) padding-box,
    linear-gradient(120deg, #ffd97a, #ff8a5c, #c86bff, #4f9cf0, #ffd97a) border-box;
  background-size: auto, 300% 300%;
  animation: tier4Flow 4s linear infinite;
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 18px rgba(200, 107, 255, 0.5);
}
@keyframes tier4Flow { from { background-position: 0 0, 0% 50%; } to { background-position: 0 0, 300% 50%; } }
.card.tier-4::before { content: '\265B'; color: #ffeecb; }

/* ---------- Пикер цели прокачки (C4-a) ---------- */
.deckpick-box {
  width: min(760px, 94vw); max-height: 88dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(23, 18, 38, 0.97), rgba(13, 10, 20, 0.98));
  border: 1px solid rgba(216, 169, 75, 0.45);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.8);
}
.deckpick-box h3 { font-family: var(--font-title); color: var(--gold-bright); text-align: center; }
#deckpick-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px; overflow-y: auto; padding: 4px 2px;
}
.deckpick-item {
  position: relative; cursor: pointer; --cell: 100px;
  border-radius: 9px; border: 1px solid transparent;
  padding: 4px; background: rgba(28, 21, 48, 0.4);
  transition: transform 0.13s ease, border-color 0.15s;
}
/* карта живёт в .dc-frame (общий с драфтом) */
.deckpick-item:hover { transform: translateY(-3px); border-color: var(--gold-bright); box-shadow: 0 0 14px rgba(255, 217, 122, 0.25); }
.deckpick-item .dp-cap { padding-top: 4px; font-size: 0.66rem; text-align: center; opacity: 0.9; }
.deckpick-item .dp-cap b { color: var(--gold-bright); }
#btn-deckpick-cancel { align-self: center; min-height: 44px; }

/* ---------- Сцена роста (C4-b): <=2.5 c, клик — пропуск ---------- */
#growth-overlay { cursor: pointer; }
#growth-box {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 22px 30px;
}
#growth-title {
  font-family: var(--font-title); font-size: 1.4rem; letter-spacing: 0.1em;
  color: var(--gold-bright); text-shadow: 0 0 18px rgba(255, 217, 122, 0.6);
}
#growth-card {
  position: relative; width: min(220px, 56vw); aspect-ratio: 3 / 4; --cell: 200px;
}
#growth-card .card { inset: 0; }
#growth-card.burst { animation: growthPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes growthPop {
  0% { transform: scale(0.6) rotate(-4deg); filter: brightness(2.2); }
  60% { transform: scale(1.08) rotate(1deg); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}
.card.tier-flash { animation: tierFlash 0.6s ease both; }
@keyframes tierFlash {
  0% { filter: brightness(1); }
  30% { filter: brightness(2.4) saturate(1.6); }
  100% { filter: brightness(1); }
}
#growth-stats { display: flex; gap: 18px; font-size: 1.15rem; }
#growth-stats .gs { display: flex; align-items: center; gap: 6px; }
#growth-stats .gs b { font-size: 1.3rem; }
#growth-stats .gs-atk { color: #ffe9b0; }
#growth-stats .gs-pd { color: #9cc4ef; }
#growth-stats .gs-md { color: #c9a6ff; }
#growth-stats .gs.grew b { color: #6fe09a; text-shadow: 0 0 10px rgba(111, 224, 154, 0.7); }
#growth-tier { font-size: 0.9rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); transition: opacity 0.3s; }
#growth-tier.pre { opacity: 0.25; }
#growth-skip { font-size: 0.68rem; opacity: 0.45; letter-spacing: 0.1em; }

/* ---------- Мобильная вёрстка драфта: 0 гор. скролла, тапы >=44px (приёмка 3.8) ---------- */
@media (max-width: 640px) {
  .draft-box { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; border-left: 0; border-right: 0;
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px)); /* не конфликтуем с аудио-контролами */ }
  #draft-hand { gap: 6px; }
  .draft-slot { flex: 1 1 0; min-width: 0; --cell: 72px; }
  #draft-pool { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .draft-card { --cell: 84px; }
  .dc-meta { font-size: 0.58rem; gap: 2px 5px; }
  #draft-title { font-size: 1.1rem; }
  .draft-actions .btn { padding: 0.55em 1em; font-size: 0.95rem; }
  #deckpick-list { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .card.tier-4 { animation: none; } /* живой фон замирает */
  #growth-card.burst { animation: none; }
}

/* ==================== ЭТАП 4: МИНИ-ИГРЫ (ЭКС-МОДЫ) ==================== */
#minigame-overlay { z-index: 44; }
.mg-box {
  position: relative;
  width: min(94vw, 560px); max-height: 92vh; overflow: hidden;
  background: linear-gradient(170deg, #1c1433, #100b1f);
  border: 1px solid var(--gold); border-radius: 14px;
  padding: 1.1rem 1.2rem 1.2rem; text-align: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7), 0 0 34px rgba(216, 169, 75, 0.12) inset;
  animation: overlayIn 0.25s ease both;
}
.mg-title { font-family: var(--font-title); color: var(--gold); font-size: 1.25rem; letter-spacing: 0.08em; }
.mg-hint { color: var(--parchment); opacity: 0.85; font-size: 0.92rem; margin: 0.45em 0 0.8em; line-height: 1.35; }
.mg-sub { color: var(--parchment); opacity: 0.55; font-size: 0.78rem; margin-top: 0.7em; }
.mg-timebar { height: 8px; border-radius: 4px; background: #241a3e; overflow: hidden; margin: 0.6em auto 0; }
.mg-timefill { height: 100%; width: 100%; background: linear-gradient(90deg, #d8a94b, #ffd97a); transition: width 0.1s linear; }
.mg-verdict {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 1.7rem; letter-spacing: 0.1em;
  background: rgba(10, 6, 20, 0.82); border-radius: 14px; animation: overlayIn 0.18s ease both;
}
.mg-verdict.mg-perfect { color: #ffd97a; text-shadow: 0 0 24px rgba(255, 217, 122, 0.6); }
.mg-verdict.mg-hit { color: #9fe3a1; }
.mg-verdict.mg-miss, .mg-verdict.mg-timeout { color: #b9a8d8; }

/* E1 «Поплавок»: дорожка, зона, идеальная подзона, бегунок */
.mg-float .mg-track {
  position: relative; height: 56px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, #14102a, #1d1638);
  border: 1px solid #4a3d6b; overflow: hidden; touch-action: manipulation;
}
.mg-float .mg-zone {
  position: absolute; top: 0; bottom: 0; background: rgba(216, 169, 75, 0.28);
  border-left: 1px solid rgba(255, 217, 122, 0.7); border-right: 1px solid rgba(255, 217, 122, 0.7);
}
.mg-float .mg-zone-perfect { position: absolute; top: 0; bottom: 0; background: rgba(255, 217, 122, 0.45); }
.mg-float .mg-marker {
  position: absolute; top: -2px; bottom: -2px; width: 5px; margin-left: -2px;
  background: #9ff3ff; border-radius: 3px; box-shadow: 0 0 12px #9ff3ff;
}

/* E2 «Слово силы»: буквы и экранная клавиатура (тап-таргеты ≥44px) */
.mg-word { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 0.3em; }
.mg-letter {
  min-width: 34px; padding: 6px 4px; border-radius: 8px;
  font-family: var(--font-title); font-size: 1.35rem; color: var(--parchment);
  background: #241a3e; border: 1px solid #4a3d6b;
}
.mg-letter.done { color: #ffd97a; border-color: var(--gold); background: #2d2347; }
.mg-letter.next { border-color: #9ff3ff; box-shadow: 0 0 10px rgba(159, 243, 255, 0.35); }
.mg-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 0.9em; }
.mg-key {
  min-width: 46px; min-height: 46px; border-radius: 9px; cursor: pointer;
  font-family: var(--font-title); font-size: 1.2rem; color: var(--parchment);
  background: linear-gradient(180deg, #2a2140, #1a1430); border: 1px solid #4a3d6b;
  touch-action: manipulation;
}
.mg-key:active { transform: scale(0.94); border-color: var(--gold); }
.mg-key.wrong { animation: mgShake 0.25s ease; border-color: #b3486e; }
@keyframes mgShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.mg-actions { margin-top: 0.9em; display: flex; gap: 10px; justify-content: center; }
.mg-actions .btn { min-height: 46px; }

/* E3 «Стрелка против роя»: канвас-арена, HUD, кнопка рывка */
.mg-swarm { padding: 0.7rem; width: min(96vw, 640px); }
.mg-swarm-hud { display: flex; align-items: center; gap: 10px; padding: 2px 4px 8px; }
.mg-swarm-hud .mg-lives { color: #ff8f8f; font-size: 1.05rem; letter-spacing: 2px; min-width: 64px; text-align: left; }
.mg-swarm-hud .mg-kills { color: #9ff3ff; min-width: 48px; text-align: right; font-size: 0.95rem; }
.mg-swarm-time { flex: 1; margin: 0; }
.mg-canvas { display: block; width: 100%; border-radius: 10px; background: #0c0818; border: 1px solid #4a3d6b; touch-action: none; }
.mg-dash-btn {
  position: absolute; right: 16px; bottom: 16px; min-width: 96px; min-height: 52px;
  opacity: 0.55; touch-action: manipulation;
}
.mg-dash-btn.ready { opacity: 1; border-color: #9ff3ff; box-shadow: 0 0 14px rgba(159, 243, 255, 0.35); }
.mg-intro {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 1.2rem;
  background: rgba(10, 6, 20, 0.88); border-radius: 14px;
}
.mg-intro .mg-hint { max-width: 40ch; }

@media (max-width: 700px) {
  .mg-box { width: 96vw; padding: 0.9rem 0.7rem 1rem; }
  .mg-float .mg-track { height: 64px; }
  .mg-key { min-width: 44px; min-height: 44px; }
  .mg-swarm .mg-canvas { max-height: 58vh; }
}

/* Этап 4: цена отступления на кнопке роя — решение должно приниматься со знанием цены */
.mg-cost { opacity: 0.75; font-size: 0.82em; margin-left: 0.35em; }

/* ================================================================
   ЭТАП 6 — Визуал и анимации (C2 bossfx, C3 cardstate, C5 victory)
   Контракт классов ↔ @keyframes сверяется тестом (приёмка 6.4):
   источник правды — js/cardstate.js STATES и js/bossfx.js KEYFRAME_CONTRACT.
   ================================================================ */

/* ---------- C3. Живые карты: состояния (js/cardstate.js) ---------- */
/* idle: дыхание — еле заметно, «тихая доска» */
.hand-card.cs-idle { animation: csIdle 3.4s ease-in-out infinite; }
@keyframes csIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}
/* hover: подъём с бэк-аутом (наклон к курсору даёт attachTilt через --rx/--ry) */
.hand-card.cs-hover { animation: csHover 0.24s cubic-bezier(0.34, 1.56, 0.64, 1) both; z-index: 5; }
@keyframes csHover {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-12px) scale(1.07); }
}
/* tap-focus: мобильная замена hover (6.5) — первый тап приподнимает карту */
.hand-card.cs-tap-focus { animation: csTapFocus 0.24s cubic-bezier(0.34, 1.56, 0.64, 1) both; z-index: 5; }
@keyframes csTapFocus {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-9px) scale(1.05); }
}
/* ready: выбрана — пульс готовности на внутренней карте (.selected держит transform) */
.hand-card.cs-ready .card { animation: csReady 1.5s ease-in-out infinite; }
@keyframes csReady {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold-bright), 0 0 22px rgba(216, 169, 75, 0.55), 0 18px 34px rgba(0, 0, 0, 0.7); }
  50% { box-shadow: 0 0 0 2px #fff3c9, 0 0 34px rgba(255, 217, 122, 0.85), 0 18px 34px rgba(0, 0, 0, 0.7); }
}
/* warn: опасное размещение — встречная стрелка сильнее; тревожная дрожь рамки */
.hand-card.cs-warn .card { animation: csWarn 0.42s ease-in-out infinite; }
@keyframes csWarn {
  0%, 100% { box-shadow: 0 0 0 2px #ff4d5e, 0 0 22px rgba(255, 77, 94, 0.65), 0 14px 30px rgba(0, 0, 0, 0.7); transform: perspective(720px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateX(0); }
  25% { transform: perspective(720px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateX(-2px); }
  75% { box-shadow: 0 0 0 2px #ff8a95, 0 0 30px rgba(255, 77, 94, 0.85), 0 14px 30px rgba(0, 0, 0, 0.7); transform: perspective(720px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateX(2px); }
}
/* triumph: захват — золотой всплеск (транзиент, ставится и на карты доски) */
.card.cs-triumph, .hand-card.cs-triumph .card { animation: csTriumph 0.72s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes csTriumph {
  0% { transform: scale(1); filter: brightness(1); }
  28% { transform: scale(1.16) rotate(2deg); filter: brightness(1.75) saturate(1.4); box-shadow: 0 0 30px rgba(255, 217, 122, 0.9); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}
/* tremble: проигран бой стат — дрожь и просадка цвета (транзиент) */
.card.cs-tremble, .hand-card.cs-tremble .card { animation: csTremble 0.52s ease-out both; }
@keyframes csTremble {
  0% { transform: translateX(0); filter: brightness(1); }
  15% { transform: translateX(-5px) rotate(-1.5deg); filter: brightness(0.72) saturate(0.6); }
  35% { transform: translateX(4px) rotate(1deg); }
  55% { transform: translateX(-3px); }
  75% { transform: translateX(2px); filter: brightness(0.85) saturate(0.8); }
  100% { transform: translateX(0); filter: brightness(1); }
}

/* ---------- C2. Спецэффекты боссов: волна по клеткам (js/bossfx.js) ----------
   Все ignite-анимации — на псевдоэлементе и только opacity/transform:
   анимация box-shadow/background на 25 клетках валит p95 кадра (приёмка 6.3). */
/* ОГОНЬ (Дракон Разлома): язык пламени взлетает по клетке.
   -armed (взвод): слой создан заранее, ignite только стартует анимацию (6.3) */
.cell.bfx-burn-armed::before {
  content: ''; position: absolute; inset: -5px; border-radius: 10px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background:
    radial-gradient(ellipse 60% 45% at 50% 30%, rgba(255, 220, 120, 0.65), transparent 70%),
    radial-gradient(ellipse 85% 90% at 50% 78%, rgba(255, 248, 210, 1), rgba(255, 150, 60, 0.98) 34%, rgba(226, 70, 20, 0.75) 58%, rgba(150, 30, 8, 0) 80%);
}
.cell.bfx-burn::before { animation: bfxBurn 0.42s ease-out both; }
@keyframes bfxBurn {
  0% { opacity: 0; transform: scale(0.55) translateY(18%); }
  18% { opacity: 1; transform: scale(1.12) translateY(-2%); }
  55% { opacity: 0.95; transform: scale(1.06) translateY(-7%); }
  100% { opacity: 0; transform: scale(1) translateY(-15%); }
}
/* остаточное ОБУГЛИВАНИЕ: чёрная корка с раскалёнными трещинами, угли тлеют на ::before */
.cell.bfx-charred {
  background:
    repeating-linear-gradient(105deg, transparent 0 9px, rgba(255, 96, 28, 0.28) 9px 10.5px, transparent 10.5px 22px),
    repeating-linear-gradient(37deg, rgba(0, 0, 0, 0.88) 0 5px, rgba(26, 13, 7, 0.92) 5px 11px),
    linear-gradient(160deg, #0d0603, #030100) !important;
  border-color: rgba(150, 62, 24, 0.8) !important;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.95), inset 0 -6px 16px rgba(226, 80, 20, 0.22), 0 0 10px rgba(226, 80, 20, 0.18) !important;
}
.cell.bfx-charred::after { opacity: 0.16; filter: grayscale(0.8) brightness(0.4); }
.cell.bfx-charred::before {
  content: ''; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  background:
    radial-gradient(circle at 28% 72%, rgba(255, 120, 45, 0.85), transparent 34%),
    radial-gradient(circle at 74% 30%, rgba(255, 150, 60, 0.6), transparent 28%),
    radial-gradient(circle at 55% 55%, rgba(255, 90, 30, 0.4), transparent 40%);
  opacity: 0.5; will-change: opacity;
  animation: bfxCharredEmber 2.8s ease-in-out infinite;
}
@keyframes bfxCharredEmber {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}
/* ИЛ (Иловый Пастырь): трясина вспучивается снизу */
.cell.bfx-silt-armed::before {
  content: ''; position: absolute; inset: -2px; border-radius: 9px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background: radial-gradient(ellipse at 50% 88%, rgba(154, 168, 106, 0.9), rgba(94, 110, 58, 0.7) 45%, rgba(40, 48, 22, 0) 78%);
}
.cell.bfx-silt::before { animation: bfxSilt 0.42s ease-in-out both; }
@keyframes bfxSilt {
  0% { opacity: 0; transform: scaleY(0.4) translateY(28%); }
  38% { opacity: 1; transform: scaleY(1.06) translateY(-2%); }
  100% { opacity: 0; transform: scaleY(1) translateY(0); }
}
.cell.bfx-silted {
  background:
    radial-gradient(ellipse at 50% 62%, rgba(122, 138, 74, 0.4), transparent 62%),
    linear-gradient(160deg, #2c3318, #151a0b) !important;
  border-color: rgba(140, 155, 90, 0.5) !important;
  box-shadow: inset 0 0 18px rgba(20, 26, 8, 0.9) !important;
}
.cell.bfx-silted::after { opacity: 0.3; filter: sepia(0.8) brightness(0.65); }
/* ТЛЕН (Мать Пиявок): багровая гниль наползает сверху */
.cell.bfx-blight-armed::before {
  content: ''; position: absolute; inset: -2px; border-radius: 9px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background: linear-gradient(180deg, rgba(94, 42, 42, 0.9), rgba(58, 26, 26, 0.75) 55%, rgba(30, 12, 12, 0) 90%);
}
.cell.bfx-blight::before { animation: bfxBlight 0.42s ease-in-out both; }
@keyframes bfxBlight {
  0% { opacity: 0; transform: translateY(-24%) scaleY(0.5); }
  42% { opacity: 0.95; transform: translateY(0) scaleY(1.02); }
  100% { opacity: 0; transform: translateY(6%) scaleY(1); }
}
.hand-card.bfx-blighted .card, .hand-card.bfx-blighted .card-back {
  box-shadow: 0 0 0 1px rgba(178, 60, 60, 0.8), 0 0 18px rgba(178, 60, 60, 0.55);
  filter: saturate(1.25) contrast(1.06);
}
/* ЛЁД (Падший Дикарь): морозная пелена оседает */
.cell.bfx-frost-armed::before {
  content: ''; position: absolute; inset: -2px; border-radius: 9px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background: radial-gradient(circle at 50% 38%, rgba(230, 246, 255, 0.95), rgba(150, 205, 250, 0.65) 48%, rgba(80, 130, 190, 0) 80%);
}
.cell.bfx-frost::before { animation: bfxFrost 0.42s ease-out both; }
@keyframes bfxFrost {
  0% { opacity: 0; transform: scale(1.35); }
  32% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.94); }
}
.hand-card.bfx-frosted .card, .hand-card.bfx-frosted .card-back {
  box-shadow: 0 0 0 1px rgba(160, 215, 255, 0.75), 0 0 16px rgba(140, 200, 255, 0.5), inset 0 0 22px rgba(190, 230, 255, 0.28);
  filter: brightness(1.1) saturate(0.75);
}
/* МОЛНИЯ (Падшая Жрица): золотой разряд — резкий и короткий */
.cell.bfx-spark-armed::before {
  content: ''; position: absolute; inset: -3px; border-radius: 9px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background:
    linear-gradient(104deg, transparent 44%, rgba(255, 255, 255, 0.95) 49%, rgba(255, 242, 201, 0.9) 52%, transparent 58%),
    radial-gradient(circle at 50% 50%, rgba(255, 240, 190, 0.9), rgba(216, 169, 75, 0.4) 55%, transparent 80%);
}
.cell.bfx-spark::before { animation: bfxSpark 0.3s ease-out both; }
@keyframes bfxSpark {
  0% { opacity: 0; transform: scale(0.7); }
  16% { opacity: 1; transform: scale(1.12); }
  40% { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
.p-target.bfx-gilded {
  border-color: #ffd97a !important;
  box-shadow: 0 0 0 1px rgba(255, 217, 122, 0.7), 0 0 18px rgba(255, 217, 122, 0.55) !important;
}
/* ОКОВЫ (Падшая Тень): лязг — клетку сжимает железной хваткой (transform-only) */
.cell.bfx-chain-armed { will-change: transform; }
.cell.bfx-chain-armed::before {
  content: ''; position: absolute; inset: 0; border-radius: 8px; z-index: 2;
  pointer-events: none;
  background:
    repeating-linear-gradient(45deg, rgba(216, 222, 233, 0.75) 0 5px, rgba(20, 22, 28, 0.55) 5px 13px),
    radial-gradient(circle at 50% 50%, rgba(92, 98, 112, 0.6), rgba(20, 22, 28, 0.8));
  box-shadow: inset 0 0 14px #000;
  opacity: 0; will-change: opacity;
}
.cell.bfx-chain { animation: bfxChain 0.56s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.cell.bfx-chain::before { animation: bfxChainVeil 0.56s ease-out both; }
@keyframes bfxChain {
  0% { transform: scale(1); }
  30% { transform: scale(0.92) rotate(-0.8deg); }
  62% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes bfxChainVeil {
  0% { opacity: 0; }
  22% { opacity: 1; }
  70% { opacity: 0.85; }
  100% { opacity: 0; }
}
#wheel-box.bfx-chained {
  filter: grayscale(0.55) brightness(0.82);
  box-shadow: inset 0 0 26px rgba(10, 12, 16, 0.8), 0 0 0 1px rgba(154, 160, 173, 0.5);
  background-image: repeating-linear-gradient(45deg, rgba(154, 160, 173, 0.09) 0 6px, transparent 6px 18px);
}
/* ЗЕРКАЛО (Падшая Чародейка): косой блик пробегает по клетке */
.cell.bfx-glint-armed { overflow: hidden; }
.cell.bfx-glint-armed::before {
  content: ''; position: absolute; inset: -8% -55%; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.85) 48%, rgba(199, 125, 255, 0.5) 55%, transparent 66%);
}
.cell.bfx-glint::before { animation: bfxGlint 0.38s ease-in-out both; }
@keyframes bfxGlint {
  0% { opacity: 0; transform: translateX(-46%); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateX(46%); }
}
.hand-card.bfx-mirrored .card, .hand-card.bfx-mirrored .card-back {
  box-shadow: 0 0 0 1px rgba(199, 125, 255, 0.85), 0 0 18px rgba(199, 125, 255, 0.6);
  filter: hue-rotate(18deg) brightness(1.12);
}
/* ПУСТОТА (Падший Воитель): клетку всасывает (transform-only) + тёмная воронка */
.cell.bfx-devour-armed { will-change: transform; }
.cell.bfx-devour-armed::before {
  content: ''; position: absolute; inset: -2px; border-radius: 9px; z-index: 2;
  pointer-events: none; opacity: 0; will-change: opacity, transform;
  background: radial-gradient(circle at 50% 50%, rgba(10, 6, 18, 0.95), rgba(86, 58, 128, 0.6) 52%, rgba(199, 125, 255, 0) 82%);
}
.cell.bfx-devour { animation: bfxDevour 0.32s cubic-bezier(0.6, -0.28, 0.74, 0.05) both; }
.cell.bfx-devour::before { animation: bfxDevourVeil 0.32s ease-in both; }
@keyframes bfxDevour {
  0% { transform: scale(1) rotate(0); }
  45% { transform: scale(0.85) rotate(-2.5deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes bfxDevourVeil {
  0% { opacity: 0; transform: scale(1.3); }
  50% { opacity: 1; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(0.7); }
}
.hand-card.bfx-voided .card, .hand-card.bfx-voided .card-back {
  opacity: 0.5;
  box-shadow: 0 0 0 1px rgba(120, 80, 190, 0.8), 0 0 16px rgba(86, 58, 128, 0.7);
  filter: brightness(0.55) saturate(0.4);
}
/* Вспышка пика: слой размером с доску, только opacity (вставлен заранее) */
.bfx-flash {
  position: absolute; inset: -6%; z-index: 5; border-radius: 12px;
  pointer-events: none; opacity: 0; will-change: opacity;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.95), rgba(255, 236, 190, 0.55) 55%, transparent 82%);
}
.bfx-flash.bfx-flash-on { animation: bfxFlash 0.46s ease-out both; }
@keyframes bfxFlash {
  0% { opacity: 0; }
  14% { opacity: 1; }
  100% { opacity: 0; }
}
/* Тряска пика — на #battle-main (доска+руки), НЕ на #app: дешёвый repaint (6.3).
   -armed заранее поднимает слой, чтобы пик не платил за растеризацию */
#battle-main.bfx-shake-armed { will-change: transform; }
#battle-main.bfx-shake { animation: bfxShake 0.6s ease-out both; }
@keyframes bfxShake {
  10% { transform: translate(7px, -5px) rotate(0.4deg); }
  25% { transform: translate(-8px, 5px) rotate(-0.4deg); }
  40% { transform: translate(6px, -4px); }
  55% { transform: translate(-5px, 3px) rotate(0.3deg); }
  70% { transform: translate(3px, -2px); }
  85% { transform: translate(-2px, 1px); }
  100% { transform: none; }
}

/* ---------- C5. Сцены победы (три концовки, >=4 с, пропуск по клику) ---------- */
#victory-overlay { cursor: pointer; overflow: hidden; z-index: 60; }
#victory-overlay.vfx-overlay { animation: vfxIn 0.45s ease both; }
@keyframes vfxIn { from { opacity: 0; } to { opacity: 1; } }
#victory-overlay.vfx-keeper { background: radial-gradient(circle at 50% 42%, rgba(90, 70, 30, 0.92), rgba(8, 5, 12, 0.97) 70%); }
#victory-overlay.vfx-rift { background: radial-gradient(circle at 50% 55%, rgba(80, 18, 22, 0.94), rgba(10, 4, 8, 0.98) 75%); }
#victory-overlay.vfx-void-hands { background: radial-gradient(circle at 50% 46%, rgba(30, 22, 52, 0.95), rgba(4, 2, 8, 0.99) 72%); }
#victory-box {
  position: relative; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center;
}
/* keeper: расходящийся свет — лучи + кольца */
.vfx-rays {
  position: absolute; left: 50%; top: 44%; width: 160vmax; height: 160vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(rgba(255, 217, 122, 0.12) 0deg 9deg, transparent 9deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  animation: vfxRays 16s linear infinite;
  pointer-events: none;
}
@keyframes vfxRays { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg); } }
.vfx-ring {
  position: absolute; left: 50%; top: 44%; width: 20px; height: 20px;
  border: 2px solid rgba(255, 217, 122, 0.75); border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: vfxRing 2.4s cubic-bezier(0.22, 0.9, 0.36, 1) infinite;
  pointer-events: none;
}
@keyframes vfxRing {
  0% { width: 20px; height: 20px; opacity: 0.9; }
  100% { width: 120vmin; height: 120vmin; opacity: 0; }
}
/* rift: парад карт через экран */
.vfx-parade { position: absolute; inset: 0; pointer-events: none; }
.vfx-parade-card {
  position: absolute; left: -140px; width: 108px; aspect-ratio: 3 / 4; --cell: 100px;
  animation: vfxParade 3.2s cubic-bezier(0.25, 0.6, 0.3, 1) both;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.7));
}
.vfx-parade-card .card, .vfx-parade-card .card-back { position: absolute; inset: 0; }
@keyframes vfxParade {
  0% { transform: translateX(0) rotate(-9deg) scale(0.9); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateX(48vw) rotate(3deg) scale(1.12); }
  90% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 200px)) rotate(10deg) scale(0.92); opacity: 0; }
}
/* void-hands: печать Арканы рисует себя штрихом */
.vfx-seal {
  width: min(52vmin, 340px); height: min(52vmin, 340px);
  color: #c7a6ff;
  filter: drop-shadow(0 0 18px rgba(160, 110, 255, 0.6));
}
.vfx-seal circle, .vfx-seal path {
  stroke-dasharray: 640; stroke-dashoffset: 640;
  animation: vfxSeal 2.6s ease-out forwards;
}
.vfx-seal circle:nth-child(2), .vfx-seal path:nth-child(4) { animation-delay: 0.5s; }
@keyframes vfxSeal { to { stroke-dashoffset: 0; } }
/* тексты сцены */
.vfx-title {
  font-family: var(--font-title); font-size: clamp(2rem, 7vw, 4.2rem);
  letter-spacing: 0.16em; color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(255, 217, 122, 0.6), 0 4px 18px rgba(0, 0, 0, 0.8);
  animation: vfxTitleIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
  position: relative; z-index: 2;
}
@keyframes vfxTitleIn {
  from { opacity: 0; transform: translateY(26px) scale(0.86); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
.vfx-sub { font-size: 0.95rem; opacity: 0.8; letter-spacing: 0.08em; animation: vfxTitleIn 0.6s ease 1s both; position: relative; z-index: 2; }
.vfx-score {
  font-family: var(--font-title); font-size: clamp(1.6rem, 5vw, 3rem);
  color: #fff2c9; text-shadow: 0 0 22px rgba(255, 217, 122, 0.5);
  animation: vfxTitleIn 0.5s ease 0.9s both; position: relative; z-index: 2;
}
.vfx-rank {
  font-family: var(--font-title); font-size: clamp(3rem, 11vw, 6.5rem); line-height: 1;
  color: #ffd97a; text-shadow: 0 0 40px rgba(255, 217, 122, 0.8);
  opacity: 0; position: relative; z-index: 2;
}
.vfx-rank.vfx-done, .vfx-done .vfx-rank { animation: vfxRankIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes vfxRankIn {
  0% { opacity: 0; transform: scale(2.6) rotate(-7deg); filter: blur(8px); }
  60% { opacity: 1; transform: scale(0.94) rotate(1deg); filter: none; }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.vfx-skip { position: absolute; bottom: 18px; left: 0; right: 0; font-size: 0.68rem; opacity: 0.45; letter-spacing: 0.1em; }
/* финальный кадр (пропуск/reduced): всё видно, декорации замирают */
#victory-overlay.vfx-done .vfx-title, #victory-overlay.vfx-done .vfx-sub, #victory-overlay.vfx-done .vfx-score { animation: none; opacity: 1; transform: none; filter: none; }
#victory-overlay.vfx-done .vfx-parade-card { animation: none; opacity: 0; }
#victory-overlay.vfx-done .vfx-seal circle, #victory-overlay.vfx-done .vfx-seal path { animation: none; stroke-dashoffset: 0; }
#victory-overlay.vfx-done .vfx-ring { animation: none; opacity: 0; }

/* ---------- prefers-reduced-motion: этап 6 схлопывается в статичный кадр (6.7) ---------- */
@media (prefers-reduced-motion: reduce) {
  .cs-idle, .cs-hover, .cs-tap-focus, .cs-ready .card, .cs-warn .card,
  .cs-triumph, .cs-tremble, .card.cs-triumph, .card.cs-tremble,
  .cell.bfx-burn, .cell.bfx-burn::before, .cell.bfx-silt, .cell.bfx-silt::before,
  .cell.bfx-blight, .cell.bfx-blight::before, .cell.bfx-frost, .cell.bfx-frost::before,
  .cell.bfx-spark, .cell.bfx-spark::before, .cell.bfx-chain, .cell.bfx-chain::before,
  .cell.bfx-glint, .cell.bfx-glint::before, .cell.bfx-devour, .cell.bfx-devour::before,
  #battle-main.bfx-shake, .bfx-flash, .bfx-flash.bfx-flash-on,
  .cell.bfx-charred, .cell.bfx-charred::before, .cell.bfx-silted, .hand-card.bfx-blighted, .hand-card.bfx-frosted,
  .p-target.bfx-gilded, #wheel-box.bfx-chained, .hand-card.bfx-mirrored, .hand-card.bfx-voided,
  #victory-overlay.vfx-overlay, .vfx-rays, .vfx-ring, .vfx-parade-card,
  .vfx-seal circle, .vfx-seal path, .vfx-title, .vfx-sub, .vfx-score, .vfx-rank,
  .vfx-keeper, .vfx-rift, .vfx-void-hands, .vfx-skip, .vfx-done {
    animation: none !important;
  }
  /* статичный кадр + текст: всё финальное состояние видно сразу */
  .vfx-title, .vfx-sub, .vfx-score, .vfx-rank { opacity: 1 !important; transform: none !important; filter: none !important; }
  .vfx-parade-card { opacity: 0 !important; }
  .vfx-seal circle, .vfx-seal path { stroke-dashoffset: 0 !important; }
}

/* ============================================================
   ЭТАП 7 — Персонализация и обвязка (G1 меню, F1 торговец,
   F2 казна, G3 котик, G2 аватар)
   ============================================================ */

/* ---------- G1: главное меню — 7 пунктов ---------- */
#menu-identity {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  margin: 0.9rem auto 0.2rem;
}
#menu-title-line { font-style: italic; font-size: 0.82rem; opacity: 0.55; letter-spacing: 0.04em; }
#menu-title-line.has-title { color: var(--gold-bright); opacity: 0.95; text-shadow: 0 0 12px rgba(216, 169, 75, 0.4); }
.menu-buttons { max-width: 320px; }
.menu-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-tile {
  flex: 1 1 calc(50% - 0.5rem);
  font-size: 0.82rem; padding: 0.55em 0.4em;
  letter-spacing: 0.05em; opacity: 0.92;
}
#btn-continue:disabled { opacity: 0.38; cursor: default; filter: grayscale(0.6); }

/* ---------- G2: аватар — круглые чипы с «дыханием» и бликом ---------- */
.av-chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #241a3e, #120c22);
  border: 2px solid rgba(216, 169, 75, 0.55);
  box-shadow: 0 0 14px rgba(216, 169, 75, 0.18), inset 0 0 12px rgba(0, 0, 0, 0.6);
  overflow: hidden; cursor: pointer; padding: 0; flex: none;
}
.av-chip.small { width: 34px; height: 34px; border-width: 1.5px; cursor: default; }
.av-chip.big { width: 128px; height: 128px; }
.av-chip .av-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.av-chip .av-empty { color: var(--gold); opacity: 0.6; font-size: 1.2em; }
.av-chip.has-avatar { border-color: var(--gold); }
/* «дыхание» + пробегающий блик — оживление, не генерация */
.av-live { animation: avBreathe 4.2s ease-in-out infinite; transform-origin: center; }
@keyframes avBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.av-chip.has-avatar::after {
  content: ''; position: absolute; inset: -30%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 233, 168, 0.28) 50%, transparent 58%);
  transform: translateX(-70%) rotate(8deg);
  animation: avGlare 6.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes avGlare { 0%, 55% { transform: translateX(-80%) rotate(8deg); } 75% { transform: translateX(80%) rotate(8deg); } 100% { transform: translateX(80%) rotate(8deg); } }

/* мастер аватара */
.avatar-box {
  width: min(94vw, 560px); max-height: 92vh; overflow-y: auto;
  background: rgba(12, 8, 22, 0.96);
  border: 1px solid rgba(216, 169, 75, 0.4); border-radius: 14px;
  padding: 1.5rem; text-align: center;
}
.avatar-box h3 { font-family: var(--font-title); color: var(--gold-bright); margin-bottom: 0.9rem; letter-spacing: 0.06em; }
.av-privacy {
  text-align: left; font-size: 0.86rem; line-height: 1.5;
  background: rgba(24, 17, 44, 0.7); border: 1px solid rgba(140, 120, 200, 0.3);
  border-left: 3px solid var(--gold); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1rem;
}
.av-note { font-size: 0.82rem; color: #ffb347; margin-bottom: 0.8rem; }
.av-hint { font-size: 0.8rem; opacity: 0.65; margin: 0.6rem 0; }
.av-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; margin-top: 1rem; }
.av-actions .btn { min-height: 44px; }
.av-del { border-color: rgba(255, 77, 94, 0.5); color: #ff8d99; }
.av-del:hover { border-color: var(--enemy); box-shadow: 0 0 12px rgba(255, 77, 94, 0.3); }
.av-cancel { opacity: 0.7; }
.av-camwrap {
  width: 240px; height: 240px; margin: 0 auto; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--gold); box-shadow: 0 0 30px rgba(216, 169, 75, 0.3);
  background: #000;
}
.av-camwrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.av-current { margin: 0.4rem auto 0.8rem; }
.av-current .av-img {
  width: 190px; height: 190px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 34px rgba(216, 169, 75, 0.35);
}
.av-file { display: inline-block; margin-bottom: 0.4rem; }
.av-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; margin: 0.6rem 0; }
.av-preset {
  background: rgba(24, 17, 44, 0.7); border: 1px solid rgba(140, 120, 200, 0.3);
  border-radius: 10px; padding: 0.55rem 0.3rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  color: var(--parchment); font-size: 0.78rem; transition: border-color 0.2s, transform 0.15s;
}
.av-preset:hover { border-color: var(--gold); transform: translateY(-2px); }
.av-preset img { width: 64px; height: 64px; border-radius: 50%; }

/* ---------- F1: торговец-робочеловек в Лавке ---------- */
@media (min-width: 821px) {
  .shop-box {
    width: min(94vw, 920px);
    display: grid; column-gap: 1.3rem;
    grid-template-columns: 216px 1fr;
    grid-template-areas:
      'merchant title'
      'merchant flavor'
      'merchant wallet'
      'merchant items'
      'merchant actions'
      'deckinfo deckinfo'
      'scrolls scrolls';
  }
  #merchant-box { grid-area: merchant; }
  .shop-box h2 { grid-area: title; }
  #shop-flavor { grid-area: flavor; }
  #shop-wallet { grid-area: wallet; }
  #shop-items { grid-area: items; align-content: start; }
  .shop-actions { grid-area: actions; }
  #shop-deck-info { grid-area: deckinfo; }
  #shop-scrolls { grid-area: scrolls; }
}
#merchant-box {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.2rem;
}
#merchant-figure { width: 172px; cursor: pointer; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55)); }
#merchant-figure svg { width: 100%; height: auto; display: block; }
#merchant-name {
  font-family: var(--font-title); color: var(--gold-bright); font-size: 0.92rem;
  letter-spacing: 0.06em; text-align: center;
}
#merchant-name span { display: block; font-family: var(--font-body); font-size: 0.68rem; opacity: 0.55; font-style: italic; letter-spacing: 0.03em; }
#merchant-bubble {
  position: relative; max-width: 210px; font-size: 0.8rem; line-height: 1.4;
  background: rgba(30, 22, 52, 0.95); border: 1px solid rgba(216, 169, 75, 0.45);
  border-radius: 10px; padding: 0.55rem 0.7rem; color: var(--parchment);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  animation: mrBubbleIn 0.3s ease both;
}
#merchant-bubble::before {
  content: ''; position: absolute; top: -7px; left: 50%; margin-left: -6px;
  border: 6px solid transparent; border-bottom-color: rgba(216, 169, 75, 0.45); border-top: 0;
}
@keyframes mrBubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* анимации состояний робота */
.mr-gear { transform-box: fill-box; transform-origin: center; animation: mrGear 9s linear infinite; }
@keyframes mrGear { to { transform: rotate(360deg); } }
.mr-head { transform-box: fill-box; transform-origin: center 80%; }
.mr-eyes ellipse { filter: drop-shadow(0 0 4px rgba(255, 179, 71, 0.8)); }
.mr-glint { animation: mrGlint 3.8s ease-in-out infinite; }
@keyframes mrGlint { 0%, 88%, 100% { opacity: 1; } 93% { opacity: 0.1; } }
.mr-steam circle { animation: mrSteam 2.6s ease-in-out infinite; transform-box: fill-box; }
.mr-steam circle:nth-child(2) { animation-delay: 0.5s; }
.mr-steam circle:nth-child(3) { animation-delay: 1s; }
@keyframes mrSteam { 0% { opacity: 0.5; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-9px); } }
.mr-coin { opacity: 0; transform-box: fill-box; transform-origin: center; }
.mr-lamp { transform-box: fill-box; transform-origin: 50% 10%; }
.mr-arm { transform-box: fill-box; transform-origin: 10% 30%; }

.m-idle .mr-head { animation: mrIdleBob 3.6s ease-in-out infinite; }
@keyframes mrIdleBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2.5px); } }

.m-deal .mr-gear { animation-duration: 1.1s; }
.m-deal .mr-eyes { filter: brightness(1.6); }
.m-deal .mr-arm { animation: mrDealArm 0.7s ease-in-out; }
@keyframes mrDealArm { 0% { transform: rotate(0); } 40% { transform: rotate(-14deg); } 100% { transform: rotate(0); } }
.m-deal .mr-coin { animation: mrCoin 0.9s ease-out; }
@keyframes mrCoin { 0% { opacity: 0; transform: translateY(6px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }

.m-refuse .mr-head { animation: mrRefuse 0.55s ease-in-out; }
@keyframes mrRefuse { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 55% { transform: rotate(4deg); } 80% { transform: rotate(-2deg); } }
.m-refuse .mr-eyes { filter: brightness(0.55) saturate(2.4) hue-rotate(-28deg); }
.m-refuse .mr-gear { animation-play-state: paused; }

.m-beckon .mr-lamp { animation: mrLamp 1.1s ease-in-out infinite; }
@keyframes mrLamp { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(9deg); } }
.m-beckon .mr-head { animation: mrBeckonLean 1.1s ease-in-out infinite; }
@keyframes mrBeckonLean { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-3deg) translateY(1.5px); } }
.m-beckon .mr-flame { animation: mrFlame 0.5s ease-in-out infinite alternate; }
@keyframes mrFlame { from { opacity: 0.8; } to { opacity: 1; filter: brightness(1.4); } }

.m-muse .mr-head { transform: rotate(4deg); transition: transform 0.4s; }
.m-muse .mr-steam circle { animation-duration: 1.4s; }

/* кошелёк лавки + трекер казны (F2: жадность видна всегда) */
#shop-wallet { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
#shop-wallet .shop-gold { margin-bottom: 0; }
#shop-treasury {
  font-size: 0.8rem; color: var(--gold-bright);
  background: rgba(216, 169, 75, 0.08); border: 1px solid rgba(216, 169, 75, 0.35);
  border-radius: 999px; padding: 0.3rem 0.8rem; cursor: help;
}
#shop-treasury .tr-next { opacity: 0.6; color: var(--parchment); }

/* ---------- G3: летающий котик — из-за края: СПЕРВА ЛАПКИ, ПОТОМ МОРДОЧКА ---------- */
#companion {
  position: fixed; left: clamp(14px, 7vw, 110px); bottom: -4px;
  z-index: 92; width: 150px; pointer-events: none;
}
#companion-cat { position: relative; width: 140px; height: 158px; margin: 0 auto; pointer-events: auto; cursor: pointer; }
.cat-body {
  position: absolute; left: 5px; bottom: 14px; width: 130px;
  transform: translateY(190px);
  transition: transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}
.cat-paws {
  position: absolute; left: 5px; bottom: -4px; width: 130px; z-index: 2;
  transform: translateY(64px);
  transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.4s;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}
/* фазы появления */
#companion.c-hidden { visibility: hidden; }
#companion.c-paws .cat-paws { transform: translateY(0); }        /* 1: лапки цепляются за край */
#companion.c-paws .cat-body { transform: translateY(190px); }
#companion.c-face .cat-paws { transform: translateY(0); }
#companion.c-face .cat-body { transform: translateY(62px); }     /* 2: мордочка выглядывает (глаза над лапками) */
#companion.c-float .cat-paws { transform: translateY(10px); opacity: 0; transition-delay: 0.25s; }
#companion.c-float .cat-body { transform: translateY(0); animation: catBob 3.2s ease-in-out 0.5s infinite; } /* 3: парит */
#companion.c-react .cat-body { transform: translateY(0) scale(1.08); transition-duration: 0.18s; }
#companion.c-react .cat-paws { opacity: 0; }
@keyframes catBob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-9px) rotate(1.5deg); } }
/* крылья и зрачки живут своей жизнью */
.cw-l, .cw-r { transform-box: fill-box; animation: catWing 0.9s ease-in-out infinite alternate; }
.cw-l { transform-origin: 90% 60%; }
.cw-r { transform-origin: 10% 60%; animation-delay: 0.12s; }
@keyframes catWing { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }
.cp { transform-box: fill-box; animation: catPupil 5.4s ease-in-out infinite; }
@keyframes catPupil { 0%, 42%, 100% { transform: translateX(0); } 50%, 72% { transform: translateX(1.6px); } 80%, 92% { transform: translateX(-1.4px); } }
#companion-bubble {
  position: absolute; left: 118px; bottom: 118px; width: max-content; max-width: 250px;
  font-size: 0.8rem; line-height: 1.45; pointer-events: none;
  background: rgba(30, 22, 52, 0.96); border: 1px solid rgba(205, 184, 234, 0.5);
  border-radius: 12px 12px 12px 3px; padding: 0.55rem 0.75rem; color: var(--parchment);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  animation: mrBubbleIn 0.3s ease both;
}

/* ---------- G1: оверлеи Профиль / Достижения / Настройки ---------- */
.profile-box, .achieve-box, .settings-box { width: min(94vw, 620px); text-align: left; }
.pr-grid { display: flex; gap: 1.2rem; align-items: flex-start; margin-bottom: 1rem; }
.pr-avatar { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex: none; }
.pr-avatar .btn { font-size: 0.78rem; padding: 0.4em 0.8em; }
.pr-info { flex: 1; min-width: 0; }
.pr-sub {
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); opacity: 0.85; margin: 0.7rem 0 0.35rem;
}
.pr-empty { font-size: 0.82rem; opacity: 0.55; font-style: italic; }
.pr-titles { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pr-title {
  background: rgba(24, 17, 44, 0.8); border: 1px solid rgba(140, 120, 200, 0.3);
  color: var(--parchment); border-radius: 999px; padding: 0.3rem 0.8rem;
  font-size: 0.8rem; cursor: pointer; transition: border-color 0.2s;
}
.pr-title:hover { border-color: var(--gold); }
.pr-title.active { border-color: var(--gold); color: var(--gold-bright); box-shadow: 0 0 10px rgba(216, 169, 75, 0.25); }
.pr-stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.85rem; opacity: 0.9; }
.pr-stats b { color: var(--gold-bright); }
.pr-treasury {
  background: rgba(216, 169, 75, 0.06); border: 1px solid rgba(216, 169, 75, 0.3);
  border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.6rem 0 1rem;
}
.pr-treasury .pr-sub { margin-top: 0; }
.tr-value { font-size: 1.05rem; color: var(--gold-bright); margin: 0.2rem 0 0.5rem; }
.tr-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.tr-chip {
  border: 1px solid rgba(216, 169, 75, 0.5); color: var(--gold-bright);
  border-radius: 999px; padding: 0.18rem 0.65rem; font-size: 0.8rem;
}
.tr-chip.done { background: rgba(216, 169, 75, 0.22); box-shadow: 0 0 8px rgba(216, 169, 75, 0.3); }
.tr-chip.far { opacity: 0.4; }
.tr-warn { font-size: 0.76rem; font-style: italic; color: #d98a8a; opacity: 0.85; margin-top: 0.5rem; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.55rem; margin: 0.8rem 0 1rem; }
.ach {
  position: relative; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto;
  column-gap: 0.55rem; align-items: center;
  background: rgba(24, 17, 44, 0.6); border: 1px solid rgba(140, 120, 200, 0.2);
  border-radius: 10px; padding: 0.55rem 0.7rem; opacity: 0.45; filter: grayscale(0.7);
}
.ach.got { opacity: 1; filter: none; border-color: rgba(216, 169, 75, 0.5); box-shadow: 0 0 12px rgba(216, 169, 75, 0.12); }
.ach-icon { grid-row: span 2; font-size: 1.4rem; text-align: center; color: var(--gold-bright); }
.ach-name { font-size: 0.88rem; color: var(--gold-bright); }
.ach-desc { font-size: 0.74rem; opacity: 0.7; line-height: 1.35; }
.ach-mark { position: absolute; top: 6px; right: 9px; color: var(--rar-uncommon); font-size: 0.85rem; }

.set-row {
  display: flex; align-items: flex-start; gap: 0.7rem; cursor: pointer;
  background: rgba(24, 17, 44, 0.6); border: 1px solid rgba(140, 120, 200, 0.2);
  border-radius: 10px; padding: 0.7rem 0.9rem; margin-bottom: 0.55rem;
}
.set-row input { margin-top: 0.25rem; accent-color: var(--gold); width: 17px; height: 17px; flex: none; }
.set-label { font-size: 0.92rem; }
.set-label small { display: block; font-size: 0.74rem; opacity: 0.6; margin-top: 0.15rem; line-height: 1.35; }
.set-danger { margin: 1rem 0; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.set-danger .btn { font-size: 0.8rem; }
.profile-box > .btn-primary, .achieve-box > .btn-primary, .settings-box > .btn-primary { display: block; margin: 0.6rem auto 0; }

/* ---------- F2: косметика «золочёная рамка колоды» (порог 500, навсегда) ---------- */
body.cosmetic-gilded .draft-box,
body.cosmetic-gilded .deckpick-box {
  border-color: var(--gold);
  box-shadow: 0 0 34px rgba(216, 169, 75, 0.22), inset 0 0 26px rgba(216, 169, 75, 0.06);
}
body.cosmetic-gilded #draft-hand { outline: 1px solid rgba(216, 169, 75, 0.35); outline-offset: 4px; border-radius: 10px; }

/* ---------- мобила и reduced-motion ---------- */
@media (max-width: 820px) {
  #merchant-box { flex-direction: row; justify-content: center; align-items: flex-end; gap: 0.7rem; }
  #merchant-figure { width: 108px; }
  #merchant-name { display: none; }
  #merchant-bubble { max-width: 180px; font-size: 0.74rem; }
  #merchant-bubble::before { left: -7px; top: 60%; border: 6px solid transparent; border-right-color: rgba(216, 169, 75, 0.45); border-left: 0; }
  #companion { left: 4px; width: 118px; }
  #companion-cat { width: 108px; height: 128px; }
  .cat-body, .cat-paws { width: 100px; }
  #companion.c-face .cat-body { transform: translateY(56px); }
  #companion-bubble { left: 92px; bottom: 92px; max-width: 190px; font-size: 0.74rem; }
  .pr-grid { flex-direction: column; align-items: center; }
  .av-presets { grid-template-columns: repeat(2, 1fr); }
  .menu-grid .btn-tile { font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) {
  .av-live, .av-chip.has-avatar::after, .mr-gear, .mr-glint, .mr-steam circle,
  .m-idle .mr-head, .m-beckon .mr-lamp, .m-beckon .mr-head, .m-beckon .mr-flame,
  .cw-l, .cw-r, .cp, #companion.c-float .cat-body { animation: none !important; }
  .cat-body, .cat-paws { transition-duration: 0.01s !important; }
}
/* F1: товар не по карману — приглушён, но кликается (торговец честно откажет) */
.si-buy.poor { opacity: 0.5; filter: grayscale(0.4); }

/* ============================== ЭТАП 8: дуэль призраков (профиль) ============================== */
.gd-box { margin-top: 14px; padding: 10px 12px; border: 1px solid rgba(216, 169, 75, 0.25); border-radius: 10px; background: rgba(28, 21, 48, 0.55); }
.gd-label { font-size: 0.78rem; color: #b9a77d; margin: 8px 0 4px; }
.gd-row { display: flex; gap: 6px; align-items: center; }
.gd-input { flex: 1 1 auto; min-width: 0; background: #16102a; color: #e8dcc0; border: 1px solid rgba(216, 169, 75, 0.35); border-radius: 6px; padding: 5px 8px; font-size: 0.78rem; font-family: ui-monospace, monospace; }
.gd-seed { flex: 0 0 110px; }
.gd-result { margin-top: 8px; font-size: 0.85rem; min-height: 1.2em; }
.gd-err { color: #e07a5f; }
.gd-records { margin-top: 4px; }
.gd-rec { font-size: 0.8rem; color: #cbbf9f; }
.gd-rec-label { color: #8d7f5f; font-size: 0.72rem; }

/* ---------- Интерактивная дуэль с призраком (доработка этапа 8) ---------- */
/* Своя сетка, а не боевой экран: подмена обработчиков ArcanaRender сломала бы обычный бой. */
.gp-overlay { z-index: 46; }
.gp-box {
  width: min(94vw, 620px); max-height: 92vh; overflow-y: auto;
  background: linear-gradient(170deg, #1c1433, #100b1f);
  border: 1px solid var(--gold); border-radius: 14px; padding: 1.1rem;
}
.gp-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem; }
.gp-title { font-family: var(--font-title); color: var(--gold-bright); font-size: 1.15rem; }
.gp-score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: #e7dcff; }
.gp-hint { font-size: 0.85rem; opacity: 0.75; margin-bottom: 0.7rem; min-height: 1.2em; }
.gp-final { opacity: 1; color: var(--gold-bright); font-weight: 700; }
.gp-grid {
  display: grid; gap: 5px; justify-content: center; margin: 0 auto 0.9rem;
  --gp-cell: min(12vh, 17vw, 92px);
  grid-template-columns: repeat(var(--gp-n, 4), var(--gp-cell));
  grid-template-rows: repeat(var(--gp-n, 4), var(--gp-cell));
}
.gp-cell {
  position: relative; border-radius: 8px; overflow: hidden;
  background: linear-gradient(160deg, rgba(56, 45, 92, 0.55), rgba(26, 19, 48, 0.7));
  border: 1px solid rgba(150, 130, 210, 0.22);
}
.gp-cell.gp-blocked { background: repeating-linear-gradient(45deg, #241a2e, #241a2e 6px, #1a1222 6px, #1a1222 12px); }
.gp-cell.gp-free { border-color: rgba(216, 169, 75, 0.6); box-shadow: inset 0 0 14px rgba(216, 169, 75, 0.18); cursor: pointer; }
.gp-cell .card { position: absolute; inset: 0; width: 100%; height: 100%; }
.gp-hand { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
/* position:relative обязателен: .card внутри позиционируется абсолютно и без
   позиционированного родителя растягивается на весь оверлей (поймано скриншотом). */
.gp-hand-card { position: relative; width: min(15vw, 84px); aspect-ratio: 3 / 4; cursor: pointer; transition: transform 0.18s cubic-bezier(0.22, 1.4, 0.36, 1); }
.gp-hand-card .card { position: absolute; inset: 0; width: 100%; height: 100%; }
.gp-hand-card:hover { transform: translateY(-6px); }
.gp-hand-card.gp-sel { transform: translateY(-10px); filter: drop-shadow(0 0 10px rgba(216, 169, 75, 0.75)); }
/* Тап-таргеты на телефоне не меньше 44 px */
@media (max-width: 480px) {
  .gp-grid { --gp-cell: min(18vw, 68px); }
  .gp-hand-card { width: 56px; }
  #gp-close { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .gp-hand-card { transition: none; }
}

/* ================= ЭТАП 9 — АКТ II «против самого себя» ================= */

/* Плашка счёта отнятого в HUD: иконка и число. Ни подписи, ни тултипа —
   игрок восемь анте гадает, что это, и получает ответ один раз и целиком. */
.hunger-chip {
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  transition: color .5s ease, text-shadow .5s ease, border-color .5s ease;
}
.hunger-chip .h-mark { opacity: .85; margin-right: .28em; }
.hunger-chip.hs-0 { color: #9a9494; border-color: rgba(154,148,148,.35); }
.hunger-chip.hs-1 { color: #e0a24a; border-color: rgba(224,162,74,.40); text-shadow: 0 0 6px rgba(224,162,74,.30); }
.hunger-chip.hs-2 { color: #d0563f; border-color: rgba(208,86,63,.48); text-shadow: 0 0 8px rgba(208,86,63,.38); }
.hunger-chip.hs-3 { color: #ff4d4d; border-color: rgba(255,77,77,.62); text-shadow: 0 0 12px rgba(180,0,0,.72); background: rgba(40,0,0,.35); }
@keyframes hunger-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.28); filter: brightness(1.6); }
  100% { transform: scale(1); }
}
.hunger-chip.pulse { animation: hunger-pulse .62s cubic-bezier(.2,.9,.25,1); }

/* Портрет Хранителя — маленький, в углу боевого сайдбара, меняется молча */
.keeper-portrait {
  position: relative; width: 64px; height: 64px; margin: 0 auto .5rem;
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(200,170,110,.35);
  box-shadow: 0 0 12px rgba(0,0,0,.55);
  background: #14101c;
}
.keeper-portrait img, .keeper-portrait .kp-fallback {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: flex; align-items: center; justify-content: center;
  font-size: 30px; transition: opacity .6s ease;
}
.keeper-portrait .kp-out { opacity: 0; }
.keeper-portrait.kp-flash::after {
  content: ''; position: absolute; inset: 0; background: #fff;
  animation: kp-flash .45s ease-out forwards; pointer-events: none;
}
@keyframes kp-flash { from { opacity: .75; } to { opacity: 0; } }
.keeper-portrait.stage-1 { border-color: rgba(224,162,74,.45); }
.keeper-portrait.stage-2 { border-color: rgba(208,86,63,.55); box-shadow: 0 0 16px rgba(208,86,63,.35); }
.keeper-portrait.stage-3 { border-color: rgba(255,60,60,.7); box-shadow: 0 0 22px rgba(150,0,0,.6); }
/* На стадии 3 портрет перестаёт моргать — заметит только второй проход */
.keeper-portrait.stage-0 img, .keeper-portrait.stage-1 img, .keeper-portrait.stage-2 img { animation: kp-blink 9s infinite; }
@keyframes kp-blink { 0%,96%,100% { filter: none; } 98% { filter: brightness(.35); } }
@media (max-width: 820px) { .keeper-portrait { width: 44px; height: 44px; } }

/* «Дыхание Хранителя» — одна полоса вместо трёх рилов (переиспользует слот Колеса) */
#breath-box {
  background: rgba(18,14,26,.72); border: 1px solid rgba(150,190,220,.22);
  border-radius: 10px; padding: .55rem .6rem .5rem; margin-bottom: .6rem;
}
#breath-row { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; }
#breath-wrap {
  flex: 1; height: 12px; border-radius: 7px; overflow: hidden;
  background: rgba(0,0,0,.55); border: 1px solid rgba(150,190,220,.25);
}
#breath-bar {
  height: 100%; width: 30%;
  background: linear-gradient(90deg, #4a7f9c, #8fd4e8);
  box-shadow: 0 0 10px rgba(143,212,232,.5);
  transition: width .45s cubic-bezier(.2,.9,.25,1);
}
#breath-bar.ready { background: linear-gradient(90deg, #6fae72, #cdf3b6); box-shadow: 0 0 14px rgba(205,243,182,.6); }
#breath-text { font-size: .78rem; color: #a9c6d4; font-variant-numeric: tabular-nums; white-space: nowrap; }
#breath-state { margin-top: .35rem; font-size: .74rem; color: #7f93a3; font-style: italic; text-align: center; }

/* Кнопка «Отпустить» — оверлей на свежеотнятой карте, живёт один ход */
.cell .release-btn {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  z-index: 6; padding: .18rem .5rem; border-radius: 999px;
  font-size: .68rem; line-height: 1.3; white-space: nowrap; cursor: pointer;
  color: #eaf6ff; background: rgba(20,34,44,.92);
  border: 1px solid rgba(143,212,232,.6);
  box-shadow: 0 0 10px rgba(143,212,232,.35);
}
.cell .release-btn:hover { background: rgba(34,58,74,.96); }
.cell .release-btn[disabled] { opacity: .45; cursor: default; }
@keyframes release-hint {
  0%,100% { box-shadow: 0 0 10px rgba(143,212,232,.35); }
  50%     { box-shadow: 0 0 22px rgba(205,243,182,.95); transform: translateX(-50%) scale(1.09); }
}
.cell .release-btn.hint { animation: release-hint .8s ease-in-out 3; }

/* Сожжение карты: белеет и растворяется искрами вверх */
@keyframes release-burn {
  0%   { filter: brightness(1); opacity: 1; transform: translateY(0) scale(1); }
  40%  { filter: brightness(3) saturate(0); opacity: .92; transform: translateY(-6%) scale(1.04); }
  100% { filter: brightness(4) saturate(0); opacity: 0; transform: translateY(-46%) scale(.82); }
}
.card.releasing { animation: release-burn .72s ease-in forwards; }

/* Плашка Наследия в главном меню — рубашка карты с сигилом */
#legacy-plaque {
  margin: .1rem auto .8rem; max-width: 380px; padding: .6rem .8rem;
  border-radius: 10px; text-align: left;
  background: linear-gradient(160deg, rgba(28,16,26,.92), rgba(12,8,16,.92));
  border: 1px solid rgba(180,60,60,.45);
  box-shadow: 0 0 18px rgba(120,0,0,.28) inset;
}
#legacy-plaque .lg-row { display: flex; align-items: center; gap: .6rem; }
#legacy-plaque .lg-sigil {
  width: 38px; height: 52px; flex: 0 0 38px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: repeating-linear-gradient(45deg, #1b1220 0 5px, #241627 5px 10px);
  border: 1px solid rgba(200,150,90,.4);
}
#legacy-plaque .lg-name { font-weight: 700; color: #e6c98a; letter-spacing: .02em; }
#legacy-plaque .lg-meta { font-size: .78rem; color: #b39a86; margin-top: .1rem; }
#legacy-plaque .lg-note { font-size: .78rem; color: #8f7f92; font-style: italic; margin-top: .15rem; }
#legacy-plaque.stage-1 { border-color: rgba(224,162,74,.45); }
#legacy-plaque.stage-2 { border-color: rgba(208,86,63,.5); }
#legacy-plaque.stage-3 { border-color: rgba(255,60,60,.65); box-shadow: 0 0 22px rgba(150,0,0,.35) inset; }
#legacy-plaque.defeated { opacity: .72; border-color: rgba(120,120,120,.4); }
#legacy-plaque .lg-forget {
  margin-top: .45rem; font-size: .74rem; color: #9a8f9a;
  background: none; border: 1px solid rgba(154,143,154,.3); border-radius: 6px;
  padding: .16rem .5rem; cursor: pointer;
}
#legacy-plaque .lg-forget:hover { color: #e0d4c0; border-color: rgba(224,212,192,.5); }

/* Акт II: боевой экран чуть холоднее — та же вёрстка, другая температура */
body.act2 #board { box-shadow: 0 0 40px rgba(90,140,180,.18); }
body.act2 #blind-name { color: #bcd6e6; }

/* Класс занятой клетки ставился в render.js, но правила для него не было (нашло ревью).
   Либо стиль потерян, либо класс мусорный — оставляем осмысленный минимум: занятая клетка
   не подсвечивается как доступная и не ловит наведение. */
.cell.occupied { cursor: default; }
.cell.occupied::after { content: none; }
