* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0e1020;
  color: #fff;
}

.screen[hidden] { display: none; }
.screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}

#screen-code, #screen-name {
  background: radial-gradient(ellipse at center, #1a1f3a 0%, #0e1020 100%);
}

#screen-code h1, #screen-name h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #88aaff 0%, #ff77cc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede { margin-bottom: 2rem; opacity: 0.7; }

form { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

input {
  font-size: 1.5rem;
  padding: 0.8rem 1.2rem;
  border: 2px solid #44488a;
  background: #1a1f3a;
  color: #fff;
  border-radius: 8px;
  min-width: 280px;
  outline: none;
  text-align: center;
  font-family: inherit;
}
input:focus { border-color: #88aaff; box-shadow: 0 0 0 3px rgba(136, 170, 255, 0.2); }

button {
  font-size: 1.2rem;
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, #4477ff 0%, #6655dd 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(68, 119, 255, 0.4); }
button:active { transform: translateY(0); }

.error { color: #ff5577; margin-top: 0.5rem; }

#screen-game { background: #0e1020; }
#canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }

.hud-bottom-left {
  position: fixed; bottom: 1rem; left: 1rem;
  font-size: 1.5rem; font-weight: 600;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  color: #fff;
}
.hud-top-left {
  position: fixed; top: 1rem; left: 1rem;
  background: rgba(20, 24, 50, 0.7);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(136, 170, 255, 0.2);
  color: #88ffaa;
}
.hud-top-left .dim { opacity: 0.6; color: #ccc; margin-left: 0.5rem; }
.hud-bottom-right {
  position: fixed; bottom: 1rem; right: 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.hud-top-right {
  position: fixed; top: 1rem; right: 1rem;
  background: rgba(20, 24, 50, 0.7);
  backdrop-filter: blur(8px);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  min-width: 200px;
  border: 1px solid rgba(136, 170, 255, 0.2);
}
.hud-top-right h2 {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.hud-top-right ol { padding-left: 1.5rem; list-style: decimal; }
.hud-top-right li { padding: 2px 0; font-variant-numeric: tabular-nums; }
.hud-top-right li.me { color: #ffaa44; font-weight: 600; }
.hud-top-right li.bot { opacity: 0.6; }

.overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem;
  z-index: 10;
}
.overlay h2 { font-size: 2rem; }
.overlay p { font-size: 1.2rem; opacity: 0.8; }
