:root {
  --bg-deep: #08151f;
  --bg-mid: #12304a;
  --panel: rgba(8, 24, 37, 0.84);
  --panel-line: rgba(168, 205, 223, 0.18);
  --text: #f0f6f7;
  --muted: #a8c5cf;
  --gold: #d9b36a;
  --gold-strong: #f1c978;
  --teal: #45b9a7;
  --teal-strong: #66dbc8;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(69, 185, 167, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(217, 179, 106, 0.18), transparent 26%),
    linear-gradient(145deg, #061019 0%, #0d2434 45%, #183a4f 100%);
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.hero-panel,
.board-panel,
.card {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.5fr minmax(260px, 360px);
  gap: 20px;
  padding: 24px;
  margin-bottom: 20px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
}

.hero-copy,
.details {
  color: var(--muted);
  line-height: 1.5;
}

.setup-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.setup-panel label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

select,
.action {
  border-radius: 14px;
  border: 1px solid rgba(240, 246, 247, 0.16);
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.action {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.action:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 246, 247, 0.3);
}

.action.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-strong));
  color: #10202d;
  font-weight: 700;
}

.action.subtle {
  background: rgba(255, 255, 255, 0.04);
}

.action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 20px;
}

.board-panel {
  padding: 18px;
}

.board-stage {
  position: relative;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.turn-stats {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(240, 246, 247, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.stat-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-icon.reserve {
  background: rgba(241, 201, 120, 0.2);
  color: #f1c978;
}

.stat-icon.territory {
  background: rgba(102, 219, 200, 0.18);
  color: #66dbc8;
}

.stat-icon.troops {
  background: rgba(150, 178, 255, 0.18);
  color: #9ec4ff;
}

.board-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.phaser-root {
  min-height: 720px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(240, 246, 247, 0.08);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(28, 60, 79, 0.7), rgba(8, 21, 31, 0.92));
}

.hex-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.hex-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 12, 0.54);
  backdrop-filter: blur(4px);
}

.hex-modal-card {
  position: relative;
  z-index: 1;
  width: min(540px, calc(100% - 18px));
  border-radius: 24px;
  border: 1px solid rgba(240, 246, 247, 0.16);
  background: rgba(10, 22, 32, 0.95);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45);
  padding: 20px;
}

.hex-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.hex-close {
  padding: 8px 12px;
}

.hex-modal-grid {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.sigil-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 136px;
  border-radius: 18px;
  border: 1px solid rgba(240, 246, 247, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

.hex-sigil {
  width: 110px;
  height: 110px;
}

.hex-meta {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hex-meta-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.card {
  padding: 18px;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status-list,
.ledger-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-list li,
.ledger-list li {
  padding: 10px 0;
  border-top: 1px solid rgba(240, 246, 247, 0.08);
  color: var(--muted);
}

.status-list li:first-child,
.ledger-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.status-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 10px;
  vertical-align: middle;
}

.status-strong {
  color: var(--text);
  font-weight: 700;
}

.ledger-item {
  border-left: 4px solid rgba(240, 246, 247, 0.12);
  padding-left: 10px;
}

.ledger-item.player-1 { border-left-color: #63a4ff; }
.ledger-item.player-2 { border-left-color: #ff7e6b; }
.ledger-item.player-3 { border-left-color: #78d68d; }
.ledger-item.player-4 { border-left-color: #dca0ff; }
.ledger-item.system { border-left-color: #f1c978; color: var(--text); }
.ledger-item.win { border-left-color: #66dbc8; color: #e8fff8; }
.ledger-item.loss { border-left-color: #ffb366; color: #fff0de; }

@media (max-width: 1100px) {
  .hero-panel,
  .experience {
    grid-template-columns: 1fr;
  }

  .phaser-root {
    min-height: 620px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
  }

  .hero-panel,
  .board-panel,
  .card {
    border-radius: 18px;
  }

  .board-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .phaser-root {
    min-height: 520px;
  }

  .hex-modal-grid {
    grid-template-columns: 1fr;
  }
}
