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

:root {
  --bg-color: #1a1a2e;
  --bg-secondary: #16213e;
  --accent-color: #4ade80;
  --accent-glow: rgba(74, 222, 128, 0.3);
  --text-color: #ffffff;
  --text-muted: #94a3b8;
  --food-color: #f43f5e;
  --food-glow: rgba(244, 63, 94, 0.4);
  --snake-head: #22c55e;
  --snake-body: #4ade80;
  --snake-tail: #86efac;
  --meter-bg: #334155;
  --meter-fill: linear-gradient(90deg, #22c55e, #4ade80);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.screen.hidden {
  display: none;
}

/* Ready Screen */
#ready-screen h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 2rem;
  margin-bottom: 10px;
  text-shadow: 0 0 20px var(--accent-glow);
}

#ready-screen .subtitle {
  color: var(--text-muted);
  margin-bottom: 30px;
}

.instructions {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 30px;
  width: 100%;
}

.instructions p {
  margin: 8px 0;
  color: var(--text-muted);
}

.instructions strong {
  color: var(--text-color);
}

/* Buttons */
.btn-primary {
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--accent-glow);
}

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

/* Game Screen */
#game-screen {
  gap: 15px;
}

/* Discount Meter */
#discount-meter {
  width: 100%;
  background: var(--bg-secondary);
  padding: 15px;
  border-radius: 12px;
}

.meter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.meter-bar {
  width: 100%;
  height: 20px;
  background: var(--meter-bg);
  border-radius: 10px;
  overflow: hidden;
}

#meter-fill {
  height: 100%;
  width: 0%;
  background: var(--meter-fill);
  border-radius: 10px;
  transition: width 0.3s ease-out;
  box-shadow: 0 0 10px var(--accent-glow);
}

#meter-text {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* Game Canvas */
#game-canvas {
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  touch-action: none;
}

/* Mobile Controls */
#mobile-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 15px;
}

#mobile-controls.hidden {
  display: none;
}

.control-row {
  display: flex;
  gap: 60px;
}

.control-btn {
  width: 60px;
  height: 60px;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-color);
  border-radius: 12px;
  color: var(--accent-color);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
  background: var(--accent-color);
  color: var(--bg-color);
  transform: scale(0.95);
}

/* Pause Overlay */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  z-index: 100;
}

#pause-overlay.hidden {
  display: none;
}

#pause-overlay h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.5rem;
}

/* Game Over Screen */
#gameover-screen h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  margin-bottom: 15px;
}

/* Discount Summary */
.discount-summary {
  background: var(--bg-secondary);
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.discount-summary.tier-gold {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 180, 0, 0.1));
  border-color: #ffd700;
  color: #ffd700;
  animation: goldPulse 1.5s ease-in-out infinite;
}

.discount-summary.tier-silver {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(160, 160, 160, 0.1));
  border-color: #c0c0c0;
  color: #e0e0e0;
}

.discount-summary.tier-bronze {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(180, 100, 40, 0.1));
  border-color: #cd7f32;
  color: #dda15e;
}

.discount-summary.tier-none {
  color: var(--text-muted);
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
}

#final-stats {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
}

.stat {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat:last-child {
  border-bottom: none;
}

.stat.highlight {
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.1), transparent);
  margin: 0 -20px;
  padding: 12px 20px;
  border-radius: 8px;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 700;
  color: var(--accent-color);
}

.stat.highlight .stat-value {
  font-size: 1.3rem;
}

#reward-section {
  margin-bottom: 30px;
}

#reward-section p {
  color: var(--text-muted);
  margin-bottom: 10px;
}

#discount-code {
  background: var(--bg-secondary);
  padding: 15px 30px;
  border-radius: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  color: var(--accent-color);
  border: 2px dashed var(--accent-color);
}

/* Milestone Popup */
#milestone-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(74, 222, 128, 0.95);
  color: var(--bg-color);
  padding: 20px 40px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.2rem;
  z-index: 200;
  animation: none;
  pointer-events: none;
}

#milestone-popup.show {
  animation: milestonePopup 1.5s ease-out forwards;
}

@keyframes milestonePopup {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  15% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
}

/* Perfect Game Animation */
.perfect-game #game-canvas {
  animation: perfectPulse 0.5s ease-in-out infinite alternate;
}

@keyframes perfectPulse {
  from {
    box-shadow: 0 0 20px var(--accent-glow);
  }
  to {
    box-shadow: 0 0 40px var(--accent-color), 0 0 60px var(--accent-glow);
  }
}

/* Responsive */
@media (max-width: 420px) {
  #game-container {
    padding: 10px;
  }
  
  #ready-screen h1 {
    font-size: 1.5rem;
  }
  
  .instructions {
    padding: 15px;
  }
}

@media (min-height: 800px) {
  #game-container {
    max-width: 450px;
  }
}
