/* Ping Pong Game — Style Guide
 * Retro Arcade Neon Theme
 */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Press+Start+2P&display=swap');

/* ─── CSS Custom Properties ─── */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122e;
  --bg-overlay: rgba(10, 10, 26, 0.92);

  /* Neon Accents */
  --neon-cyan: #00f0ff;
  --neon-magenta: #ff00aa;
  --neon-lime: #39ff14;
  --neon-yellow: #ffee00;
  --neon-red: #ff2a2a;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #b8b8d0;
  --text-muted: #68688a;

  /* Borders */
  --border-subtle: rgba(0, 240, 255, 0.2);
  --border-glow: rgba(0, 240, 255, 0.6);

  /* Game Colors */
  --paddle-player: #00f0ff;
  --paddle-ai: #ff00aa;
  --ball-color: #00f0ff;
  --wall-color: rgba(255, 255, 255, 0.3);
  --center-line: rgba(255, 255, 255, 0.15);

  /* Typography */
  --font-display: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 400ms ease;

  /* Z-index layers */
  --z-canvas: 1;
  --z-ui: 10;
  --z-overlay: 100;
  --z-modal: 200;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ─── */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 2px solid var(--border-subtle);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  user-select: none;
}

.btn:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
  transform: scale(1.02);
}

.btn:active {
  transform: scale(0.98);
}

/* Button variants */
.btn--primary {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.btn--primary:hover {
  background: rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.btn--danger {
  background: rgba(255, 42, 42, 0.15);
  border-color: var(--neon-red);
  color: var(--neon-red);
}

.btn--danger:hover {
  background: rgba(255, 42, 42, 0.3);
  box-shadow: 0 0 20px rgba(255, 42, 42, 0.4);
}

/* ─── Cards ─── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: var(--space-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ─── Inputs ─── */
.input {
  display: block;
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: all var(--transition-base);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

/* ─── Layout ─── */
.game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.game-canvas {
  display: block;
  z-index: var(--z-canvas);
}

.ui-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-ui);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.ui-overlay > * {
  pointer-events: auto;
}

.ui-overlay--hidden {
  display: none;
}

/* ─── Score Display ─── */
.score-display {
  font-family: var(--font-display);
  font-size: 48px;
  text-shadow: 0 0 20px currentColor;
}

.score-display--player {
  color: var(--paddle-player);
}

.score-display--ai {
  color: var(--paddle-ai);
}

/* ─── Neon Glow Text ─── */
.neon-text {
  text-shadow:
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor;
}

.neon-text--cyan {
  color: var(--neon-cyan);
}

.neon-text--magenta {
  color: var(--neon-magenta);
}

.neon-text--lime {
  color: var(--neon-lime);
}

/* ─── Pause Overlay ─── */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* ─── Animations ─── */
@keyframes neon-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes score-pop {
  0% { transform: scale(1.5); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.animate-neon-pulse {
  animation: neon-pulse 2s ease-in-out infinite;
}

.animate-fade-in-up {
  animation: fade-in-up 400ms ease-out forwards;
}

.animate-score-pop {
  animation: score-pop 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ─── Utility Classes ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ─── Focus (Accessibility) ─── */
:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  :root {
    --space-xl: 24px;
    --space-2xl: 32px;
  }

  h1 { font-size: 24px; }
  h2 { font-size: 18px; }

  .btn {
    padding: var(--space-md) var(--space-lg);
    font-size: 12px;
  }

  .score-display {
    font-size: 32px;
  }
}
