/* Achilles Spire ("Slay the Crisis Spire") — Neo-Classical Spire, Animated Intents & Imperial Gold (`public/css/spire.css`) */
:root {
  --bg: #050811;
  --bg-panel: rgba(11, 17, 32, 0.92);
  --bg-elevated: rgba(18, 27, 48, 0.95);
  --border-gold: rgba(245, 158, 11, 0.42);
  --border-subtle: rgba(148, 163, 184, 0.22);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --gold: #f59e0b;
  --gold-bright: #fde047;
  --card-attack: #7f1d1d;
  --card-skill: #0c4a6e;
  --card-power: #78350f;
  --card-status: #334155;
  --card-upgraded: #10b981;
  --energy-orb: #f59e0b;
  --hp-red: #ef4444;
  --block-blue: #38bdf8;
  --poison-green: #22c55e;
  --wrath-crimson: #dc2626;
  --calm-cyan: #06b6d4;
  --divinity-purple: #a855f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html,
body {
  background: radial-gradient(circle at 50% 0%, #131f3d 0%, var(--bg) 74%);
  color: var(--text-main);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
}

/* ============================================================================
   1. Top HUD Bar (1:1 Slay the Spire Ergonomics — Compact Single-Row Fit)
   ============================================================================ */
.spire-hud {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 5px 12px;
  background: linear-gradient(180deg, rgba(5, 8, 17, 0.98) 0%, rgba(11, 17, 32, 0.94) 100%);
  border-bottom: 1px solid var(--border-gold);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
}

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(120, 53, 15, 0.35) 100%);
  border: 1px solid var(--border-gold);
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  color: var(--gold-bright);
  white-space: nowrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.stat-chip.hp-chip {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.stat-chip.gold-chip {
  border-color: rgba(245, 158, 11, 0.5);
  color: var(--gold-bright);
}

.stat-chip.floor-chip {
  border-color: rgba(56, 189, 248, 0.5);
  color: #bae6fd;
}

/* 3 Potion Belt Slots */
.potion-belt {
  display: flex;
  align-items: center;
  gap: 4px;
}

.potion-slot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.potion-slot.filled {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.32);
}

.potion-slot.filled:hover {
  transform: scale(1.14);
  border-color: var(--gold-bright);
}

/* Relic Ribbon */
.relic-ribbon {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(9, 14, 28, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.28);
  max-width: 220px;
  overflow-x: auto;
}

.relic-badge {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: help;
  transition: transform 0.14s ease;
}

.relic-badge:hover {
  transform: translateY(-1px) scale(1.1);
  border-color: var(--gold-bright);
}

/* HUD Buttons */
.hud-btn {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.hud-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.18);
}

.hud-btn.gold-cta {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: var(--gold-bright);
  color: #fff;
}

.hud-btn.hardcore-active {
  background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 100%);
  border-color: #fca5a5;
  color: #fff;
}

.ascension-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-gold);
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.ascension-select-wrap select {
  background: transparent;
  border: none;
  color: var(--gold-bright);
  font-size: 0.73rem;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

.ascension-select-wrap select option {
  background: #0b1120;
  color: #fff;
}

/* ============================================================================
   2. Class Selection & Compact Boon / Vault / Coach Strips
   ============================================================================ */
.top-control-strip {
  width: 100%;
  max-width: 1420px;
  margin: 4px auto 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.class-selector-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.class-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.88);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.class-pill-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.compact-subbars-wrap {
  width: 100%;
  max-width: 1420px;
  margin: 4px auto 0;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 6px;
}

.oracle-blessing-banner {
  padding: 4px 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(120, 53, 15, 0.4) 0%, rgba(12, 74, 110, 0.38) 100%);
  border: 1px solid rgba(245, 158, 11, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.oracle-banner-title {
  font-size: 0.73rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.blessing-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.blessing-buttons .hud-btn {
  padding: 3px 7px;
  font-size: 0.7rem;
}

/* ============================================================================
   3. Main Workspace Grid (Combat / Map / Campfire / Merchant / Event)
   ============================================================================ */
.spire-main {
  width: 100%;
  max-width: 1420px;
  margin: 4px auto 6px;
  padding: 0 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage-container {
  position: relative;
  flex: 1;
  min-height: 410px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 25%, rgba(23, 37, 84, 0.52) 0%, rgba(10, 15, 30, 0.96) 65%, rgba(5, 8, 17, 0.99) 100%);
  border: 1.5px solid var(--border-gold);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), inset 0 0 48px rgba(245, 158, 11, 0.06);
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.12s ease;
}

.stage-container.shake-attack {
  animation: stageShakeAttack 0.24s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.stage-container.shake-shield {
  animation: stagePulseShield 0.22s ease-out;
}

@keyframes stageShakeAttack {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 2px); }
  50% { transform: translate(5px, -2px); }
  75% { transform: translate(-3px, -1px); }
}

@keyframes stagePulseShield {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.006); box-shadow: 0 0 32px rgba(56, 189, 248, 0.45); }
}

/* Combat Battlefield Stage (Left: Hero + Orbs | Right: Enemies + Floating Intents) */
.combat-battlefield {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
  align-items: center;
  padding: 4px 8px;
  min-height: 175px;
}

.hero-stage,
.enemies-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.enemies-stage {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
}

/* Hephaestus 3-Slot Floating Orb Ring */
.hephaestus-orb-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 38px;
}

.orb-node {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  border: 2px solid rgba(56, 189, 248, 0.72);
  background: radial-gradient(circle, rgba(14, 116, 144, 0.72) 0%, rgba(15, 23, 42, 0.96) 100%);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.48);
  animation: orbFloat 2.4s ease-in-out infinite alternate;
}

.orb-node.lightning {
  border-color: #fde047;
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.6);
}

.orb-node.frost {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

.orb-node.dark {
  border-color: #a855f7;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.65);
}

.orb-node.plasma {
  border-color: #f97316;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.65);
}

.orb-node.empty {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
  box-shadow: none;
  color: var(--text-muted);
}

@keyframes orbFloat {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-4px); }
}

/* Fighter Pedestal Card (Hero & Enemy with 2.5D Pantheon Studio Portraits) */
.combatant-unit {
  position: relative;
  width: 215px;
  padding: 8px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.94) 0%, rgba(9, 14, 28, 0.96) 100%);
  border: 2px solid rgba(148, 163, 184, 0.34);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.16s ease;
}

.combatant-unit.hero-unit {
  border-color: rgba(245, 158, 11, 0.55);
}

.combatant-unit.hero-unit.stance-wrath {
  border-color: var(--wrath-crimson);
  box-shadow: 0 0 24px rgba(220, 38, 38, 0.6);
}

.combatant-unit.hero-unit.stance-calm {
  border-color: var(--calm-cyan);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.6);
}

.combatant-unit.hero-unit.stance-divinity {
  border-color: var(--divinity-purple);
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.8);
}

.combatant-unit.enemy-unit {
  cursor: pointer;
}

.combatant-unit.enemy-unit.targeted {
  border-color: var(--gold-bright);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.52);
}

.combatant-unit.enemy-unit.preview-hover-target {
  border-color: #ef4444;
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.72);
  transform: scale(1.03);
}

/* Floating Enemy Intent Bubble directly above Enemy's head */
.enemy-intent-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.96) 0%, rgba(30, 41, 59, 0.96) 100%);
  border: 1.5px solid var(--gold-bright);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  animation: orbFloat 2s ease-in-out infinite alternate;
}

.combatant-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.combatant-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.32) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 2.5px solid var(--gold);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  overflow: hidden;
  position: relative;
}

.combatant-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.combatant-corner-badge {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0b1120;
  border: 1.5px solid var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* HP & Block Bar */
.hp-bar-wrap {
  width: 100%;
  height: 19px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.38);
  position: relative;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
  transition: width 0.22s ease;
}

.hp-bar-fill.shielded {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
}

.hp-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  text-shadow: 0 1px 3px #000;
}

.target-damage-preview-pill {
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.24);
  border: 1px solid #f87171;
  color: #fecaca;
  display: none;
}

.target-damage-preview-pill.visible {
  display: inline-block;
}

.status-pills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 20px;
}

.status-pill {
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.status-pill.buff {
  border-color: #10b981;
  color: #6ee7b7;
}

.status-pill.debuff {
  border-color: #f43f5e;
  color: #fda4af;
}

/* ============================================================================
   4. Bottom Stage: 3/3 Energy Orb, Fanned Hand of Cards, Draw/Discard/Exhaust & End Turn
   ============================================================================ */
.combat-bottom-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.controls-and-energy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.energy-and-draw {
  display: flex;
  align-items: center;
  gap: 10px;
}

.glowing-energy-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fde047 0%, var(--energy-orb) 55%, #92400e 100%);
  border: 2.5px solid #fef08a;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.68);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #050811;
  font-weight: 900;
  font-size: 1.05rem;
}

.glowing-energy-orb small {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pile-counter-btn {
  padding: 6px 11px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.pile-counter-btn:hover {
  border-color: var(--gold);
}

.end-turn-btn {
  padding: 8px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: 2px solid #fca5a5;
  color: #fff;
  font-weight: 900;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(220, 38, 38, 0.45);
  transition: transform 0.14s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.end-turn-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

.turn-safety-chip {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(5, 8, 17, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.turn-safety-chip.safe {
  color: #6ee7b7;
  border-color: #10b981;
}

.turn-safety-chip.danger {
  color: #fde047;
  border-color: #f59e0b;
}

/* Fanned Hand of 5–10 Cards (Hover scales up 1.18x!) */
.card-hand-fan {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 154px;
  padding: 4px 4px 2px;
}

.spire-card {
  position: relative;
  width: 138px;
  min-height: 152px;
  border-radius: 11px;
  padding: 7px 8px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  border: 2px solid rgba(245, 158, 11, 0.56);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.68);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}

.spire-card.type-attack {
  background: linear-gradient(180deg, var(--card-attack) 0%, #1a0707 100%);
}

.spire-card.type-skill {
  background: linear-gradient(180deg, var(--card-skill) 0%, #061829 100%);
}

.spire-card.type-power {
  background: linear-gradient(180deg, var(--card-power) 0%, #211004 100%);
}

.spire-card.type-status,
.spire-card.type-curse {
  background: linear-gradient(180deg, var(--card-status) 0%, #0f172a 100%);
  border-color: rgba(148, 163, 184, 0.35);
  opacity: 0.78;
}

.spire-card:hover {
  transform: translateY(-12px) scale(1.18);
  z-index: 30;
  border-color: var(--gold-bright);
  box-shadow: 0 16px 32px rgba(245, 158, 11, 0.45);
}

.spire-card.upgraded {
  border-color: var(--card-upgraded);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.25);
}

.spire-card.ai-suggested-card {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
}

.spire-card.unaffordable {
  opacity: 0.56;
}

.card-cost-pip {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 0%, var(--energy-orb) 80%);
  border: 2px solid #fff;
  color: #050811;
  font-weight: 900;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-hotkey-pip {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.55);
}

.card-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  padding: 0 12px;
  line-height: 1.15;
}

.spire-card.upgraded .card-title {
  color: var(--card-upgraded);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.55);
}

.card-art-banner {
  position: relative;
  height: 44px;
  border-radius: 7px;
  background: radial-gradient(circle at 50% 40%, rgba(245, 158, 11, 0.22) 0%, rgba(5, 8, 17, 0.78) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 4px 0;
  overflow: hidden;
}

.card-art-portrait {
  position: absolute;
  width: 42px;
  height: 42px;
  right: 4px;
  bottom: -2px;
  opacity: 0.36;
  pointer-events: none;
  object-fit: cover;
  border-radius: 50%;
}

.card-type-pill {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
  color: #cbd5e1;
  font-weight: 800;
}

.card-desc {
  font-size: 0.7rem;
  line-height: 1.24;
  color: #f1f5f9;
  text-align: center;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   5. 3-Act 45-Floor Branching Node Map View (With SVG Connecting Lines)
   ============================================================================ */
.spire-map-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.act-tabs-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-grid-rows {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 14px;
  border-radius: 12px;
  background: rgba(5, 8, 17, 0.85);
  border: 1px solid var(--border-subtle);
}

.map-connections-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.map-floor-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.62);
}

.map-floor-nodes {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px;
}

.map-node-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.94);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-node-btn.available {
  border-color: var(--gold-bright);
  background: rgba(245, 158, 11, 0.25);
  color: #fff;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  transform: scale(1.05);
}

.map-node-btn.visited {
  border-color: var(--card-upgraded);
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

/* ============================================================================
   6. Campfire Sanctuary, Hermes Merchant, Mystery Filing Event & Modal Dialogs
   ============================================================================ */
.room-card-panel {
  max-width: 980px;
  margin: 6px auto;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aio-filing-capsule {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(12, 74, 110, 0.36);
  border-left: 4px solid var(--gold);
  font-size: 0.83rem;
  line-height: 1.42;
  color: #e2e8f0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.84);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-window {
  width: 100%;
  max-width: 1040px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px;
  background: #0b1120;
  border: 1.5px solid var(--border-gold);
  padding: 18px 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
}

.grid-cards-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.toast-banner {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  z-index: 150;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.96);
  border: 1.5px solid var(--gold-bright);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72);
}

/* ============================================================================
   7. 4-Studio Council HUD Pills, Vault Chests, Coach, Codex & 60fps FX Canvas
   ============================================================================ */
.era-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.92) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1.5px solid var(--gold-bright);
  color: var(--gold-bright);
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.era-pill-badge:hover {
  border-color: #ffffff;
  transform: translateY(-1px);
}

.streak-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #fb923c;
  color: #ffedd5;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.streak-pill-badge:hover {
  border-color: var(--gold-bright);
  transform: translateY(-1px);
}

.sovereign-council-strip {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(11, 17, 32, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  overflow: hidden;
}

.vault-chests-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.vault-chest-pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1.5px solid #c084fc;
  background: linear-gradient(180deg, #4c1d95 0%, #2e1065 100%);
  color: #f3e8ff;
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.vault-chest-pill:hover:not(:disabled) {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  transform: translateY(-1px);
}

.vault-chest-pill.claimed-chest,
.vault-chest-pill:disabled {
  opacity: 0.55;
  border-color: #10b981;
  cursor: default;
}

.macro-wire-pill {
  font-size: 0.71rem;
  font-weight: 700;
  color: #bae6fd;
  background: rgba(5, 8, 17, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 3px 9px;
  border-radius: 999px;
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-strip-panel {
  width: 100%;
  max-width: 1420px;
  margin: 4px auto 0;
  padding: 4px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.45) 0%, rgba(15, 23, 42, 0.94) 100%);
  border: 1px solid #10b981;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
}

.coach-strip-panel.hidden {
  display: none;
}

.coach-left-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.coach-left-copy strong {
  color: var(--gold-bright);
  font-size: 0.78rem;
  white-space: nowrap;
}

.coach-left-copy #coachBody {
  font-size: 0.74rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-right-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.coach-step-badge {
  padding: 2px 6px;
  border-radius: 5px;
  background: #10b981;
  color: #022c22;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}

.spire-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.stage-content-layer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.codex-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 12px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}

.codex-entry-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.codex-entry-card.era-active {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.38) 0%, rgba(15, 23, 42, 0.95) 100%);
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

[hidden] {
  display: none !important;
}

/* ============================================================================
   8. Laptop (1280x720) & Mobile Touch (390x844) Zero-Overflow Viewport Tuning
   ============================================================================ */
.spire-card,
.orb-node,
.enemy-intent-bubble,
.combatant-unit {
  will-change: transform;
  transform: translateZ(0);
}

@media (max-height: 780px) {
  .spire-hud {
    padding: 3px 10px;
  }
  .compact-subbars-wrap {
    margin-top: 2px;
  }
  .coach-strip-panel {
    margin-top: 2px;
    padding: 3px 10px;
  }
  .stage-container {
    min-height: 360px;
    padding: 6px 12px 8px;
  }
  .combat-battlefield {
    min-height: 150px;
    padding: 2px 6px;
  }
  .combatant-avatar-wrap,
  .combatant-avatar {
    width: 52px;
    height: 52px;
  }
  .card-hand-fan {
    min-height: 138px;
  }
  .spire-card {
    width: 128px;
    min-height: 136px;
    padding: 5px 7px 6px;
  }
  .card-art-banner {
    height: 34px;
    margin: 2px 0;
  }
  .card-desc {
    min-height: 32px;
    font-size: 0.66rem;
  }
}

@media (max-width: 860px) {
  #hudSeedChip,
  #eraBadgePill,
  #btnOpenCompendium,
  #btnSharePlaque,
  #btnSpeedToggle,
  #btnSpawnDuo,
  #btnQuickCampfire,
  #btnQuickMerchant,
  #btnQuickMystery,
  .oracle-blessing-banner,
  .macro-wire-pill {
    display: none;
  }

  .spire-hud {
    padding: 4px 8px;
    gap: 3px 5px;
  }

  .brand-pill {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .stat-chip,
  .hud-btn {
    padding: 3px 7px;
    font-size: 0.68rem;
  }

  .potion-slot {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  .relic-badge {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    font-size: 0.78rem;
  }

  .top-control-strip {
    padding: 0 8px;
    margin-top: 2px;
    gap: 3px;
  }

  .class-selector-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    gap: 4px;
  }

  .class-pill-btn {
    padding: 3px 7px;
    font-size: 0.66rem;
    flex-shrink: 0;
  }

  .compact-subbars-wrap {
    grid-template-columns: 1fr;
    padding: 0 8px;
    margin-top: 2px;
  }

  .sovereign-council-strip {
    padding: 3px 8px;
  }

  .coach-strip-panel {
    margin: 2px 8px 0;
    width: auto;
    padding: 3px 8px;
    gap: 4px;
  }

  .coach-left-copy strong {
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .coach-right-actions .hud-btn {
    padding: 2px 6px;
    font-size: 0.64rem;
  }

  .coach-left-copy #coachBody {
    display: none;
  }

  .spire-main {
    padding: 0 8px;
    margin: 3px auto 4px;
  }

  .stage-container {
    padding: 6px 8px 8px;
    min-height: 340px;
  }

  .combat-battlefield {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 2px;
    min-height: 155px;
  }

  .hephaestus-orb-ring {
    min-height: 28px;
    gap: 6px;
  }

  .orb-node {
    width: 28px;
    height: 28px;
    font-size: 0.58rem;
  }

  .combatant-unit {
    width: 100%;
    max-width: 168px;
    padding: 6px 6px;
  }

  .combatant-avatar-wrap,
  .combatant-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.35rem;
  }

  .enemy-intent-bubble {
    font-size: 0.66rem;
    padding: 2px 7px;
  }

  .card-hand-fan {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 6px 4px 4px;
    min-height: 142px;
    gap: 6px;
  }

  .spire-card {
    flex: 0 0 116px;
    width: 116px;
    min-height: 134px;
    padding: 5px 6px;
    scroll-snap-align: center;
  }

  .spire-card:hover {
    transform: translateY(-4px) scale(1.04);
  }

  .card-art-banner {
    height: 30px;
    margin: 2px 0;
    font-size: 1.15rem;
  }

  .card-desc {
    font-size: 0.63rem;
    min-height: 30px;
  }

  .glowing-energy-orb {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
  }

  .pile-counter-btn {
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .end-turn-btn {
    padding: 6px 12px;
    font-size: 0.74rem;
  }
}
