.snake-game {
  max-width: 620px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

/* Shared panel / button styles (duplicated per-game by Corner convention) */
.panel {
  background: var(--card);
  border: 3px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px);
}
.panel.hidden { display: none; }

.panel h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}

.snake-icon {
  font-size: 4rem;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.tagline {
  margin: 0 0 1.5rem;
  color: var(--text-soft);
  font-weight: 600;
}

.row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}
.row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.row select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: white;
  color: #1f1b2e;
  cursor: pointer;
}

.setup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.btn-primary {
  font: inherit;
  font-weight: 800;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); }

.btn-secondary {
  display: inline-block;
  margin-left: 0.75rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--card-border);
  font-weight: 700;
}

/* HUD */
.snake-header {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 0.5rem;
}
.hud-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  font-weight: 700;
}
.hud-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

/* Target banner */
.target-banner {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
  padding: 0.6rem 1rem;
  border-radius: 14px;
  margin-bottom: 0.75rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.target-banner strong { font-size: 1.4em; }

/* Board */
.board-wrap {
  display: flex;
  justify-content: center;
}
#board {
  width: min(420px, 86vw);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25);
  touch-action: none;
}

/* D-pad */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  justify-content: center;
  margin: 1rem auto 0;
  grid-template-areas:
    ".    up    ."
    "left .     right"
    ".    down  .";
}
.dpad-btn {
  border: none;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--card-border);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: transform 0.1s ease, background 0.1s ease;
  user-select: none;
}
.dpad-btn:active { transform: scale(0.92); background: var(--primary); color: white; }
.dpad-btn.up { grid-area: up; }
.dpad-btn.left { grid-area: left; }
.dpad-btn.right { grid-area: right; }
.dpad-btn.down { grid-area: down; }

.feedback {
  min-height: 1.5em;
  font-weight: 700;
  margin-top: 0.85rem;
  font-size: 1.05rem;
}
.feedback.good { color: #2e8b3a; }
.feedback.bad  { color: #b32b2b; }

/* Board flash on losing a life */
#board.hurt { animation: board-hurt 0.5s ease; }
@keyframes board-hurt {
  0%, 100% { box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25); }
  50% { box-shadow: inset 0 0 0 6px #ff5c5c, 0 6px 16px rgba(0, 0, 0, 0.25); }
}
