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

body {
  background-color: #0f0f1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #e0e0e0;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* --- Score board --- */

.score-board {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px;
}

.score-item + .score-item {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.score-item--main {
  padding-left: 24px;
  padding-right: 24px;
}

.score-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #5a5a7e;
  text-transform: uppercase;
}

.score-value {
  font-size: 32px;
  font-weight: 700;
  color: #00e676;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: center;
  line-height: 1.1;
}

.level-value {
  font-size: 24px;
  font-weight: 700;
  color: #b0b0c8;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
  line-height: 1.1;
}

.highscore-value {
  font-size: 24px;
  font-weight: 700;
  color: #ffd740;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
  text-align: center;
  line-height: 1.1;
}

/* --- Canvas --- */

.canvas-wrapper {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 30px rgba(0, 230, 118, 0.08),
    0 0 60px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.06);
}

#gameCanvas {
  display: block;
  background-color: #1a1a2e;
}

/* --- Overlays --- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(15, 15, 26, 0.88);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

.overlay-hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.overlay-title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 8px;
  color: #00e676;
  text-shadow: 0 0 40px rgba(0, 230, 118, 0.5);
}

.overlay-title--gameover {
  color: #ff5252;
  text-shadow: 0 0 40px rgba(255, 82, 82, 0.5);
}

.overlay-title--victory {
  color: #ffd740;
  text-shadow: 0 0 40px rgba(255, 215, 64, 0.6);
  animation: victory-glow 1.5s ease-in-out infinite;
}

.overlay-score {
  font-size: 26px;
  font-weight: 600;
  color: #e0e0e0;
}

.overlay-highscore {
  font-size: 16px;
  font-weight: 500;
  color: #ffd740;
  letter-spacing: 1px;
}

.overlay-hint {
  font-size: 17px;
  color: #b0b0c8;
  animation: pulse 2s ease-in-out infinite;
}

.overlay-controls {
  font-size: 12px;
  color: #5a5a7e;
  letter-spacing: 1px;
}

/* --- Difficulty buttons --- */

.difficulty-buttons {
  display: flex;
  gap: 10px;
}

.btn-difficulty {
  padding: 10px 22px;
  border-radius: 6px;
  border: 2px solid transparent;
  background-color: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
  color: #b0b0c8;
}

.btn-difficulty:hover {
  background-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.btn-difficulty--easy   { border-color: rgba(0, 230, 118, 0.35); }
.btn-difficulty--normal { border-color: rgba(255, 215, 64, 0.35); }
.btn-difficulty--hard   { border-color: rgba(255, 82, 82, 0.35);  }

.btn-difficulty--easy.btn-difficulty--active {
  background-color: rgba(0, 230, 118, 0.18);
  border-color: #00e676;
  color: #00e676;
}
.btn-difficulty--normal.btn-difficulty--active {
  background-color: rgba(255, 215, 64, 0.18);
  border-color: #ffd740;
  color: #ffd740;
}
.btn-difficulty--hard.btn-difficulty--active {
  background-color: rgba(255, 82, 82, 0.18);
  border-color: #ff5252;
  color: #ff5252;
}

/* --- Mute button --- */

.mute-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background-color: rgba(15, 15, 26, 0.7);
  color: #7a7a9e;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  z-index: 10;
  line-height: 1;
}

.mute-btn:hover {
  color: #e0e0e0;
  border-color: rgba(255, 255, 255, 0.3);
}

.mute-btn--off {
  color: #3a3a5e;
  border-color: rgba(255, 255, 255, 0.06);
  text-decoration: line-through;
}

/* --- Animations --- */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes victory-glow {
  0%, 100% { text-shadow: 0 0 40px rgba(255, 215, 64, 0.6); }
  50%       { text-shadow: 0 0 70px rgba(255, 215, 64, 1); }
}

/* --- Combo display --- */

.score-item--hidden {
  display: none;
}

.combo-value {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
  line-height: 1.1;
  color: #b0b0c8;
}

.combo-value--mid { color: #00e5ff; }
.combo-value--high { color: #ff9100; }
.combo-value--max {
  color: #ffd740;
  text-shadow: 0 0 12px rgba(255, 215, 64, 0.8);
  animation: combo-pulse 0.4s ease-in-out infinite alternate;
}

@keyframes combo-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

/* --- Leaderboard button (start screen) --- */

.btn-leaderboard {
  padding: 8px 20px;
  border-radius: 6px;
  border: 1px solid rgba(255, 215, 64, 0.35);
  background-color: rgba(255, 215, 64, 0.08);
  color: #ffd740;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.btn-leaderboard:hover {
  background-color: rgba(255, 215, 64, 0.18);
  transform: translateY(-2px);
}

/* --- Leaderboard table --- */

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #b0b0c8;
  min-width: 260px;
}

.lb-table--full {
  font-size: 14px;
  min-width: 300px;
}

.lb-table th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #5a5a7e;
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.lb-row--first td { color: #ffd740; font-weight: 700; }

.lb-rank   { color: #5a5a7e; width: 24px; text-align: center; }
.lb-score  { font-variant-numeric: tabular-nums; color: #00e676; }
.lb-difficulty { font-weight: 700; font-size: 11px; letter-spacing: 1px; }
.lb-difficulty--easy   { color: #00e676; }
.lb-difficulty--normal { color: #ffd740; }
.lb-difficulty--hard   { color: #ff5252; }
.lb-date   { color: #5a5a7e; font-size: 11px; }
.lb-empty  { text-align: center; color: #5a5a7e; padding: 12px; }

/* --- New record badge --- */

.new-record-badge {
  background: linear-gradient(135deg, #ffd740, #ff9100);
  color: #1a1a2e;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 6px 16px;
  border-radius: 20px;
  animation: badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* --- Pause stats --- */

.pause-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 24px;
  min-width: 200px;
}

.pause-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.pause-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #5a5a7e;
  text-transform: uppercase;
}

.pause-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #e0e0e0;
  font-variant-numeric: tabular-nums;
}

/* --- Abandon button --- */

.btn-abandon {
  padding: 9px 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 82, 82, 0.35);
  background-color: rgba(255, 82, 82, 0.08);
  color: #ff5252;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.btn-abandon:hover {
  background-color: rgba(255, 82, 82, 0.18);
  transform: translateY(-1px);
}

/* ============================================================
   Sprint 6 — Phase 1: Snake Skin Selector
   ============================================================ */

.skin-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sub-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #5a5a7e;
  margin: 0;
}

.skin-buttons {
  display: flex;
  gap: 10px;
}

.btn-skin {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.btn-skin:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.45);
}

.btn-skin--active {
  border-color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.5);
}

.skin-preview {
  width: 100%;
  height: 100%;
}

.skin-preview--classic { background: linear-gradient(135deg, #00e676, #006837); }
.skin-preview--cyber   { background: linear-gradient(135deg, #00e5ff, #005b8e); }
.skin-preview--neon    { background: linear-gradient(135deg, #e040fb, #7b00d4); }
.skin-preview--golden  { background: linear-gradient(135deg, #ffd740, #e65100); }

/* ============================================================
   Sprint 6 — Phase 3: Time Attack Mode
   ============================================================ */

.timer-value {
  font-size: 22px;
  font-weight: 700;
  color: #80d8ff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.timer-value--warning {
  color: #ff5252;
  animation: timer-blink 0.5s ease-in-out infinite;
}

@keyframes timer-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* Mode selection buttons */
.mode-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
}

.btn-mode {
  padding: 7px 16px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  color: #7a7a9e;
}

.btn-mode:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #aaaacc;
}

.btn-mode--active {
  background: rgba(0, 230, 118, 0.12);
  border-color: #00e676;
  color: #00e676;
}
