:root {
  --bg: #060b1c;
  --ink: #f2f6ff;
  --mute: #9fb0d6;
  --p0: #ff5d6c; /* bottom player */
  --p1: #38d6e8; /* top player */
  --accent: #ffd34d;
  --u: 4.8px; /* base UI unit; main.js sets it from the frame size */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
  touch-action: none;
}
body {
  position: fixed;
  inset: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: calc(var(--u) * 3);
  line-height: 1.35;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
canvas#game {
  display: block;
  touch-action: none;
  outline: none;
  cursor: crosshair;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 22, 0.72);
  touch-action: none;
  z-index: 5;
}
.overlay[hidden] { display: none; }
.panel {
  width: min(92%, calc(var(--u) * 78));
  max-height: 100%;
  padding: calc(var(--u) * 2.4) calc(var(--u) * 3);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(var(--u) * 1.8);
  text-align: center;
}
h1, h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
}
h1 { font-size: calc(var(--u) * 8.6); }
h2 { font-size: calc(var(--u) * 6.4); }
#overTitle { font-size: calc(var(--u) * 5.8); letter-spacing: 0.03em; }
h1::after {
  content: "";
  display: block;
  width: calc(var(--u) * 14);
  height: calc(var(--u) * 0.9);
  margin: calc(var(--u) * 1.6) auto 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--p0) 0 50%, var(--p1) 50% 100%);
}
.tagline { display: none; margin: 0; color: var(--mute); font-size: calc(var(--u) * 3.6); letter-spacing: 0.12em; }
.controls { display: flex; flex-direction: column; gap: calc(var(--u) * 1.8); }
.row { display: flex; align-items: center; gap: calc(var(--u) * 1.6); }
.label { flex: 0 0 auto; width: calc(var(--u) * 13); text-align: left; color: var(--mute); font-size: calc(var(--u) * 2.8); }
.seg { flex: 1; display: flex; gap: calc(var(--u) * 0.8); }
.seg button {
  flex: 1;
  min-width: 0;
  padding: calc(var(--u) * 1.5) calc(var(--u) * 0.4);
  border-radius: calc(var(--u) * 1.4);
  background: rgba(255, 255, 255, 0.08);
  color: var(--mute);
  font-size: calc(var(--u) * 2.9);
  white-space: nowrap;
}
.seg button.on { background: var(--ink); color: #0b1530; font-weight: 700; }
.primary {
  padding: calc(var(--u) * 2.2);
  border-radius: calc(var(--u) * 1.8);
  background: var(--accent);
  color: #1a1400;
  font-size: calc(var(--u) * 4.2);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}
.primary:active { transform: translateY(1px); filter: brightness(0.92); }
.ghost {
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2);
  border-radius: calc(var(--u) * 1.4);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: calc(var(--u) * 2.8);
  white-space: nowrap;
}
.foot { justify-content: space-between; }
.hint { color: var(--mute); font-size: calc(var(--u) * 2.5); text-align: right; }
.score-line { margin: 0; font-size: calc(var(--u) * 4); color: var(--mute); font-variant-numeric: tabular-nums; }
.pause {
  position: absolute;
  z-index: 3;
  width: calc(var(--u) * 7);
  height: calc(var(--u) * 7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-size: calc(var(--u) * 3);
  line-height: 1;
  padding: 0;
}
.pause[hidden] { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Poster mode (?card=1): title only, screenshotted by tools/make-card.mjs */
body.poster .controls { display: none; }
body.poster .tagline { display: block; }
body.poster .overlay { background: rgba(4, 8, 22, 0.38); }
body.poster .panel { width: 100%; }
body.poster h1 { font-size: calc(var(--u) * 11); letter-spacing: 0.04em; white-space: nowrap; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }
body.poster .tagline { color: var(--ink); font-size: calc(var(--u) * 4.4); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); }
