/* ============================================================
   Snake AI Game — Styles
   Dark gaming aesthetic with neon green/cyan accents
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121e;
  --bg-surface: #1a1a2e;
  --bg-overlay: rgba(10, 10, 18, 0.92);

  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  --player-color: #00ff88;
  --player-glow: rgba(0, 255, 136, 0.3);
  --player-head: #00ff88;

  --ai-color: #00e5ff;
  --ai-glow: rgba(0, 229, 255, 0.3);
  --ai-head: #00e5ff;

  --food-color: #ff3366;
  --food-glow: rgba(255, 51, 102, 0.5);

  --danger: #ff3366;
  --warning: #ffaa00;
  --success: #00ff88;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --transition: 200ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* --- App Layout --- */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.logo-accent {
  color: var(--player-color);
  text-shadow: 0 0 20px var(--player-glow);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-group {
  display: flex;
  gap: 8px;
}

.score-box,
.high-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 6px 16px;
  min-width: 72px;
}

.score-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.score-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.player-score .score-value {
  color: var(--player-color);
  text-shadow: 0 0 12px var(--player-glow);
}

.ai-score .score-value {
  color: var(--ai-color);
  text-shadow: 0 0 12px var(--ai-glow);
}

/* --- Game Container --- */
.game-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

#game-canvas {
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--bg-secondary);
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.4),
    inset 0 0 80px rgba(0, 0, 0, 0.2);
}

/* --- Overlays --- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  z-index: 10;
  animation: fadeIn 300ms ease;
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 32px;
}

.overlay-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.overlay-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* --- Settings --- */
.settings-group {
  margin-bottom: 20px;
}

.setting-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.button-group {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-option {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-option:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.btn-option.active {
  background: var(--player-color);
  color: var(--bg-primary);
  border-color: var(--player-color);
  font-weight: 600;
  box-shadow: 0 0 16px var(--player-glow);
}

/* --- Buttons --- */
.btn-primary {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 36px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--player-color);
  color: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px var(--player-glow), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary kbd {
  font-family: var(--font-body);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.6);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* --- Controls Hint --- */
.controls-hint {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.8;
}

.controls-hint kbd {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

/* --- Final Scores --- */
.final-scores {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.final-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px 28px;
  min-width: 120px;
}

.final-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.final-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2rem;
}

.player-final .final-value {
  color: var(--player-color);
  text-shadow: 0 0 16px var(--player-glow);
}

.ai-final .final-value {
  color: var(--ai-color);
  text-shadow: 0 0 16px var(--ai-glow);
}

/* --- Footer --- */
.footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  flex-shrink: 0;
}

.footer-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Utilities --- */
.hidden {
  display: none !important;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  #app {
    padding: 10px 12px;
  }

  .logo {
    font-size: 1.1rem;
  }

  .score-box,
  .high-score-box {
    padding: 4px 10px;
    min-width: 56px;
  }

  .score-value {
    font-size: 1rem;
  }

  .overlay-title {
    font-size: 1.6rem;
  }

  .overlay-content {
    padding: 20px;
  }

  .btn-primary {
    padding: 12px 28px;
    font-size: 0.9rem;
  }

  .final-score {
    padding: 12px 20px;
    min-width: 100px;
  }

  .final-value {
    font-size: 1.5rem;
  }

  .footer-text {
    display: none;
  }
}
