html, body {
  margin: 0;
  height: 100%;
  background: #0b1026;
  color: #e8ecf4;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

#stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #11162b;
  border-top: 1px solid #232a48;
}

.pair {
  display: flex;
  gap: 8px;
}

#controls button {
  font: inherit;
  color: #e8ecf4;
  background: #1f2747;
  border: 1px solid #34406e;
  border-radius: 16px;
  touch-action: none;
  cursor: pointer;
  padding: 0;
}

#controls #left, #controls #right {
  width: min(76px, 19vw);
  height: 72px;
  font-size: 26px;
}

#controls #burn {
  width: min(140px, 34vw);
  height: 72px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #5a2a14;
  border-color: #b5541f;
  color: #ffd7b0;
}

/* Mute and pause stack in the middle so the bar fits 360px-wide phones. */
.mid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#controls #mute, #controls #pause {
  width: 44px;
  height: 34px;
  font-size: 15px;
  opacity: 0.85;
}

#controls #pause { font-size: 13px; }
#controls #pause:not(.paused)::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 13px;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
  box-sizing: border-box;
  vertical-align: middle;
}
#controls #pause.idle { opacity: 0.35; }

#controls button.on {
  filter: brightness(1.7);
  transform: scale(0.97);
}

/* Name prompt shown over the game-over panel the first time a score is saved. */
#namebox {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100% - 48px));
  padding: 18px;
  background: #121833;
  border: 1px solid #34406e;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}

#namebox[hidden] { display: none; }

#namebox label { font-weight: 700; text-align: center; }

#namebox input {
  font: inherit;
  font-size: 18px;   /* 16px+ keeps phones from zooming in */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #34406e;
  background: #0b1026;
  color: #e8ecf4;
}

#namebox input:focus { outline: 2px solid #7ee787; outline-offset: 1px; }

#namebox .row { display: flex; gap: 10px; }

#namebox button {
  flex: 1;
  font: inherit;
  font-weight: 700;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #34406e;
  background: #1f2747;
  color: #9aa3bd;
  cursor: pointer;
}

#namebox #name-save { background: #16351f; border-color: #7ee787; color: #7ee787; }
