:root {
  --navy: #1e2761;
  --ice: #cadcfc;
  --white: #ffffff;
  --ink: #1b1f2a;
  --muted: #5b6472;
  --good: #1e7a3a;
  --bad: #b3261e;
  --border: #dfe4ee;
}

* { box-sizing: border-box; }

/* .btn and a few other classes below set their own `display`, which has
   the same CSS specificity as the browser's built-in `[hidden] { display:
   none }` rule -- and author styles win specificity ties over the
   user-agent stylesheet. Without this, an element that's both `.btn` and
   `hidden` (e.g. the Load More button before there's more to load) stays
   visible. !important forces `hidden` to always win. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--white);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.app { width: 100%; max-width: 520px; }

.app-header { text-align: center; margin-bottom: 32px; }

.app-header h1 {
  font-size: 28px;
  margin: 0 0 6px;
  color: var(--navy);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 14px;
}

.nav-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

.nav-link.nav-exit {
  color: var(--muted);
}

.screen-root { position: relative; }

.screen {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
}

.lead { font-size: 16px; margin-top: 0; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover { opacity: 0.92; }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--ice);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: default;
}

.error {
  color: var(--bad);
  font-size: 14px;
  margin-top: 8px;
}

.progress {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
}

.source {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  overflow-wrap: break-word;
}

.source a {
  color: var(--muted);
}

.source a:hover {
  color: var(--navy);
}

#question-text {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 20px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.choice-btn {
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--navy);
  background: var(--ice);
}

.choice-btn:disabled { cursor: default; }

.choice-btn.correct {
  border-color: var(--good);
  background: #e6f4ea;
  font-weight: 600;
}

.choice-btn.incorrect {
  border-color: var(--bad);
  background: #fbe9e7;
}

.feedback {
  font-weight: 600;
  margin-bottom: 16px;
}

.feedback.correct { color: var(--good); }
.feedback.incorrect { color: var(--bad); }

.detail {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin: -8px 0 16px;
}

.highscore-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  counter-reset: rank;
}

.highscore-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.highscore-list li:before {
  counter-increment: rank;
  content: counter(rank) ".";
  color: var(--muted);
  width: 24px;
  flex-shrink: 0;
}

.highscore-list li.me {
  font-weight: 700;
  color: var(--navy);
}
