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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --border: #475569;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --green: #10b981;
  --red: #ef4444;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Back bar ── */
.back-bar {
  padding: 0.6rem 1.5rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }

/* ── Header ── */
.game-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  flex-shrink: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.game-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.game-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ── Stats Row ── */
.stats-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.55rem 1rem;
  text-align: center;
  min-width: 90px;
}

.stat-box--live {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-box--live .stat-value {
  color: var(--green);
}

.live-dot-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-live 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.75); }
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

/* ── Map ── */
#map {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 180px);
  z-index: 1;
  background: #0d1b2e;
}

/* Override Leaflet dark theme */
.leaflet-container {
  background: #0d1b2e !important;
  font-family: inherit;
}

.leaflet-tile-pane {
  filter: brightness(0.65) saturate(0.5) hue-rotate(180deg);
}

/* ── Birth Marker ── */
.birth-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  animation: birth-pop 2.5s ease-out forwards;
  pointer-events: none;
}

@keyframes birth-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  20% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* ── Legend ── */
.legend {
  position: fixed;
  bottom: 80px;
  left: 16px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  z-index: 500;
  backdrop-filter: blur(8px);
}

.legend-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Info Panel ── */
.info-panel {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  max-width: 560px;
  width: calc(100% - 32px);
}

.info-panel-inner {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 0.75rem 1.25rem;
  backdrop-filter: blur(8px);
  text-align: center;
}

.info-fact {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  transition: opacity 0.4s ease;
}

.info-fact strong {
  color: var(--gold-light);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .stats-row {
    gap: 0.5rem;
    margin-left: 0;
  }
  .stat-box {
    min-width: 70px;
    padding: 0.45rem 0.7rem;
  }
  .stat-value {
    font-size: 1rem;
  }
  .legend {
    display: none;
  }
  #map {
    height: calc(100vh - 220px);
  }
}
