:root {
  --bg: #0f172a;
  --panel: #181f33;
  --grid: #232c45;
  --accent: #34d399;
  --accent-dim: #115e59;
  --food: #fbbf24;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --rock: #475569;
  --boost: #facc15;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.game-wrapper {
  padding: 24px;
  max-width: 100vw;
}

h1 {
  margin: 0 0 12px;
  font-size: 24px;
  text-align: center;
  letter-spacing: 2px;
}

.title-suffix {
  color: var(--boost);
  font-size: 12px;
  vertical-align: middle;
  letter-spacing: 3px;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px;
  margin-bottom: 12px;
  font-size: 15px;
  color: var(--text-dim);
}

.hud > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hud #score {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.best-num {
  font-weight: 800;
  color: var(--accent);
}

.mute-ind,
.boost-ind {
  font-size: 18px;
  cursor: pointer;
  user-select: none;
}

.boost-ind.active {
  animation: pulse 0.4s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.25); }
}

.board-wrap {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

#game-canvas {
  display: block;
  background: var(--panel);
  max-width: 92vw;
  max-height: 80vh;
  width: auto;
  height: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.82);
  text-align: center;
  padding: 16px;
}

.overlay p {
  margin: 4px 0;
}

.overlay p:first-child {
  font-size: 24px;
  font-weight: 700;
}

#overlay-message {
  color: var(--text-dim);
  font-size: 15px;
}

.legend {
  margin: 16px 0 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.legend span {
  margin: 0 10px;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--grid);
  border-bottom-width: 3px;
  background: var(--panel);
  font-family: inherit;
  font-size: 13px;
}
