/* ==========================================================================
   EDIT ME: colors, fonts, and spacing all live in this one block.
   Change these and the whole page follows.

   The design is deliberately flat: no gradients, no shadows, no rounded
   corners, no animation. Structure comes from hairline rules, alignment,
   and type size — not from boxes.
   ========================================================================== */

:root {
  color-scheme: light;

  --color-bg: #f6f1e7;
  --color-border: #ddd3c2;
  --color-text: #161412;
  --color-text-muted: #6b645b;
  --color-accent: #b3121f;
  --color-on-accent: #fff8ec;
  --color-gold: #a87700;
  --color-right: #1d6b3a;
  --color-right-bg: #e2efdf;
  --color-wrong-bg: #f6dcd8;

  --font-sans:
    ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;

  --rule: 1px solid var(--color-border);
  --page-width: 40rem;
  --gutter: 1.5rem;
}

/* Dark theme. Two selectors so it works from the operating system setting on
   its own, and from the toggle button. Keep these blocks in sync. */

:root[data-theme='dark'] {
  color-scheme: dark;

  --color-bg: #141110;
  --color-border: #35302b;
  --color-text: #f4eee4;
  --color-text-muted: #a69e93;
  --color-accent: #ff5a4f;
  --color-on-accent: #141110;
  --color-gold: #f2c230;
  --color-right: #6fd08f;
  --color-right-bg: #17291c;
  --color-wrong-bg: #3a1714;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --color-bg: #141110;
    --color-border: #35302b;
    --color-text: #f4eee4;
    --color-text-muted: #a69e93;
    --color-accent: #ff5a4f;
    --color-on-accent: #141110;
    --color-gold: #f2c230;
    --color-right: #6fd08f;
    --color-right-bg: #17291c;
    --color-wrong-bg: #3a1714;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-accent);
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0;
  left: var(--gutter);
  translate: 0 -200%;
  padding: 0.5rem 0.75rem;
  border: var(--rule);
  background: var(--color-bg);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 2;
}

.skip-link:focus-visible {
  translate: 0 0;
}

/* The sprite holds icon definitions only and must never take up space. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Small uppercase section label. */
.label {
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding: clamp(3.5rem, 10vh, 6rem) var(--gutter) 4rem;
}

/* ==========================================================================
   Header — a thick red rule and a star, poster style
   ========================================================================== */

.hero {
  padding-bottom: 2rem;
  border-bottom: 6px solid var(--color-accent);
}

.hero__star {
  display: block;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.5rem;
  fill: var(--color-accent);
  stroke: none;
}

.hero .label {
  color: var(--color-accent);
}

.hero__title {
  margin-top: 0.5rem;
  font-size: clamp(2.125rem, 9vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.hero__tagline {
  max-width: 32rem;
  margin-top: 1rem;
  font-size: 1.0625rem;
  text-wrap: pretty;
}

.notice {
  margin-top: 2rem;
  padding: 1rem;
  border: var(--rule);
}

.screen {
  margin-top: 2.5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.button {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  border: 2px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

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

.button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Setup form
   ========================================================================== */

.setup {
  display: grid;
  gap: 1.75rem;
  margin-top: 1rem;
}

.setup .button {
  justify-self: start;
}

.field {
  margin: 0;
  padding: 0;
  border: 0;
  border-top: var(--rule);
}

.field[hidden] {
  display: none;
}

.field__legend {
  padding: 1rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.choice input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--color-accent);
}

.team-names {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.field__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

.field__row select,
.field__row input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--color-text-muted);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

.field__row select {
  width: auto;
  justify-self: start;
}

/* ==========================================================================
   Question
   ========================================================================== */

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.status__turn {
  color: var(--color-accent);
  font-weight: 700;
}

.progress {
  height: 4px;
  margin-top: 0.75rem;
  background: var(--color-border);
}

.progress span {
  display: block;
  height: 100%;
  background: var(--color-accent);
}

.question {
  margin-top: 1.75rem;
  font-size: clamp(1.375rem, 5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.question:focus {
  outline: none;
}

.options {
  margin-top: 1.5rem;
  border-top: var(--rule);
}

.options li {
  border-bottom: var(--rule);
}

.option {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  width: 100%;
  padding: 1rem 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.0625rem;
  text-align: left;
  cursor: pointer;
}

.option:hover:not(:disabled) {
  background: var(--color-border);
}

.option:disabled {
  cursor: default;
}

.option__letter {
  flex: none;
  width: 1.25rem;
  color: var(--color-accent);
  font-weight: 800;
}

.option.is-right {
  background: var(--color-right-bg);
  color: var(--color-right);
  font-weight: 700;
}

.option.is-right .option__letter {
  color: inherit;
}

.option.is-wrong {
  background: var(--color-wrong-bg);
  text-decoration: line-through;
}

.feedback {
  margin-top: 1.5rem;
  padding-left: 1rem;
  border-left: 4px solid var(--color-accent);
}

.feedback__verdict {
  font-size: 1.125rem;
  font-weight: 800;
}

.feedback__verdict.is-right {
  color: var(--color-right);
}

.feedback__verdict.is-wrong {
  color: var(--color-accent);
}

.feedback__fact {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.feedback .button {
  margin-top: 1.25rem;
}

/* ==========================================================================
   Scoreboard and final ranking
   ========================================================================== */

.scoreboard {
  margin-top: 2.5rem;
}

.scoreboard__list,
.ranking {
  margin-top: 0.75rem;
  border-top: var(--rule);
}

.scoreboard__list li,
.ranking li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: var(--rule);
}

.scoreboard__list li.is-current {
  color: var(--color-accent);
  font-weight: 700;
}

.scoreboard__score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result__title {
  margin-top: 0.5rem;
  color: var(--color-accent);
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
}

.result__title:focus {
  outline: none;
}

.result__text {
  margin-top: 1rem;
  font-size: 1.0625rem;
  text-wrap: pretty;
}

.ranking {
  margin-top: 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: place;
}

.ranking li {
  counter-increment: place;
}

.ranking li span:first-child::before {
  content: counter(place) '. ';
  color: var(--color-text-muted);
}

.ranking li:first-child {
  color: var(--color-gold);
  font-weight: 700;
}

.ranking:empty {
  display: none;
}

#screen-result .button {
  margin-top: 2rem;
}

@media (max-width: 30rem) {
  .field__row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: var(--rule);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.footer a {
  color: inherit;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Toolbar (theme toggle + copy link)
   ========================================================================== */

.toolbar {
  position: fixed;
  top: var(--gutter);
  right: var(--gutter);
  display: flex;
  gap: 0.5rem;
  z-index: 1;
}

.toolbar__button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: var(--rule);
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
}

.toolbar__button:hover {
  color: var(--color-text);
}

/* Show the sun in light mode and the moon in dark mode. Both icons live in
   the same button so its size never shifts when the theme changes. */
.icon--dark {
  display: none;
}

:root[data-theme='dark'] .icon--light {
  display: none;
}

:root[data-theme='dark'] .icon--dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon--light {
    display: none;
  }

  :root:not([data-theme='light']) .icon--dark {
    display: block;
  }
}
