/* ── Snake Game ── */

.snake-container {
  background: #1a1a2e;
  border-radius: var(--radius-lg, 16px);
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  border: 3px solid #2a2a4a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ── Header ── */
.snake-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  flex-wrap: wrap;
}

.snake-scores {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.snake-score-box {
  background: #2a2a4a;
  border-radius: 6px;
  padding: 5px 14px;
  text-align: center;
  min-width: 56px;
}

.snake-score-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
}

.snake-score-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4ade80;
  line-height: 1.1;
}

.snake-score-box.best .snake-score-value {
  color: #ffd700;
}

/* ── Controls ── */
.snake-controls {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  align-items: center;
}

.snake-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: #4ade80;
  color: #1a1a2e;
  transition: background 0.15s ease;
}

.snake-btn:hover { background: #6ee7a0; }

.snake-btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.snake-btn-secondary:hover { background: rgba(255, 255, 255, 0.2); }

/* Speed toggle */
.snake-speed-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.snake-speed-opt {
  padding: 5px 10px;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease, color 0.15s ease;
}

.snake-speed-opt.active {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ── Canvas Board ── */
.snake-board-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  touch-action: none;
}

.snake-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
  background: #0f0f23;
  border: 2px solid #2a2a4a;
}

/* ── Overlays ── */
.snake-overlay {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  background: rgba(15, 15, 35, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.snake-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.snake-overlay-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 4px;
}

.snake-overlay-title.game-over {
  color: #f87171;
}

.snake-overlay-score {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
}

.snake-overlay-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 12px;
}

/* ── D-Pad (mobile) ── */
.snake-dpad {
  display: none;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 3 / 3;
  position: relative;
  margin-top: 4px;
}

.snake-dpad-btn {
  position: absolute;
  width: 33.33%;
  height: 33.33%;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
}

.snake-dpad-btn:active {
  background: rgba(74, 222, 128, 0.3);
  color: #4ade80;
}

.snake-dpad-up    { top: 0; left: 33.33%; }
.snake-dpad-down  { bottom: 0; left: 33.33%; }
.snake-dpad-left  { top: 33.33%; left: 0; }
.snake-dpad-right { top: 33.33%; right: 0; }

/* ── Hint text ── */
.snake-hint {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.7rem;
  text-align: center;
}

/* ── Best Stats ── */
.snake-best-row {
  display: flex;
  gap: 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.72rem;
}

.snake-best-row span {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .snake-container { padding: 14px 10px; }
  .snake-dpad { display: block; }
  .snake-hint-desktop { display: none; }
}

@media (max-width: 480px) {
  .snake-container { padding: 10px 6px; border-radius: 12px; }
  .snake-score-box { padding: 4px 10px; min-width: 48px; }
  .snake-score-label { font-size: 0.52rem; }
  .snake-score-value { font-size: 0.95rem; }
  .snake-btn { padding: 5px 12px; font-size: 0.75rem; }
  .snake-speed-opt { padding: 4px 8px; font-size: 0.65rem; }
  .snake-overlay-title { font-size: 1.3rem; }
  .snake-dpad { max-width: 170px; }
}
