:root {
  --ink: #222;
  --muted: #5f6368;
  --paper: #f7f4ec;
  --card: #fff;
  --graphite: #1f2933;
  --gold: #b08d57;
  --gold-dark: #8d6d3e;
  --line: #d8d1c2;
  --soft: #f5f2eb;
  --correct-bg: #edf7ef;
  --correct-border: #3d7a49;
  --wrong-bg: #fbefee;
  --wrong-border: #a94442;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

.container {
  width: min(960px, 92%);
  margin: 0 auto;
}

.site-header {
  color: #fff;
  background: var(--graphite);
  border-bottom: 4px solid var(--gold);
}

.header-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-name {
  color: #fff;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: bold;
  text-decoration: none;
}

.section-name {
  color: #eee7da;
  font-size: 1rem;
}

.page-content {
  flex: 1;
  padding: 48px 0 64px;
}

.game-card {
  padding: clamp(24px, 5vw, 48px);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: 5px;
  box-shadow: 0 8px 24px rgb(31 41 51 / 8%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  color: var(--graphite);
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.15;
}

.intro {
  max-width: 760px;
  margin: 0 0 34px;
  font-size: 1.08rem;
}

.setup-form {
  display: grid;
  gap: 30px;
}

.setup-section {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.setup-section legend {
  width: 100%;
  margin-bottom: 13px;
  color: var(--graphite);
  font-size: 1.2rem;
  font-weight: bold;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

.degree-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.choice-card:hover,
.choice-card:has(input:checked) {
  border-color: var(--gold-dark);
  background: #f6efe3;
}

.choice-card input {
  width: 19px;
  height: 19px;
  margin: 4px 0 0;
  accent-color: var(--gold-dark);
}

.choice-card span {
  display: grid;
  gap: 1px;
}

.choice-card strong {
  color: var(--graphite);
}

.choice-card small {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
}

.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.segmented-options label {
  cursor: pointer;
}

.segmented-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-options span {
  min-width: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  color: var(--graphite);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 4px;
  font-weight: bold;
}

.segmented-options input:checked + span {
  color: #fff;
  background: var(--graphite);
  border-color: var(--graphite);
}

.segmented-options input:focus-visible + span,
.choice-card:focus-within,
.button:focus-visible,
.answer-button:focus-visible {
  outline: 3px solid rgb(176 141 87 / 40%);
  outline-offset: 3px;
}

.team-name-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.team-name-field {
  display: grid;
  gap: 6px;
}

.team-name-field span {
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  font-weight: bold;
}

.team-name-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 4px;
}

.team-name-field input:focus {
  border-color: var(--gold-dark);
  outline: 3px solid rgb(176 141 87 / 20%);
  outline-offset: 1px;
}

.game-size-summary {
  margin: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
}

.button {
  min-height: 46px;
  padding: 10px 22px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.button-primary {
  color: #fff;
  background: var(--graphite);
  border-color: var(--graphite);
}

.button-primary:hover:not(:disabled) {
  background: #111820;
}

.button-secondary {
  color: var(--graphite);
  background: #fff;
  border-color: var(--line);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--gold);
}

.start-button {
  justify-self: start;
  min-width: 160px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.score-card {
  min-width: 0;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 4px;
}

.score-card.active {
  background: #f6efe3;
  border-color: var(--gold-dark);
}

.score-name {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: bold;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-value {
  display: block;
  color: var(--graphite);
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.2;
}

.question-card {
  padding-top: clamp(22px, 4vw, 36px);
}

.turn-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.turn-name {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
}

.question-progress {
  display: grid;
  justify-items: end;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
}

.progress-track {
  height: 7px;
  margin: 22px 0 32px;
  overflow: hidden;
  background: #e6e1d7;
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 180ms ease;
}

.question-text {
  margin-bottom: 26px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.35;
}

.answer-list {
  display: grid;
  gap: 12px;
}

.answer-button {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 17px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.answer-button:hover:not(:disabled) {
  border-color: var(--gold);
  background: #fcfaf6;
}

.answer-button:disabled {
  cursor: default;
}

.answer-letter {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--graphite);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  font-weight: bold;
}

.answer-button.correct-answer {
  background: var(--correct-bg);
  border-color: var(--correct-border);
}

.answer-button.wrong-answer {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
}

.answer-feedback {
  margin-top: 22px;
  padding: 14px 16px;
  border-left: 5px solid;
  font-weight: bold;
}

.answer-feedback.correct {
  background: var(--correct-bg);
  border-color: var(--correct-border);
}

.answer-feedback.incorrect {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
}

.continue-button {
  margin-top: 18px;
}

.winner-message {
  margin: 0 0 26px;
  font-size: 1.18rem;
}

.final-standings {
  display: grid;
  gap: 10px;
  margin-bottom: 30px;
}

.standing-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.standing-rank {
  color: var(--gold-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
}

.standing-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: bold;
}

.standing-score {
  color: var(--graphite);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.notice {
  padding: 12px 16px;
  color: #6a1b1a;
  background: var(--wrong-bg);
  border: 1px solid var(--wrong-border);
}

.site-footer {
  padding: 22px 0;
  color: #eee7da;
  background: var(--graphite);
  border-top: 4px solid var(--gold);
}

.site-footer p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .degree-grid,
  .team-name-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .header-inner,
  .turn-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    justify-content: center;
    padding: 15px 0;
    gap: 2px;
  }

  .page-content {
    padding: 28px 0 40px;
  }

  .question-progress {
    justify-items: start;
  }

  .segmented-options span {
    min-width: 54px;
    padding-inline: 14px;
  }

  .start-button,
  .continue-button,
  .results-actions .button {
    width: 100%;
  }

  .standing-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .standing-score {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar {
    transition: none;
  }
}
