:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5d6678;
  --line: #d8deea;
  --paper: #f6f8fc;
  --panel: #ffffff;
  --blue: #1565d8;
  --green: #18835a;
  --gold: #f0a21a;
  --red: #c94134;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}

button,
.button,
input,
select {
  font: inherit;
}

button,
.button {
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  padding: 12px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

button.secondary,
.button.secondary {
  color: var(--ink);
  background: #e8edf6;
}

button.danger {
  background: var(--red);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.player-shell,
.admin-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 8px 0 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.score-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.06);
}

.score-card {
  min-width: 104px;
  padding: 10px 14px;
  text-align: center;
}

.score-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.score-card strong {
  display: block;
  font-size: 2rem;
}

.panel {
  padding: 16px;
}

.join-panel,
.admin-auth,
.admin-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.admin-auth {
  grid-template-columns: 1fr auto;
}

.admin-controls {
  grid-template-columns: 280px 1fr;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.game-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #b9e2ff;
  aspect-ratio: 5 / 3;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: rgba(11, 20, 38, 0.46);
  font-size: clamp(1.6rem, 7vw, 4rem);
  font-weight: 900;
  text-align: center;
}

.overlay.hidden,
.hidden {
  display: none;
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 1.2fr;
  gap: 14px;
  margin-top: 14px;
}

.leaderboard {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
}

.leaderboard li {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef3fb;
  font-weight: 800;
}

#instructionText,
#gameDetails,
#adminStatus {
  color: var(--muted);
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .topbar,
  .join-panel,
  .admin-auth,
  .admin-controls,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .score-card {
    width: 100%;
  }
}
