* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #141432, #050510 70%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  color: #9fd8ff;
}

#wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

#hud {
  width: min(480px, 96vw);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #67e8f9;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(103, 232, 249, .7);
}

#hud span { color: #ffd83d; margin-left: 8px; text-shadow: 0 0 6px rgba(255, 216, 61, .7); }

#screen {
  position: relative;
  width: min(480px, 96vw);
  aspect-ratio: 3 / 4;
  border: 4px solid #2a2a55;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 4px #0b0b1e,
    0 0 40px rgba(80, 120, 255, .35),
    inset 0 0 60px rgba(0, 0, 20, .8);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  background: #050510;
}

/* CRT overlay: scanlines + vignette + screen curvature tint */
.crt {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22) 0px,
      rgba(0, 0, 0, 0.22) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: multiply;
}

.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 10, .55) 100%);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
  background: rgba(3, 3, 18, .55);
  z-index: 5;
  touch-action: manipulation;
  cursor: pointer;
}

.overlay h1 {
  font-size: 28px;
  color: #ff5a5a;
  line-height: 1.6;
  text-shadow: 0 0 12px rgba(255, 90, 90, .8), 4px 4px 0 #7a1020;
  transform: skewX(-4deg);
}

.overlay h2 {
  font-size: 22px;
  color: #ff5a5a;
  text-shadow: 0 0 12px rgba(255, 90, 90, .8), 3px 3px 0 #7a1020;
}

.overlay p {
  font-size: 10px;
  line-height: 2;
  color: #9fd8ff;
}

.blink { animation: blink 1.1s steps(2, start) infinite; }

@keyframes blink { 50% { opacity: 0; } }

.hidden { display: none !important; }

#hint {
  font-size: 8px;
  color: #5566aa;
  letter-spacing: 1px;
}

/* ---------- leaderboard ---------- */
#boardList {
  width: 78%;
  max-height: 52%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 9px;
  scrollbar-width: thin;
}
#boardList .row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: #9fd8ff;
  text-align: left;
}
#boardList .row.me { color: #ffd83d; }
#boardList .rank { width: 28px; color: #67e8f9; }
#boardList .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#boardList .pts { color: #ffd83d; }
#boardList .empty { color: #5566aa; text-align: center; }

/* mobile: allow scroll inside board even with touch-action:none on body */
#boardList { touch-action: pan-y; }
