:root {
  --bg: #f4f0e8;
  --surface: #fffdf8;
  --ink: #111816;
  --muted: #66736f;
  --line: #ddd4c8;
  --accent: #0f766e;
  --accent-strong: #0b534d;
  --danger: #b23b3b;
  --gold: #c98f26;
  --shadow: 0 18px 45px rgba(37, 31, 22, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 28px clamp(18px, 4vw, 52px) 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
}

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

h1 {
  max-width: 820px;
  font-size: clamp(2.2rem, 5vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-width: 110px;
  padding: 10px 16px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab.is-active {
  background: var(--ink);
  color: white;
}

main {
  padding: 28px clamp(18px, 4vw, 52px) 54px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.game-layout,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(270px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.panel-title,
.section-head,
.quiz-status,
.result-grid,
.choice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-head {
  margin-bottom: 18px;
}

.side-panel {
  display: grid;
  gap: 16px;
}

.challenge-info {
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.4;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(201, 143, 38, 0.35);
  outline-offset: 2px;
}

.primary-button,
.secondary,
.ghost-button {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 900;
}

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

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

.quiz-panel {
  min-height: 520px;
}

.empty-state,
.result-state {
  min-height: 470px;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
}

.empty-state h2,
.result-state h2 {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: 1;
}

.empty-state p {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.1rem;
}

.question-state {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.quiz-status {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
}

#questionText {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.03;
  max-width: 900px;
}

.answer-area {
  display: grid;
  gap: 10px;
}

.choice-row {
  justify-content: flex-start;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
}

.choice-row.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.feedback {
  min-height: 26px;
  color: var(--muted);
  font-weight: 900;
}

.feedback.is-good {
  color: var(--accent-strong);
}

.feedback.is-bad {
  color: var(--danger);
}

.result-grid {
  justify-content: center;
  flex-wrap: wrap;
}

.result-grid div {
  min-width: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.result-grid span {
  display: block;
  color: var(--muted);
  font-weight: 900;
}

.result-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
}

.leaderboard {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard th,
.leaderboard td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.leaderboard th {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.question-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.question-card p {
  color: var(--muted);
  margin-top: 6px;
}

.form-message {
  min-height: 24px;
  color: var(--muted);
  font-weight: 900;
}

@media (max-width: 900px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .game-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }
}
