:root {
  --teal: #1f9e8f;
  --teal-dark: #15756a;
  --green: #3fc04f;
  --ink: #10221f;
  --paper: #f4faf8;
  --line: #d6e6e1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
.topbar {
  padding: 12px 20px;
  background: var(--teal);
  color: white;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.topbar .brand { font-weight: 800; }
.app { max-width: 900px; margin: 0 auto; padding: 24px; }
.screen { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
button {
  font: inherit; cursor: pointer; border: none; border-radius: 8px;
  padding: 10px 16px; background: var(--teal); color: white; font-weight: 600;
}
button:hover { background: var(--teal-dark); }
button.secondary { background: white; color: var(--teal-dark); border: 1px solid var(--teal); }
input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; width: 100%;
}
.error { color: #c0392b; min-height: 1.2em; }
.game { position: relative; }
.game-grid {
  display: grid; grid-template-columns: 140px auto 140px;
  gap: 16px; align-items: start; justify-content: center;
}
.playfield { background: #0f1c1a; border-radius: 8px; display: block; }
.panel { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.panel canvas { background: #0f1c1a; border-radius: 8px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal-dark); }
.hud { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.hud div { display: flex; justify-content: space-between; align-items: baseline; }
.hud b { font-size: 20px; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  gap: 12px; align-items: center; justify-content: center;
  background: rgba(15, 28, 26, 0.72); color: white; border-radius: 12px; font-size: 24px;
}
.hidden { display: none !important; }

.screen h2 { margin-top: 0; }
.muted { color: #5a726c; }
.big { font-size: 56px; font-weight: 800; margin: 8px 0; color: var(--teal-dark); }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard th, .leaderboard td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.leaderboard .num { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard tr.you { background: #e6f6f2; font-weight: 700; }
