/* Achilles Tactics ("TFT × Super Auto Pets Pantheon Auto-Battler") — Stylesheet (`public/css/tactics.css`) */
:root {
  --bg: #050811;
  --card: #0c1324;
  --card-elev: #111b33;
  --border-gold: rgba(212, 175, 55, 0.45);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --gold: #d4af37;
  --gold-bright: #fde047;
  --emerald: #10b981;
  --sky: #38bdf8;
  --crimson: #ef4444;
  --amethyst: #a855f7;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

html,
body {
  background: radial-gradient(circle at 50% 0%, #101c38 0%, var(--bg) 70%);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  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);
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Top Navigation Header */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(12, 19, 36, 0.92);
  border-bottom: 1px solid var(--border-gold);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-gold);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.03em;
}

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

.mode-switch {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

.mode-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.18s ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.1));
  color: var(--gold-bright);
  border: 1px solid var(--border-gold);
}

.regime-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--sky);
  font-size: 0.78rem;
  font-weight: 600;
}

.regime-pill:hover {
  background: rgba(56, 189, 248, 0.22);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-elev);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.nav-btn.gold-cta {
  background: linear-gradient(135deg, #d4af37, #b48618);
  color: #050811;
  border-color: var(--gold-bright);
  font-weight: 700;
}

.oracle-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: var(--emerald);
}

/* Main 3-Column Auto-Battler Workspace */
.tactics-workspace {
  display: grid;
  grid-template-columns: 270px 1fr 270px;
  gap: 14px;
  max-width: 1580px;
  margin: 12px auto;
  padding: 0 14px 20px;
}

@media (max-width: 1200px) {
  .tactics-workspace {
    grid-template-columns: 1fr;
  }
}

/* Left Rail: 9 Desk Synergy Trait Tracker */
.rail-panel {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 0.96rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.trait-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trait-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(17, 27, 51, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  transition: all 0.18s ease;
}

.trait-row.tier-bronze {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.14);
}

.trait-row.tier-silver {
  border-color: #94a3b8;
  background: rgba(148, 163, 184, 0.18);
}

.trait-row.tier-gold {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.26), rgba(168, 85, 247, 0.14));
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.25);
}

.trait-hex {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
  background: #1e293b;
  font-size: 1rem;
  flex-shrink: 0;
}

.trait-row.tier-bronze .trait-hex {
  background: linear-gradient(135deg, #b45309, #78350f);
}

.trait-row.tier-silver .trait-hex {
  background: linear-gradient(135deg, #cbd5e1, #475569);
}

.trait-row.tier-gold .trait-hex {
  background: linear-gradient(135deg, #fde047, #b45309);
}

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

.trait-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trait-bp {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--gold);
}

.trait-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center Arena: HUD + 4x7 Tactical Grid + 8-Slot Bench + 5-Slot Agora Shop */
.center-arena {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
}

.hud-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hud-stat {
  display: flex;
  flex-direction: column;
}

.hud-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.hud-val {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.hud-val.gold {
  color: var(--gold-bright);
}

.hud-val.emerald {
  color: var(--emerald);
}

.hud-val.crimson {
  color: var(--crimson);
}

.battle-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-pill {
  background: var(--card-elev);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 5px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.speed-pill.active {
  border-color: var(--sky);
  color: var(--sky);
  background: rgba(56, 189, 248, 0.14);
}

.start-battle-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #04130e;
  border: 1px solid #34d399;
  padding: 8px 18px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

.start-battle-btn:hover {
  filter: brightness(1.08);
}

/* Battlefield Container with 50g Interest Coins on Side Rail */
.battlefield-shell {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  background: radial-gradient(circle at 50% 45%, #162344 0%, #091022 85%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 12px;
  position: relative;
}

.interest-coin-pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(5, 8, 17, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 4px;
}

.interest-coin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px dashed rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.interest-coin.lit {
  background: radial-gradient(circle at 30% 30%, #fde047, #d4af37 65%, #92400e);
  color: #050811;
  font-weight: 800;
  border: 2px solid #fef08a;
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.65);
  transform: scale(1.06);
}

.board-section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

/* 4x7 Tactical Grid */
.tactical-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.grid-tile {
  aspect-ratio: 1.08;
  min-height: 68px;
  background: rgba(12, 19, 36, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.grid-tile.enemy-tile {
  background: rgba(45, 14, 28, 0.42);
  border-color: rgba(239, 68, 68, 0.22);
}

.grid-tile.player-tile:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.grid-tile.selected-tile {
  border: 2px solid var(--sky);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.unit-token {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.unit-stars {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
}

.unit-stars.stars-1 {
  color: #cbd5e1;
}
.unit-stars.stars-2 {
  color: #38bdf8;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}
.unit-stars.stars-3 {
  color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.95);
}

.unit-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  background: #0f172a;
}

.unit-name-tag {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-bars {
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hp-bar-track,
.mana-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 2px;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  background: var(--emerald);
  transition: width 0.18s ease;
}

.hp-bar-fill.enemy {
  background: var(--crimson);
}

.mana-bar-fill {
  height: 100%;
  background: var(--sky);
  transition: width 0.18s ease;
}

/* 8-Slot Reserve Bench */
.bench-bar {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
}

.bench-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.bench-slot {
  min-height: 74px;
  background: var(--card-elev);
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.bench-slot.occupied {
  border-style: solid;
  border-color: rgba(212, 175, 55, 0.45);
}

.bench-slot.selected-bench {
  border: 2px solid var(--sky);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

/* 5-Slot Olympus Agora Shop */
.agora-shop {
  background: linear-gradient(180deg, #0f182e 0%, #090f1f 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.odds-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.shop-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-action-btn {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border-gold);
  background: var(--card-elev);
  color: var(--text);
}

.shop-action-btn.reroll-btn {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.08));
  color: var(--gold-bright);
}

.shop-action-btn.xp-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.08));
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--sky);
}

.shop-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}

@media (max-width: 900px) {
  .shop-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bench-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.shop-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
  position: relative;
}

.shop-card:hover:not(.purchased) {
  transform: translateY(-3px);
  border-color: var(--gold-bright);
}

.shop-card.tier-1 {
  border-top: 3px solid var(--emerald);
}
.shop-card.tier-2 {
  border-top: 3px solid var(--amethyst);
}
.shop-card.tier-3 {
  border-top: 3px solid var(--gold-bright);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.14) 0%, var(--card) 100%);
}

.shop-card.purchased {
  opacity: 0.32;
  pointer-events: none;
}

.merge-alert-pill {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, #fde047, #d4af37);
  color: #050811;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 17, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

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

.modal-card {
  background: var(--card);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  max-width: 880px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--gold);
}

.close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.85rem;
}

.tab-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--card-elev);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tab-btn.active {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.14);
}

.passport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.passport-card {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.passport-card.active {
  border-color: var(--border-gold);
}

.genome-bars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.genome-item {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
}

.toast-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--card-elev);
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.toast-banner.hidden {
  display: none;
}
