:root {
  --bg: #f4efe7;
  --panel: #fffaf1;
  --ink: #171512;
  --muted: #6f6659;
  --line: #d8cbb8;
  --accent: #d64b2a;
  --accent-dark: #a4321d;
  --secondary: #1c5f73;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff7df 0, var(--bg) 42rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
.button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.8rem 1.2rem;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button.secondary,
.button.secondary {
  background: var(--secondary);
}

button.danger,
.button.danger {
  background: #9f1d18;
}

button.danger:hover,
.button.danger:hover {
  background: #77130f;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: white;
  color: var(--ink);
  font: inherit;
  min-height: 2.8rem;
  padding: 0.65rem 0.8rem;
}

label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

code {
  background: #efe4d3;
  border-radius: 0.4rem;
  padding: 0.15rem 0.3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}

.brand {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.topbar nav a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

main {
  display: grid;
  gap: 1.2rem;
  padding: 1rem clamp(1rem, 4vw, 3rem) 3rem;
  width: 100%;
}

.hero,
.panel {
  background: color-mix(in srgb, var(--panel) 92%, white);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: 0 1rem 4rem rgb(60 40 20 / 10%);
  margin-inline: auto;
  max-width: 52rem;
  padding: clamp(1.25rem, 4vw, 3rem);
  width: 100%;
}

.hero {
  min-height: 24rem;
}

.wide {
  max-width: 76rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 0.96;
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 5.75rem);
  overflow-wrap: anywhere;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
}

p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.actions,
.answer-buttons,
.stats,
.scoreboards {
  display: grid;
  gap: 1rem;
}

.actions,
.answer-buttons {
  grid-template-columns: repeat(auto-fit, minmax(9rem, max-content));
}

.answer-buttons button {
  border-radius: 1rem;
  font-size: 1.6rem;
  min-height: 5rem;
  min-width: 5rem;
}


.answer-buttons button {
  align-items: center;
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  text-align: left;
}

.answer-buttons button strong,
.option-list strong {
  color: var(--accent);
  font-size: 1.4rem;
}

.answer-buttons button span {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.option-list {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 1rem 0;
  padding: 0;
}

.option-list li {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 2rem 1fr;
  padding: 0.65rem 0.8rem;
}

.warning {
  background: #fff0dc;
  border: 1px solid #e7b56a;
  border-radius: 0.9rem;
  color: #704200;
  font-weight: 800;
  padding: 0.8rem 1rem;
}

.form-card,
.answer-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.host-grid {
  grid-template-columns: minmax(8rem, 12rem) 1fr;
}

.host-actions {
  align-items: start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.host-actions .warning {
  flex-basis: 100%;
  margin: 0;
}

.host-grid button {
  grid-column: 2;
}

.current-question {
  border: 1px solid var(--line);
  border-radius: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
}

.result {
  background: #e9f5e7;
  border: 1px solid #a8d19f;
  border-radius: 0.9rem;
  color: #215c1a;
  font-weight: 800;
  padding: 0.8rem 1rem;
}

.question-timer {
  align-items: baseline;
  background: var(--ink);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  gap: 0.35rem;
  margin: 0.6rem 0;
  padding: 0.55rem 0.85rem;
}

.question-timer span {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.question-timer small {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 800;
  text-transform: uppercase;
}

.scoreboard-live {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.waiting-next {
  align-items: center;
  display: grid;
  justify-items: center;
  min-height: 16rem;
  text-align: center;
}

.spinner {
  animation: spin 0.8s linear infinite;
  border: 0.35rem solid #efe7d7;
  border-radius: 999px;
  border-top-color: var(--accent);
  height: 4rem;
  width: 4rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.stats article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}

.stats strong {
  display: block;
  font-size: 2rem;
}

.stats span {
  color: var(--muted);
}

.scoreboards {
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
}

.scoreboards article {
  overflow-x: auto;
}

.team-panel h1 {
  color: var(--secondary);
  font-size: clamp(3rem, 12vw, 5rem);
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .topbar {
    padding: 0.8rem 1rem 0.35rem;
  }

  .brand {
    font-size: 0.92rem;
    letter-spacing: 0.03em;
  }

  main {
    gap: 0.8rem;
    padding: 0.65rem 0.75rem calc(1.25rem + env(safe-area-inset-bottom));
  }

  .hero,
  .panel {
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem rgb(60 40 20 / 8%);
    max-width: none;
    padding: 1rem;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 3.35rem);
    line-height: 1;
  }

  h2 {
    font-size: clamp(1.7rem, 8vw, 2.45rem);
    line-height: 1.03;
  }

  p {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  .team-panel h1 {
    font-size: clamp(3rem, 16vw, 4.4rem);
  }

  .question-timer {
    justify-content: center;
    width: 100%;
  }

  .answer-buttons {
    grid-template-columns: 1fr;
  }

  .answer-buttons button {
    min-height: 4.5rem;
    width: 100%;
  }

  .waiting-next {
    min-height: 11rem;
  }

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

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

  .host-grid button {
    grid-column: 1;
  }

  .host-actions {
    display: grid;
  }

  th,
  td {
    padding: 0.55rem;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-inline: 0.75rem;
  }

  main {
    padding-inline: 0.55rem;
  }

  .hero,
  .panel {
    border-radius: 0.9rem;
    padding: 0.9rem;
  }

  .team-panel h1 {
    font-size: clamp(2.6rem, 15vw, 3.8rem);
  }
}

.question-plan {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
}

.round-plan {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}

.round-plan ol {
  display: grid;
  gap: 0.6rem;
  list-style-position: inside;
  margin: 0;
  padding: 0;
}

.question-row {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr max-content;
  padding: 0.75rem;
}

.question-row strong,
.question-row span {
  display: block;
}

.question-row.is-next {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.question-row.is-open {
  background: #e9f5e7;
  border-color: #a8d19f;
}

.question-row.is-closed {
  opacity: 0.7;
}

.question-status {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}

.next-question-card {
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 1rem;
  padding: 1rem;
}

@media (max-width: 720px) {
  .question-plan,
  .question-row {
    grid-template-columns: 1fr;
  }
}
