/* ═══════════ PIXEL SNAKE – STYLES v2 ═══════════ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Inter:wght@300;400;600&display=swap');

:root {
  --bg-1: #0b0c10;
  --bg-2: #1f2833;
  --bg-3: #1a1e29;
  --neon: #00e676;
  --neon-dim: #00c853;
  --danger: #ff1744;
  --gold: #ffd740;
  --cyan: #00e5ff;
  --text: #e0e0e0;
  --text-dim: #78909c;
  --border: rgba(0,230,118,0.12);
  --panel: rgba(31,40,51,0.92);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Orbitron', monospace;
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  user-select: none;
}

/* ── Screens ── */
.screen { position: fixed; inset: 0; display: flex; justify-content: center; align-items: center; }
.hidden { display: none !important; }

/* ── Title Screen ── */
.title-content { text-align: center; animation: slideIn .5s ease; }

.title-emoji {
  font-size: 90px;
  animation: pulse 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 28px rgba(0,230,118,0.5));
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 58px;
  color: var(--neon);
  text-shadow: 0 0 40px rgba(0,230,118,0.35), 0 0 80px rgba(0,230,118,0.15);
  margin: 12px 0 4px;
  letter-spacing: 6px;
}

.subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 28px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.controls-info {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 28px;
  margin: 18px auto;
  max-width: 420px;
  text-align: left;
}
.controls-info p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #b0bec5;
  margin: 7px 0;
  font-weight: 400;
  letter-spacing: .3px;
}

.highscore {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 1px;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 14px 44px;
  border: 2px solid var(--neon);
  border-radius: 6px;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: 2px;
  margin: 6px;
  text-transform: uppercase;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }

.btn-play {
  background: var(--neon);
  color: var(--bg-1);
  border-color: var(--neon);
  box-shadow: 0 0 24px rgba(0,230,118,0.25), inset 0 0 12px rgba(0,0,0,0.1);
}
.btn-play:hover { box-shadow: 0 0 40px rgba(0,230,118,0.4); }

.btn-resume {
  background: var(--neon);
  color: var(--bg-1);
  border-color: var(--neon);
  box-shadow: 0 0 20px rgba(0,230,118,0.2);
}

.btn-quit {
  background: transparent;
  border: 2px solid var(--text-dim);
  color: var(--text-dim);
}
.btn-quit:hover { border-color: var(--text); color: var(--text); }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--neon); box-shadow: 0 0 12px rgba(0,230,118,0.15); }
.btn-icon.muted { opacity: .35; }

/* ── Game Screen ── */
#gameScreen {
  flex-direction: column;
  background: var(--bg-1);
}

#gameCanvas {
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-top: none;
}

/* ── HUD ── */
#hud {
  width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: none;
  z-index: 10;
}

.hud-left, .hud-right { display: flex; align-items: center; gap: 20px; }
.hud-center { display: flex; align-items: center; gap: 18px; }

.hud-level, .hud-length {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.progress-bar {
  width: 90px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(0,230,118,0.08);
}
.progress-fill {
  height: 100%;
  background: var(--neon);
  border-radius: 3px;
  transition: width .3s ease;
  width: 0%;
  box-shadow: 0 0 8px rgba(0,230,118,0.3);
}
.progress-text {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--text-dim);
}

.hud-score, .hud-best {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hud-label {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 3px;
}
.hud-value {
  font-size: 30px;
  font-weight: 900;
  color: var(--neon);
  text-shadow: 0 0 16px rgba(0,230,118,0.3);
}
.hud-value-sm {
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
}

.hud-lives {
  font-size: 22px;
  letter-spacing: 3px;
}

.hud-buttons { display: flex; gap: 6px; }

/* ── Level Overlay ── */
.level-complete { animation: slideIn .35s ease; }
.level-emoji {
  font-size: 68px;
  animation: pulse 2s ease-in-out infinite;
}
.level-sub {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 400;
  letter-spacing: 1px;
}

/* ── Overlays ── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,12,16,0.9);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
}
.overlay-content { text-align: center; animation: slideIn .3s ease; }
.overlay-content h2 {
  font-family: 'Orbitron', monospace;
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--text);
  letter-spacing: 3px;
}

/* ── Game Over ── */
.gameover-content { text-align: center; animation: slideIn .5s ease; }
.gameover-emoji { font-size: 76px; animation: glitch .6s ease; }

.gameover-title {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 50px;
  color: var(--danger);
  text-shadow: 0 0 30px rgba(255,23,68,0.4), 0 0 60px rgba(255,23,68,0.15);
  margin: 8px 0 18px;
  letter-spacing: 4px;
}

.gameover-stats {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 36px;
  margin: 18px auto;
  max-width: 340px;
  text-align: left;
}
.gameover-stats p {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #b0bec5;
  margin: 9px 0;
  font-weight: 400;
}
.gameover-stats strong {
  color: var(--neon);
  font-family: 'Orbitron', monospace;
  font-weight: 700;
}

.new-hs {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  animation: flashIn .5s ease;
  margin-top: 10px;
  letter-spacing: 1px;
}

.gameover-buttons {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Animations ── */
@keyframes slideIn {
  from { opacity:0; transform:translateY(24px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.08); }
}

@keyframes flashIn {
  0%   { opacity:0; transform:scale(1.4); }
  50%  { opacity:1; transform:scale(.95); }
  100% { transform:scale(1); }
}

@keyframes glitch {
  0%   { transform: translate(0); }
  15%  { transform: translate(-4px, 2px); }
  30%  { transform: translate(4px, -2px); }
  45%  { transform: translate(-2px, 4px); }
  60%  { transform: translate(3px, -1px); }
  75%  { transform: translate(-1px, 3px); }
  100% { transform: translate(0); }
}

/* ── Responsive ── */
@media (max-width: 1000px) {
  #gameCanvas { width: 100vw; height: auto; border:none; }
  #hud { width: 100vw; }
  .game-title { font-size: 36px; }
  .title-emoji { font-size: 64px; }
}
