/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #0A0A0F;
  color: #F0F0F5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100%;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* ── Fonts ────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/Inter-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

/* ── Game Canvas ─────────────────────────────────────────────────────────── */
#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ── Loading Overlay ─────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0A0A0F;
  transition: opacity 0.5s ease-out;
}
#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading-bg-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 280px;
}

#loading-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 48px;
  letter-spacing: 4px;
  color: #F0F0F5;
  margin-bottom: 16px;
  z-index: 1;
}

#loading-quip {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: #6B6B78;
  font-style: italic;
  margin-bottom: 32px;
  text-align: center;
  max-width: 300px;
  min-height: 20px;
  z-index: 1;
}

#loading-progress-wrap {
  width: 200px;
  height: 4px;
  background: #1A1A24;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
  z-index: 1;
}

#loading-progress-bar {
  width: 0%;
  height: 100%;
  background: #5856D6;
  border-radius: 2px;
  transition: width 0.2s ease-out;
}
#loading-progress-bar.pulse {
  animation: pulse-bar 1.2s ease-in-out infinite;
}

@keyframes pulse-bar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

#loading-status {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #6B6B78;
  z-index: 1;
}

/* ── Overlay Root (menus, results, etc.) ─────────────────────────────────── */
#overlay-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

#overlay-root > * {
  pointer-events: auto;
}

/* ── Neon Button ─────────────────────────────────────────────────────────── */
.neon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border: 2px solid;
  border-radius: 28px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.12s ease-out, opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
}
.neon-btn:active {
  transform: scale(0.95);
}

/* Primary variant */
.neon-btn--primary {
  color: #F0F0F5;
  border-color: #5856D6;
  background: rgba(88, 86, 214, 0.15);
  box-shadow: 0 0 12px rgba(88, 86, 214, 0.3), inset 0 0 12px rgba(88, 86, 214, 0.1);
}
.neon-btn--primary:hover {
  background: rgba(88, 86, 214, 0.25);
}

/* Ghost variant */
.neon-btn--ghost {
  color: #9090A0;
  border-color: rgba(144, 144, 160, 0.3);
  background: transparent;
}
.neon-btn--ghost:hover {
  border-color: rgba(144, 144, 160, 0.5);
  color: #F0F0F5;
}

/* Success variant */
.neon-btn--success {
  color: #F0F0F5;
  border-color: #32D74B;
  background: rgba(50, 215, 75, 0.15);
  box-shadow: 0 0 12px rgba(50, 215, 75, 0.3);
}

/* Gold variant (daily) */
.neon-btn--gold {
  color: #F0F0F5;
  border-color: #D4A017;
  background: rgba(212, 160, 23, 0.15);
  box-shadow: 0 0 12px rgba(212, 160, 23, 0.3);
}

/* Teal variant (VS / P2 accent) */
.neon-btn--teal {
  color: #F0F0F5;
  border-color: #30B8C8;
  background: rgba(48, 184, 200, 0.15);
  box-shadow: 0 0 12px rgba(48, 184, 200, 0.3);
}
.neon-btn--teal:hover {
  background: rgba(48, 184, 200, 0.25);
}

/* Warning variant (exhausted → conversion) */
.neon-btn--warning {
  color: #F0F0F5;
  border-color: #FFD60A;
  background: rgba(255, 214, 10, 0.12);
  box-shadow: 0 0 12px rgba(255, 214, 10, 0.25);
}
.neon-btn--warning:hover {
  background: rgba(255, 214, 10, 0.22);
}

/* Disabled */
.neon-btn[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── Screen Overlay (menu/results/gates) ─────────────────────────────────── */
.screen-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.92);
  z-index: 50;
  gap: 12px;
  padding: 24px;
}

.screen-overlay__title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 36px;
  letter-spacing: 3px;
  color: #F0F0F5;
}

.screen-overlay__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #6B6B78;
  text-align: center;
}

.screen-overlay__spacer {
  height: 16px;
}

/* ── Stagger entrance animation ──────────────────────────────────────────── */
.stagger-enter {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: stagger-in 0.4s ease-out forwards;
}

@keyframes stagger-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(88, 86, 214, 0.9);
  color: #F0F0F5;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 20px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
}
