/* ========== Meowstone v1.1 — меню + графика ========== */
:root {
  --bg-deep: #120c08;
  --bg-room: #2a2016;
  --wood: #5c4033;
  --wood-mid: #6b4a36;
  --wood-light: #d4b07a;
  --cream: #f7ead0;
  --cream-dark: #e8d4a8;
  --accent: #d4863c;
  --accent-bright: #f0b050;
  --mana: #4a9ef0;
  --mana-glow: #9ad0ff;
  --mana-empty: #1e3550;
  --hp: #d04048;
  --hp-glow: #ff7a7a;
  --attack: #e0b020;
  --attack-glow: #ffe060;
  --shadow: rgba(0, 0, 0, 0.55);
  --card-w: 132px;
  --card-h: 182px;
  --radius: 16px;
  --font: "Nunito", system-ui, sans-serif;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --glow-gold: 0 0 24px rgba(240, 180, 60, 0.35);
  --glow-mana: 0 0 16px rgba(80, 160, 255, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--cream);
  position: relative;
}

body.no-anim *,
body.no-anim *::before,
body.no-anim *::after {
  animation: none !important;
  transition: none !important;
}

/* ========== Фон ========== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(196, 120, 58, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 20% 100%, rgba(80, 50, 30, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 85% 70%, rgba(100, 60, 40, 0.25) 0%, transparent 45%),
    linear-gradient(165deg, #3a2a1c 0%, #1a120c 45%, #0f0b08 100%);
  overflow: hidden;
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: drift 18s ease-in-out infinite;
}

.bg-glow-1 {
  width: 280px;
  height: 280px;
  background: #c4783a;
  top: 10%;
  left: 15%;
}

.bg-glow-2 {
  width: 220px;
  height: 220px;
  background: #4a90d9;
  bottom: 20%;
  right: 10%;
  animation-delay: -6s;
  opacity: 0.25;
}

.bg-glow-3 {
  width: 180px;
  height: 180px;
  background: #8b5a2b;
  top: 50%;
  left: 60%;
  animation-delay: -12s;
  opacity: 0.3;
}

body.no-particles .bg-glow {
  display: none;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.08); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ========== Экраны ========== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  pointer-events: none;
  visibility: hidden;
}

.screen.active {
  display: flex !important;
  pointer-events: auto !important;
  visibility: visible !important;
  z-index: 10;
  animation: screenIn 0.4s var(--ease-pop);
}

@keyframes screenIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

#screenGame.active {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  padding: 0;
  overflow: hidden !important;
  pointer-events: auto !important;
  visibility: visible !important;
  z-index: 10;
  animation: fadeIn 0.35s ease;
  height: 100% !important;
  width: 100% !important;
  max-height: 100dvh !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== Главное меню ========== */
.menu-shell {
  position: relative;
  z-index: 2;
  width: min(400px, 100%);
  text-align: center;
  padding: 36px 28px 28px;
  background:
    linear-gradient(160deg, rgba(92, 64, 51, 0.55) 0%, rgba(40, 28, 20, 0.85) 100%);
  border: 2px solid rgba(201, 166, 107, 0.45);
  border-radius: 28px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.menu-logo-wrap {
  margin-bottom: 28px;
}

.menu-logo-badge {
  font-size: 3.6rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  animation: logoBounce 2.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes logoBounce {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.menu-title {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff8e8 0%, #f5e6c8 40%, #e8a050 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.menu-tagline {
  font-size: 0.95rem;
  opacity: 0.75;
  margin-top: 4px;
  font-weight: 600;
}

.menu-title-underline {
  width: 80px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
}

.menu-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.menu-nav .menu-btn-primary,
.menu-nav #btnCampaign,
.menu-nav #btnRanked {
  grid-column: 1 / -1; /* крупные кнопки на всю ширину */
}
@media (min-width: 720px) {
  .menu-nav {
    grid-template-columns: 1fr 1fr 1fr;
    max-width: 720px;
    gap: 14px;
  }
  .menu-nav .menu-btn-primary,
  .menu-nav #btnCampaign,
  .menu-nav #btnRanked {
    grid-column: auto;
  }
  /* Кампания и Рейтинг — один верхний ряд, общая линия */
  .menu-nav #btnCampaign {
    grid-column: 1 / 2;
    grid-row: 1;
  }
  .menu-nav #btnRanked {
    grid-column: 2 / 4;
    grid-row: 1;
  }
}
@media (max-width: 480px) {
  .menu-nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .menu-btn {
    padding: 12px 10px !important;
    font-size: 0.9rem !important;
    flex-direction: column;
    gap: 4px !important;
    text-align: center;
  }
  .menu-btn-text { text-align: center !important; }
}

.menu-btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: 2px solid rgba(201, 166, 107, 0.35);
  border-radius: 16px;
  cursor: var(--cursor-action, pointer);
  background: linear-gradient(145deg, rgba(60, 42, 30, 0.9), rgba(40, 28, 18, 0.95));
  color: var(--cream);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s var(--ease-pop), border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.menu-btn > * {
  pointer-events: none; /* клик всегда на button */
}

.menu-btn:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--wood-light);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(196, 120, 58, 0.15);
  background: linear-gradient(145deg, rgba(80, 55, 38, 0.95), rgba(50, 35, 22, 0.98));
}

.menu-btn:active {
  transform: translateY(0) scale(0.98);
}

.menu-btn-primary {
  background: linear-gradient(145deg, #d4883c, #a06028);
  border-color: rgba(255, 220, 150, 0.4);
  color: #fff;
  box-shadow: 0 6px 18px rgba(196, 120, 58, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 1.15rem;
  padding: 16px 20px;
}

.menu-btn-primary:hover {
  background: linear-gradient(145deg, #e89848, #b87030);
  box-shadow: 0 10px 24px rgba(196, 120, 58, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.menu-btn-icon {
  font-size: 1.35rem;
  width: 32px;
  text-align: center;
}

.menu-btn-text {
  flex: 1;
  text-align: left;
}
.menu-nav .menu-btn {
  min-height: 64px;
  justify-content: flex-start;
}
.menu-shell {
  max-width: 760px !important;
  width: min(96vw, 760px) !important;
}

.menu-footer {
  margin-top: 22px;
  font-size: 0.75rem;
  opacity: 0.45;
  font-weight: 600;
}

.menu-deco {
  position: fixed;
  font-size: 4rem;
  opacity: 0.15;
  filter: blur(0.5px);
  pointer-events: none;
  z-index: 1;
  animation: logoBounce 4s ease-in-out infinite;
}

.menu-deco-left {
  bottom: 8%;
  left: 6%;
  animation-delay: -1s;
}

.menu-deco-right {
  top: 12%;
  right: 7%;
  animation-delay: -2.5s;
  font-size: 3.2rem;
}

/* ========== Панели (howto, collection, settings) ========== */
.panel {
  position: relative;
  z-index: 2;
  width: min(440px, 100%);
  max-height: min(90vh, 700px);
  overflow-y: auto;
  padding: 28px 24px 24px;
  background:
    linear-gradient(160deg, rgba(92, 64, 51, 0.6) 0%, rgba(30, 22, 14, 0.92) 100%);
  border: 2px solid rgba(201, 166, 107, 0.4);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.panel-wide {
  width: min(820px, 100%);
}

.panel-back {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  color: var(--cream);
  opacity: 0.7;
  cursor: var(--cursor-action, pointer);
  margin-bottom: 12px;
  padding: 4px 0;
  transition: opacity 0.15s, transform 0.15s;
}

.panel-back:hover {
  opacity: 1;
  transform: translateX(-3px);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--cream-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-sub {
  opacity: 0.65;
  font-size: 0.9rem;
  margin-bottom: 18px;
  font-weight: 600;
}

/* How to */
.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.howto-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(201, 166, 107, 0.2);
  border-radius: 16px;
  padding: 16px 14px;
  transition: transform 0.2s, border-color 0.2s;
}

.howto-card:hover {
  transform: translateY(-3px);
  border-color: rgba(201, 166, 107, 0.45);
}

.howto-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #a06028);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(196, 120, 58, 0.4);
}

.howto-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--accent-bright);
}

.howto-card p {
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.85;
}

.howto-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

.howto-hint kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(245, 230, 200, 0.25);
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.8rem;
}

/* Collection */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  justify-items: center;
  padding: 8px 0 12px;
}

.collection-grid .card {
  cursor: var(--cursor-default, default);
}

.collection-grid .card:hover {
  transform: translateY(-8px) scale(1.06);
}

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  border: 1px solid rgba(201, 166, 107, 0.18);
  cursor: var(--cursor-action, pointer);
  position: relative;
}

.setting-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.setting-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle {
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: var(--mana-empty);
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ddd;
  transition: transform 0.25s var(--ease-pop), background 0.25s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.setting-row input:checked + .toggle {
  background: linear-gradient(90deg, #3a7a3a, #4caf50);
}

.setting-row input:checked + .toggle::after {
  transform: translateX(22px);
  background: #fff;
}

.setting-select {
  cursor: var(--cursor-default, default);
}

.setting-select select {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 166, 107, 0.35);
  background: rgba(0, 0, 0, 0.4);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  outline: none;
}

.setting-select select:focus {
  border-color: var(--accent);
}

.settings-note {
  margin-top: 16px;
  font-size: 0.75rem;
  opacity: 0.5;
  text-align: center;
}

/* ========== Игровой экран ========== */
.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  margin: 0 auto;
  display: grid;
  /* header | enemy hero | enemy board | divider | player board | player hero | hand */
  grid-template-rows: auto auto minmax(72px, 1fr) auto minmax(72px, 1fr) auto minmax(150px, auto);
  gap: 4px;
  padding: 6px 12px 4px;
  background:
    linear-gradient(180deg, rgba(92, 64, 51, 0.25) 0%, transparent 12%),
    linear-gradient(0deg, rgba(92, 64, 51, 0.3) 0%, transparent 10%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0%, transparent 8%, transparent 92%, rgba(0, 0, 0, 0.2) 100%);
  border-left: 2px solid rgba(201, 166, 107, 0.15);
  border-right: 2px solid rgba(201, 166, 107, 0.15);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  gap: 10px;
}

.btn-icon {
  font-family: var(--font);
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(201, 166, 107, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(196, 120, 58, 0.35);
  transform: scale(1.05);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
  text-shadow: 0 2px 8px var(--shadow);
}

.turn-info {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(245, 230, 200, 0.12);
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#turnLabel.enemy-turn { color: #f88; }
#turnLabel.player-turn { color: #8f8; }

/* Герои */
.hero-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 6px;
  flex-wrap: wrap;
}

.hero-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 16px 8px;
  border-radius: 18px;
  border: 2px solid transparent;
  cursor: var(--cursor-default, default);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  min-width: 96px;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.hero-portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 60%);
  pointer-events: none;
}

.hero-portrait.enemy {
  background: linear-gradient(155deg, #5a3030 0%, #3a1a1a 60%, #2a1212 100%);
  border-color: rgba(220, 90, 90, 0.55);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(180, 40, 40, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-portrait.player {
  background: linear-gradient(155deg, #2e5a40 0%, #1a3a28 60%, #122a1c 100%);
  border-color: rgba(80, 190, 110, 0.5);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(40, 140, 70, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-portrait.targetable {
  cursor: var(--cursor-target, crosshair);
  border-color: #ff6b6b !important;
  box-shadow: 0 0 0 3px rgba(255, 80, 80, 0.5), 0 0 24px rgba(255, 80, 80, 0.45) !important;
  animation: pulse-target 1s ease-in-out infinite;
}

.hero-portrait.damaged {
  animation: shake 0.4s ease;
}

.hero-avatar {
  font-size: 2.1rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  position: relative;
  z-index: 1;
}

.hero-name {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.hero-hp {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #e66, var(--hp));
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(180, 40, 40, 0.5), 0 0 12px rgba(196, 69, 69, 0.3);
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

/* Мана */
.mana-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 7px 12px;
  border-radius: 14px;
  border: 1px solid rgba(74, 144, 217, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mana-label {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.75;
}

.mana-crystals {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 170px;
}

.crystal {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--mana-empty);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  border-radius: 0;
  width: 13px;
  height: 13px;
}

.crystal.filled {
  background: radial-gradient(circle at 35% 30%, var(--mana-glow), var(--mana));
  box-shadow: 0 0 8px rgba(74, 144, 217, 0.75);
  transform: scale(1.08);
}

/* Spent this turn — dimmed / used mana */
.crystal.spent {
  background: radial-gradient(circle at 35% 30%, #3a4560, #1a2030);
  border-color: rgba(100, 120, 160, 0.35);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.55);
  opacity: 0.55;
  filter: grayscale(0.35) brightness(0.65);
}

.mana-text {
  font-weight: 800;
  font-size: 0.88rem;
  color: #a8d4ff;
  min-width: 36px;
  text-shadow: 0 0 8px rgba(74, 144, 217, 0.4);
}

/* Колода */
.deck-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.enemy-deck-zone {
  margin-left: auto;
  margin-right: 0;
}

.deck-stack {
  width: 58px;
  height: 78px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.deck-stack:hover {
  transform: translateY(-2px);
}

.deck-stack.empty .card-back {
  opacity: 0.25;
  filter: grayscale(0.6);
}

/* Рубашка в стопке колоды (не путать с .card.card-back в руке) */
.deck-stack .card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 2px solid #c9a66b;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 220, 160, 0.18) 0%, transparent 55%),
    repeating-linear-gradient(
      135deg,
      #4a3220 0 6px,
      #3a2818 6px 12px
    );
  box-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.deck-stack .card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  opacity: 0.85;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
}

.deck-stack .card-back::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(201, 166, 107, 0.35);
  border-radius: 6px;
  pointer-events: none;
}

.deck-stack .card-back.layer-1 { transform: translate(0, 0); z-index: 3; }
.deck-stack .card-back.layer-2 { transform: translate(3px, -3px); z-index: 2; opacity: 0.95; }
.deck-stack .card-back.layer-3 { transform: translate(6px, -6px); z-index: 1; opacity: 0.85; }

.deck-stack.thin .layer-3 { display: none; }
.deck-stack.thin .layer-2 { transform: translate(2px, -2px); }
.deck-stack.single .layer-3,
.deck-stack.single .layer-2 { display: none; }

.deck-count {
  position: absolute;
  bottom: 4px;
  right: 5px;
  z-index: 5;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.72);
  color: #ffe6b0;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 220, 160, 0.25);
  min-width: 1.1em;
  text-align: center;
  line-height: 1.3;
}

.deck-label {
  font-size: 0.68rem;
  opacity: 0.65;
  font-weight: 600;
}

/* Enemy hero stays on the left; its deck sits beside mana on the right. */
.enemy-hero-zone {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* Кнопка конца хода */
.end-turn-btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.92rem;
  padding: 12px 20px;
  border: none;
  border-radius: 14px;
  cursor: var(--cursor-action, pointer);
  background: linear-gradient(145deg, var(--accent-bright), var(--accent) 50%, #a06028);
  color: #fff;
  box-shadow:
    0 4px 14px rgba(196, 120, 58, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: relative;
  overflow: hidden;
}

.end-turn-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.end-turn-btn:hover:not(:disabled)::before {
  left: 120%;
}

.end-turn-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.1);
  box-shadow: 0 8px 20px rgba(196, 120, 58, 0.55);
}

.end-turn-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.end-turn-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Столы */
.board {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 150px;
  padding: 8px 12px;
  background:
    radial-gradient(ellipse at center, rgba(80, 55, 35, 0.25) 0%, rgba(0, 0, 0, 0.25) 70%);
  border-radius: 18px;
  border: 1px dashed rgba(245, 230, 200, 0.1);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.board.drop-ready {
  background: rgba(80, 180, 100, 0.12);
  border-color: rgba(80, 180, 100, 0.4);
  box-shadow: inset 0 0 30px rgba(80, 180, 100, 0.08);
}

.board-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20%;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 166, 107, 0.35), transparent);
}

.divider-text {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.45;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ========== Карточки ========== */
.card {
  width: var(--card-w);
  height: var(--card-h);
  position: relative;
  border-radius: var(--radius);
  background:
    linear-gradient(165deg, #fff6e0 0%, #f0dcb0 45%, #dcc490 100%);
  border: 3px solid #b8925a;
  box-shadow:
    0 4px 14px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 6px rgba(139, 105, 20, 0.15);
  cursor: var(--cursor-action, pointer);
  transition: transform 0.25s var(--ease-pop),
              box-shadow 0.25s,
              border-color 0.2s;
  animation: cardAppear 0.4s var(--ease-pop) both;
  user-select: none;
  flex-shrink: 0;
  color: #2c1e10;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  border: 1px solid rgba(139, 105, 20, 0.2);
  pointer-events: none;
  z-index: 2;
}

.card:hover {
  transform: translateY(-16px) scale(1.1);
  z-index: 20;
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(255, 220, 150, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card.selected {
  transform: translateY(-20px) scale(1.12);
  border-color: #4a90d9;
  box-shadow:
    0 0 0 3px #4a90d9,
    0 0 20px rgba(74, 144, 217, 0.5),
    0 18px 32px rgba(0, 0, 0, 0.5);
  z-index: 25;
}

.card.attacker {
  border-color: #e09050;
  box-shadow:
    0 0 0 3px #e09050,
    0 0 18px rgba(224, 144, 80, 0.55),
    0 14px 28px rgba(0, 0, 0, 0.45);
  z-index: 25;
}

.card.targetable {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px #ff6b6b, 0 0 18px rgba(255, 80, 80, 0.5);
  animation: pulse-target 1s ease-in-out infinite;
  cursor: var(--cursor-target, crosshair);
}

.card.exhausted {
  filter: brightness(0.7) saturate(0.65);
  cursor: var(--cursor-default, default);
}

.card.exhausted::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.85rem;
  z-index: 5;
}

.card.cannot-play {
  opacity: 0.5;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.card.cannot-play:hover {
  transform: none;
  box-shadow: 0 4px 14px var(--shadow);
}

.card-cost {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--mana-glow), var(--mana) 60%, #2a6aaa);
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(40, 100, 180, 0.55), 0 0 10px rgba(74, 144, 217, 0.35);
  z-index: 3;
}

.card-art {
  height: 56%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.7rem;
  background:
    radial-gradient(ellipse at 50% 40%, #fffaf0 0%, #f5e8c8 50%, #e8d4a0 100%);
  border-bottom: 1px solid rgba(92, 64, 51, 0.12);
  margin: 3px 3px 0;
  border-radius: 10px 10px 0 0;
  position: relative;
  overflow: hidden;
}

.card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(200, 160, 80, 0.15));
  pointer-events: none;
}

.card-name {
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  padding: 4px 5px 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.card-stats {
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
  pointer-events: none;
  z-index: 3;
}

.stat {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px var(--shadow);
}

.stat.attack {
  background: radial-gradient(circle at 35% 30%, var(--attack-glow), var(--attack) 55%, #a07810);
  box-shadow: 0 2px 6px rgba(180, 120, 20, 0.5), 0 0 8px rgba(212, 160, 23, 0.3);
}

.stat.health {
  background: radial-gradient(circle at 35% 30%, #f88, var(--hp) 55%, #902020);
  box-shadow: 0 2px 6px rgba(160, 40, 40, 0.5), 0 0 8px rgba(196, 69, 69, 0.3);
}

/* Рука */
.hand-zone {
  padding: 2px 0 6px;
  min-height: 165px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0 6px 6px;
}

/* Лог — прокручиваемый */
.game-log {
  position: absolute;
  right: 6px;
  top: 8px;
  bottom: 8px;
  width: 156px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.62rem;
  line-height: 1.3;
  border: 1px solid rgba(245, 230, 200, 0.14);
  pointer-events: auto;
  opacity: 0.92;
  backdrop-filter: blur(6px);
  scrollbar-width: thin;
  z-index: 40;
  -webkit-overflow-scrolling: touch;
}
.game-log:hover {
  opacity: 1;
}

.game-log .log-entry {
  margin-bottom: 3px;
  opacity: 0;
  animation: fadeInLog 0.3s ease forwards;
}

.game-log .log-entry.combat { color: #f8a0b0; }
.game-log .log-entry.play { color: #a0e8a0; }
.game-log .log-entry.system { color: #a0c8f0; }

/* Оверлеи */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 8, 4, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}
.overlay:not(.hidden) {
  pointer-events: auto;
}

.message-overlay { z-index: 20000; }
body.gameplay-paused .screen.active *, body.gameplay-paused .fx-layer * { animation-play-state: paused !important; }
.message-card { width: min(520px, 92vw); max-height: 88dvh; overflow-y: auto; }
.message-card p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-input-label { display: block; text-align: left; margin-bottom: 6px; }
.message-input-label[hidden], .message-input[hidden], .message-card button[hidden] { display: none !important; }
.message-input { box-sizing: border-box; width: 100%; min-height: 90px; resize: vertical; padding: 10px; margin-bottom: 16px; font: inherit; color: #2c1e10; background: #fff8e8; border: 2px solid #8e642f; border-radius: 8px; }

.overlay-card {
  background:
    linear-gradient(160deg, #f8ecd4 0%, #e8d4a8 50%, #dcc488 100%);
  color: #2c1e10;
  padding: 32px 40px;
  border-radius: 22px;
  text-align: center;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 0 0 3px rgba(201, 166, 107, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: cardAppear 0.45s var(--ease-pop);
  max-width: 90vw;
}

.overlay-result .result-emoji {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: logoBounce 1.5s ease-in-out infinite;
  display: inline-block;
}

.overlay-card h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  margin-bottom: 8px;
}

.overlay-card p {
  margin-bottom: 18px;
  font-weight: 600;
  opacity: 0.8;
  line-height: 1.4;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.restart-btn {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  cursor: var(--cursor-action, pointer);
  background: linear-gradient(145deg, var(--accent-bright), #a06028);
  color: #fff;
  box-shadow: 0 4px 14px rgba(196, 120, 58, 0.4);
  transition: transform 0.15s, filter 0.15s;
}

.restart-btn:hover {
  transform: scale(1.04);
  filter: brightness(1.08);
}

.menu-btn-secondary {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 24px;
  border: 2px solid rgba(92, 64, 51, 0.35);
  border-radius: 12px;
  cursor: var(--cursor-action, pointer);
  background: transparent;
  color: #2c1e10;
  transition: background 0.15s, transform 0.15s;
}

.menu-btn-secondary:hover {
  background: rgba(92, 64, 51, 0.12);
  transform: scale(1.02);
}

/* Анимации */
@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.82);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInLog {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-target {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes floatAway {
  to {
    opacity: 0;
    transform: translateY(-36px) scale(0.55) rotate(10deg);
  }
}

.card.dying {
  animation: floatAway 0.5s ease forwards;
  pointer-events: none;
}

/* Адаптив */
@media (max-width: 700px) {
  :root {
    --card-w: 100px;
    --card-h: 138px;
  }

  .game-log { display: none; }
  .logo { font-size: 1rem; }
  .card-name { font-size: 0.58rem; }
  .card-art { font-size: 2rem; }
  .menu-title { font-size: 2.2rem; }
  .menu-deco { display: none; }
  .howto-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .howto-grid { grid-template-columns: 1fr; }
  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ========== v1.2 — ключевые слова, магия, редкости ========== */

.card-spell {
  background: linear-gradient(165deg, #e8e0ff 0%, #d0c0f0 40%, #b8a0e0 100%);
  border-color: #8b6bc9;
  color: #2a1840;
}

.card-spell:hover {
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(180, 140, 255, 0.5),
    0 0 24px rgba(140, 100, 220, 0.35);
}

.card-spell .card-art {
  background: radial-gradient(ellipse at 50% 40%, #f5f0ff 0%, #e0d0f8 55%, #c8b0e8 100%);
}

.card-spell.selected,
.card-spell.casting {
  border-color: #a78bfa;
  box-shadow:
    0 0 0 3px #a78bfa,
    0 0 28px rgba(167, 139, 250, 0.55),
    0 18px 32px rgba(0, 0, 0, 0.5);
}

.card-badges {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 4;
  pointer-events: none;
}

.kw-badge {
  font-size: 0.75rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  animation: badgePop 0.4s var(--ease-pop);
}

@keyframes badgePop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Провокация — классическая рамка + щит выше */
.card.has-taunt {
  border-color: #3d8f2e !important;
  border-width: 4px !important;
  border-radius: var(--radius, 14px) !important;
  clip-path: none !important;
  -webkit-clip-path: none !important;
  background:
    linear-gradient(165deg, #e8f8d8 0%, #f0dcb0 40%, #d4c070 100%) !important;
  box-shadow:
    0 4px 14px var(--shadow),
    0 0 0 3px rgba(60, 160, 50, 0.55),
    0 0 22px rgba(50, 180, 60, 0.45),
    inset 0 0 0 2px rgba(40, 120, 40, 0.35) !important;
  animation: tauntPulse 1.8s ease-in-out infinite;
  overflow: hidden !important;
}

.card.has-taunt::before {
  content: "" !important;
  position: absolute !important;
  inset: 3px !important;
  border-radius: 10px !important;
  border: 2px solid rgba(60, 160, 50, 0.45) !important;
  box-shadow: inset 0 0 14px rgba(80, 200, 70, 0.2) !important;
  background: none !important;
  clip-path: none !important;
  z-index: 1 !important;
  pointer-events: none;
}
.card.has-taunt::after {
  content: none !important;
  display: none !important;
}

.card.has-taunt .taunt-frame {
  position: absolute;
  inset: 2px;
  border-radius: 11px;
  border: 2px dashed rgba(40, 140, 40, 0.55);
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 12px rgba(60, 180, 50, 0.2);
  display: block !important;
}

/* taunt banner — center, see v2.9.1 */

.card.has-taunt .taunt-shield-rim {
  display: none !important;
}

.card.has-taunt .art-taunt {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 6px rgba(60, 180, 50, 0.45));
  border-radius: 10px 10px 0 0 !important;
  margin: 3px 3px 0 !important;
  border: none !important;
  background: inherit;
}

.card.has-taunt .card-art {
  /* место сверху под щит */
  margin-top: 18px !important;
  height: calc(56% - 10px) !important;
}

.card.has-taunt .card-art-emoji {
  filter: drop-shadow(0 0 4px rgba(60, 180, 50, 0.35));
}

.card.has-taunt .card-name {
  color: #1a4a18 !important;
  background: transparent !important;
  margin: 2px 4px 0 !important;
  font-weight: 900 !important;
}

.card.has-taunt .card-kw-line,
.card.has-taunt .card-taunt-line,
.card-taunt-line {
  color: #1a5c18 !important;
  font-weight: 900 !important;
  font-size: 0.58rem !important;
  letter-spacing: 0.04em;
  opacity: 1 !important;
  text-shadow: 0 0 6px rgba(100, 220, 80, 0.35);
  background: linear-gradient(90deg, transparent, rgba(60, 160, 50, 0.22), transparent) !important;
  border-radius: 4px;
  padding: 1px 2px !important;
  margin: 0 4px !important;
}

.kw-badge.kw-taunt {
  background: linear-gradient(145deg, #4caf50, #2e7d32) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 0 10px rgba(76, 175, 80, 0.7);
  font-size: 1.05rem !important;
  width: 26px !important;
  height: 26px !important;
  top: 2px !important;
  animation: tauntBadgePulse 1.4s ease-in-out infinite;
  z-index: 8 !important;
}

/* бейдж щита чуть выше в углу */
.card.has-taunt .card-badges {
  top: 2px !important;
  z-index: 8 !important;
}
.card.has-taunt .card-badges .kw-badge.kw-taunt {
  transform: translateY(-2px);
}

@keyframes tauntPulse {
  0%, 100% {
    box-shadow:
      0 4px 14px var(--shadow),
      0 0 0 3px rgba(60, 160, 50, 0.5),
      0 0 16px rgba(50, 180, 60, 0.4),
      inset 0 0 0 2px rgba(40, 120, 40, 0.3);
  }
  50% {
    box-shadow:
      0 4px 14px var(--shadow),
      0 0 0 4px rgba(80, 200, 60, 0.75),
      0 0 28px rgba(80, 220, 80, 0.65),
      inset 0 0 0 2px rgba(40, 120, 40, 0.45);
  }
}

@keyframes tauntShieldFloat {
  0%, 100% { opacity: 0.85; transform: translate(-50%, 0) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -3px) scale(1.08); }
}

@keyframes tauntBadgePulse {
  0%, 100% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.12); }
}

@keyframes tauntShieldBob {
  0%, 100% { transform: none; }
  50% { transform: none; }
}

.board .card.has-taunt {
  outline: 3px solid rgba(70, 190, 60, 0.85);
  outline-offset: 2px;
  filter: none;
}

.board .card.has-taunt.targetable {
  outline-color: #7dff6a;
  filter: none;
  box-shadow:
    0 0 0 3px #4caf50,
    0 0 24px rgba(80, 220, 80, 0.75) !important;
}

.card.has-divine-shield {
  box-shadow:
    0 4px 14px var(--shadow),
    0 0 0 2px rgba(100, 180, 255, 0.5),
    0 0 16px rgba(100, 180, 255, 0.35);
}

.card.has-divine-shield .card-art.has-shield-glow {
  box-shadow: inset 0 0 20px rgba(120, 200, 255, 0.35);
}

.card.has-divine-shield .card-art::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  opacity: 0.85;
  z-index: 2;
  animation: shieldPulse 1.8s ease-in-out infinite;
}

@keyframes shieldPulse {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

.card-kw-line {
  font-size: 0.55rem;
  font-weight: 700;
  text-align: center;
  padding: 0 4px;
  line-height: 1.2;
  opacity: 0.75;
  color: #5a4028;
  max-height: 1.6em;
  overflow: hidden;
}

.card-spell .card-kw-line {
  color: #4a3080;
  font-size: 0.52rem;
  padding: 1px 4px 0;
  max-height: 2.4em;
  line-height: 1.15;
}

.card-spell-label {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #6b4aaa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-desc {
  font-size: 0.55rem;
  font-weight: 600;
  text-align: center;
  padding: 2px 5px 0;
  line-height: 1.2;
  opacity: 0.8;
  max-height: 2.4em;
  overflow: hidden;
}

.collection-card {
  height: auto;
  min-height: var(--card-h);
  padding-bottom: 8px;
}

.collection-card .card-desc {
  max-height: none;
  padding-bottom: 4px;
}

.collection-card .card-spell-label {
  position: static;
  margin-top: 4px;
}

/* Редкости — полоска снизу рамки */
.rarity-rare {
  border-bottom-color: #4a90d9;
  border-bottom-width: 4px;
}
.rarity-epic {
  border-bottom-color: #9b59b6;
  border-bottom-width: 4px;
}
.rarity-legendary {
  border-bottom-color: #e67e22;
  border-bottom-width: 4px;
  box-shadow:
    0 4px 14px var(--shadow),
    0 0 14px rgba(230, 126, 34, 0.25);
}

.card.blocked-target {
  opacity: 0.4;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.card.spell-target.targetable {
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 3px #a78bfa, 0 0 20px rgba(167, 139, 250, 0.5);
  animation: pulse-target 1s ease-in-out infinite;
}

.hero-portrait.blocked-target {
  opacity: 0.55;
  filter: grayscale(0.3);
}

/* Подсказка выбора цели */
.target-hint {
  position: fixed;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: linear-gradient(145deg, rgba(80, 50, 120, 0.92), rgba(40, 25, 70, 0.95));
  color: #f0e8ff;
  padding: 10px 22px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 2px solid rgba(180, 150, 255, 0.5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(140, 100, 220, 0.3);
  pointer-events: none;
  animation: cardAppear 0.3s var(--ease-pop);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}

.target-hint.hidden {
  display: none;
}

/* How-to keyword chips */
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 2px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(201, 166, 107, 0.25);
}


/* ========== v1.3 — онлайн / hotseat ========== */
.menu-btn-online {
  border-color: rgba(74, 144, 217, 0.45);
  background: linear-gradient(145deg, rgba(40, 55, 80, 0.95), rgba(25, 35, 55, 0.98));
}
.menu-btn-online:hover {
  border-color: #4a90d9;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(74, 144, 217, 0.2);
}

.panel-online {
  width: min(480px, 100%);
}

.online-name-row,
.online-server-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  text-align: left;
}
.online-name-row label,
.online-server-row label {
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.75;
}
.online-name-row input,
.online-server-row input,
.code-input {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(201, 166, 107, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  outline: none;
}
.online-name-row input:focus,
.online-server-row input:focus,
.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 120, 58, 0.25);
}

.online-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}
.online-join-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.code-input {
  width: 100px;
  text-align: center;
  letter-spacing: 0.2em;
  font-size: 1.2rem;
  text-transform: uppercase;
}
.online-join-row .menu-btn {
  flex: 1;
}

.online-status {
  margin: 14px 0;
}
.online-status.hidden { display: none; }
.online-status-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(74, 144, 217, 0.35);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}
.online-status-title {
  font-weight: 800;
  margin-bottom: 8px;
}
.online-code-display {
  font-family: var(--font-display), var(--font);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent-bright);
  text-shadow: 0 0 20px rgba(232, 160, 80, 0.4);
  margin: 8px 0;
}
.online-status-text {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 12px;
}

.online-help {
  margin-top: 12px;
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.45;
  opacity: 0.85;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
}
.online-help ol {
  margin: 8px 0 8px 18px;
}
.online-help code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}
.online-note {
  opacity: 0.65;
  font-size: 0.75rem;
  margin-top: 6px;
}

.mode-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(74, 144, 217, 0.25);
  border: 1px solid rgba(74, 144, 217, 0.4);
  white-space: nowrap;
}
.mode-badge.hidden { display: none; }

.card-back {
  background: linear-gradient(145deg, #5a4030, #2a1c10) !important;
  border-color: var(--wood-light) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: var(--cursor-default, default);
}
.card-back:hover {
  transform: none !important;
}
.card-back-inner {
  font-size: 2.2rem;
  opacity: 0.7;
}

.game-header {
  flex-wrap: wrap;
}

/* ========== v1.4 — чат, эмоции, реванш ========== */
.social-panel {
  position: absolute;
  left: 10px;
  bottom: 12px;
  width: 260px;
  max-width: calc(100% - 24px);
  z-index: 40;
  background: rgba(12, 8, 4, 0.88);
  border: 1px solid rgba(201, 166, 107, 0.28);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 280px;
}
.social-panel.hidden { display: none; }
.social-panel.collapsed .social-body { display: none; }
.social-panel.collapsed { max-height: none; }

.social-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.85rem;
  background: rgba(196, 120, 58, 0.18);
  border-bottom: 1px solid rgba(201, 166, 107, 0.15);
}
.social-toggle {
  font-family: var(--font);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(245, 230, 200, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  font-weight: 800;
}
.social-toggle:hover { background: rgba(196, 120, 58, 0.35); }

.social-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  min-height: 90px;
  max-height: 140px;
  font-size: 0.78rem;
  line-height: 1.35;
  scrollbar-width: thin;
}
.chat-msg {
  margin-bottom: 6px;
  word-break: break-word;
  animation: fadeInLog 0.25s ease;
}
.chat-msg .chat-name {
  font-weight: 800;
  color: var(--accent-bright);
  margin-right: 4px;
}
.chat-msg.me .chat-name { color: #8fdf8f; }
.chat-msg.system-chat {
  opacity: 0.7;
  font-style: italic;
  color: #a8c8f0;
}
.chat-msg.emote-msg {
  text-align: center;
  font-size: 1.1rem;
}

.emote-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid rgba(245, 230, 200, 0.08);
  background: rgba(0, 0, 0, 0.25);
}
.emote-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  cursor: var(--cursor-action, pointer);
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.15s var(--ease-pop), background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emote-btn:hover {
  transform: scale(1.2);
  background: rgba(196, 120, 58, 0.35);
}
.emote-btn:active { transform: scale(0.95); }
.emote-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(245, 230, 200, 0.1);
}
.chat-form input {
  flex: 1;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(201, 166, 107, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  outline: none;
  min-width: 0;
}
.chat-form input:focus {
  border-color: var(--accent);
}
.chat-send {
  width: 38px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent-bright), var(--accent));
  color: #fff;
  font-weight: 800;
  cursor: var(--cursor-action, pointer);
  font-size: 1rem;
}
.chat-send:hover { filter: brightness(1.1); }

/* Floating emotes */
.emote-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
}
.float-emote {
  position: absolute;
  font-size: 3.2rem;
  animation: floatEmote 2.2s ease-out forwards;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
  user-select: none;
}
.float-emote.from-me {
  left: 22%;
  bottom: 28%;
}
.float-emote.from-opp {
  right: 18%;
  top: 18%;
  animation-name: floatEmoteOpp;
}
@keyframes floatEmote {
  0% { opacity: 0; transform: translateY(20px) scale(0.4) rotate(-12deg); }
  15% { opacity: 1; transform: translateY(0) scale(1.15) rotate(6deg); }
  40% { transform: translateY(-30px) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translateY(-120px) scale(0.8) rotate(10deg); }
}
@keyframes floatEmoteOpp {
  0% { opacity: 0; transform: translateY(-10px) scale(0.4) rotate(12deg); }
  15% { opacity: 1; transform: translateY(0) scale(1.15) rotate(-6deg); }
  40% { transform: translateY(30px) scale(1) rotate(4deg); }
  100% { opacity: 0; transform: translateY(100px) scale(0.8) rotate(-8deg); }
}

.rematch-status {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: #5a4020;
  background: rgba(196, 120, 58, 0.15);
  padding: 8px 12px;
  border-radius: 10px;
}
.rematch-status.hidden { display: none; }
.rematch-status.waiting { color: #3a5a2a; }
.rematch-status.ready { color: #2a5a3a; font-weight: 800; }

.restart-btn.voted {
  opacity: 0.75;
  filter: saturate(0.7);
}

@media (max-width: 700px) {
  .social-panel {
    width: 200px;
    max-height: 220px;
    bottom: 8px;
    left: 6px;
  }
  .chat-messages { max-height: 80px; min-height: 60px; }
  .emote-btn { width: 28px; height: 28px; font-size: 1rem; }
  .float-emote { font-size: 2.4rem; }
}


/* ========== v1.4 polish — badge, sparks, chat big emoji ========== */
.social-toggle {
  position: relative;
}
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e05050;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(224, 80, 80, 0.6);
  animation: badgePop 0.35s var(--ease-pop);
  pointer-events: none;
}
.chat-emote-big {
  font-size: 1.35rem;
  vertical-align: middle;
}
.emote-bar {
  max-height: 96px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.float-emote {
  --ox: 0px;
  --oy: 0px;
  transform: translate(var(--ox), var(--oy));
}
.float-emote-spark {
  opacity: 0.85;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}
.social-panel {
  transition: box-shadow 0.2s;
}
.social-panel:not(.collapsed):not(.hidden) {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(201, 166, 107, 0.12);
}
.chat-form input::placeholder {
  color: rgba(245, 230, 200, 0.4);
}
/* hint under emotes */
.emote-bar::after {
  content: "клик = эмоция сопернику";
  flex-basis: 100%;
  font-size: 0.62rem;
  opacity: 0.45;
  font-weight: 600;
  padding: 2px 2px 0;
  text-align: center;
}

/* ========== v1.5 — кампания, колода, сундуки ========== */
.menu-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
#menuProgress {
  color: var(--accent-bright);
  font-weight: 800;
  opacity: 0.9;
}

.panel-campaign,
.panel-deck {
  max-height: min(92vh, 820px);
}

.campaign-progress-bar {
  height: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  margin: 10px 0 16px;
  overflow: hidden;
  border: 1px solid rgba(201, 166, 107, 0.2);
}
.campaign-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.campaign-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}

.campaign-node {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid rgba(201, 166, 107, 0.3);
  background: linear-gradient(160deg, rgba(60, 42, 30, 0.9), rgba(30, 22, 14, 0.95));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: var(--cursor-action, pointer);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  padding: 6px;
  user-select: none;
}
.campaign-node:hover:not(.locked) {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--wood-light);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.campaign-node.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.6);
  pointer-events: none;
}
.campaign-node.cleared {
  border-color: rgba(80, 180, 100, 0.55);
  box-shadow: inset 0 0 12px rgba(80, 160, 80, 0.15);
}
.campaign-node.current {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 2px rgba(232, 160, 80, 0.35), 0 0 18px rgba(196, 120, 58, 0.35);
  animation: pulse-target 1.6s ease-in-out infinite;
}
.campaign-node.boss {
  border-color: rgba(200, 80, 80, 0.65);
  background: linear-gradient(160deg, rgba(80, 30, 30, 0.95), rgba(40, 16, 16, 0.98));
}
.campaign-node.boss.current {
  box-shadow: 0 0 0 2px rgba(255, 100, 100, 0.4), 0 0 20px rgba(200, 50, 50, 0.4);
}
.campaign-node-av {
  font-size: 1.6rem;
  line-height: 1;
}
.campaign-node-num {
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0.85;
}
.campaign-node-star {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 0.75rem;
}
.campaign-node-check {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 0.7rem;
  color: #8f8;
}
.campaign-hint {
  font-size: 0.8rem;
  opacity: 0.65;
  text-align: center;
  margin-top: 8px;
}

/* Deck builder */
.deck-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.deck-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.deck-count-label {
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 166, 107, 0.25);
}
.deck-count-label.invalid {
  color: #f88;
  border-color: rgba(255, 100, 100, 0.4);
}
.deck-count-label.valid {
  color: #8f8;
  border-color: rgba(100, 200, 100, 0.4);
}

.deck-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
  min-height: 0;
}
@media (max-width: 720px) {
  .deck-builder { grid-template-columns: 1fr; }
}

.deck-col {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(201, 166, 107, 0.18);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  max-height: 55vh;
}
.deck-col-title {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--accent-bright);
}
.deck-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chip {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(201, 166, 107, 0.3);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
}
.chip.active {
  background: linear-gradient(145deg, var(--accent), #a06028);
  border-color: rgba(255, 220, 150, 0.4);
  color: #fff;
}

.deck-pool,
.deck-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  min-height: 120px;
}

.deck-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(201, 166, 107, 0.12);
  cursor: var(--cursor-action, pointer);
  transition: background 0.15s, transform 0.12s;
  text-align: left;
  color: var(--cream);
  font-family: var(--font);
  width: 100%;
}
.deck-row:hover {
  background: rgba(196, 120, 58, 0.2);
  transform: translateX(2px);
}
.deck-row.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.deck-row-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
}
.deck-row-info {
  flex: 1;
  min-width: 0;
}
.deck-row-name {
  font-weight: 800;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.deck-row-meta {
  font-size: 0.68rem;
  opacity: 0.7;
}
.deck-row-cost {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7ec0ff, var(--mana));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.deck-row-count {
  font-weight: 800;
  font-size: 0.8rem;
  min-width: 28px;
  text-align: right;
  opacity: 0.9;
}
.deck-row.rarity-rare { border-left: 3px solid #4a90d9; }
.deck-row.rarity-epic { border-left: 3px solid #9b59b6; }
.deck-row.rarity-legendary { border-left: 3px solid #e67e22; }
.deck-row.locked-card {
  filter: grayscale(0.8);
  opacity: 0.45;
}

.deck-mana-curve {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.curve-bar {
  flex: 1;
  background: rgba(74, 144, 217, 0.35);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
}
.curve-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 700;
  opacity: 0.7;
}

/* Reward box */
.overlay-reward {
  min-width: min(420px, 92vw);
}
.reward-box-art {
  font-size: 4rem;
  margin-bottom: 8px;
  animation: logoBounce 1.2s ease-in-out infinite;
  display: inline-block;
}
.reward-box-art.opened {
  animation: cardAppear 0.5s var(--ease-pop);
}
.reward-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  min-height: 40px;
}
.reward-cards .card {
  animation: cardAppear 0.45s var(--ease-pop) both;
}
.reward-cards .card:nth-child(2) { animation-delay: 0.1s; }
.reward-cards .card:nth-child(3) { animation-delay: 0.2s; }
.reward-cards .card:nth-child(4) { animation-delay: 0.3s; }

.collection-owned-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.collection-card.not-owned {
  filter: grayscale(0.85) brightness(0.7);
  opacity: 0.55;
}
.collection-card.not-owned::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: rgba(0, 0, 0, 0.25);
  z-index: 6;
  border-radius: inherit;
  pointer-events: none;
}


/* ========== v1.6.1 click-fix ========== */
button, .menu-btn, .panel-back, .restart-btn, .end-turn-btn, .btn-icon, .campaign-node, .deck-row, .chip {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.panel-back, .restart-btn, .menu-btn-secondary, .end-turn-btn, .btn-icon {
  pointer-events: auto !important;
  cursor: var(--cursor-action, pointer);
  position: relative;
  z-index: 2;
}
.panel, .menu-shell {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
/* оверлеи поверх всего, но hidden полностью выключен */
.overlay {
  pointer-events: auto;
}
body.modal-open .screen.active {
  pointer-events: none;
}

/* ========== v1.8 — combat FX, achievements, difficulty ========== */
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

.fx-dmg {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 1.45rem;
  color: #ff5555;
  text-shadow:
    0 0 8px rgba(255, 40, 40, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.7),
    0 0 2px #000;
  animation: fxDmgFloat 0.85s ease-out forwards;
  z-index: 62;
  pointer-events: none;
  white-space: nowrap;
}
.fx-dmg-counter {
  color: #ff9944;
  font-size: 1.15rem;
}
.fx-slash {
  position: absolute;
  width: 90px;
  height: 10px;
  margin-left: -45px;
  margin-top: -5px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent, #fff8c0 30%, #ffd060 50%, #ff7040 70%, transparent);
  box-shadow: 0 0 18px rgba(255, 200, 80, 0.9), 0 0 30px rgba(255, 100, 40, 0.5);
  transform: translate(-0%, -0%) rotate(var(--ang, 0deg)) scaleX(0.2);
  animation: fxSlash 0.4s ease-out forwards;
  z-index: 61;
}
.fx-spark {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.4);
  font-size: 1.8rem;
  animation: fxSpark 0.55s ease-out forwards;
  z-index: 63;
  filter: drop-shadow(0 0 8px rgba(255, 180, 40, 0.9));
}
.fx-shield-break {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  animation: fxShield 0.7s ease-out forwards;
  z-index: 63;
}
.fx-death {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  animation: fxDeath 0.7s ease-out forwards;
  z-index: 63;
}
.fx-spell {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 2.4rem;
  animation: fxSpell 0.8s ease-out forwards;
  z-index: 63;
  filter: drop-shadow(0 0 12px rgba(160, 120, 255, 0.8));
}

@keyframes fxDmgFloat {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.9); }
}
@keyframes fxSlash {
  0% { opacity: 0; transform: rotate(var(--ang, 0deg)) scaleX(0.15); }
  30% { opacity: 1; transform: rotate(var(--ang, 0deg)) scaleX(1.15); }
  100% { opacity: 0; transform: rotate(var(--ang, 0deg)) scaleX(1.4) translateX(12px); }
}
@keyframes fxSpark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-20deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(10deg); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.6) rotate(30deg); }
}
@keyframes fxShield {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); filter: brightness(2); }
  50% { opacity: 1; transform: translate(-50%, -70%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -100%) scale(0.8); }
}
@keyframes fxDeath {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -30%) scale(0.8) rotate(15deg); }
}
@keyframes fxSpell {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-30deg); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(10deg); }
  100% { opacity: 0; transform: translate(-50%, -20%) scale(0.7) rotate(40deg); }
}

.card.card-lunge {
  animation: cardLunge 0.35s var(--ease-pop) forwards;
  z-index: 30 !important;
}
.card.card-hit {
  animation: cardHit 0.4s ease-out;
  z-index: 28 !important;
}
.card.card-death {
  animation: cardDeath 0.48s ease-in forwards !important;
  pointer-events: none;
}
.hero-portrait.hero-hit,
.hero-portrait.damaged {
  animation: heroHit 0.4s ease-out;
}

@keyframes cardLunge {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-18px) scale(1.08); filter: brightness(1.15); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes cardHit {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-4deg); filter: brightness(1.3) saturate(1.4); }
  40% { transform: translateX(10px) rotate(4deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
@keyframes cardDeath {
  0% { opacity: 1; transform: scale(1) rotate(0); filter: brightness(1); }
  40% { opacity: 1; transform: scale(1.1) rotate(-6deg); filter: brightness(1.4); }
  100% { opacity: 0; transform: scale(0.4) rotate(12deg) translateY(20px); filter: brightness(0.5); }
}
@keyframes heroHit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); filter: brightness(1.3); box-shadow: 0 0 20px rgba(255, 60, 60, 0.6); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* Difficulty chips */
.campaign-diff-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  justify-content: center;
}
.diff-chip {
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid rgba(201, 166, 107, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.diff-chip small {
  opacity: 0.7;
  font-size: 0.72rem;
}
.diff-chip:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--wood-light);
}
.diff-chip.active {
  border-color: var(--accent-bright);
  background: linear-gradient(145deg, rgba(196, 120, 58, 0.35), rgba(80, 50, 20, 0.5));
  box-shadow: 0 0 14px rgba(196, 120, 58, 0.35);
}
.diff-chip.locked,
.diff-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 8px 0 16px;
}
.ach-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(201, 166, 107, 0.25);
  background: rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, border-color 0.15s;
}
.ach-card.unlocked {
  border-color: rgba(232, 160, 80, 0.55);
  background: linear-gradient(145deg, rgba(196, 120, 58, 0.18), rgba(0, 0, 0, 0.35));
  box-shadow: 0 0 16px rgba(196, 120, 58, 0.12);
}
.ach-card.locked {
  opacity: 0.55;
  filter: grayscale(0.35);
}
.ach-card.unlocked:hover {
  transform: translateY(-2px);
}
.ach-icon {
  font-size: 1.8rem;
  line-height: 1;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.ach-name {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.ach-desc {
  font-size: 0.78rem;
  opacity: 0.75;
  line-height: 1.35;
}
.ach-status {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
  color: var(--accent-bright);
}
.ach-card.locked .ach-status {
  color: inherit;
  opacity: 0.6;
}

/* Achievement toasts */
.ach-toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(340px, calc(100vw - 24px));
}
.ach-toast {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(40, 28, 16, 0.95), rgba(20, 14, 8, 0.98));
  border: 2px solid rgba(232, 160, 80, 0.55);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 20px rgba(196, 120, 58, 0.25);
  color: var(--cream);
  animation: achIn 0.4s var(--ease-pop);
}
.ach-toast.out {
  animation: achOut 0.35s ease-in forwards;
}
.ach-toast-icon {
  font-size: 1.8rem;
}
.ach-toast-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
  opacity: 0.9;
}
.ach-toast-name {
  font-weight: 800;
  font-size: 0.95rem;
}
.ach-toast-desc {
  font-size: 0.75rem;
  opacity: 0.75;
}
@keyframes achIn {
  from { opacity: 0; transform: translateX(40px) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes achOut {
  to { opacity: 0; transform: translateX(30px) scale(0.95); }
}

body.no-anim .card-lunge,
body.no-anim .card-hit,
body.no-anim .card-death,
body.no-anim .hero-hit,
body.no-anim .fx-layer * {
  animation: none !important;
}

/* ========== v1.9 — hero power + card art polish ========== */
.hero-power-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.hero-power-btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255, 200, 100, 0.55);
  background:
    radial-gradient(circle at 35% 30%, #5a4030 0%, #2a1c12 70%);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.45),
    0 0 12px rgba(196, 120, 58, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s, border-color 0.15s;
  font-family: var(--font);
  padding: 0;
  touch-action: manipulation;
}
.hero-power-btn:hover:not(:disabled) {
  transform: scale(1.08);
  border-color: #ffd080;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(232, 160, 80, 0.45);
}
.hero-power-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.hero-power-btn:disabled,
.hero-power-btn.used {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
  box-shadow: none;
}
.hero-power-btn.mode-heal {
  border-color: rgba(80, 200, 120, 0.65);
  background: radial-gradient(circle at 35% 30%, #2a4a30 0%, #142018 70%);
}
.hero-power-btn.mode-heal:hover:not(:disabled) {
  border-color: #80e0a0;
  box-shadow: 0 0 20px rgba(80, 200, 120, 0.4);
}
.hero-power-btn .hp-cost {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--mana-glow), var(--mana));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.hero-power-btn .hp-icon {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}
.hero-power-btn .hp-label {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-top: 1px;
}

.fx-heal {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 1.4rem;
  color: #5dffa0;
  text-shadow: 0 0 10px rgba(80, 255, 140, 0.8), 0 2px 4px #000;
  animation: fxDmgFloat 0.9s ease-out forwards;
  z-index: 62;
  pointer-events: none;
}

/* Card art: bigger emoji, no tofu squares */
.card-art {
  font-size: 2.35rem !important;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.card-ninja .card-art {
  position: relative;
  filter: drop-shadow(0 0 6px rgba(40, 40, 80, 0.6));
}
.card-ninja .card-art::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 0;
  font-size: 0.75rem;
  opacity: 0.9;
}
.card-ninja {
  background: linear-gradient(165deg, #2a2a40 0%, #1a1a28 40%, #3a3040 100%) !important;
  border-color: #5a5a80 !important;
  color: #f0e8ff;
}
.card-ninja .card-name {
  color: #e8e0ff;
}
.card-ninja .card-kw-line {
  color: #c0b0ff;
}
.card-dragon .card-art {
  filter: drop-shadow(0 0 8px rgba(220, 80, 40, 0.5));
  font-size: 2.5rem !important;
}

/* prevent empty emoji box look */
.card-art:empty::before {
  content: "";
}

@media (max-width: 700px) {
  .hero-power-btn {
    width: 52px;
    height: 52px;
  }
  .hero-power-btn .hp-icon { font-size: 1.1rem; }
  .hero-power-btn .hp-label { font-size: 0.48rem; }
}

/* ========== v2.0 shop, skills, divine (celestial), fatigue note ========== */
/* divine redefined below in v2.8 — keep placeholder empty */

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 8px 0 20px;
}
.shop-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 166, 107, 0.3);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}
.shop-card.owned-full {
  opacity: 0.55;
}
.shop-art {
  font-size: 2.2rem;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.shop-name {
  font-weight: 800;
  font-size: 0.9rem;
}
.shop-meta {
  font-size: 0.72rem;
  opacity: 0.75;
}
.shop-desc {
  font-size: 0.72rem;
  opacity: 0.7;
  line-height: 1.3;
  min-height: 2.4em;
}
.shop-buy {
  width: 100%;
  margin-top: auto;
  font-size: 0.85rem;
  padding: 8px 10px;
}

.skill-tree {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 20px;
}
.skill-branch {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  border: 1px solid rgba(201, 166, 107, 0.25);
  padding: 10px;
}
.skill-branch-title {
  margin: 0 0 10px;
  font-size: 1rem;
  text-align: center;
}
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-node {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid rgba(201, 166, 107, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  cursor: var(--cursor-action, pointer);
  font-family: var(--font);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.skill-node .sk-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.skill-node .sk-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.skill-node .sk-name {
  font-weight: 800;
  font-size: 0.88rem;
}
.skill-node .sk-desc {
  font-size: 0.72rem;
  opacity: 0.8;
}
.skill-node .sk-req {
  font-size: 0.65rem;
  opacity: 0.55;
}
.skill-node.unlocked {
  border-color: rgba(100, 200, 120, 0.6);
  background: linear-gradient(145deg, rgba(60, 120, 70, 0.35), rgba(0, 0, 0, 0.35));
  cursor: var(--cursor-default, default);
}
.skill-node.can {
  border-color: rgba(232, 160, 80, 0.7);
  box-shadow: 0 0 12px rgba(196, 120, 58, 0.25);
}
.skill-node.can:hover {
  transform: translateY(-2px);
}
.skill-node.locked {
  opacity: 0.45;
  filter: grayscale(0.4);
  cursor: not-allowed;
}

.menu-footer {
  flex-wrap: wrap;
  gap: 8px 14px;
}
#menuGold, #menuHeroLevel {
  font-weight: 800;
  color: var(--accent-bright);
}

/* ========== v2.1 turn banner, timer, stronger combat ========== */
.turn-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#turnLabel.turn-active,
.player-turn.turn-active {
  font-weight: 900 !important;
  font-size: 1.15rem !important;
  color: #ffe08a !important;
  text-shadow:
    0 0 12px rgba(255, 200, 80, 0.9),
    0 0 24px rgba(255, 160, 40, 0.5),
    0 2px 0 #5a3a10;
  animation: turnLabelPulse 1.2s ease-in-out infinite;
  letter-spacing: 0.04em;
}
@keyframes turnLabelPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.15); }
}

.turn-timer {
  font-weight: 900;
  font-size: 0.95rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(201, 166, 107, 0.45);
  color: var(--cream);
  min-width: 3.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.turn-timer.urgent {
  border-color: #e0a040;
  color: #ffd080;
  box-shadow: 0 0 12px rgba(255, 180, 60, 0.4);
}
.turn-timer.critical {
  border-color: #e04040;
  color: #ff8080;
  background: rgba(80, 0, 0, 0.45);
  animation: timerBlink 0.5s ease-in-out infinite;
}
@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.turn-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(60, 40, 12, 0.95), rgba(30, 18, 8, 0.98));
  border: 3px solid rgba(255, 200, 80, 0.85);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 30px rgba(255, 180, 40, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #ffe9a8;
}
.turn-banner.hidden {
  display: none !important;
}
.turn-banner.pulse {
  animation: turnBannerIn 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.turn-banner-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(255, 200, 80, 0.8));
}
.turn-banner-text {
  font-weight: 900;
  font-size: 1.55rem;
  letter-spacing: 0.12em;
  text-shadow: 0 0 16px rgba(255, 200, 80, 0.7);
}
@keyframes turnBannerIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6) translateY(-20px); }
  60% { opacity: 1; transform: translateX(-50%) scale(1.08) translateY(0); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* stronger combat */
.fx-slash-strong {
  width: 140px !important;
  height: 16px !important;
  margin-left: -70px !important;
  margin-top: -8px !important;
  background: linear-gradient(90deg, transparent, #fff 15%, #ffe080 40%, #ff6040 70%, transparent) !important;
  box-shadow:
    0 0 24px rgba(255, 220, 100, 1),
    0 0 40px rgba(255, 100, 40, 0.7) !important;
}
.fx-shockwave {
  position: absolute;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border-radius: 50%;
  border: 3px solid rgba(255, 220, 120, 0.9);
  box-shadow: 0 0 20px rgba(255, 180, 40, 0.8);
  animation: fxShock 0.45s ease-out forwards;
  pointer-events: none;
  z-index: 62;
}
@keyframes fxShock {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(4.5); opacity: 0; }
}
.fx-attack-line {
  position: absolute;
  height: 4px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(255, 240, 180, 0.9), rgba(255, 120, 40, 0.2));
  box-shadow: 0 0 12px rgba(255, 200, 80, 0.9);
  border-radius: 2px;
  animation: fxLine 0.35s ease-out forwards;
  pointer-events: none;
  z-index: 60;
}
@keyframes fxLine {
  0% { opacity: 0; filter: brightness(2); }
  40% { opacity: 1; }
  100% { opacity: 0; }
}
.fx-dmg-big {
  font-size: 1.85rem !important;
  color: #ff4444 !important;
  text-shadow:
    0 0 12px rgba(255, 40, 40, 1),
    0 3px 6px #000,
    0 0 3px #000 !important;
}
.card.card-lunge-strong {
  animation: cardLungeStrong 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) forwards !important;
  z-index: 40 !important;
  filter: brightness(1.25) drop-shadow(0 0 12px rgba(255, 200, 80, 0.7));
}
@keyframes cardLungeStrong {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-28px) scale(1.14) rotate(-3deg); }
  55% { transform: translateY(-8px) scale(1.08) rotate(2deg); }
  100% { transform: translateY(0) scale(1); }
}
.card.card-hit-strong {
  animation: cardHitStrong 0.5s ease-out !important;
  z-index: 35 !important;
}
@keyframes cardHitStrong {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-14px) rotate(-8deg); filter: brightness(1.5) saturate(1.6); }
  30% { transform: translateX(14px) rotate(8deg); }
  45% { transform: translateX(-10px) rotate(-4deg); }
  60% { transform: translateX(8px) rotate(3deg); }
  75% { transform: translateX(-4px); }
}

/* chat always readable */
.social-panel:not(.hidden) {
  z-index: 70;
  pointer-events: auto;
}
.social-panel .chat-messages {
  min-height: 80px;
}

/* ========== Hearthstone-style attack lunge ========== */
.card-attack-ghost {
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(255, 200, 80, 0.45) !important;
  border-color: #ffd080 !important;
  filter: brightness(1.12);
  pointer-events: none !important;
}
.card-attack-ghost.card-attack-lift {
  z-index: 130 !important;
}
.card-attack-ghost.card-attack-slam {
  z-index: 140 !important;
  filter: brightness(1.25) drop-shadow(0 0 16px rgba(255, 180, 40, 0.85)) !important;
}
.card-attack-origin {
  opacity: 0.22 !important;
  filter: grayscale(0.35) brightness(0.85);
  transform: scale(0.96);
  transition: opacity 0.15s, filter 0.15s, transform 0.15s;
  pointer-events: none !important;
}

.fx-impact-flash {
  position: absolute;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9c0 0%, #ffb040 35%, transparent 70%);
  box-shadow: 0 0 30px rgba(255, 200, 60, 0.95), 0 0 60px rgba(255, 120, 40, 0.5);
  animation: fxImpactFlash 0.4s ease-out forwards;
  pointer-events: none;
  z-index: 125;
}
@keyframes fxImpactFlash {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(3.2); opacity: 0; }
}

.game-wrapper.board-shake {
  animation: boardShake 0.35s ease-out;
}
@keyframes boardShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 2px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(3px, 1px); }
}

/* board cards need relative for transforms not to clip badly */
.board .card {
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}
.board {
  overflow: visible !important;
}
.fx-layer {
  z-index: 100 !important;
}

body.no-anim .card-attack-ghost,
body.no-anim .card-attack-origin,
body.no-anim .board-shake {
  animation: none !important;
  transition: none !important;
}
.ranked-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: 10px 0 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(232, 180, 60, 0.35);
}
.ranked-rating-label {
  font-weight: 700;
  opacity: 0.85;
}
.ranked-rating-value {
  font-weight: 900;
  font-size: 1.35rem;
  color: #ffd060;
  text-shadow: 0 0 12px rgba(255, 200, 80, 0.45);
}
.ranked-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}
.ranked-found {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(80, 50, 10, 0.45);
  border: 2px solid rgba(255, 200, 80, 0.5);
  animation: rankedFoundPulse 1.4s ease-in-out infinite;
}
@keyframes rankedFoundPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 200, 80, 0); }
  50% { box-shadow: 0 0 20px rgba(255, 200, 80, 0.35); }
}
.ranked-found-peer {
  font-weight: 800;
  text-align: center;
  margin: 0 0 12px;
}
.ranked-found-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.ranked-hint {
  margin-top: 14px;
  font-size: 0.82rem;
  opacity: 0.75;
  line-height: 1.4;
  text-align: center;
}
.panel-ranked .online-status-card {
  min-width: 0;
}
#menuRating {
  font-weight: 900;
  color: #ffd060;
}

.card-attack-ghost {
  border-radius: 12px !important;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.65),
    0 0 28px rgba(255, 200, 80, 0.55) !important;
  border: 2px solid #ffd080 !important;
}
.card-attack-origin {
  opacity: 0 !important;
  visibility: hidden !important;
}

.fx-screen.fx-impact-flash,
.fx-screen.fx-shockwave,
.fx-screen.fx-slash,
.fx-screen.fx-spark,
.fx-screen.fx-dmg {
  transform: translate(-50%, -50%);
}
.fx-screen.fx-impact-flash {
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9c0 0%, #ffb040 35%, transparent 70%);
  box-shadow: 0 0 36px rgba(255, 200, 60, 1), 0 0 70px rgba(255, 120, 40, 0.55);
  animation: fxImpactFlash 0.42s ease-out forwards;
}
.fx-screen.fx-shockwave {
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 220, 120, 0.95);
  animation: fxShock 0.48s ease-out forwards;
}
.fx-screen.fx-dmg {
  font-weight: 900;
  font-size: 1.9rem;
  color: #ff4444;
  text-shadow: 0 0 14px rgba(255,40,40,1), 0 3px 6px #000;
  animation: fxDmgFloat 0.9s ease-out forwards;
}
.fx-screen.fx-spark {
  font-size: 1.6rem;
  animation: fxDmgFloat 0.7s ease-out forwards;
}

/* ensure boards don't clip cards during anim — but keep #screenGame clipped to viewport */
.board, .player-board, .enemy-board, .screen-game {
  overflow: visible !important;
}
.game-wrapper {
  overflow: hidden !important;
  height: 100% !important;
  max-height: 100% !important;
  box-sizing: border-box;
}
.fx-layer {
  overflow: visible !important;
  z-index: 200 !important;
}


/* ========== mana-ready: always lift when affordable (every turn) ========== */
.hand-zone {
  overflow: visible !important;
  padding-top: 28px;
}
.hand {
  overflow: visible !important;
  align-items: flex-end;
  min-height: 150px;
}
.hand .card.can-play,
.hand .card.mana-ready {
  transform: translateY(-26px) scale(1.07) !important;
  z-index: 12 !important;
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(255, 200, 80, 0.55) !important;
  border-color: rgba(255, 220, 120, 0.9) !important;
  filter: brightness(1.1);
  transition: transform 0.25s cubic-bezier(0.2, 1.1, 0.3, 1), box-shadow 0.25s;
  animation: manaReadyIdle 2.2s ease-in-out infinite;
}
.hand .card.can-play:hover,
.hand .card.mana-ready:hover {
  transform: translateY(-36px) scale(1.12) !important;
  animation: none;
}
.hand .card.mana-nudge {
  animation: manaNudgePop 0.55s cubic-bezier(0.2, 1.2, 0.3, 1) !important;
}
.hand .card.mana-dim {
  transform: translateY(-10px) scale(1.02) !important;
  opacity: 0.85;
  filter: brightness(0.95);
}
@keyframes manaReadyIdle {
  0%, 100% { transform: translateY(-24px) scale(1.06); }
  50% { transform: translateY(-30px) scale(1.08); }
}
@keyframes manaNudgePop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-34px) scale(1.12); }
  100% { transform: translateY(-26px) scale(1.07); }
}

.turn-timer-visual {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 10px;
  flex-shrink: 0;
  z-index: 25;
}
.turn-timer-visual.hidden { display: none !important; }
.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 8;
}
.timer-ring-fg {
  fill: none;
  stroke: #7dcea0;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
  filter: drop-shadow(0 0 6px rgba(125, 206, 160, 0.6));
}
.turn-timer-visual.my-turn-timer .timer-ring-fg { stroke: #f0c060; filter: drop-shadow(0 0 8px rgba(240, 180, 60, 0.7)); }
.turn-timer-visual.enemy-turn-timer .timer-ring-fg { stroke: #c080ff; }
.turn-timer-visual.urgent .timer-ring-fg { stroke: #e0a040; }
.turn-timer-visual.critical .timer-ring-fg {
  stroke: #e05050;
  animation: timerRingPulse 0.5s ease-in-out infinite;
}
@keyframes timerRingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.timer-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.timer-paw {
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.board-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 20;
}
.fx-hero-shot {
  position: fixed;
  z-index: 2147483002;
  font-size: 1.8rem;
  pointer-events: none;
  transition: left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.3s;
  transform: translate(-50%, -50%) scale(1.2);
  filter: drop-shadow(0 0 12px rgba(255, 120, 40, 0.9));
}
.fx-heal-float {
  position: fixed;
  z-index: 2147483002;
  font-weight: 900;
  font-size: 1.4rem;
  color: #5ddea0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: healRise 0.85s ease-out forwards;
  text-shadow: 0 0 10px rgba(80, 220, 140, 0.8), 0 2px 4px #000;
}
@keyframes healRise {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1.2); }
}
.hero-portrait.hero-heal-pulse {
  animation: heroHealPulse 0.65s ease-out;
  box-shadow: 0 0 28px rgba(80, 220, 140, 0.7) !important;
}
@keyframes heroHealPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.08); filter: brightness(1.25) saturate(1.3); }
}

.tutorial-coach {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  z-index: 90;
  width: min(420px, 92%);
  pointer-events: auto;
}
.tutorial-coach.hidden { display: none !important; }
.tutorial-coach-bubble {
  background: linear-gradient(145deg, rgba(55, 38, 22, 0.96), rgba(30, 20, 12, 0.98));
  border: 2px solid rgba(255, 200, 100, 0.55);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}
.tutorial-coach-icon { font-size: 1.8rem; }
#tutorialCoachText {
  margin: 0;
  font-weight: 700;
  line-height: 1.4;
  color: var(--cream, #f5e6c8);
}
.tutorial-steps-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 16px 0;
}
.tut-card {
  width: 88px;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(201, 166, 107, 0.35);
  text-align: center;
  font-size: 0.78rem;
}
.tut-card span {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 200, 80, 0.25);
  font-weight: 900;
  margin-bottom: 6px;
}

.turn-banner {
  background: linear-gradient(145deg, rgba(70, 45, 18, 0.95), rgba(40, 24, 10, 0.98)) !important;
}

/* ========== Tutorial spotlight v2.5 ========== */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
}
.tutorial-overlay.hidden { display: none !important; }

.tutorial-spotlight {
  position: fixed;
  border-radius: 18px;
  border: 3px solid #ffe08a;
  box-shadow:
    0 0 0 9999px rgba(8, 6, 4, 0.62),
    0 0 24px rgba(255, 200, 80, 0.85),
    inset 0 0 20px rgba(255, 220, 120, 0.25);
  transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease, opacity 0.2s;
  pointer-events: none;
  z-index: 86;
  animation: spotlightPulse 1.4s ease-in-out infinite;
}
@keyframes spotlightPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(8,6,4,0.62), 0 0 18px rgba(255,200,80,0.7), inset 0 0 12px rgba(255,220,120,0.2); }
  50% { box-shadow: 0 0 0 9999px rgba(8,6,4,0.55), 0 0 32px rgba(255,200,80,1), inset 0 0 18px rgba(255,220,120,0.35); }
}

.tutorial-cursor {
  position: fixed;
  z-index: 87;
  font-size: 2.2rem;
  pointer-events: none;
  transform: translate(-30%, -20%);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
  animation: tutorialFinger 0.9s ease-in-out infinite;
  transition: left 0.25s ease, top 0.25s ease;
}
@keyframes tutorialFinger {
  0%, 100% { transform: translate(-30%, -20%) scale(1); }
  50% { transform: translate(-30%, -35%) scale(1.12); }
}

.tutorial-target {
  outline: 3px solid #ffe08a !important;
  outline-offset: 4px;
  filter: brightness(1.15) saturate(1.15);
  animation: targetGlow 1.1s ease-in-out infinite;
}
@keyframes targetGlow {
  0%, 100% { filter: brightness(1.1); }
  50% { filter: brightness(1.25) drop-shadow(0 0 12px rgba(255,200,80,0.8)); }
}

/* coach: сверху, читаемый текст */
.tutorial-coach {
  position: absolute !important;
  left: 50% !important;
  top: 10px !important;
  bottom: auto !important;
  transform: translateX(-50%) !important;
  z-index: 95 !important;
  width: min(480px, 94%) !important;
  pointer-events: auto !important;
}
.tutorial-coach-bubble {
  background: #fff8e8 !important;
  border: 3px solid #c9a040 !important;
  border-radius: 18px !important;
  padding: 14px 16px !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55) !important;
  color: #2a1a0a !important;
}
.tutorial-coach-icon {
  font-size: 2rem !important;
}
.tutorial-coach-body {
  width: 100%;
  text-align: center;
}
.tutorial-step-label {
  margin: 0 0 6px !important;
  font-size: 0.8rem !important;
  font-weight: 800 !important;
  color: #8a6020 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#tutorialCoachText {
  margin: 0 !important;
  font-weight: 800 !important;
  font-size: 1.05rem !important;
  line-height: 1.45 !important;
  color: #1a1208 !important;
  text-shadow: none !important;
}
.tutorial-coach .restart-btn {
  margin-top: 4px;
  min-width: 120px;
}

/* ========== Slower shot & magic FX ========== */
.fx-hero-charge {
  position: fixed;
  z-index: 2147483002;
  font-size: 1.8rem;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.6);
  animation: heroCharge 0.45s ease-out forwards;
  filter: drop-shadow(0 0 16px rgba(255, 200, 60, 0.9));
}
@keyframes heroCharge {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.4; }
  60% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.85; }
}

.fx-hero-shot {
  position: fixed !important;
  z-index: 2147483002 !important;
  pointer-events: none !important;
  transform: translate(-50%, -50%) scale(1);
  filter: drop-shadow(0 0 14px rgba(255, 120, 40, 0.95));
}
.fx-hero-shot-slow .shot-core {
  font-size: 2.1rem;
  display: inline-block;
  animation: shotSpin 0.8s linear infinite;
}
.fx-hero-shot-slow .shot-trail {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 10px;
  margin-left: -40px;
  margin-top: -5px;
  background: linear-gradient(90deg, transparent, rgba(255, 180, 60, 0.7), rgba(255, 80, 20, 0.9));
  border-radius: 8px;
  filter: blur(1px);
}
@keyframes shotSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.fx-hero-shot-hit {
  animation: shotHit 0.2s ease-out forwards;
}
@keyframes shotHit {
  to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}
.fx-shot-spark {
  position: fixed;
  z-index: 2147483001;
  pointer-events: none;
  font-size: 1rem;
  transform: translate(-50%, -50%);
  animation: sparkFade 0.55s ease-out forwards;
}
@keyframes sparkFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.4); }
}

.fx-heal-slow {
  animation-name: healRiseSlow !important;
}
@keyframes healRiseSlow {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1.25); }
}
.hero-portrait.hero-heal-pulse {
  animation-duration: 1.1s !important;
}

/* Magic orb */
.fx-spell-charge {
  position: fixed;
  z-index: 2147483000;
  width: 28px;
  height: 28px;
  margin: 0;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.5);
  background: radial-gradient(circle, rgba(200, 160, 255, 0.95), rgba(120, 80, 220, 0.4), transparent 70%);
  box-shadow: 0 0 24px rgba(160, 100, 255, 0.8);
  animation: spellChargeGrow 0.65s ease-out forwards;
}
.fx-spell-charge-ready {
  animation: spellChargePulse 0.9s ease-in-out infinite;
}
@keyframes spellChargeGrow {
  to { transform: translate(-50%, -50%) scale(2.2); opacity: 0.9; }
}
@keyframes spellChargePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(2.1); }
  50% { transform: translate(-50%, -50%) scale(2.5); }
}
.fx-spell-orb {
  position: fixed;
  z-index: 2147483002;
  font-size: 2rem;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  filter: drop-shadow(0 0 16px rgba(180, 120, 255, 0.95));
}
.fx-spell-orb-burst {
  animation: spellOrbBurst 0.35s ease-out forwards;
}
@keyframes spellOrbBurst {
  to { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}
.fx-spell-sparkle {
  position: fixed;
  z-index: 2147483001;
  pointer-events: none;
  font-size: 1.1rem;
  transform: translate(-50%, -50%);
  animation: sparkFade 0.65s ease-out forwards;
}
.fx-spell-burst {
  position: fixed;
  z-index: 2147483001;
  width: 24px;
  height: 24px;
  pointer-events: none;
  border-radius: 50%;
  border: 3px solid rgba(200, 160, 255, 0.9);
  box-shadow: 0 0 28px rgba(160, 100, 255, 0.85);
  transform: translate(-50%, -50%) scale(0.4);
  animation: spellBurst 0.55s ease-out forwards;
}
@keyframes spellBurst {
  to { transform: translate(-50%, -50%) scale(4.5); opacity: 0; }
}

/* slower combat css anims */
.card.card-hit-strong {
  animation-duration: 0.75s !important;
}
.card.card-lunge-strong {
  animation-duration: 0.75s !important;
}

/* ========== Premium visual shot & magic (no emoji projectiles) ========== */
.fxv-shot-muzzle {
  position: fixed;
  z-index: 2147483000;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.4);
  background: radial-gradient(circle, #fff6c8 0%, #ffb040 40%, transparent 70%);
  box-shadow: 0 0 24px rgba(255, 160, 40, 0.9);
  animation: fxvMuzzleIn 0.35s ease-out forwards;
}
.fxv-shot-muzzle-fire {
  animation: fxvMuzzleFire 0.25s ease-out forwards;
}
@keyframes fxvMuzzleIn {
  to { transform: translate(-50%, -50%) scale(1.6); opacity: 1; }
}
@keyframes fxvMuzzleFire {
  to { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}
.fxv-shot-ring {
  position: fixed;
  z-index: 2147482999;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 180, 60, 0.85);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.5);
  animation: fxvRingOut 0.7s ease-out forwards;
}
@keyframes fxvRingOut {
  to { transform: translate(-50%, -50%) scale(3.5); opacity: 0; }
}
.fxv-shot-beam {
  position: fixed;
  z-index: 2147483000;
  height: 5px;
  transform-origin: 0 50%;
  pointer-events: none;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(255, 240, 180, 0.95),
    rgba(255, 140, 40, 0.85) 45%,
    rgba(255, 60, 20, 0.35) 100%);
  box-shadow:
    0 0 12px rgba(255, 180, 40, 0.95),
    0 0 28px rgba(255, 100, 20, 0.55);
  opacity: 0.85;
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s;
}
.fxv-shot-beam-fade {
  opacity: 0 !important;
  transition: opacity 0.35s ease-out;
}
.fxv-shot-bolt {
  position: fixed;
  z-index: 2147483002;
  width: 28px;
  height: 16px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.fxv-shot-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffe080 30%, #ff6020 70%, transparent 100%);
  box-shadow: 0 0 18px #ff9020, 0 0 36px rgba(255, 80, 0, 0.7);
  animation: fxvBoltPulse 0.35s ease-in-out infinite alternate;
}
.fxv-shot-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 160, 40, 0.45), transparent 70%);
}
.fxv-shot-tail {
  position: absolute;
  right: 60%;
  top: 50%;
  width: 42px;
  height: 8px;
  margin-top: -4px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, rgba(255, 180, 60, 0.8), rgba(255, 80, 20, 0.9));
  filter: blur(1px);
}
@keyframes fxvBoltPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}
.fxv-shot-bolt-hit .fxv-shot-core {
  animation: fxvBoltHit 0.25s ease-out forwards;
}
@keyframes fxvBoltHit {
  to { transform: scale(2.2); opacity: 0; }
}
.fxv-shot-particle {
  position: fixed;
  z-index: 2147483001;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #ffe8a0, #ff8020);
  box-shadow: 0 0 8px #ffb040;
  transform: translate(-50%, -50%);
  animation: fxvParticle 0.55s ease-out forwards;
}
@keyframes fxvParticle {
  to {
    transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))) scale(0.2);
    opacity: 0;
  }
}
.fxv-shot-impact {
  position: fixed;
  z-index: 2147483002;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #fff 0%, #ffb040 35%, transparent 70%);
  box-shadow: 0 0 40px rgba(255, 140, 40, 0.95);
  animation: fxvImpact 0.45s ease-out forwards;
}
@keyframes fxvImpact {
  to { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}
.fxv-shot-shard {
  position: fixed;
  z-index: 2147483001;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  pointer-events: none;
  background: #ffc060;
  box-shadow: 0 0 8px #ff8020;
  transform: translate(-50%, -50%);
  animation: fxvShard 0.5s ease-out forwards;
}
@keyframes fxvShard {
  to {
    transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))) scale(0.3);
    opacity: 0;
  }
}

/* Magic */
.fxv-magic-rune {
  position: fixed;
  z-index: 2147483000;
  width: 64px;
  height: 64px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.3);
  animation: fxvRuneIn 0.45s cubic-bezier(0.2, 1.1, 0.3, 1) forwards;
}
.fxv-magic-rune-cast {
  animation: fxvRuneCast 0.35s ease-out forwards;
}
@keyframes fxvRuneIn {
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes fxvRuneCast {
  to { transform: translate(-50%, -50%) scale(1.35); opacity: 0.4; }
}
.fxv-magic-rune-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(180, 140, 255, 0.85);
  box-shadow: 0 0 16px rgba(140, 100, 255, 0.6), inset 0 0 12px rgba(200, 160, 255, 0.35);
  animation: fxvRuneSpin 1.8s linear infinite;
}
.fxv-magic-rune-ring.r2 {
  inset: 8px;
  border-color: rgba(120, 220, 255, 0.7);
  animation-direction: reverse;
  animation-duration: 1.2s;
}
.fxv-magic-rune-core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #c8a0ff 40%, #6040c0 75%, transparent 100%);
  box-shadow: 0 0 24px rgba(160, 100, 255, 0.9);
  animation: fxvBoltPulse 0.4s ease-in-out infinite alternate;
}
@keyframes fxvRuneSpin {
  to { transform: rotate(360deg); }
}
.fxv-magic-orbit {
  position: fixed;
  z-index: 2147483001;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  background: #e0c0ff;
  box-shadow: 0 0 10px #a060ff;
  transform: translate(-50%, -50%) rotate(var(--oang, 0deg)) translateX(34px);
  animation: fxvOrbit 0.55s ease-out forwards;
}
@keyframes fxvOrbit {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--oang) + 90deg)) translateX(48px) scale(0.4); }
}
.fxv-magic-arc {
  position: fixed;
  z-index: 2147483000;
  height: 4px;
  transform-origin: 0 50%;
  pointer-events: none;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(220, 180, 255, 0.95),
    rgba(120, 200, 255, 0.75) 50%,
    rgba(160, 80, 255, 0.25));
  box-shadow: 0 0 14px rgba(160, 120, 255, 0.9), 0 0 28px rgba(100, 180, 255, 0.45);
  opacity: 0.9;
  transition: width 0.4s cubic-bezier(0.2, 0.75, 0.25, 1), opacity 0.4s;
}
.fxv-magic-arc-fade { opacity: 0 !important; }
.fxv-magic-orb {
  position: fixed;
  z-index: 2147483002;
  width: 36px;
  height: 36px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.fxv-magic-orb-body {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #d0b0ff 28%, #7050e0 65%, #302080 100%);
  box-shadow: 0 0 20px rgba(160, 100, 255, 1), 0 0 40px rgba(80, 160, 255, 0.5);
  animation: fxvBoltPulse 0.3s ease-in-out infinite alternate;
}
.fxv-magic-orb-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 140, 255, 0.5), transparent 70%);
  animation: fxvHalo 0.8s ease-in-out infinite;
}
.fxv-magic-orb-tail {
  position: absolute;
  right: 55%;
  top: 50%;
  width: 50px;
  height: 12px;
  margin-top: -6px;
  border-radius: 10px;
  background: linear-gradient(90deg, transparent, rgba(160, 120, 255, 0.35), rgba(120, 200, 255, 0.75));
  filter: blur(2px);
}
@keyframes fxvHalo {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
}
.fxv-magic-orb-burst .fxv-magic-orb-body {
  animation: fxvBoltHit 0.3s ease-out forwards;
}
.fxv-magic-particle {
  position: fixed;
  z-index: 2147483001;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff, #a080ff);
  box-shadow: 0 0 10px #8060ff;
  transform: translate(-50%, -50%);
  animation: fxvMagPart 0.65s ease-out forwards;
}
@keyframes fxvMagPart {
  to { transform: translate(-50%, -50%) scale(0.15); opacity: 0; }
}
.fxv-magic-blast {
  position: fixed;
  z-index: 2147483002;
  width: 24px;
  height: 24px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.fxv-magic-blast-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(180, 140, 255, 0.9);
  animation: fxvBlastRing 0.55s ease-out forwards;
}
.fxv-magic-blast-ring.r2 {
  animation-delay: 0.08s;
  border-color: rgba(100, 200, 255, 0.8);
}
.fxv-magic-blast-flash {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #c8a0ff 40%, transparent 70%);
  animation: fxvImpact 0.5s ease-out forwards;
}
@keyframes fxvBlastRing {
  to { transform: scale(5); opacity: 0; }
}
.fxv-magic-shard {
  position: fixed;
  z-index: 2147483001;
  width: 5px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  background: linear-gradient(180deg, #fff, #a080ff);
  box-shadow: 0 0 8px #8060ff;
  transform: translate(-50%, -50%);
  animation: fxvShard 0.6s ease-out forwards;
}


/* Heal / milk spell FX (green soft glow) */
.fxv-magic-rune.heal .fxv-magic-rune-ring {
  border-color: rgba(100, 230, 150, 0.9);
  box-shadow: 0 0 16px rgba(60, 200, 120, 0.65), inset 0 0 12px rgba(140, 255, 180, 0.4);
}
.fxv-magic-rune.heal .fxv-magic-rune-ring.r2 {
  border-color: rgba(180, 255, 200, 0.75);
}
.fxv-magic-rune.heal .fxv-magic-rune-core {
  background: radial-gradient(circle, #fff 0%, #a8f0c0 40%, #2a9050 75%, transparent 100%);
  box-shadow: 0 0 24px rgba(80, 220, 140, 0.95);
}
.fxv-magic-orbit.heal {
  background: #9dffb8;
  box-shadow: 0 0 10px #40d070;
}
.fxv-magic-arc.heal {
  background: linear-gradient(90deg,
    rgba(180, 255, 200, 0.95),
    rgba(80, 220, 140, 0.75) 50%,
    rgba(40, 160, 90, 0.25));
  box-shadow: 0 0 14px rgba(80, 220, 140, 0.9), 0 0 28px rgba(60, 180, 120, 0.45);
}
.fxv-magic-orb.heal .fxv-magic-orb-body {
  background: radial-gradient(circle at 35% 30%, #fff 0%, #b8ffd0 28%, #40c070 65%, #186038 100%);
  box-shadow: 0 0 20px rgba(80, 220, 140, 1), 0 0 40px rgba(60, 180, 100, 0.55);
}
.fxv-magic-orb.heal .fxv-magic-orb-halo {
  background: radial-gradient(circle, rgba(140, 255, 180, 0.55), transparent 70%);
}
.fxv-magic-orb.heal .fxv-magic-orb-tail {
  background: linear-gradient(90deg, transparent, rgba(100, 220, 140, 0.35), rgba(80, 230, 150, 0.8));
}
.fxv-magic-particle.heal {
  background: radial-gradient(circle, #fff, #70e098);
  box-shadow: 0 0 10px #40d070;
}
.fxv-magic-blast.heal .fxv-magic-blast-ring {
  border-color: rgba(100, 230, 150, 0.9);
}
.fxv-magic-blast.heal .fxv-magic-blast-ring.r2 {
  border-color: rgba(180, 255, 200, 0.85);
}
.fxv-magic-blast.heal .fxv-magic-blast-flash {
  background: radial-gradient(circle, #fff 0%, #a0f0c0 40%, transparent 70%);
}
.fxv-magic-shard.heal {
  background: linear-gradient(180deg, #fff, #70e098);
  box-shadow: 0 0 8px #40d070;
}
.fx-heal-float {
  font-size: 1.55rem;
}
.fx-heal-float:first-of-type,
.fx-heal-float {
  color: #6eeba8;
}

/* ranked accept countdown */
.ranked-accept-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  margin: 8px auto;
  padding: 8px 16px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2a1a08;
  background: linear-gradient(180deg, #ffe8a0, #f0c060);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(240, 180, 60, 0.45);
}
.ranked-accept-timer.hidden { display: none !important; }
.ranked-accept-timer.urgent {
  color: #fff;
  background: linear-gradient(180deg, #ff9080, #e04040);
  animation: acceptPulse 0.5s ease-in-out infinite;
}
@keyframes acceptPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}


/* ========== v2.6 graphics polish ========== */
body {
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(180, 100, 40, 0.22), transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(80, 40, 120, 0.12), transparent 50%),
    radial-gradient(ellipse 40% 35% at 90% 70%, rgba(40, 80, 140, 0.1), transparent 50%),
    linear-gradient(180deg, #1a120c 0%, #120c08 40%, #0e0a06 100%) !important;
}

.bg-room,
.room-bg,
.screen.game-active,
.game-layout {
  position: relative;
}

/* richer game table */
.board-area,
.play-field,
.game-board {
  background:
    radial-gradient(ellipse at center, rgba(90, 60, 35, 0.55) 0%, transparent 70%),
    linear-gradient(180deg, rgba(50, 35, 22, 0.4), rgba(30, 20, 12, 0.55)) !important;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(201, 166, 107, 0.12) !important;
  border-radius: 20px;
}

.board-divider {
  background: linear-gradient(90deg, transparent, rgba(240, 180, 80, 0.35), transparent) !important;
  height: 2px !important;
  box-shadow: 0 0 12px rgba(240, 180, 60, 0.25);
}

/* cards — glass + foil */
.card {
  background:
    linear-gradient(155deg, rgba(255, 250, 235, 0.98) 0%, #f0e0c0 38%, #e0c898 100%) !important;
  border: 2px solid rgba(180, 140, 70, 0.65) !important;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 6px rgba(120, 80, 30, 0.12) !important;
  border-radius: 14px !important;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.35) 0%,
    transparent 35%,
    transparent 60%,
    rgba(255, 220, 140, 0.12) 100%
  );
  z-index: 3;
}
.card-art {
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(180deg, #3a2a1c 0%, #1e1510 100%) !important;
  border-radius: 10px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
  font-size: 1.85rem !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.card-name {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  font-weight: 800 !important;
  letter-spacing: 0.01em;
}
.card-cost {
  background: radial-gradient(circle at 35% 30%, #9ad0ff, #3a7fd4 55%, #1e4a90) !important;
  box-shadow:
    0 2px 8px rgba(30, 80, 180, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    var(--glow-mana) !important;
  border: 2px solid rgba(200, 230, 255, 0.7) !important;
  font-weight: 900 !important;
}
.stat.attack {
  background: radial-gradient(circle at 35% 30%, #ffe080, #d4a017 60%, #8a6010) !important;
  box-shadow: 0 2px 8px rgba(180, 120, 20, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  border: 1.5px solid rgba(255, 230, 150, 0.7) !important;
}
.stat.health {
  background: radial-gradient(circle at 35% 30%, #ff9090, #c44545 60%, #7a2020) !important;
  box-shadow: 0 2px 8px rgba(180, 40, 40, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  border: 1.5px solid rgba(255, 180, 180, 0.65) !important;
}

/* rarities foil */
.rarity-rare {
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 0 14px rgba(80, 140, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(100, 160, 255, 0.75) !important;
}
.rarity-epic {
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 0 16px rgba(180, 80, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(190, 100, 255, 0.8) !important;
}
.rarity-legendary {
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(255, 180, 40, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.75) !important;
  border-color: rgba(255, 200, 80, 0.9) !important;
  /* Persistent illustration motion is reserved for divine cards. */
}
@keyframes legendShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

/* taunt shield shape wins — no rectangular frame override */

/* heroes */
.hero,
.hero-panel,
#playerHero,
#enemyHero {
  background:
    radial-gradient(circle at 40% 25%, rgba(255, 220, 160, 0.2), transparent 50%),
    linear-gradient(165deg, #4a3424 0%, #2a1c12 55%, #1a120c 100%) !important;
  border: 2px solid rgba(212, 176, 100, 0.55) !important;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    var(--glow-gold) !important;
  border-radius: 18px !important;
}
.hero-avatar,
.hero .avatar {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  font-size: 2.4rem;
  text-shadow: 0 0 16px rgba(255, 200, 100, 0.35);
}
.hero-hp,
.hp-badge {
  background: radial-gradient(circle, #ff8080, #c03030) !important;
  box-shadow: 0 0 14px rgba(255, 80, 80, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  font-weight: 900 !important;
}

/* mana crystals */
.mana-crystal,
.mana-pip,
.crystal {
  background: radial-gradient(circle at 30% 25%, #c0e8ff, #4a9ef0 50%, #1e5080) !important;
  box-shadow: 0 0 10px rgba(80, 160, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
  border: 1px solid rgba(180, 220, 255, 0.6) !important;
}
.mana-crystal.empty,
.mana-pip.empty,
.crystal.empty {
  background: radial-gradient(circle at 30% 25%, #3a5068, #1a2838) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
  opacity: 0.55;
}

/* buttons */
.menu-btn,
.restart-btn,
.primary-btn,
.end-turn-btn,
#endTurnBtn {
  background: linear-gradient(180deg, #f0c878 0%, #c4783a 55%, #8a4a20 100%) !important;
  border: 2px solid rgba(255, 220, 150, 0.45) !important;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  color: #2a1808 !important;
  font-weight: 800 !important;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.menu-btn:hover,
.restart-btn:hover,
#endTurnBtn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(240, 180, 60, 0.3) !important;
}

/* menu */
.menu-panel,
.panel,
.screen-menu .menu-card {
  background:
    linear-gradient(165deg, rgba(60, 42, 28, 0.92), rgba(28, 18, 12, 0.95)) !important;
  border: 1px solid rgba(212, 176, 100, 0.28) !important;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 40px rgba(180, 100, 40, 0.08) !important;
  backdrop-filter: blur(12px);
  border-radius: 22px !important;
}

.logo,
.game-title,
.menu-title {
  text-shadow:
    0 2px 0 rgba(80, 40, 10, 0.5),
    0 0 28px rgba(240, 180, 60, 0.4),
    0 0 48px rgba(200, 100, 40, 0.2) !important;
  letter-spacing: 0.04em;
}

/* turn banner + timer */
.turn-banner {
  background: linear-gradient(90deg, rgba(40, 25, 10, 0.2), rgba(240, 180, 60, 0.92), rgba(40, 25, 10, 0.2)) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 40px rgba(240, 180, 60, 0.25) !important;
  border: 1px solid rgba(255, 230, 150, 0.5) !important;
}
.turn-timer-visual {
  filter: drop-shadow(0 0 10px rgba(125, 206, 160, 0.35));
}
.turn-timer-visual.my-turn-timer {
  filter: drop-shadow(0 0 14px rgba(240, 180, 60, 0.55));
}

/* log glass */
.game-log {
  background: rgba(12, 8, 6, 0.72) !important;
  border: 1px solid rgba(212, 176, 100, 0.18) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

/* soft vignette on game */
#screenGame::after,
.screen#screenGame::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.35) 100%);
}
#screenGame .game-layout,
#screenGame .game-root {
  position: relative;
  z-index: 2;
}

/* ========== v2.7 ui polish ========== */

/* divine styles moved to v2.8 */

/* settings gear — side */
.menu-top-right-btns {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-gear-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(212, 176, 100, 0.45);
  background: linear-gradient(160deg, rgba(60, 42, 28, 0.95), rgba(28, 18, 12, 0.98));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-size: 1.45rem;
  cursor: var(--cursor-action, pointer);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  color: #f5e6c8;
}
.settings-gear-btn:hover {
  transform: rotate(45deg) scale(1.08);
  filter: brightness(1.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(240, 180, 60, 0.3);
}
.lang-toggle-btn {
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border-radius: 24px;
  border: 2px solid rgba(212, 176, 100, 0.45);
  background: linear-gradient(160deg, rgba(60, 42, 28, 0.95), rgba(28, 18, 12, 0.98));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: var(--cursor-action, pointer);
  color: #f5e6c8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.lang-toggle-btn:hover {
  transform: scale(1.08);
  filter: brightness(1.12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(120, 180, 255, 0.35);
}
#screenMenu {
  position: relative;
}

/* skill points badge */
.menu-btn {
  position: relative;
}
.skill-points-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff6b6b, #c03030);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(200, 40, 40, 0.55);
  animation: badgePulse 1.4s ease-in-out infinite;
  z-index: 2;
}
.skill-points-badge.hidden { display: none !important; }
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* toasts */
.toast-layer {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483600;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: min(420px, 92vw);
}
.game-toast {
  background: linear-gradient(165deg, rgba(50, 35, 20, 0.96), rgba(20, 12, 8, 0.98));
  border: 1px solid rgba(240, 180, 80, 0.45);
  color: #f5e6c8;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 24px rgba(240, 180, 60, 0.15);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.3s, transform 0.3s;
}
.game-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.game-toast.hide {
  opacity: 0;
  transform: translateY(-8px);
}
.game-toast.toast-levelup {
  border-color: rgba(255, 210, 80, 0.75);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 36px rgba(255, 200, 60, 0.35);
  font-size: 1.05rem;
}
.game-toast.toast-skill {
  border-color: rgba(120, 200, 120, 0.55);
}

/* chest open animation */
.reward-box-art {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}
.chest-3d {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chest-body {
  font-size: 4.2rem;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  transition: transform 0.4s;
}
.chest-lid {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  opacity: 0.85;
  z-index: 3;
  transition: transform 0.55s cubic-bezier(0.2, 1.2, 0.3, 1), opacity 0.4s;
}
.chest-glow {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 80, 0.35), transparent 70%);
  opacity: 0.6;
  z-index: 1;
  animation: chestGlowPulse 1.8s ease-in-out infinite;
}
.chest-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.reward-box-art.opening .chest-body {
  animation: chestShake 0.45s ease-in-out 2;
}
.reward-box-art.opening .chest-lid {
  transform: translateX(-50%) translateY(-28px) rotate(-18deg) scale(1.15);
  opacity: 1;
}
.reward-box-art.opening .chest-glow {
  opacity: 1;
  animation: chestGlowBurst 0.9s ease-out forwards;
}
.reward-box-art.opened .chest-body {
  transform: scale(1.08);
  filter: drop-shadow(0 0 20px rgba(255, 200, 80, 0.7));
}
.reward-box-art.opened .chest-lid {
  transform: translateX(-50%) translateY(-40px) rotate(-25deg);
  opacity: 0.9;
}
.reward-box-art.burst::after {
  content: "";
  position: absolute;
  font-size: 3rem;
  animation: chestStar 0.8s ease-out forwards;
  z-index: 5;
}
@keyframes chestShake {
  0%, 100% { transform: rotate(0) translateX(0); }
  25% { transform: rotate(-6deg) translateX(-4px); }
  75% { transform: rotate(6deg) translateX(4px); }
}
@keyframes chestGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.85; }
}
@keyframes chestGlowBurst {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes chestStar {
  0% { transform: scale(0.4); opacity: 0; }
  40% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1.8) translateY(-20px); opacity: 0; }
}
.reward-card-fly {
  animation: rewardCardIn 0.55s var(--ease-pop) both;
}
@keyframes rewardCardIn {
  0% { opacity: 0; transform: translateY(30px) scale(0.6) rotate(-8deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}


/* ========== v2.8 menu grid · divine celestial · card living art ========== */

/* --- living art inside every card --- */
.card {
  overflow: hidden;
}
.card-art {
  position: relative !important;
  overflow: hidden !important;
  isolation: isolate;
}
.card-art-emoji {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-size: inherit;
  line-height: 1;
  animation: cardEmojiFloat 3.2s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
  will-change: transform;
}
.card-art-fx {
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.35) 0%, transparent 42%),
    radial-gradient(circle at 70% 60%, rgba(255, 200, 100, 0.18) 0%, transparent 45%),
    linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.22) 45%, transparent 55%);
  background-size: 100% 100%, 100% 100%, 200% 200%;
  animation: cardArtDrift 5.5s ease-in-out infinite, cardArtShimmer 4s linear infinite;
  opacity: 0.85;
}
.card-spell .card-art-fx {
  background:
    radial-gradient(circle at 40% 30%, rgba(160, 120, 255, 0.35) 0%, transparent 50%),
    radial-gradient(circle at 60% 70%, rgba(80, 180, 255, 0.25) 0%, transparent 45%),
    linear-gradient(120deg, transparent 0%, rgba(200, 180, 255, 0.25) 48%, transparent 58%);
  background-size: 100% 100%, 100% 100%, 200% 200%;
}
/* slower on board to not distract */
.board .card-art-emoji { animation-duration: 4s; }
.hand .card-art-emoji { animation-duration: 2.8s; }

@keyframes cardEmojiFloat {
  0%, 100% { transform: translateY(0) scale(1) rotate(-2deg); }
  35% { transform: translateY(-5px) scale(1.06) rotate(2deg); }
  70% { transform: translateY(2px) scale(1.02) rotate(-1deg); }
}
@keyframes cardArtDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(6%, -4%) rotate(3deg); }
}
@keyframes cardArtShimmer {
  0% { background-position: 0% 0%, 0% 0%, 0% 50%; }
  100% { background-position: 0% 0%, 0% 0%, 200% 50%; }
}

body.no-anim .card-art-emoji,
body.no-anim .card-art-fx {
  animation: none !important;
}

/* --- DIVINE: celestial silver/indigo (NOT gold) --- */
.card.rarity-divine {
  background: linear-gradient(180deg, #eef4ff 0%, #dce8f8 40%, #c8d8f0 100%) !important;
  border: 2.5px solid #4a6a9a !important;
  box-shadow:
    0 8px 20px rgba(20, 40, 80, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset,
    0 0 18px rgba(100, 140, 220, 0.35) !important;
  animation: divinePulse 3s ease-in-out infinite !important;
  filter: none !important;
}
.card.rarity-divine .card-name {
  color: #0c1a33 !important;
  background: rgba(255, 255, 255, 0.92) !important;
  margin: 2px 4px 0 !important;
  padding: 3px 4px !important;
  border-radius: 6px !important;
  text-shadow: none !important;
  font-weight: 900 !important;
  font-size: 0.66rem !important;
  white-space: normal !important;
  line-height: 1.15 !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}
.card.rarity-divine .card-desc,
.card.rarity-divine .card-kw-line,
.card.rarity-divine .card-spell-label {
  color: #122038 !important;
  background: rgba(255, 255, 255, 0.85) !important;
  margin: 2px 4px !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
  text-shadow: none !important;
  font-weight: 700 !important;
  font-size: 0.58rem !important;
  line-height: 1.2 !important;
}
.card.rarity-divine .card-art,
.card.rarity-divine .card-art.art-divine {
  background:
    radial-gradient(circle at 50% 30%, #a8c4f0 0%, #3a5080 55%, #1a2848 100%) !important;
  border: 1px solid rgba(200, 220, 255, 0.4);
}
.card.rarity-divine .card-art-fx {
  background:
    radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(140, 180, 255, 0.4) 0%, transparent 45%),
    linear-gradient(125deg, transparent 0%, rgba(255, 255, 255, 0.35) 48%, transparent 58%) !important;
  background-size: 100% 100%, 100% 100%, 220% 220% !important;
  animation: cardArtDrift 4s ease-in-out infinite, cardArtShimmer 3s linear infinite !important;
}
.card.rarity-divine .card-cost {
  background: radial-gradient(circle at 35% 30%, #e8f0ff, #6a90d8 55%, #2a4880) !important;
  border-color: #d0e0ff !important;
  color: #fff !important;
}
.card.rarity-divine::after {
  content: "✧ DIVINE";
  position: absolute;
  top: 22px;
  right: 4px;
  z-index: 4;
  font-size: 0.42rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #1a3060;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 4px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
@keyframes divinePulse {
  0%, 100% { box-shadow: 0 8px 20px rgba(20, 40, 80, 0.4), 0 0 0 1px rgba(255,255,255,0.6) inset, 0 0 14px rgba(100,140,220,0.3); }
  50% { box-shadow: 0 8px 22px rgba(20, 40, 80, 0.45), 0 0 0 1px rgba(255,255,255,0.7) inset, 0 0 22px rgba(120,160,255,0.5); }
}

/* collection / deck editor — even clearer */
.collection-grid .card.rarity-divine,
.deck-pool .card.rarity-divine,
.deck-list .card.rarity-divine,
.shop-grid .card.rarity-divine {
  background: linear-gradient(180deg, #f4f8ff 0%, #e2ecf8 100%) !important;
  min-height: 168px;
}
.collection-grid .card.rarity-divine .card-name,
.deck-pool .card.rarity-divine .card-name {
  color: #081428 !important;
  background: #ffffff !important;
  font-size: 0.7rem !important;
  -webkit-line-clamp: 3 !important;
}

/* menu shell wider for grid */
.menu-shell {
  padding-left: 16px;
  padding-right: 16px;
}
.menu-title {
  font-size: clamp(2rem, 5vw, 2.6rem);
}

/* force divine over global card foil */
.card.rarity-divine::before {
  background: linear-gradient(125deg, rgba(255,255,255,0.4) 0%, transparent 40%, rgba(160,190,255,0.15) 100%) !important;
}
.card.rarity-divine {
  color: #0c1a33 !important;
}

/* card-name z-index fix above foil */
.card-name, .card-desc, .card-kw-line, .card-spell-label, .card-stats, .card-cost, .card-badges {
  position: relative;
  z-index: 5 !important;
}
.card.rarity-divine .card-name,
.card.rarity-divine .card-desc,
.card.rarity-divine .card-kw-line {
  z-index: 6 !important;
}
.card::before { z-index: 1 !important; }
.card-art { z-index: 2; }

/* ========== settings readability + danger ========== */
#screenSettings .panel {
  background: linear-gradient(165deg, rgba(48, 34, 22, 0.98), rgba(22, 14, 10, 0.99)) !important;
  border: 1px solid rgba(220, 180, 100, 0.35) !important;
  color: #f5e6c8 !important;
  max-width: 480px;
}
#screenSettings .panel-title {
  color: #ffe8b0 !important;
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
#screenSettings .setting-label {
  color: #fff4dc !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#screenSettings .setting-row {
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid rgba(220, 180, 100, 0.28) !important;
}
#screenSettings .settings-note {
  color: #e8d4a8 !important;
  opacity: 1 !important;
  font-size: 0.88rem !important;
  line-height: 1.45 !important;
  margin-top: 14px !important;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  border-left: 3px solid rgba(200, 160, 80, 0.6);
}
#screenSettings select {
  background: #2a1c12 !important;
  color: #f5e6c8 !important;
  border: 1px solid rgba(201, 166, 107, 0.5) !important;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
}
.settings-danger {
  margin-top: 1.25rem !important;
  padding: 16px !important;
  border-radius: 14px !important;
  background: rgba(90, 20, 20, 0.55) !important;
  border: 1px solid rgba(255, 120, 100, 0.45) !important;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.25);
}
.settings-danger-title {
  margin: 0 0 8px 0;
  color: #ffc8b8 !important;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.settings-danger-text {
  margin: 0 0 14px 0;
  color: #ffe8e0 !important;
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
  font-weight: 600 !important;
  opacity: 1 !important;
}
.btn-reset-meta {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 180, 160, 0.55);
  background: linear-gradient(180deg, #e07060, #a03028);
  color: #fff !important;
  font-weight: 900 !important;
  font-size: 1rem !important;
  cursor: var(--cursor-action, pointer);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.btn-reset-meta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
/* checked toggle green */
.setting-row input:checked + .toggle {
  background: #4a9e6a !important;
}

/* taunt shield extras */
.card.has-taunt .taunt-shield-rim {
  position: absolute;
  inset: 6%;
  pointer-events: none;
  z-index: 2;
  border: 2px solid rgba(255, 255, 210, 0.5);
  border-radius: 12px 12px 45% 45%;
  box-shadow: inset 0 0 16px rgba(180, 255, 140, 0.2);
}
.card.has-taunt .card-cost {
  z-index: 8 !important;
  box-shadow: 0 2px 8px rgba(0, 80, 0, 0.45) !important;
}
.card.has-taunt .card-stats {
  z-index: 8 !important;
  bottom: 10px !important;
}
.card.has-taunt .stat {
  border: 2px solid rgba(255, 255, 220, 0.55) !important;
}
body.no-anim .card.has-taunt {
  animation: none !important;
}

/* volume sliders in settings */
.setting-row-volume {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  cursor: var(--cursor-default, default) !important;
}
.setting-volume-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
}
.setting-volume-val {
  font-weight: 900;
  color: #ffe8b0;
  min-width: 3ch;
  text-align: right;
}
.vol-slider {
  width: 100%;
  height: 8px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #2a4a6a, #4a9e6a);
  outline: none;
  cursor: var(--cursor-action, pointer);
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe8a0, #e0a040);
  border: 2px solid #fff8e0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: var(--cursor-action, pointer);
}
.vol-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f0c060;
  border: 2px solid #fff8e0;
  cursor: var(--cursor-action, pointer);
}


/* ========== v2.9 card stats & text readability ========== */
.card {
  color: #2a1a08 !important;
}
.card-name {
  color: #1a1008 !important;
  font-weight: 900 !important;
  font-size: 0.72rem !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7) !important;
  white-space: normal !important;
  line-height: 1.15 !important;
  max-height: 2.4em;
  overflow: hidden !important;
  z-index: 8 !important;
  position: relative !important;
  padding: 3px 4px 0 !important;
}
.card-desc,
.card-kw-line,
.card-spell-label {
  color: #2a2010 !important;
  font-weight: 700 !important;
  font-size: 0.6rem !important;
  line-height: 1.2 !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.55) !important;
  z-index: 8 !important;
  position: relative !important;
  opacity: 1 !important;
}
.card-stats {
  z-index: 20 !important;
  bottom: 4px !important;
  padding: 0 4px !important;
  pointer-events: none !important;
}
.stat {
  width: 30px !important;
  height: 30px !important;
  font-size: 0.95rem !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  -webkit-text-stroke: 0 !important;
  text-shadow:
    0 0 2px #000,
    0 1px 2px rgba(0,0,0,0.9),
    0 0 6px rgba(0,0,0,0.5) !important;
  border: 2.5px solid #fff !important;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.55),
    0 0 0 1px rgba(0,0,0,0.35) !important;
  z-index: 20 !important;
}
.stat.attack {
  background: radial-gradient(circle at 35% 28%, #ffe080 0%, #e0a020 45%, #8a5808 100%) !important;
}
.stat.health {
  background: radial-gradient(circle at 35% 28%, #ff9090 0%, #d04040 50%, #701818 100%) !important;
}
.card-cost {
  z-index: 22 !important;
  font-weight: 900 !important;
  font-size: 1rem !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
  border: 2.5px solid #fff !important;
}

/* spells — readable */
.card.card-spell {
  background: linear-gradient(165deg, #f8f0ff 0%, #e8d8f8 45%, #d0b8e8 100%) !important;
  border-color: rgba(120, 80, 160, 0.55) !important;
}
.card.card-spell .card-name {
  color: #2a1040 !important;
  background: rgba(255,255,255,0.75);
  border-radius: 4px;
  margin: 2px 4px 0;
}
.card.card-spell .card-spell-label,
.card.card-spell .card-desc,
.card.card-spell .card-kw-line {
  color: #301848 !important;
  background: rgba(255,255,255,0.7);
  border-radius: 4px;
  margin: 2px 4px;
  padding: 2px 4px !important;
}
.card.card-spell .card-art {
  background:
    radial-gradient(circle at 40% 30%, rgba(255,255,255,0.4), transparent 55%),
    linear-gradient(180deg, #5a3a80 0%, #2a1848 100%) !important;
}
.card.card-spell .card-art-emoji {
  font-size: 2.4rem !important;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45));
}

/* foil must not cover stats */
.card::before {
  z-index: 0 !important;
  pointer-events: none !important;
}
.card-art {
  z-index: 1 !important;
}
.card-art-fx {
  z-index: 1 !important;
}
.card-art-emoji {
  z-index: 2 !important;
}

/* taunt: don't push art so hard that stats vanish */
.card.has-taunt .card-art {
  margin-top: 14px !important;
  height: calc(50% - 4px) !important;
}
.card.has-taunt .card-stats {
  bottom: 3px !important;
  z-index: 25 !important;
}
.card.has-taunt .stat {
  z-index: 25 !important;
}
/* banner center via v2.9.1 */
.card.has-taunt .taunt-frame {
  z-index: 3 !important;
}

/* collection / deck builder — same clarity */
.collection-grid .stat,
.deck-pool .stat,
.shop-grid .stat,
.reward-cards .stat {
  width: 28px !important;
  height: 28px !important;
  font-size: 0.9rem !important;
}

/* damaged hp still readable */
.stat.health.damaged,
.stat.health.hurt {
  color: #fff !important;
  background: radial-gradient(circle at 35% 28%, #ffb0b0, #c02020 55%, #600808) !important;
}

.spell-amount-badge {
  position: absolute;
  right: 6px;
  bottom: 8px;
  z-index: 20;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.95rem;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #d0a0ff, #7030c0 60%, #401868);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.card-spell-desc {
  max-height: 2.6em;
  overflow: hidden;
}


/* ========== v2.9.1 card layout fix · single taunt shield · larger cards ========== */
.card {
  width: var(--card-w) !important;
  height: var(--card-h) !important;
  overflow: visible !important; /* cost/stats can sit on edges */
}

.card-cost {
  position: absolute !important;
  top: -8px !important;
  left: -8px !important;
  right: auto !important;
  bottom: auto !important;
  width: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 30 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  font-size: 1.05rem !important;
  font-weight: 900 !important;
  color: #fff !important;
  line-height: 1 !important;
}

.card-stats {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: -6px !important;
  top: auto !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0 2px !important;
  margin: 0 !important;
  height: 34px !important;
  z-index: 30 !important;
  pointer-events: none !important;
  transform: none !important;
}

.stat {
  position: relative !important;
  flex: 0 0 auto !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1rem !important;
  font-weight: 900 !important;
  color: #fff !important;
  line-height: 1 !important;
  margin: 0 !important;
  transform: none !important;
}

.stat.attack {
  margin-left: 0 !important;
}
.stat.health {
  margin-right: 0 !important;
}

/* single center taunt shield */
.card.has-taunt .taunt-banner {
  position: absolute !important;
  left: 50% !important;
  top: 42% !important;
  transform: translate(-50%, -50%) !important;
  font-size: 2.2rem !important;
  opacity: 0.32 !important;
  z-index: 2 !important;
  pointer-events: none !important;
  filter: drop-shadow(0 2px 4px rgba(0, 60, 0, 0.4));
  animation: tauntShieldFloat 2.4s ease-in-out infinite;
}
.card.has-taunt .kw-badge.kw-taunt {
  display: none !important;
}
.card.has-taunt .card-badges .kw-taunt {
  display: none !important;
}
/* don't shift art on taunt */
.card.has-taunt .card-art {
  margin-top: 3px !important;
  height: 52% !important;
}
.card.has-taunt .card-stats {
  bottom: -6px !important;
}
.card.has-taunt .card-cost {
  top: -8px !important;
  left: -8px !important;
}

@keyframes tauntShieldFloat {
  0%, 100% { opacity: 0.28; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.4; transform: translate(-50%, -54%) scale(1.08); }
}

/* hand room for larger cards */
.hand-zone {
  min-height: 190px !important;
}
.board-row {
  min-height: calc(var(--card-h) + 16px) !important;
}

/* badges only top-right, not overlapping cost */
.card-badges {
  position: absolute !important;
  top: 4px !important;
  right: 4px !important;
  left: auto !important;
  z-index: 12 !important;
  flex-direction: column !important;
}


/* ========== quest panel ========== */
#screenMenu {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 16px;
  padding: 12px 16px !important;
  box-sizing: border-box;
}
#screenMenu .menu-shell {
  flex: 1 1 auto;
  max-width: 760px;
}
.quest-panel {
  flex: 0 0 280px;
  width: 280px;
  max-height: min(92vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(40, 28, 18, 0.96), rgba(18, 12, 8, 0.98));
  border: 1px solid rgba(220, 180, 100, 0.35);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 12px;
  z-index: 5;
  align-self: flex-start;
  margin-top: 0;
}
.quest-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 166, 107, 0.25);
}
.quest-panel-title {
  margin: 0;
  font-size: 1.05rem;
  color: #ffe8b0;
  font-weight: 900;
}
.quest-claimable-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8a6a, #c03030);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 1.4s ease-in-out infinite;
}
.quest-claimable-badge.hidden { display: none !important; }
.quest-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  flex: 1;
}
.quest-card {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(201, 166, 107, 0.22);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px 10px;
  align-items: start;
}
.quest-card.can-claim {
  border-color: rgba(120, 200, 100, 0.55);
  box-shadow: 0 0 12px rgba(80, 180, 80, 0.25);
}
.quest-card.claimed {
  opacity: 0.55;
}
.quest-card-icon {
  font-size: 1.5rem;
  line-height: 1;
  text-align: center;
  padding-top: 2px;
}
.quest-card-body {
  min-width: 0;
}
.quest-card-title {
  font-weight: 900;
  font-size: 0.88rem;
  color: #fff4dc;
  margin: 0 0 2px;
}
.quest-card-desc {
  font-size: 0.72rem;
  color: #d8c8a8;
  margin: 0 0 6px;
  line-height: 1.3;
}
.quest-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 800;
}
.quest-progress {
  color: #c8e8a0;
}
.quest-reward {
  color: #ffd080;
}
.quest-claim-btn {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(140, 220, 120, 0.5);
  background: linear-gradient(180deg, #5a9e48, #2e6a28);
  color: #fff;
  font-weight: 900;
  font-size: 0.82rem;
  cursor: var(--cursor-action, pointer);
}
.quest-claim-btn:hover { filter: brightness(1.1); }
.quest-claim-btn:disabled {
  opacity: 0.5;
  cursor: var(--cursor-default, default);
  background: #444;
  border-color: #555;
}
.quest-status-pill {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #c8b890;
}
.quest-status-pill.done { color: #9e9; background: rgba(60,120,60,0.35); }
.quest-status-pill.claimed { color: #aaa; }

@media (max-width: 900px) {
  #screenMenu {
    flex-direction: column !important;
    overflow-y: auto;
  }
  .quest-panel {
    width: min(100%, 420px);
    flex: 0 0 auto;
    max-height: 280px;
    order: 2;
  }
  #screenMenu .menu-shell { order: 1; }
}


/* ========== fix: game must fit viewport (tutorial + play) ========== */
#screenGame.active {
  position: fixed !important;
  inset: 0 !important;
  overflow: hidden !important;
  height: 100% !important;
  max-height: 100dvh !important;
}
#screenGame.active .game-wrapper {
  height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
}
#screenGame.active .hand-zone {
  min-height: 140px !important;
  max-height: 28vh;
  overflow: visible !important;
}
#screenGame.active .board {
  min-height: 72px !important;
}
/* spotlight must not block clicks; already pointer-events:none — keep */
.tutorial-overlay,
.tutorial-spotlight,
.tutorial-cursor {
  pointer-events: none !important;
}


/* ========== v2.9 polish ========== */
.btn-skip-tutorial {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 166, 107, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: var(--cream, #f5e6c8);
  cursor: var(--cursor-action, pointer);
  z-index: 20;
  pointer-events: auto !important;
  white-space: nowrap;
}
.btn-skip-tutorial:hover {
  background: rgba(196, 120, 58, 0.45);
}
.btn-skip-tutorial.hidden { display: none !important; }

/* stronger legal targets */
.card.targetable,
.hero-portrait.targetable {
  outline: 3px solid rgba(120, 220, 120, 0.95) !important;
  box-shadow:
    0 0 0 4px rgba(80, 200, 100, 0.35),
    0 0 22px rgba(100, 255, 120, 0.55) !important;
  cursor: var(--cursor-action, pointer) !important;
  animation: targetPulse 1.1s ease-in-out infinite;
}
@keyframes targetPulse {
  0%, 100% { filter: brightness(1.05); }
  50% { filter: brightness(1.18); }
}

/* телеграф атаки противника — красная вспышка, чтобы сразу было видно, по кому бьют */
.card.attack-telegraph,
.hero-portrait.attack-telegraph {
  outline: 3px solid rgba(255, 90, 70, 0.98) !important;
  box-shadow:
    0 0 0 5px rgba(255, 70, 50, 0.45),
    0 0 28px rgba(255, 80, 60, 0.7) !important;
  animation: attackTelegraphPulse 0.35s ease-in-out infinite !important;
  z-index: 30 !important;
}
@keyframes attackTelegraphPulse {
  0%, 100% { filter: brightness(1.08); transform: scale(1); }
  50% { filter: brightness(1.25); transform: scale(1.04); }
}
.card.can-attack:not(.exhausted) {
  box-shadow:
    0 0 0 2px rgba(255, 200, 80, 0.7),
    0 0 16px rgba(255, 180, 60, 0.45) !important;
  cursor: var(--cursor-action, pointer);
}
.hand .card.can-play {
  box-shadow:
    0 0 0 2px rgba(120, 200, 255, 0.75),
    0 8px 20px rgba(0, 0, 0, 0.4) !important;
}

.kw-badge.kw-battlecry {
  background: rgba(255, 200, 60, 0.25);
  border-color: rgba(255, 200, 60, 0.5);
}
.kw-badge.kw-deathrattle {
  background: rgba(160, 80, 200, 0.3);
  border-color: rgba(180, 100, 220, 0.55);
}

/* mobile / short screens */
@media (max-height: 720px) {
  :root {
    --card-w: 100px;
    --card-h: 138px;
  }
  #screenGame.active .hand-zone {
    min-height: 120px !important;
    max-height: 26vh;
  }
  .game-wrapper {
    gap: 2px !important;
    padding: 4px 8px 2px !important;
  }
  .end-turn-btn {
    padding: 8px 14px !important;
    font-size: 0.8rem !important;
  }
}
@media (max-width: 640px) {
  :root {
    --card-w: 88px;
    --card-h: 120px;
  }
  .btn-skip-tutorial {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
  .tutorial-coach {
    width: min(96%, 420px) !important;
  }
}


/* ========== Mulligan v3.0 ========== */
#mulliganOverlay {
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 4, 0.78);
  backdrop-filter: blur(6px);
}
#mulliganOverlay.hidden { display: none !important; }
.panel-mulligan {
  width: min(720px, 94vw);
  max-height: 90vh;
  overflow: auto;
  padding: 22px 20px 18px;
  text-align: center;
  background: linear-gradient(160deg, rgba(70, 48, 30, 0.96), rgba(28, 18, 12, 0.98));
  border: 2px solid rgba(201, 166, 107, 0.5);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
}
.mulligan-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin: 18px 0 16px;
  min-height: 160px;
}
.mulligan-card {
  cursor: var(--cursor-action, pointer) !important;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  pointer-events: auto !important;
}
.mulligan-card:hover {
  transform: translateY(-8px) scale(1.04);
}
.mulligan-card.mulligan-selected {
  outline: 3px solid #ff6b6b !important;
  box-shadow: 0 0 0 4px rgba(255, 80, 80, 0.35), 0 12px 28px rgba(0,0,0,0.45) !important;
  filter: saturate(0.7) brightness(0.92);
  transform: translateY(-6px);
}
.mulligan-card.mulligan-selected::after {
  content: "↺";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #ff8888;
  text-shadow: 0 2px 8px #000;
  z-index: 20;
  pointer-events: none;
}
.mulligan-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.mulligan-actions .menu-btn {
  min-width: 140px;
}

/* v3.1 */
.kw-badge.kw-lifesteal { background: rgba(200,40,60,0.3); }
.kw-badge.kw-windfury { background: rgba(100,160,255,0.3); }
.kw-badge.kw-freeze { background: rgba(140,200,255,0.35); }
.card.is-frozen {
  filter: saturate(0.5) brightness(1.1);
  box-shadow: inset 0 0 20px rgba(150,220,255,0.55) !important;
}
.card.is-frozen::after {
  content: "";
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 1.6rem;
  z-index: 15;
  pointer-events: none;
  opacity: 0.85;
}
.turn-history {
  position: absolute;
  right: 8px;
  top: 56px;
  width: min(220px, 28vw);
  max-height: 42vh;
  overflow: auto;
  z-index: 25;
  pointer-events: none;
  font-size: 0.72rem;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(201,166,107,0.25);
  border-radius: 12px;
  padding: 8px;
}
.hist-line { margin: 0 0 4px; line-height: 1.25; opacity: 0.9; }
.hist-combat { color: #f8a0b0; }
.hist-play { color: #a0e8a0; }
.hist-system { color: #a0c8f0; }
.pack-buy-row { margin: 12px 0; text-align: center; }
.quest-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.7;
  margin: 10px 4px 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.quest-card.weekly {
  border-color: rgba(120, 180, 255, 0.35);
}
@media (max-width: 900px) {
  .turn-history { display: none; }
}

.game-log .log-count {
  opacity: 0.65;
  font-size: 0.85em;
  margin-left: 2px;
}
/* turn-history отключён — не дублируем журнал */
.turn-history { display: none !important; }


/* v3.2 UX */
.game-log {
  pointer-events: auto !important;
}
.game-log::-webkit-scrollbar { width: 6px; }
.game-log::-webkit-scrollbar-thumb {
  background: rgba(201, 166, 107, 0.45);
  border-radius: 4px;
}

.battle-hint {
  position: absolute;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  z-index: 28;
  max-width: min(520px, 90vw);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.78);
  border: 1px solid rgba(201, 166, 107, 0.35);
  color: #f5e6c8;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: opacity 0.2s, transform 0.2s;
}
.battle-hint.hidden { opacity: 0; transform: translateX(-50%) translateY(8px); }
.battle-hint.hint-play { border-color: rgba(120, 220, 140, 0.45); }
.battle-hint.hint-attack { border-color: rgba(255, 140, 120, 0.5); }
.battle-hint.hint-end { border-color: rgba(160, 180, 255, 0.45); }

.match-history-panel {
  margin-top: 12px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(201,166,107,0.2);
}
.match-hist-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.match-hist-row.win { color: #9ee0a8; }
.match-hist-row.loss { color: #f0a0a8; }
.match-hist-meta { opacity: 0.7; font-size: 0.72rem; }

#overlayMatchStats {
  margin-top: 10px;
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.45;
}


/* ========== v3.3: log rail + hints toggle + quest align ========== */
body.no-hints .battle-hint { display: none !important; }

#screenGame.active .game-wrapper {
  padding-right: 172px !important;
  box-sizing: border-box !important;
  max-width: min(1240px, 100vw) !important;
}
#screenGame .game-log,
.game-log {
  position: absolute !important;
  right: 6px !important;
  top: 8px !important;
  bottom: 8px !important;
  left: auto !important;
  width: 156px !important;
  max-width: 156px !important;
  max-height: none !important;
  height: auto !important;
  z-index: 40 !important;
  pointer-events: auto !important;
}
.game-log:hover {
  width: 156px !important;
  max-height: none !important;
}
@media (max-width: 700px) {
  #screenGame.active .game-wrapper { padding-right: 8px !important; }
}



/* ========== v3.5 card anim + magic cast FX (no weather) ========== */
@keyframes cardPlayIn {
  0% { opacity: 0; transform: translateY(36px) scale(0.72) rotate(-8deg); }
  55% { opacity: 1; transform: translateY(-6px) scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes cardDeathPop {
  0% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.85; transform: scale(1.1) rotate(6deg); filter: brightness(1.3); }
  100% { opacity: 0; transform: scale(0.35) rotate(-14deg); }
}
@keyframes magicRing {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.9; border-width: 3px; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; border-width: 1px; }
}
@keyframes magicFlash {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}
@keyframes magicSpark {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.15); opacity: 0; }
}

.card.card-play-in {
  animation: cardPlayIn 0.48s cubic-bezier(0.22, 1.15, 0.36, 1) both;
}
.card.card-dying {
  animation: cardDeathPop 0.5s ease-in forwards;
  pointer-events: none !important;
}
body.no-anim .card.card-play-in,
body.no-anim .card.card-dying { animation: none !important; }

.fx-magic-ring {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(180, 140, 255, 0.85);
  box-shadow: 0 0 16px rgba(140, 100, 255, 0.5);
  pointer-events: none;
  z-index: 230;
  animation: magicRing 0.65s ease-out forwards;
}
.fx-magic-ring.dmg { border-color: rgba(255, 120, 70, 0.9); box-shadow: 0 0 16px rgba(255, 80, 40, 0.5); }
.fx-magic-ring.heal { border-color: rgba(100, 230, 140, 0.9); box-shadow: 0 0 16px rgba(60, 200, 100, 0.5); }
.fx-magic-ring.freeze { border-color: rgba(160, 220, 255, 0.95); box-shadow: 0 0 16px rgba(100, 180, 255, 0.55); }
.fx-magic-ring.draw { border-color: rgba(255, 210, 100, 0.9); box-shadow: 0 0 14px rgba(255, 190, 60, 0.45); }
.fx-magic-ring.buff { border-color: rgba(255, 160, 80, 0.9); box-shadow: 0 0 14px rgba(255, 140, 50, 0.45); }

.fx-magic-flash {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 229;
  background: radial-gradient(circle, rgba(200, 170, 255, 0.95) 0%, rgba(120, 80, 220, 0.35) 50%, transparent 70%);
  animation: magicFlash 0.4s ease-out forwards;
}
.fx-magic-flash.dmg { background: radial-gradient(circle, rgba(255, 150, 90, 0.95) 0%, rgba(220, 50, 20, 0.35) 50%, transparent 70%); }
.fx-magic-flash.heal { background: radial-gradient(circle, rgba(140, 255, 170, 0.95) 0%, rgba(40, 180, 80, 0.3) 50%, transparent 70%); }
.fx-magic-flash.freeze { background: radial-gradient(circle, rgba(200, 240, 255, 0.95) 0%, rgba(80, 160, 230, 0.35) 50%, transparent 70%); }
.fx-magic-flash.draw { background: radial-gradient(circle, rgba(255, 230, 140, 0.95) 0%, rgba(220, 160, 40, 0.3) 50%, transparent 70%); }
.fx-magic-flash.buff { background: radial-gradient(circle, rgba(255, 190, 120, 0.95) 0%, rgba(240, 120, 40, 0.3) 50%, transparent 70%); }

.fx-magic-spark {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 231;
  background: #d0b0ff;
  box-shadow: 0 0 6px rgba(180, 140, 255, 0.8);
  animation: magicSpark 0.55s ease-out forwards;
}
.fx-magic-spark.dmg { background: #ff9a60; box-shadow: 0 0 6px rgba(255, 100, 50, 0.8); }
.fx-magic-spark.heal { background: #7dff9a; box-shadow: 0 0 6px rgba(80, 220, 120, 0.8); }
.fx-magic-spark.freeze { background: #b0e8ff; box-shadow: 0 0 6px rgba(120, 200, 255, 0.85); }
.fx-magic-spark.draw { background: #ffd878; box-shadow: 0 0 6px rgba(255, 200, 80, 0.75); }
.fx-magic-spark.buff { background: #ffb060; box-shadow: 0 0 6px rgba(255, 150, 60, 0.75); }

/* v3.6 arena + history filter + daily */
.history-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 14px;
  font-weight: 700;
  color: #e8d8b0;
}
.history-filter-row select {
  background: rgba(0,0,0,0.4);
  color: #fff4dc;
  border: 1px solid rgba(201,166,107,0.4);
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 700;
}
.arena-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  min-height: 200px;
  padding: 12px 0 24px;
}
.arena-options .card {
  cursor: var(--cursor-action, pointer);
  transition: transform 0.15s, box-shadow 0.15s;
}
.arena-options .card:hover {
  transform: translateY(-10px) scale(1.06);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,200,80,0.5);
}
.arena-progress {
  text-align: center;
  font-weight: 900;
  color: #ffe8b0;
  font-size: 1.05rem;
  margin: 8px 0;
}
.panel-arena { max-width: 920px; }

/* v3.7 deck buttons + mana filter + exit */
.deck-header-actions .menu-btn-secondary {
  background: linear-gradient(180deg, #6a4a32, #3e2a1c) !important;
  border: 1px solid rgba(230, 190, 120, 0.55) !important;
  color: #fff6e0 !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  padding: 8px 14px !important;
  border-radius: 12px !important;
  opacity: 1 !important;
}
.deck-header-actions .menu-btn-secondary:hover {
  background: linear-gradient(180deg, #8a6038, #5a3c24) !important;
  color: #fff !important;
  border-color: rgba(255, 210, 120, 0.75) !important;
}
.deck-filter-mana {
  margin-top: 8px;
  flex-wrap: wrap;
}
.deck-filter-mana .chip-mana {
  min-width: 36px;
  padding: 4px 8px;
  font-weight: 900;
  color: #9ad0ff;
  border-color: rgba(80, 140, 220, 0.4);
}
.deck-filter-mana .chip-mana.active {
  background: rgba(60, 120, 200, 0.45);
  color: #e8f4ff;
  border-color: rgba(140, 190, 255, 0.7);
}
.menu-btn-exit {
  border-color: rgba(200, 80, 80, 0.45) !important;
  background: linear-gradient(180deg, rgba(80, 30, 30, 0.5), rgba(40, 16, 16, 0.7)) !important;
}
.menu-btn-exit:hover {
  border-color: rgba(255, 100, 100, 0.6) !important;
  background: linear-gradient(180deg, rgba(120, 40, 40, 0.55), rgba(60, 20, 20, 0.75)) !important;
}


/* ===== Leaderboards ===== */
.lb-tabs { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.lb-tab {
  flex: 1; min-width: 120px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.25);
  color: #e8e0d0; font-weight: 700; cursor: var(--cursor-action, pointer);
}
.lb-tab.active { background: linear-gradient(135deg, #5a4a2a, #3a3020); border-color: #c9a66b; color: #ffe6a8; }
.lb-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; }
.lb-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.06);
}
.lb-row.me { border-color: #c9a66b; background: rgba(201,166,107,0.12); }
.lb-rank { font-weight: 800; color: #c9a66b; }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; color: #a8d4ff; }
.lb-hint { opacity: 0.7; font-size: 0.85rem; margin-top: 8px; }

/* ===== IAP shop section ===== */
.iap-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); }
.iap-title { font-size: 1.05rem; font-weight: 800; color: #ffe6a8; margin: 0 0 8px; }
.iap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.iap-card {
  background: linear-gradient(160deg, rgba(80,50,120,0.45), rgba(20,15,40,0.7));
  border: 1px solid rgba(180,120,255,0.35); border-radius: 14px; padding: 14px;
}
.iap-card h4 { margin: 0 0 6px; color: #e8d5ff; }
.iap-card p { margin: 0 0 10px; font-size: 0.85rem; opacity: 0.85; line-height: 1.35; }
.iap-price { font-weight: 800; color: #ffd76a; margin-bottom: 8px; display: block; }
.iap-card .restart-btn { width: 100%; }
.challenge-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; margin-top: 20px; }
.challenge-entry, .deck-themes { border: 1px solid rgba(201,166,107,.45); background: rgba(20,16,12,.75); border-radius: 14px; padding: 16px; color: #f5e6c8; }
.challenge-entry { display: flex; flex-direction: column; gap: 12px; }
.challenge-entry h3, .challenge-entry p { margin: 0; line-height: 1.5; }
.challenge-entry button { margin-top: auto; min-height: 44px; }
.challenge-status { color: #bce5b4; font-size: .9rem; }
.deck-themes { margin-bottom: 16px; font-size: .9rem; line-height: 1.55; }
.deck-themes summary { cursor: var(--cursor-action, pointer); font-weight: 800; }
.deck-themes p { margin: 8px 0 0; }
.deck-row-theme { color: #e7ce8c; font-size: .75rem; margin-top: 2px; }
.game-wrapper.with-mechanics { grid-template-rows: auto auto auto minmax(60px, 1fr) auto minmax(60px, 1fr) auto minmax(150px, auto); }
.mechanics-status { padding: 6px 12px; border: 1px solid rgba(201,166,107,.5); border-radius: 10px; background: rgba(20,16,12,.94); color: #f5e6c8; font-size: .8rem; line-height: 1.4; text-align: center; }
.mechanics-status.hidden { display: none; }
.boss-reward-choices { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; width: 100%; }
.boss-reward-choice { padding: 4px; margin: 0; background: rgba(255,215,106,.08); border: 2px solid #c9a66b; border-radius: 16px; cursor: var(--cursor-action, pointer); color: inherit; font: inherit; }
.boss-reward-choice:hover, .boss-reward-choice:focus-visible { outline: 3px solid #ffe09a; outline-offset: 3px; background: rgba(255,215,106,.2); }
.boss-reward-choice .card { pointer-events: none; margin: 0; }
.reward-fixed-label { flex-basis: 100%; margin: 8px 0 0; }
#rewardOverlay .overlay-card { max-height: 94dvh; overflow-y: auto; width: min(800px, 96vw); max-width: min(800px, 96vw); }
@media (max-width: 600px) {
  .mechanics-status { font-size: .72rem; padding: 5px 8px; }
  .boss-reward-choices { gap: 8px; }
  .boss-reward-choice { padding: 2px; }
}
.iap-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em;
  background: #7b3fe4; color: #fff; padding: 2px 8px; border-radius: 999px; margin-bottom: 6px;
}
