* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #06080d;
  color: #e8edf5;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */

#leaderboard {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 200px;
  padding: 10px 14px;
  background: rgba(10, 14, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 13px;
  pointer-events: none;
}
#leaderboard h3 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: #9fb0c8;
}
#leaderboard ol { margin: 0; padding-left: 22px; }
#leaderboard li { line-height: 1.55; color: #6f7f96; }
#leaderboard .row { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
#leaderboard .row span:first-child { overflow: hidden; text-overflow: ellipsis; color: #e8edf5; }
#leaderboard .row span:last-child { color: #8796ab; font-variant-numeric: tabular-nums; }
#leaderboard li.me .row span:first-child { color: #ffd166; font-weight: 600; }

#stats {
  position: fixed;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  background: rgba(10, 14, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  pointer-events: none;
}
#mass { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
#rank { font-size: 13px; color: #9fb0c8; }

#stats.charging #mass { color: #ff6b7a; text-shadow: 0 0 10px rgba(255, 71, 87, 0.6); }

#hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  font-size: 12px;
  color: #6f7f96;
  white-space: nowrap;
  pointer-events: none;
}
#hint b { color: #9fb0c8; }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 10, 0.45);
  backdrop-filter: blur(3px);
}

.panel {
  width: min(420px, 100%);
  padding: 28px 28px 22px;
  background: rgba(14, 19, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}
h1 .north { color: #ff4757; text-shadow: 0 0 24px rgba(255, 71, 87, 0.5); }
h1 .south { color: #3d7bff; text-shadow: 0 0 24px rgba(61, 123, 255, 0.5); }
h2 { margin: 0 0 8px; font-size: 32px; color: #ff6b7a; }

.tag { margin: 8px 0 20px; color: #8796ab; letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; }

input#name {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  color: inherit;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  outline: none;
  text-align: center;
  user-select: text;
}
input#name:focus { border-color: #3d7bff; }

button {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 18px;
  font-weight: 700;
  color: white;
  background: linear-gradient(90deg, #ff4757, #3d7bff);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
button:hover { filter: brightness(1.12); }
button:active { transform: scale(0.98); }
button:disabled { filter: grayscale(1) brightness(0.6); cursor: default; }

.help {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 13px;
  color: #9fb0c8;
  line-height: 1.5;
}
.help li { padding: 3px 0 3px 16px; position: relative; }
.help li::before { content: "◆"; position: absolute; left: 0; color: #3d7bff; font-size: 9px; top: 7px; }
.help b { color: #e8edf5; }

#status { margin-top: 14px; font-size: 12px; color: #6f7f96; }
#deathBy { color: #c5d0e0; margin: 0 0 12px; }
#deathBy b { color: #ffd166; }
#deathStats { display: flex; justify-content: space-around; margin-bottom: 8px; }
#deathStats div { font-size: 12px; color: #8796ab; text-transform: uppercase; letter-spacing: 0.08em; }
#deathStats b { display: block; font-size: 22px; color: #e8edf5; letter-spacing: 0; }
.small { font-size: 12px; color: #6f7f96; margin: 8px 0 0; }
.name-note { margin: 6px 0 0; font-size: 11px; color: #6f7f96; }
.legal { margin: 10px 0 0; font-size: 11px; }
.legal a { color: #6f7f96; }
.legal a:hover { color: #9fb0c8; }

/* ---------- text pages (privacy) ---------- */

html.doc, html.doc body { height: auto; overflow: auto; user-select: text; -webkit-user-select: text; }
.doc main { max-width: 680px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.6; color: #c5d0e0; }
.doc h1 { font-size: 32px; margin-bottom: 4px; color: #e8edf5; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; color: #e8edf5; }
.doc a { color: #6fa0ff; }
.doc .updated { color: #6f7f96; font-size: 13px; margin-top: 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.doc th { color: #9fb0c8; font-weight: 600; }

@media (max-width: 600px) {
  #leaderboard { width: 150px; font-size: 11px; }
  h1 { font-size: 42px; }
  h2 { font-size: 26px; }
}
