:root {
  color-scheme: dark;
  --bg: #12131a;
  --panel: #1b1d29;
  --accent: #4fd1c5;
  --accent-2: #ff5d73;
  --text: #eef0f5;
  --muted: #8b8fa3;
  --wall: #2f3245;
  --pillar: #454866;
  --input-bg: #10121a;
}

/* The game canvas itself (public/src/game.js) stays a fixed dark arcade
   palette in both themes - only the surrounding UI chrome retheme. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4;
  --panel: #ffffff;
  --accent: #0d9488;
  --accent-2: #e11d48;
  --text: #1a1c25;
  --muted: #6b7280;
  --wall: #e4e6ec;
  --pillar: #cbd1dc;
  --input-bg: #f4f5f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#topbar {
  width: 100%;
  max-width: 700px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

#topbar h1 {
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  margin: 0;
}

#topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#btn-theme-toggle {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem;
  text-decoration: none;
}

#user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem 2rem;
}

.screen {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.screen.hidden {
  display: none;
}

#screen-game {
  max-width: 660px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--wall);
  color: var(--text);
}

.btn:hover {
  filter: brightness(1.15);
}

.btn-primary {
  background: var(--accent);
  color: #0a0f0e;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
}

#form-email {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

#form-email input {
  background: var(--input-bg);
  border: 1px solid var(--wall);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font-size: 0.9rem;
}

.divider {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  gap: 0.6rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--wall);
}

.error {
  color: var(--accent-2);
  font-size: 0.85rem;
}

.error.hidden {
  display: none;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0.5rem auto 0;
  border: 3px solid var(--wall);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 624px;
  max-width: 100%;
  margin-bottom: 0.5rem;
}

#hud-timer {
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

#hud-players {
  list-style: none;
  display: flex;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

#hud-players li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--wall);
}

#hud-players li.dead {
  opacity: 0.4;
  text-decoration: line-through;
}

#hud-players li.me {
  outline: 2px solid var(--accent);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

#game-canvas {
  background: #0d0e15;
  border-radius: 8px;
  max-width: 100%;
  image-rendering: pixelated;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

#results-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
