
:root {
  --bg: #0f2a1f;
  --bg-card: #163528;
  --ink: #f4efe4;
  --muted: #c5d4cb;
  --accent: #d4f56e;
  --accent-ink: #132418;
  --line: rgba(244, 239, 228, 0.14);
  --wrong: #f3b4a8;
  --right: #d4f56e;
  --tier-1: #c5d4cb; /* Sunday League */
  --tier-2: #9fd3f0; /* Amateur */
  --tier-3: #d4f56e; /* Semi-Pro */
  --tier-4: #c9a8ff; /* World Class */
  --tier-5: #ffd25e; /* Golden Boy */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top, #1b4634, var(--bg) 55%);
  color: var(--ink);
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app {
  width: min(440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.brand-mark {
  margin: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.menu-wrap {
  position: relative;
}

.menu-button {
  display: flex;
  width: 42px;
  height: 42px;
  padding: 10px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-card);
  cursor: pointer;
}

.menu-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.menu-panel {
  position: absolute;
  top: 50px;
  left: 0;
  z-index: 10;
  width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #163528;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel button {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.menu-panel button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.screen {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 22px 28px;
}

.screen[hidden] {
  display: none;
}

.kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
}

h2 {
  margin: 0 0 12px;
  font-size: 1.55rem;
  line-height: 1.25;
}

.lede,
.results-note {
  margin: 0 0 18px;
  color: var(--muted);
}

.how-to {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.how-to li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.how-to li:last-child {
  border-bottom: 1px solid var(--line);
}

.button {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.button:hover {
  filter: brightness(1.06);
}

.button:active {
  transform: scale(0.99);
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

#question-number {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.timer {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}

.timer-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#timer-value {
  font-size: 1.35rem;
  font-weight: 800;
  min-width: 1.5em;
  text-align: right;
}

.timer.is-low #timer-value {
  color: var(--wrong);
}

#answer-form label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 600;
}

.combobox {
  position: relative;
}

#answer-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #10291f;
  color: var(--ink);
  font-size: 1rem;
}

#answer-input::placeholder {
  color: #91a99a;
}

/* The suggestion list floats over the content below the text box. */
.combobox-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 240px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10291f;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.combobox-options[hidden] {
  display: none;
}

.combobox-option {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.combobox-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.combobox-option[aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.combobox-alias {
  opacity: 0.7;
}

.combobox-empty {
  padding: 10px 12px;
  color: var(--muted);
}

.answer-hint {
  min-height: 1.5em;
  margin: 6px 0 10px;
  color: var(--wrong);
  font-size: 0.92rem;
}

.feedback-mark {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.feedback-mark.is-correct {
  color: var(--right);
}

.feedback-mark.is-incorrect {
  color: var(--wrong);
}

.feedback-question {
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 600;
}

/* Explains a timed-out question, e.g. one that ran out while away. */
.feedback-note {
  margin: -6px 0 16px;
  color: var(--tier-5);
  font-size: 0.92rem;
}

.feedback-note[hidden] {
  display: none;
}

.feedback-answer {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  overflow-wrap: anywhere;
}

.feedback-answer p {
  margin: 0;
}

.feedback-answer p + p {
  margin-top: 10px;
}

/* Points earned for this question, shown above the answer list. */
.feedback-points {
  margin-bottom: 24px;
}

.feedback-points p {
  margin: 0;
}

.feedback-earned {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}

.feedback-tier {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--muted);
}

.feedback-points .feedback-total {
  margin-top: 6px;
  color: var(--muted);
}

/* All accepted answers for a question, shown when a result is expanded. */
.tier-groups {
  margin-top: 12px;
  padding: 4px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  overflow-wrap: anywhere;
}

.tier-groups p {
  margin: 0;
}

.tier-group {
  margin-top: 10px;
}

.tier-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tier-groups .tier-group-answers {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

/* Each answer on its own line: name pushed left, points pushed right. */
.tier-group-answers li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.answer-points {
  flex-shrink: 0;
  color: var(--muted);
}

.tier-group-answers .is-picked {
  font-weight: 800;
}

.tier-group-answers .is-picked span:first-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* One color per tier, from common (muted) to rare (gold). */
.tier-1 .tier-group-label,
.feedback-tier.tier-1,
.result-mark.tier-1 {
  color: var(--tier-1);
}

.tier-2 .tier-group-label,
.feedback-tier.tier-2,
.result-mark.tier-2 {
  color: var(--tier-2);
}

.tier-3 .tier-group-label,
.feedback-tier.tier-3,
.result-mark.tier-3 {
  color: var(--tier-3);
}

.tier-4 .tier-group-label,
.feedback-tier.tier-4,
.result-mark.tier-4 {
  color: var(--tier-4);
}

.tier-5 .tier-group-label,
.feedback-tier.tier-5,
.result-mark.tier-5 {
  color: var(--tier-5);
}

/* "UKnowBall #3 · Thu, Oct 15" under the kicker. */
.game-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

/* "Next game in 19h 05m 12s" */
.next-game {
  margin: 14px 0;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.next-game[hidden] {
  display: none;
}

.total-score {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 800;
}

.max-score {
  margin: 0 0 18px;
  color: var(--muted);
}

.results-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
}

.stat p {
  margin: 0;
}

.stat-label,
.stat-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
}

.results-list {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.results-list > li {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.results-list > li:last-child {
  border-bottom: 1px solid var(--line);
}

.results-hint {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* The clickable part of each result. The browser's default triangle is
   replaced with a chevron on the right that flips when the row is open. */
.results-list summary {
  position: relative;
  padding-right: 32px;
  list-style: none;
  cursor: pointer;
}

.results-list summary::-webkit-details-marker {
  display: none;
}

.results-list summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-75%) rotate(45deg);
  transition: transform 0.15s ease;
}

.results-list details[open] summary::after {
  transform: translateY(-25%) rotate(-135deg);
}

.results-list summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.result-q {
  margin: 0 0 6px;
  font-weight: 700;
}

.result-a {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.result-mark {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-mark.is-incorrect {
  color: var(--wrong);
}

@media (max-width: 360px) {
  .app {
    width: calc(100% - 20px);
  }

  .screen {
    padding: 20px 16px 24px;
  }

  .question-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 640px) {
  .app {
    padding-top: 48px;
  }
}
