:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(8, 20, 35, 0.88);
  --panel-border: rgba(157, 201, 255, 0.18);
  --text: #edf6ff;
  --muted: #9eb5d2;
  --accent: #7df9c1;
  --accent-strong: #31d49a;
  --warning: #ffc857;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(72, 125, 199, 0.22), transparent 34%),
    linear-gradient(160deg, #02060d 0%, #07111f 48%, #0b2037 100%);
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 1.5rem;
  min-height: 100vh;
  padding: 1.25rem;
}

.panel,
.game-frame {
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 60px var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.copy h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 3rem);
  line-height: 0.95;
}

.lede {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hud {
  display: grid;
  gap: 0.85rem;
}

.stat {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat strong {
  font-size: 1.35rem;
}

.text-input {
  width: 100%;
  border: 1px solid rgba(157, 201, 255, 0.22);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  color: var(--text);
  background: rgba(5, 15, 27, 0.9);
}

.text-input:focus {
  outline: 2px solid rgba(125, 249, 193, 0.35);
  outline-offset: 2px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.15rem;
  cursor: pointer;
  color: #042315;
  background: linear-gradient(135deg, var(--accent), #b6ffd1);
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
  box-shadow: 0 14px 30px rgba(49, 212, 154, 0.18);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 35px rgba(49, 212, 154, 0.24);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  color: var(--text);
  background: linear-gradient(135deg, rgba(83, 109, 134, 0.9), rgba(48, 65, 82, 0.95));
  box-shadow: 0 14px 30px rgba(7, 17, 31, 0.32);
}

.helper {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.leaderboard-panel {
  min-height: 0;
}

.leaderboard-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.65rem;
}

.leaderboard-list li {
  color: var(--text);
  line-height: 1.4;
}

.leaderboard-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.score-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-shots {
  color: var(--accent);
  white-space: nowrap;
}

.empty-state {
  color: var(--muted);
}

.game-frame {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 13, 0.55);
}

.hidden {
  display: none;
}

.overlay-card {
  width: min(92%, 420px);
  padding: 2rem;
  border-radius: 24px;
  background: rgba(7, 17, 31, 0.96);
  border: 1px solid rgba(125, 249, 193, 0.2);
  text-align: center;
}

.overlay-card h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.overlay-card p {
  color: var(--muted);
}

.overlay-label {
  margin-top: 1rem;
  text-align: left;
}

.overlay-helper {
  text-align: left;
}

.overlay-buttons {
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel {
    order: 2;
  }

  .game-frame {
    order: 1;
    min-height: 60vh;
  }
}
