/* ═══════════════════════════════════════════════════════════════════════════
   PuniCodex Mythic Duel — game UI styles
   Tabs: Lobby / Collection / Packs / Battle. Dark temple theme, gold accents,
   rarity color system, foil shimmer for mythics.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --game-bg: #080b12;
  --game-bg-2: #0e1420;
  --card-bg: #111827;
  --card-border: rgba(212, 175, 55, 0.22);
  --card-hover: rgba(212, 175, 55, 0.45);
  --text-main: #f0f2f5;
  --text-dim: #9aa3b2;
  --text-muted: #6b7280;
  --accent: #d4af37;
  --accent-soft: rgba(212, 175, 55, 0.12);
  --danger: #ef4444;
  --success: #22c55e;
  --info: #3b82f6;

  --rarity-common: #9aa3b2;
  --rarity-uncommon: #4ade80;
  --rarity-rare: #60a5fa;
  --rarity-epic: #c084fc;
  --rarity-legendary: #f59e0b;
  --rarity-mythic: #f43f5e;

  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body.game-body {
  background: var(--game-bg);
  color: var(--text-main);
  font-family: var(--font-body);
  margin: 0;
  min-height: 100vh;
}

.game-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top nav ─────────────────────────────────────────────────────────────── */
.game-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.game-nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-display);
}

.game-nav .nav-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.game-nav .nav-tabs::-webkit-scrollbar {
  display: none;
}

.game-nav .nav-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}

.game-nav .nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.game-nav .nav-tab.active {
  color: var(--game-bg);
  background: var(--accent);
}

.game-nav .currencies {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.currency-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-weight: 600;
}

.currency-pill .icon {
  color: var(--accent);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  background: var(--card-bg);
  color: var(--text-main);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--game-bg);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn.secondary {
  background: transparent;
  color: var(--text-dim);
}

.btn.secondary:hover:not(:disabled) {
  color: var(--text-main);
  border-color: var(--card-hover);
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.game-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.game-section {
  display: none;
  animation: fadeIn 0.25s ease;
}

.game-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 1.25rem;
}

.section-header h1,
.section-header h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-main);
}

.section-header p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 65ch;
}

/* ── Lobby ───────────────────────────────────────────────────────────────── */
.lobby-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  margin-bottom: 2.5rem;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(212, 175, 55, 0.14), transparent 60%),
    var(--game-bg-2);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
}

.lobby-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin: 0 0 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.lobby-hero .tagline {
  color: var(--text-dim);
  max-width: 60ch;
  margin: 0 auto 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.lobby-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.lobby-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(8, 11, 18, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  min-width: 110px;
}

.stat-card .stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.rule-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.1rem 1.25rem;
}

.rule-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1rem;
}

.rule-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ── Filters ─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.85rem;
}

.search-input,
.filter-select {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  color: var(--text-main);
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.search-input:focus,
.filter-select:focus {
  border-color: var(--card-hover);
}

.filter-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  text-transform: capitalize;
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--card-hover);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--game-bg);
}

/* ── Card grid & game cards ──────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.game-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.85rem;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.game-card .card-art {
  position: relative;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a2233, #0c1018);
  overflow: hidden;
}

.game-card .card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.game-card .card-art.fallback {
  background: linear-gradient(160deg, #1a2233, #0c1018);
}

.game-card .card-art .fallback-icon {
  font-size: 3rem;
  opacity: 0.85;
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.35);
}

.game-card .card-body {
  padding: 0.7rem 0.8rem 0.8rem;
}

.game-card .card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card .card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-bottom: 0.45rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card .card-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.game-card .card-stats .stat-cost {
  color: var(--info);
}

.game-card .card-ability {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2em;
}

.game-card .card-count {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(8, 11, 18, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

/* Rarity frames */
.game-card.rarity-common { border-bottom: 3px solid var(--rarity-common); }
.game-card.rarity-uncommon { border-bottom: 3px solid var(--rarity-uncommon); }
.game-card.rarity-rare { border-bottom: 3px solid var(--rarity-rare); }
.game-card.rarity-epic { border-bottom: 3px solid var(--rarity-epic); }
.game-card.rarity-legendary {
  border-bottom: 3px solid var(--rarity-legendary);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.12);
}
.game-card.rarity-mythic {
  border-bottom: 3px solid var(--rarity-mythic);
  box-shadow: 0 0 22px rgba(244, 63, 94, 0.16);
}

/* Foil shimmer (mythics) */
.game-card.foil::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.08) 45%,
    rgba(212, 175, 55, 0.16) 50%,
    rgba(255, 255, 255, 0.08) 55%,
    transparent 70%
  );
  background-size: 250% 250%;
  animation: foilShimmer 3.2s linear infinite;
  pointer-events: none;
}

@keyframes foilShimmer {
  0% { background-position: 120% 120%; }
  100% { background-position: -20% -20%; }
}

/* ── Packs ───────────────────────────────────────────────────────────────── */
.pack-shop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.pack-option {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.85rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pack-option .pack-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

.pack-option .pack-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.55;
  flex: 1;
}

.pack-option .pack-cost {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pack-stage {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.pack {
  width: 180px;
  height: 250px;
  border-radius: 1rem;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(212, 175, 55, 0.25), transparent 65%),
    linear-gradient(160deg, #1c2536, #0b0f17);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: packPulse 1.6s ease-in-out infinite;
  transition: transform 0.2s ease;
}

.pack:hover {
  transform: scale(1.04) rotate(-1deg);
}

.pack .pack-seal {
  font-size: 3rem;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

@keyframes packPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(212, 175, 55, 0.15); }
  50% { box-shadow: 0 0 44px rgba(212, 175, 55, 0.4); }
}

.pack-reveal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 200px));
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.pack-reveal .reveal-card {
  opacity: 0;
  animation: revealPop 0.5s ease forwards;
}

@keyframes revealPop {
  0% { opacity: 0; transform: scale(0.6) translateY(20px); }
  60% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

.pack-reveal-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

/* ── Deck builder ────────────────────────────────────────────────────────── */
.deck-builder {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.deck-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.85rem;
  padding: 1rem;
}

.deck-panel h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.deck-panel-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.deck-panel-head h3 {
  margin: 0;
}

.deck-panel-head .search-input {
  min-width: 0;
}

#deck-size {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-body);
}

.deck-pool {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 560px;
  overflow-y: auto;
}

.pool-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--game-bg-2);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.12s ease;
  font-size: 0.82rem;
}

.pool-row:hover {
  border-color: var(--card-hover);
}

.pool-row.maxed {
  opacity: 0.45;
  cursor: default;
}

.pool-row .pool-cost {
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
  color: var(--info);
  background: rgba(59, 130, 246, 0.12);
  border-radius: 0.4rem;
  padding: 0.1rem 0;
}

.pool-row .pool-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-row .pool-meta {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.deck-slots {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 480px;
  overflow-y: auto;
  margin-bottom: 0.9rem;
}

.deck-slot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--game-bg-2);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.deck-slot:hover {
  border-color: var(--danger);
}

.deck-slot .slot-cost {
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
  color: var(--info);
}

.deck-slot .slot-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-slot .slot-count {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
}

.deck-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem 0;
}

.deck-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Battlefield ─────────────────────────────────────────────────────────── */
.battlefield {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.06), transparent 55%),
    var(--game-bg-2);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.5rem;
}

.hero-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 0.55rem 1rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.hero-card .hero-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.hero-card .hero-health {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid var(--danger);
  color: #fca5a5;
  font-weight: 700;
  font-size: 1rem;
}

.hero-card.enemy.targetable,
.hero-card.enemy:hover {
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}

.hero-card.enemy.targetable {
  cursor: crosshair;
}

.hero-side {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.deck-count {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ink-pips {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.ink-pips .pip {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid var(--card-hover);
  background: transparent;
}

.ink-pips .pip.full {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.ink-pips .ink-num {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

.board-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: stretch;
  min-height: 118px;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}

.turn-banner {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.3rem 0;
  border-top: 1px dashed rgba(212, 175, 55, 0.18);
  border-bottom: 1px dashed rgba(212, 175, 55, 0.18);
}

.turn-banner.enemy-turn {
  color: var(--danger);
}

/* Minions */
.minion {
  position: relative;
  width: 96px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.45rem 0.4rem 0.5rem;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.minion .minion-art {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
}

.minion .minion-art img {
  max-height: 42px;
  max-width: 100%;
  object-fit: contain;
}

.minion .minion-name {
  font-size: 0.66rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}

.minion .minion-stats {
  display: flex;
  justify-content: space-between;
}

.minion .minion-stats span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
}

.minion .minion-stats .atk {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--rarity-legendary);
  color: #fcd34d;
}

.minion .minion-stats .hp {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.minion .minion-stats .hp.damaged {
  color: var(--danger);
}

.minion .minion-status {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  display: flex;
  gap: 0.2rem;
}

.minion .minion-status .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: 0.68rem;
  background: var(--game-bg);
  border: 1px solid var(--card-hover);
}

.minion.sick {
  opacity: 0.6;
}

.minion.ready {
  border-color: var(--success);
  cursor: pointer;
}

.minion.ready:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.25);
}

.minion.selected {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.45);
  transform: translateY(-4px);
}

.minion.targetable {
  border-color: var(--danger);
  cursor: crosshair;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.3);
}

/* Hand */
.hand-row {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem 0 1rem;
  min-height: 130px;
}

.hand-card {
  position: relative;
  width: 108px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.5rem 0.45rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.hand-card .hand-cost {
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  border: 2px solid var(--info);
  color: #bfdbfe;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hand-card .minion-art {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
  overflow: hidden;
}

.hand-card .minion-art img {
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}

.hand-card .hand-name {
  font-size: 0.68rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.hand-card .hand-stats {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}

.hand-card.playable {
  border-color: var(--success);
}

.hand-card.playable:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.hand-card.unplayable {
  opacity: 0.55;
  cursor: default;
}

.hand-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.45);
  transform: translateY(-8px);
}

/* Controls & log */
.controls {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.75rem;
  align-items: start;
}

.game-log {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.game-log .log-entry {
  padding: 0.05rem 0;
}

.game-log .log-entry.log-turn {
  color: var(--accent);
  font-weight: 600;
}

.game-log .log-entry.log-end {
  color: var(--text-main);
  font-weight: 700;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(3, 4, 8, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--game-bg-2);
  border: 1px solid var(--card-hover);
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-art {
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: linear-gradient(160deg, #1a2233, #0c1018);
  margin-bottom: 1rem;
  overflow: hidden;
}

.modal-art img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.modal-art .fallback-icon {
  font-size: 4.5rem;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.2rem;
}

.modal-original {
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.modal-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: capitalize;
  margin-bottom: 0.75rem;
}

.modal-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.modal-tags .tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
}

.modal-tags .tag.rarity-tag {
  border-color: currentColor;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.modal-stats .mstat {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  text-align: center;
  padding: 0.5rem 0.25rem;
}

.modal-stats .mstat .mstat-value {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.modal-stats .mstat .mstat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.modal-ability {
  background: var(--accent-soft);
  border: 1px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 0.9rem;
}

.modal-ability strong {
  color: var(--accent);
}

.modal-flavor {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0.9rem;
}

.modal-lore {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.modal-lore:hover {
  border-bottom-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ── Reward overlay ──────────────────────────────────────────────────────── */
.reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(3, 4, 8, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.reward-card {
  background: var(--game-bg-2);
  border: 1px solid var(--card-hover);
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.reward-card .reward-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.reward-card .reward-title.win { color: var(--accent); }
.reward-card .reward-title.loss { color: var(--danger); }
.reward-card .reward-title.draw { color: var(--text-dim); }

.reward-card .reward-amount {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.reward-card .reward-amount strong {
  color: var(--accent);
}

.reward-card .reward-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(340px, calc(100vw - 2.5rem));
}

.toast {
  background: var(--game-bg-2);
  border: 1px solid var(--card-hover);
  border-left: 3px solid var(--accent);
  border-radius: 0.6rem;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: var(--text-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.game-footer {
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid rgba(212, 175, 55, 0.08);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .deck-builder {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: auto auto;
  }

  .game-log {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .game-main {
    padding: 1.25rem 0.75rem 2rem;
  }

  .game-nav {
    flex-wrap: wrap;
    padding: 0.6rem 0.75rem;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .game-card .card-art {
    height: 110px;
  }

  .minion {
    width: 82px;
  }

  .hand-card {
    width: 96px;
  }

  .lobby-hero {
    padding: 1.75rem 0.75rem 1.5rem;
  }

  .modal-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card.foil::after,
  .pack {
    animation: none;
  }

  .pack-reveal .reveal-card {
    animation-duration: 0.01s;
  }
}

/* ── Mythic Duel v2: hero panels + spectacle layer ───────────────────────── */

#battlefield-wrap { position: relative; scroll-margin-top: 72px; }

#battle-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

.hero-panel {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 0.9rem;
  margin: 0.4rem 0;
  background: linear-gradient(180deg, rgba(20, 20, 30, 0.9), rgba(10, 10, 16, 0.9));
  border: 1px solid var(--card-border, #2a2a3a);
  border-radius: 12px;
}

.hero-panel .hero-art {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #2a2a3a 0%, #0c0c14 80%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-panel .hero-art img { width: 100%; height: 100%; object-fit: contain; }
.hero-panel .hero-sigil { font-size: 2rem; color: var(--accent, #D4AF37); }

.hero-panel .hero-info { flex: 1; min-width: 0; }

.hero-panel .hero-name {
  font-family: var(--font-display, 'Cinzel', serif);
  font-size: 0.98rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}

.hero-panel .hero-hpbar {
  height: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.hero-panel .hero-hpfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #58c76a, #a8e6a0);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s;
}

.hero-panel .hero-hpfill.low { background: linear-gradient(90deg, #d85656, #ff9d7a); }

.hero-panel .hero-hptext {
  font-size: 0.72rem;
  color: var(--text-dim, #8a8599);
  margin-top: 0.2rem;
  letter-spacing: 0.06em;
}

.hero-power {
  margin-top: 0.45rem;
  background: none;
  border: 1px solid var(--accent-dim, rgba(212, 175, 55, 0.3));
  color: var(--text-dim, #8a8599);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: not-allowed;
  transition: all 0.2s ease;
}

.hero-power.usable {
  color: var(--accent, #D4AF37);
  border-color: var(--accent, #D4AF37);
  cursor: pointer;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
  animation: power-glow 2.2s ease-in-out infinite;
}

.hero-power.usable:hover { background: rgba(212, 175, 55, 0.12); }

.hero-power.used { opacity: 0.45; }

@keyframes power-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(212, 175, 55, 0.18); }
  50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.4); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-power.usable { animation: none; }
}

@media (max-width: 640px) {
  #battlefield-wrap { scroll-margin-top: 148px; }
  .hero-panel { gap: 0.6rem; padding: 0.5rem 0.65rem; }
  .hero-panel .hero-art { width: 44px; height: 44px; }
}

/* Unified hero panels: counts line, ink pips, and the strike target state. */
.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-dim, #8a8599);
  letter-spacing: 0.05em;
}

#enemy-hero-panel { cursor: default; transition: border-color 0.15s ease, box-shadow 0.15s ease; }

#enemy-hero-panel.targetable {
  cursor: crosshair;
  border-color: var(--danger, #ef4444);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
  animation: target-pulse 1.6s ease-in-out infinite;
}

@keyframes target-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.22); }
  50% { box-shadow: 0 0 22px rgba(239, 68, 68, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  #enemy-hero-panel.targetable { animation: none; }
}

/* Tap feedback: every interactive battle element declares its cursor. */
.minion { cursor: pointer; }
.minion.sick { cursor: not-allowed; }
.hand-card.playable { cursor: pointer; }
.hand-card.unplayable { cursor: not-allowed; }

/* The hidden attribute must always win over the overlay's display. */
.reward-overlay[hidden] {
  display: none !important;
}

/* The hidden attribute must always win over every overlay's display. */
.modal-overlay[hidden],
.reward-overlay[hidden],
.pack-overlay[hidden],
.modal[hidden] {
  display: none !important;
}

/* ── Ink Shop ── */
.ink-shop-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--card-border, #2a2a3a);
}
.ink-shop-title {
  font-family: var(--font-display, 'Cinzel', serif);
  color: var(--accent, #D4AF37);
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}
.ink-shop-sub {
  color: var(--text-dim, #8a8599);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.ink-option {
  border-color: rgba(212, 175, 55, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ELITE PRESENTATION LAYER — "The Obsidian Arena"
   A ceremonial temple-tableau: ambient stage, engraved arena, medallion
   champions, breathing minions, gilded controls. Transform/opacity-only
   motion; every flourish bows to prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Ambient stage ───────────────────────────────────────────────────────── */
body.game-body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(59, 46, 109, 0.28), transparent 60%),
    radial-gradient(ellipse 800px 460px at 85% -5%, rgba(212, 175, 55, 0.10), transparent 55%),
    radial-gradient(ellipse 1000px 700px at 50% 115%, rgba(20, 32, 64, 0.35), transparent 60%),
    var(--game-bg);
  background-attachment: fixed;
}

/* Slow aurora drift — a single fixed layer, transform-only. */
body.game-body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 40% 28% at 30% 25%, rgba(212, 175, 55, 0.05), transparent 70%),
    radial-gradient(ellipse 36% 26% at 72% 60%, rgba(96, 125, 212, 0.05), transparent 70%);
  animation: aurora-drift 36s ease-in-out infinite alternate;
}

/* Starfield + vignette — static, one repaint. */
body.game-body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.5), transparent 100%),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, 0.35), transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 8%, rgba(255, 235, 190, 0.45), transparent 100%),
    radial-gradient(1px 1px at 32% 68%, rgba(255, 255, 255, 0.28), transparent 100%),
    radial-gradient(1px 1px at 88% 78%, rgba(255, 235, 190, 0.3), transparent 100%),
    radial-gradient(1.5px 1.5px at 6% 85%, rgba(255, 255, 255, 0.3), transparent 100%),
    radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(3, 5, 9, 0.55) 100%);
}

@keyframes aurora-drift {
  from { transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to { transform: translate3d(2.5%, 2%, 0) scale(1.06); }
}

.game-layout { position: relative; z-index: 1; }

/* ── Nav refinement ──────────────────────────────────────────────────────── */
.game-nav .brand {
  background: linear-gradient(100deg, #f3dfa0 10%, var(--accent) 45%, #9c7a1e 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

.game-nav .nav-tab.active {
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  background: linear-gradient(180deg, #ecd07a, #c39a2b);
}

/* ── Buttons: engraved gold plate ────────────────────────────────────────── */
.btn.primary {
  background: linear-gradient(180deg, #eed27e 0%, #d4af37 55%, #a8842a 100%);
  border-color: rgba(255, 230, 150, 0.55);
  color: #221a05;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(90, 64, 8, 0.35),
    0 6px 20px rgba(212, 175, 55, 0.22);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5);
}

.btn.primary:hover:not(:disabled) {
  filter: none;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 4px rgba(90, 64, 8, 0.35),
    0 10px 26px rgba(212, 175, 55, 0.34);
}

.btn.primary:active:not(:disabled) { transform: translateY(0); }

#end-turn:not(:disabled) {
  animation: endturn-breathe 2.6s ease-in-out infinite;
}

@keyframes endturn-breathe {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -2px 4px rgba(90,64,8,0.35), 0 6px 20px rgba(212,175,55,0.22); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -2px 4px rgba(90,64,8,0.35), 0 8px 30px rgba(212,175,55,0.45); }
}

/* ── Lobby: rotating golden corona ───────────────────────────────────────── */
.lobby-hero { position: relative; overflow: hidden; }

.lobby-hero::before {
  content: '';
  position: absolute;
  inset: -60%;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0deg, rgba(212, 175, 55, 0.22) 35deg, transparent 80deg,
    transparent 170deg, rgba(212, 175, 55, 0.14) 210deg, transparent 260deg
  );
  animation: arena-spin 14s linear infinite;
}

.lobby-hero > * { position: relative; }

@keyframes arena-spin {
  to { transform: rotate(360deg); }
}

.lobby-hero h1 {
  background: linear-gradient(100deg, #f7e7b0 5%, var(--accent) 40%, #8f721c 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(212, 175, 55, 0.3));
}

.stat-card {
  backdrop-filter: blur(6px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-hover);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

/* ── Game cards: gem, edition badge, art glow, holo shimmer ─────────────── */
.game-card {
  transform-style: preserve-3d;
  will-change: transform;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.game-card .card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 55%, var(--card-glow, rgba(212, 175, 55, 0.12)), transparent 75%);
  pointer-events: none;
}

.game-card .card-art img { position: relative; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55)); }

.rarity-gem {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 0.8rem;
  height: 0.8rem;
  transform: rotate(45deg);
  border-radius: 2px;
  background: var(--rarity-common);
  box-shadow: 0 0 8px currentColor, inset 0 1px 1px rgba(255, 255, 255, 0.5);
  z-index: 3;
}

.rarity-uncommon .rarity-gem { background: var(--rarity-uncommon); color: var(--rarity-uncommon); }
.rarity-rare .rarity-gem { background: var(--rarity-rare); color: var(--rarity-rare); }
.rarity-epic .rarity-gem { background: var(--rarity-epic); color: var(--rarity-epic); }
.rarity-legendary .rarity-gem { background: var(--rarity-legendary); color: var(--rarity-legendary); }
.rarity-mythic .rarity-gem { background: var(--rarity-mythic); color: var(--rarity-mythic); }

.edition-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(8, 11, 18, 0.78);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  backdrop-filter: blur(4px);
}

.edition-badge.ed-holo { color: #7db8ff; border-color: rgba(96, 165, 250, 0.5); }
.edition-badge.ed-full-art { color: #f5c451; border-color: rgba(245, 158, 11, 0.55); }
.edition-badge.ed-secret { color: #fb7ea0; border-color: rgba(244, 63, 94, 0.5); }

/* Holo & secret: light sweeps across the art. */
.game-card.edition-holo .card-art::after,
.game-card.edition-secret .card-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(160, 200, 255, 0.22) 46%, rgba(255, 255, 255, 0.3) 50%, rgba(160, 200, 255, 0.22) 54%, transparent 70%);
  background-size: 280% 100%;
  animation: holo-sweep 4.5s ease-in-out infinite;
}

.game-card.edition-secret .card-art::after {
  background: linear-gradient(115deg, transparent 30%, rgba(244, 114, 182, 0.2) 46%, rgba(255, 215, 230, 0.32) 50%, rgba(244, 114, 182, 0.2) 54%, transparent 70%);
  background-size: 280% 100%;
}

@keyframes holo-sweep {
  0%, 20% { background-position: 120% 0; }
  60%, 100% { background-position: -60% 0; }
}

.game-card .card-stats span {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── The Arena ───────────────────────────────────────────────────────────── */
.battlefield {
  position: relative;
  margin: 0.4rem 0;
  padding: 1rem 1.1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background:
    radial-gradient(ellipse 62% 42% at 50% 82%, var(--arena-glow, transparent), transparent 72%),
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(212, 175, 55, 0.07), transparent 60%),
    linear-gradient(180deg, #0e1220 0%, #0a0d16 50%, #080a11 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -24px 48px rgba(0, 0, 0, 0.55),
    0 30px 70px rgba(0, 0, 0, 0.5);
}

/* Corner filigree: four small golden embers at the arena corners. */
.battlefield::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 0.9rem;
  pointer-events: none;
  background-image:
    radial-gradient(circle 3px at 14px 14px, rgba(212, 175, 55, 0.7), transparent 100%),
    radial-gradient(circle 3px at calc(100% - 14px) 14px, rgba(212, 175, 55, 0.7), transparent 100%),
    radial-gradient(circle 3px at 14px calc(100% - 14px), rgba(212, 175, 55, 0.45), transparent 100%),
    radial-gradient(circle 3px at calc(100% - 14px) calc(100% - 14px), rgba(212, 175, 55, 0.45), transparent 100%);
  border: 1px solid rgba(212, 175, 55, 0.08);
}

/* Lane seams. */
.board-row {
  position: relative;
  min-height: 118px;
  padding: 0.55rem 0.25rem;
}

#enemy-board { border-bottom: 1px solid rgba(212, 175, 55, 0.1); }
#player-board { border-top: 1px solid rgba(212, 175, 55, 0.1); }

/* Turn banner: engraved plate. */
.turn-banner {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  text-align: center;
  padding: 0.5rem 0.5rem 0.5rem 0.74rem;
  margin: 0.15rem 0;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.13), rgba(212, 175, 55, 0.04));
  border-top: 1px solid rgba(212, 175, 55, 0.28);
  border-bottom: 1px solid rgba(212, 175, 55, 0.28);
  text-shadow: 0 0 16px rgba(212, 175, 55, 0.45);
}

.turn-banner.enemy-turn {
  color: #c9a0a0;
  border-color: rgba(190, 90, 90, 0.3);
  background: linear-gradient(180deg, rgba(190, 90, 90, 0.12), rgba(190, 90, 90, 0.03));
  text-shadow: 0 0 16px rgba(220, 100, 100, 0.4);
}

/* ── Champions: medallion portraits + active-turn corona ────────────────── */
.hero-panel {
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-panel .hero-art {
  position: relative;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.hero-panel.active-turn { border-color: rgba(212, 175, 55, 0.55); }

.hero-panel.active-turn::before {
  content: '';
  position: absolute;
  inset: -60%;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(212, 175, 55, 0.3) 30deg, transparent 75deg, transparent 180deg, rgba(212, 175, 55, 0.18) 210deg, transparent 255deg);
  animation: arena-spin 9s linear infinite;
}

.hero-panel.active-turn > * { position: relative; }

.hero-panel .hero-hpbar { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }

.hero-panel .hero-hpfill { position: relative; overflow: hidden; }

.hero-panel .hero-hpfill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, transparent 45%);
  border-radius: inherit;
}

.hero-panel .hero-hpfill.low { animation: lowhp-pulse 1.4s ease-in-out infinite; }

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

/* ── Minions: engraved frames, breathing readiness, summon ceremony ─────── */
.minion {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--card-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.minion .minion-stats span {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.minion.ready {
  animation: ready-breathe 2.4s ease-in-out infinite;
}

@keyframes ready-breathe {
  0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 6px rgba(34, 197, 94, 0.12); }
  50% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 18px rgba(34, 197, 94, 0.38); }
}

.minion.selected {
  box-shadow: 0 0 0 1px var(--accent), 0 0 26px rgba(212, 175, 55, 0.55), 0 10px 24px rgba(0, 0, 0, 0.5);
}

.minion.summon {
  animation: summon-rise 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes summon-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.6); }
  60% { opacity: 1; transform: translateY(-3px) scale(1.06); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Hand: lift on playable, snap-scroll on small screens ───────────────── */
.hand-card { transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }

.hand-card.playable {
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(212, 175, 55, 0.1);
}

.hand-card.playable:hover {
  transform: translateY(-9px) scale(1.04);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55), 0 0 18px rgba(212, 175, 55, 0.28);
}

@media (max-width: 640px) {
  #player-hand {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    scroll-snap-type: x mandatory;
    padding-bottom: 1.1rem;
    -webkit-overflow-scrolling: touch;
  }
  #player-hand .hand-card { scroll-snap-align: center; flex-shrink: 0; }
}

/* ── Hero-hit vignette ───────────────────────────────────────────────────── */
#hit-vignette {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
}

#hit-vignette.flash-self {
  animation: hit-self 0.55s ease-out;
}

#hit-vignette.flash-foe {
  animation: hit-foe 0.55s ease-out;
}

@keyframes hit-self {
  0% { opacity: 0; }
  18% { opacity: 1; box-shadow: inset 0 0 120px 40px rgba(220, 60, 60, 0.5); }
  100% { opacity: 0; box-shadow: inset 0 0 160px 60px rgba(220, 60, 60, 0); }
}

@keyframes hit-foe {
  0% { opacity: 0; }
  18% { opacity: 1; box-shadow: inset 0 0 120px 40px rgba(212, 175, 55, 0.45); }
  100% { opacity: 0; box-shadow: inset 0 0 160px 60px rgba(212, 175, 55, 0); }
}

/* ── Packs & reveal ceremony ─────────────────────────────────────────────── */
.pack-option {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.pack-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(212, 175, 55, 0.12);
}

.pack-option::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(212, 175, 55, 0.14) 50%, transparent 65%);
  background-size: 260% 100%;
  animation: holo-sweep 5.5s ease-in-out infinite;
}

.pack-reveal .reveal-card {
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.6));
}

.pack-reveal .reveal-card.rarity-legendary { filter: drop-shadow(0 0 26px rgba(245, 158, 11, 0.4)); }
.pack-reveal .reveal-card.rarity-mythic { filter: drop-shadow(0 0 30px rgba(244, 63, 94, 0.45)); }

/* ── Modal & toast: engraved glass ───────────────────────────────────────── */
.modal-overlay { backdrop-filter: blur(6px); }

.modal-card {
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.toast {
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
body.game-body ::-webkit-scrollbar { width: 9px; height: 9px; }
body.game-body ::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
body.game-body ::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
body.game-body ::-webkit-scrollbar-thumb:hover { background-color: rgba(212, 175, 55, 0.5); }

/* ── Focus visibility ────────────────────────────────────────────────────── */
.game-body :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Reduced motion: the arena goes still ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  body.game-body::before,
  .lobby-hero::before,
  .hero-panel.active-turn::before,
  .pack-option::after,
  .game-card.edition-holo .card-art::after,
  .game-card.edition-secret .card-art::after {
    animation: none;
  }
  .minion.ready,
  .hero-panel .hero-hpfill.low,
  #end-turn:not(:disabled) {
    animation: none;
  }
  .minion.summon { animation-duration: 0.01s; }
  #hit-vignette.flash-self,
  #hit-vignette.flash-foe { animation-duration: 0.15s; }
}

/* ── The moves, visible ──────────────────────────────────────────────────── */
.hand-ability {
  margin-top: 0.25rem;
  font-size: 0.56rem;
  line-height: 1.3;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hand-card { width: 108px; }

.minion-ability {
  font-size: 0.54rem;
  line-height: 1.2;
  color: rgba(212, 175, 55, 0.75);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: -0.15rem 0 0.25rem;
}

/* The Grimoire */
.help-btn {
  min-width: 2.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  border-color: rgba(212, 175, 55, 0.4);
}

.help-btn:hover:not(:disabled) {
  color: #f3dfa0;
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}

.grimoire {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.grimoire-row {
  border-left: 2px solid rgba(212, 175, 55, 0.4);
  padding-left: 0.75rem;
}

.grimoire-term {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.grimoire-def {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ── Combat previews: the exchange, before you commit ────────────────────── */
.preview-chip {
  position: absolute;
  top: -1.35rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  white-space: nowrap;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: rgba(8, 11, 18, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hero-panel .preview-chip.hero-preview {
  top: -0.5rem;
  right: 0.6rem;
  left: auto;
  transform: none;
  border-color: rgba(212, 175, 55, 0.55);
  color: #f3dfa0;
}

/* ── The action bar: a minion's kit ──────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem auto 0;
  padding: 0.5rem 0.75rem;
  max-width: 640px;
  background: linear-gradient(180deg, rgba(20, 20, 30, 0.92), rgba(10, 10, 16, 0.92));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  animation: actionbar-rise 0.18s ease;
}

@keyframes actionbar-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.action-title {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.action-btn {
  padding: 0.42rem 0.9rem;
  font-size: 0.78rem;
}

.action-btn.armed {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.action-disarm { min-width: 2.2rem; }

.minion-status .badge.special-pip {
  color: #1a1405;
  background: linear-gradient(180deg, #eed27e, #c39a2b);
  border-color: rgba(255, 230, 150, 0.7);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.55);
  animation: special-pip-glow 2s ease-in-out infinite;
}

@keyframes special-pip-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(212, 175, 55, 0.35); }
  50% { box-shadow: 0 0 14px rgba(212, 175, 55, 0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .minion-status .badge.special-pip { animation: none; }
}

/* ── Oracle difficulty badge + pantheon bond frame ───────────────────────── */
.oracle-tier {
  color: rgba(212, 175, 55, 0.75);
  font-style: italic;
  cursor: help;
}

.minion.bonded {
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 -2px 0 rgba(212, 175, 55, 0.6);
}

.minion.bonded::after {
  content: 'bond';
  position: absolute;
  bottom: -0.45rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1a1405;
  background: linear-gradient(180deg, #eed27e, #c39a2b);
  border-radius: 999px;
  padding: 0.08rem 0.4rem;
}

.board-row {
  padding-bottom: 0.9rem;
}

/* ── The Deckhand: mini-cards, filters, curve analysis ───────────────────── */
.deck-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.deck-filters .search-input { flex: 1; min-width: 160px; }
.deck-filters .filter-select { min-width: 120px; }

.deck-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 0.6rem;
  max-height: 520px;
  overflow-y: auto;
  padding: 0.75rem 0.25rem 0.75rem 0;
}

.pool-mini {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.65rem;
  padding: 0.45rem 0.4rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.pool-mini:hover {
  transform: translateY(-2px);
  border-color: var(--card-hover);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.pool-mini.maxed { opacity: 0.45; cursor: not-allowed; }

.pool-mini.edition-holo { border-color: rgba(96, 165, 250, 0.45); }
.pool-mini.edition-full-art { border-color: rgba(245, 158, 11, 0.5); }
.pool-mini.edition-secret { border-color: rgba(244, 63, 94, 0.45); }

.pool-mini-art {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  overflow: hidden;
}

.pool-mini-art img {
  max-height: 56px;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.pool-mini-cost {
  position: absolute;
  top: -0.4rem;
  left: -0.4rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.pool-mini-name {
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-mini-stats { font-size: 0.62rem; color: var(--text-dim); margin-top: 0.1rem; }

.pool-mini-ability {
  font-size: 0.56rem;
  font-style: italic;
  color: rgba(212, 175, 55, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.pool-mini-count { font-size: 0.62rem; font-weight: 700; color: var(--accent); margin-top: 0.15rem; }

/* Analysis */
.deck-analysis {
  margin: 0.5rem 0 0.75rem;
}

.curve-hist {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 64px;
  padding: 0.25rem 0.25rem 0;
  border-bottom: 1px solid var(--card-border);
}

.curve-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0.1rem;
}

.curve-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #eed27e, #a8842a);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
  transition: height 0.25s ease;
}

.curve-num { font-size: 0.6rem; font-weight: 700; color: var(--text-dim); }
.curve-label { font-size: 0.58rem; color: var(--text-muted); }

.deck-split {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.45rem;
  letter-spacing: 0.03em;
}

.deck-slot .slot-stats {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: auto;
  margin-right: 0.4rem;
}

/* ── The Arena 3D: cinematic presentation ────────────────────────────────── */
#arena-3d {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 1.2rem;
  display: none;
}

#battlefield-wrap.cinematic #arena-3d { display: block; }

/* The 3D stage replaces the engraved table; interaction floats above it. */
#battlefield-wrap.cinematic .battlefield {
  position: relative;
  z-index: 2;
  min-height: clamp(430px, 56vh, 620px);
  background: none;
  border: none;
  box-shadow: none;
}

@media (max-width: 640px) {
  #battlefield-wrap.cinematic .battlefield {
    min-height: clamp(340px, 52vh, 480px);
  }
}

/* The 3D scene + projected chips own the stage — the DOM rows stand down. */
#battlefield-wrap.cinematic .board-row { display: none; }

#battlefield-wrap.cinematic .battlefield::before { display: none; }

#battlefield-wrap.cinematic .hero-panel,
#battlefield-wrap.cinematic .controls,
#battlefield-wrap.cinematic .action-bar,
#battlefield-wrap.cinematic .hand-row {
  position: relative;
  z-index: 2;
}

/* Hero panels float as compact corner cards above the arena floor. */
#battlefield-wrap.cinematic .hero-panel {
  position: absolute;
  z-index: 3;
  width: 190px;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  margin: 0;
  background: linear-gradient(180deg, rgba(14, 15, 24, 0.82), rgba(8, 9, 14, 0.82));
  backdrop-filter: blur(3px);
}

#battlefield-wrap.cinematic .hero-panel.side-1 { top: 10px; left: 10px; }

/* side-0 keeps its static y (just under the stage), then lifts by its own
   height into the stage's bottom-left corner — anchored bottom:10px of the
   wrap it would cover the controls, and unshifted it would cover the hand. */
#battlefield-wrap.cinematic .hero-panel.side-0 {
  left: 10px;
  transform: translateY(calc(-100% - 10px));
}

#battlefield-wrap.cinematic .hero-panel .hero-art {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

#battlefield-wrap.cinematic .hero-panel .hero-name {
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

#battlefield-wrap.cinematic .hero-panel .hero-hpbar { height: 7px; }

#battlefield-wrap.cinematic .hero-panel .hero-hptext {
  font-size: 0.62rem;
  margin-top: 0.12rem;
}

#battlefield-wrap.cinematic .hero-panel .hero-meta {
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.62rem;
}

#battlefield-wrap.cinematic .hero-panel .hero-power {
  margin-top: 0.3rem;
  padding: 0.18rem 0.55rem;
  font-size: 0.62rem;
}

#battlefield-wrap.cinematic .hero-panel .ink-pips .pip {
  width: 8px;
  height: 8px;
}

/* The turn banner floats as a small pill mirroring the enemy corner card —
   never across the mascots' central space. */
#battlefield-wrap.cinematic .turn-banner {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  padding: 0.28rem 0.75rem;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 999px;
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(3px);
}

#battlefield-wrap.cinematic .turn-banner.enemy-turn {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
}

/* Minion frames go transparent — the characters stand in the world below. */
#battlefield-wrap.cinematic .minion {
  background: none;
  border-color: transparent;
  box-shadow: none;
}

#battlefield-wrap.cinematic .minion .minion-art {
  opacity: 0;
  height: 64px;
}

#battlefield-wrap.cinematic .minion .minion-name {
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.7);
}

#battlefield-wrap.cinematic .minion .minion-stats span {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Selection and targeting read as light on the stage itself. */
#battlefield-wrap.cinematic .minion.selected {
  box-shadow: none;
  border-radius: 0.6rem;
  background: radial-gradient(ellipse at 50% 20%, rgba(212, 175, 55, 0.22), transparent 70%);
}

#battlefield-wrap.cinematic .minion.targetable {
  border-radius: 0.6rem;
  background: radial-gradient(ellipse at 50% 20%, rgba(239, 68, 68, 0.22), transparent 70%);
}

#battlefield-wrap.cinematic .minion.ready {
  animation: none;
  border-radius: 0.6rem;
  background: radial-gradient(ellipse at 50% 20%, rgba(34, 197, 94, 0.12), transparent 70%);
}

#battlefield-wrap.cinematic .minion.sick {
  opacity: 0.55;
}

#presentation-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  #battlefield-wrap.cinematic #arena-3d { display: none; }
}

/* ── Projected chips: stats pinned to the characters ─────────────────────── */
#arena-chips {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: none;
}

#battlefield-wrap.cinematic #arena-chips { display: block; }

.arena-chip {
  position: absolute;
  transform: translate(-50%, -118%);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.3rem;
  border-radius: 999px;
  background: rgba(6, 8, 14, 0.55);
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  pointer-events: auto;
  cursor: pointer;
}

.arena-chip:hover { transform: translate(-50%, -124%); }

/* Board states mirrored from the DOM minions: bond ring, strike-ready,
   armed attacker, legal target. */
.arena-chip.bonded { box-shadow: 0 0 0 1.5px rgba(212, 175, 55, 0.85); }

.arena-chip.ready {
  box-shadow: 0 0 0 1.5px rgba(34, 197, 94, 0.9), 0 0 10px rgba(34, 197, 94, 0.5);
}

.arena-chip.selected {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 1), 0 0 14px rgba(212, 175, 55, 0.65);
}

.arena-chip.targetable {
  box-shadow: 0 0 0 1.5px rgba(239, 68, 68, 0.9), 0 0 12px rgba(239, 68, 68, 0.55);
  cursor: crosshair;
}

.arena-chip .preview-chip {
  border-radius: 999px;
  height: auto;
  padding: 0.12rem 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(30, 22, 8, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.6);
  color: var(--accent, #d4af37);
}

@media (max-width: 640px) {
  .arena-chip { transform: translate(-50%, -118%) scale(0.85); }
  .arena-chip:hover { transform: translate(-50%, -124%) scale(0.85); }
}

.arena-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.arena-chip .chip-atk {
  background: rgba(245, 158, 11, 0.92);
  border: 1px solid rgba(255, 230, 150, 0.7);
  color: #fff;
}

.arena-chip .chip-hp {
  background: rgba(239, 68, 68, 0.92);
  border: 1px solid rgba(255, 190, 190, 0.6);
  color: #fff;
}

.arena-chip .chip-hp.damaged { background: rgba(190, 40, 40, 0.95); }

.arena-chip .chip-sick {
  border-radius: 999px;
  height: auto;
  padding: 0.12rem 0.5rem;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(8, 11, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-dim, #9aa3b2);
}

/* The characters carry their numbers now — the DOM frames keep only the name. */
#battlefield-wrap.cinematic .minion .minion-stats { visibility: hidden; }
#battlefield-wrap.cinematic .minion .minion-name {
  position: absolute;
  bottom: -1.15rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ── Pantheon ascendant marker ───────────────────────────────────────────── */
.minion.ascendant {
  border-color: rgba(139, 92, 246, 0.55);
}

.minion.ascendant::before {
  content: 'ascendant';
  position: absolute;
  top: -0.45rem;
  left: -0.45rem;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e9d5ff;
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
  z-index: 2;
}

#battlefield-wrap.cinematic .minion.ascendant::before { display: none; }

/* ── The Deck Lab ────────────────────────────────────────────────────────── */
.deck-lab {
  margin-top: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 0.6rem;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.03));
}

.deck-lab-archetype {
  font-size: 0.78rem;
  color: #d8b4fe;
  line-height: 1.45;
}

.deck-lab-tip {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ── The Oracle Path ─────────────────────────────────────────────────────── */
.oracle-path {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.oracle-gate {
  flex: 1;
  min-width: 130px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  background: var(--card-bg);
  text-align: center;
  opacity: 0.55;
  transition: all 0.2s ease;
}

.oracle-gate.current {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.25);
}

.oracle-gate.cleared {
  opacity: 0.9;
  border-color: rgba(34, 197, 94, 0.5);
}

.gate-sigil {
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.oracle-gate.cleared .gate-sigil { color: var(--success); }

.gate-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.gate-tribute {
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.gate-link {
  align-self: center;
  flex: 0 0 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.4), transparent);
}

/* ── The guided first duel ───────────────────────────────────────────────── */
#tutorial-bubble {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  max-width: 340px;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(18, 18, 28, 0.97), rgba(10, 10, 16, 0.97));
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 0.9rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(212, 175, 55, 0.15);
  animation: tutorial-rise 0.25s ease;
}

@keyframes tutorial-rise {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tutorial-step {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.tutorial-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #fff;
  margin-bottom: 0.25rem;
}

.tutorial-text {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.tutorial-skip {
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}

.tutorial-skip:hover { color: var(--text-main); }

.tutorial-hl {
  position: relative;
  z-index: 5;
  box-shadow: 0 0 0 2px var(--accent), 0 0 26px rgba(212, 175, 55, 0.55) !important;
  border-radius: 0.6rem;
  animation: tutorial-pulse 1.4s ease-in-out infinite;
}

@keyframes tutorial-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(212, 175, 55, 0.35); }
  50% { box-shadow: 0 0 0 3px #f3dfa0, 0 0 30px rgba(212, 175, 55, 0.65); }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-hl { animation: none; }
}

/* ── Drag-to-attack ──────────────────────────────────────────────────────── */
.drag-arrow {
  position: fixed;
  z-index: 95;
  height: 3px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.9), rgba(239, 68, 68, 0.9));
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

.drag-arrow::after {
  content: '';
  position: absolute;
  right: -7px;
  top: -5px;
  border: 6px solid transparent;
  border-left-color: rgba(239, 68, 68, 0.95);
}

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

@media (pointer: coarse) {
  .drag-arrow { display: none; }
}

/* ── Recent duels + phantom gate ─────────────────────────────────────────── */
.recent-duels {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 2rem;
}

.recent-empty { color: var(--text-muted); font-size: 0.85rem; }

.recent-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: 0.55rem;
  background: var(--card-bg);
  font-size: 0.78rem;
}

.recent-outcome {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.72rem;
}

.recent-row.win .recent-outcome { background: rgba(34, 197, 94, 0.2); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.5); }
.recent-row.loss .recent-outcome { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.4); }
.recent-row.draw .recent-outcome { background: rgba(212, 175, 55, 0.15); color: var(--accent); border: 1px solid rgba(212, 175, 55, 0.4); }

.recent-foe { flex: 1; color: var(--text-main); }
.recent-score { color: var(--accent); font-weight: 700; }
.recent-date { color: var(--text-muted); font-size: 0.68rem; }

/* Phantom gate */
.phantom-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.9rem 0 0.35rem;
}

.phantom-code {
  font-family: ui-monospace, monospace;
  font-size: 0.62rem;
  word-break: break-all;
  color: var(--text-dim);
  background: rgba(8, 11, 18, 0.7);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
  max-height: 76px;
  overflow-y: auto;
  margin-bottom: 0.45rem;
}

.phantom-input { width: 100%; margin-bottom: 0.5rem; }

.phantom-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.phantom-row:last-child { border-bottom: none; }
.phantom-name { flex: 1; color: var(--text-main); font-size: 0.82rem; }
.phantom-level { font-size: 0.66rem; color: var(--text-muted); font-style: italic; }

/* ── Card levels ─────────────────────────────────────────────────────────── */
.card-level {
  position: absolute;
  bottom: -0.4rem;
  right: -0.4rem;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  z-index: 3;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
}

.card-level.lvl-2 {
  background: linear-gradient(180deg, #d7dce4, #8f9aab);
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: #1c2430;
}

.card-level.lvl-3 {
  background: linear-gradient(180deg, #f3dfa0, #c39a2b);
  border: 1px solid rgba(255, 230, 150, 0.85);
  color: #221a05;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

.pool-mini { position: relative; }
.game-card .card-level { bottom: auto; top: 2.1rem; right: 0.5rem; position: absolute; }

/* ── Published odds + the Archive Exchange ───────────────────────────────── */
.pack-odds { margin: 1.5rem 0; }

.odds-table {
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  overflow: hidden;
  font-size: 0.72rem;
}

.odds-row {
  display: grid;
  grid-template-columns: 1.8fr repeat(6, 0.7fr);
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-bg);
  align-items: center;
  text-align: center;
}

.odds-row span:first-child { text-align: left; color: var(--text-dim); }
.odds-row span { color: var(--text-main); }
.odds-row:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
.odds-head { font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.62rem; }

.exchange-section { margin: 1.5rem 0; }

.exchange-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.exchange-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--card-border);
  border-radius: 0.55rem;
  background: var(--card-bg);
}

.exchange-row.maxed { opacity: 0.55; }

.exchange-cost {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
  flex-shrink: 0;
}

.exchange-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exchange-edition {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.exchange-buy {
  flex-shrink: 0;
  background: linear-gradient(180deg, #eed27e, #c39a2b);
  border: 1px solid rgba(255, 230, 150, 0.5);
  border-radius: 999px;
  color: #221a05;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s ease;
}

.exchange-buy:hover:not(:disabled) { filter: brightness(1.1); }
.exchange-buy:disabled { opacity: 0.6; cursor: not-allowed; background: var(--card-bg); color: var(--text-dim); border-color: var(--card-border); }
