:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-strong: #1f2937;
  --text: #f6f8fa;
  --muted: #9ba7b4;
  --line: #303845;
  --accent: #2f81f7;
  --good: #2ea043;
  --bad: #f85149;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(47, 129, 247, 0.14), transparent 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.game-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #79c0ff;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 2.4rem;
  line-height: 1;
}

.score-card,
.stats > div,
.photo-card,
.end-card,
.leaderboard-card {
  border: 1px solid var(--line);
  background: rgba(21, 27, 35, 0.88);
  box-shadow: var(--shadow);
}

.score-card {
  min-width: 132px;
  border-radius: 8px;
  padding: 14px 18px;
  text-align: right;
}

.score-card span,
.stats span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats > div {
  border-radius: 8px;
  padding: 14px 16px;
}

.stats strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
}

.photo-card {
  overflow: hidden;
  border-radius: 8px;
}

.image-frame {
  position: relative;
  display: grid;
  min-height: 280px;
  max-height: 64vh;
  background: #070a0f;
  place-items: center;
}

.image-frame img {
  display: block;
  width: 100%;
  height: min(64vh, 620px);
  object-fit: contain;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  background: rgba(7, 10, 15, 0.78);
  color: var(--muted);
  place-items: center;
}

.loading[hidden] {
  display: none;
}

.prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.prompt p {
  margin: 0;
  color: var(--muted);
}

.choices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.choice {
  min-height: 56px;
  padding: 0 14px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.choice:hover:not(:disabled) {
  background: #273449;
  transform: translateY(-1px);
}

.choice:disabled {
  cursor: default;
  opacity: 0.82;
}

.choice.correct {
  background: var(--good);
  color: white;
}

.choice.wrong {
  background: var(--bad);
  color: white;
}

.secondary,
.end-card button {
  min-height: 44px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.end-card {
  margin-top: 16px;
  border-radius: 8px;
  padding: 22px;
}

.final-copy {
  color: var(--muted);
  line-height: 1.55;
}

.score-form {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.score-form label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.score-form div {
  display: flex;
  gap: 10px;
}

.score-form input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #070a0f;
  color: var(--text);
  font: inherit;
}

.score-form button:disabled,
.score-form input:disabled {
  cursor: default;
  opacity: 0.72;
}

#score-save-feedback {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
}

.leaderboard-card {
  margin-top: 16px;
  border-radius: 8px;
  padding: 22px;
}

.leaderboard-header {
  margin-bottom: 14px;
}

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

.leaderboard-list li {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-strong);
}

.leaderboard-list li::marker {
  color: #79c0ff;
  font-weight: 800;
}

.leaderboard-list strong,
.leaderboard-list span {
  display: block;
}

.leaderboard-list span,
.empty-leaderboard {
  color: var(--muted);
}

.empty-leaderboard {
  margin: 0;
}

@media (max-width: 760px) {
  .game-shell {
    width: min(100% - 24px, 1120px);
    padding: 20px 0;
  }

  .topbar,
  .prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .score-card {
    text-align: left;
  }

  h1 {
    font-size: 2rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .image-frame img {
    height: 54vh;
  }

  .score-form div {
    flex-direction: column;
  }
}
