:root {
  --bg: #0d1510;
  --panel: #17231b;
  --panel-soft: #1d2d22;
  --paper: #f4ecd9;
  --paper-text: #211c15;
  --text: #f7f2e7;
  --muted: #c5bcaa;
  --line: rgba(247, 242, 231, 0.15);
  --strong-line: rgba(247, 242, 231, 0.28);
  --accent: #efd17f;
  --success: #92d29e;
  --danger: #ef9e91;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(239, 209, 127, 0.14),
      transparent 34rem
    ),
    linear-gradient(
      160deg,
      #0d1510 0%,
      #14231a 52%,
      #090e0b 100%
    );
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px 14px 52px;
}

.hero,
.next-step-card,
.notice,
.round-section,
.score-summary,
.participation-panel,
.consent-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 20px;
  background: rgba(23, 35, 27, 0.95);
}

.hero-top,
.participation-heading,
.round-heading,
.round-finish,
.question-main,
.next-step-card,
.next-step-actions,
.participation-actions,
.consent-actions,
.footer-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-top,
.participation-heading,
.round-heading,
.round-finish,
.next-step-card {
  justify-content: space-between;
}

.brand {
  color: var(--accent);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 800;
}

.quick-links,
.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-links a,
.secondary-actions a {
  color: var(--muted);
  text-decoration: none;
}

.quick-links a:hover,
.secondary-actions a:hover {
  color: var(--text);
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1;
}

h2 {
  margin-bottom: 8px;
}

.event-meta,
.muted,
.score-rule,
.round-meta,
.question-status,
.private-name-field {
  color: var(--muted);
}

.privacy-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  padding: 11px 13px;
  border: 1px solid rgba(146, 210, 158, 0.28);
  border-radius: 14px;
  background: rgba(146, 210, 158, 0.08);
  color: var(--muted);
}

.privacy-line strong {
  color: var(--success);
}

.privacy-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px rgba(146, 210, 158, 0.7);
}

.private-name-field {
  display: grid;
  gap: 7px;
  max-width: 440px;
  font-size: 0.88rem;
}

.private-name-field input,
.identity-controls select {
  width: 100%;
  border: 1px solid var(--strong-line);
  border-radius: 12px;
  background: rgba(7, 12, 9, 0.66);
  color: var(--text);
  padding: 12px;
}

.next-step-card,
.notice,
.score-summary,
.participation-panel,
.consent-panel {
  margin-top: 14px;
  padding: 18px;
  background: rgba(23, 35, 27, 0.96);
}

.next-step-card {
  align-items: flex-start;
  flex-wrap: wrap;
}

.next-step-card > div:first-child {
  flex: 1 1 400px;
}

.next-step-actions {
  flex: 0 0 auto;
}

.secondary-actions {
  flex: 1 0 100%;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.notice {
  color: var(--danger);
  border-color: rgba(239, 158, 145, 0.35);
}

.button {
  min-height: 44px;
  border: 1px solid var(--strong-line);
  border-radius: 12px;
  padding: 10px 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(239, 209, 127, 0.55);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary {
  color: #221b0e;
  border-color: var(--accent);
  background: var(--accent);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.04);
}

.button.danger {
  color: var(--danger);
}

.round-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 21, 16, 0.93);
  backdrop-filter: blur(12px);
}

.round-tab {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.round-tab.active {
  color: #221b0e;
  background: var(--accent);
}

.round-tab.reviewed::after {
  content: " ✓";
}

.answer-sheet {
  display: grid;
  gap: 14px;
}

.round-section {
  display: none;
  padding: 16px;
  background: rgba(23, 35, 27, 0.96);
}

.round-section.active {
  display: block;
}

.round-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.answer-row,
.bonus-row {
  margin-top: 10px;
  padding: 13px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--paper-text);
}

.answer-row.correct,
.bonus-row.correct {
  outline: 3px solid rgba(76, 150, 91, 0.42);
}

.answer-row.missed,
.bonus-row.missed {
  opacity: 0.84;
}

.question-main {
  align-items: flex-start;
}

.question-number {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff8e8;
  background: #273a2d;
  font-weight: 900;
}

.question-body {
  min-width: 0;
  flex: 1;
}

.answer-input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid rgba(33, 28, 21, 0.24);
  border-radius: 0;
  padding: 7px 2px;
  color: var(--paper-text);
  background: transparent;
  font-size: 1.05rem;
}

.answer-input:focus {
  outline: 0;
  border-color: #516f59;
}

.question-tools,
.mark-tools,
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.question-tools {
  margin-top: 10px;
}

.tool-button,
.mark-button,
.choice-button {
  border: 1px solid rgba(33, 28, 21, 0.22);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--paper-text);
  background: rgba(255, 255, 255, 0.42);
  font-weight: 750;
  cursor: pointer;
}

.tool-button.used {
  color: #735719;
  border-color: rgba(115, 87, 25, 0.34);
  background: rgba(239, 209, 127, 0.35);
}

.mark-button.selected-correct {
  color: #21492b;
  border-color: rgba(33, 73, 43, 0.4);
  background: rgba(146, 210, 158, 0.42);
}

.mark-button.selected-missed {
  color: #732f27;
  border-color: rgba(115, 47, 39, 0.38);
  background: rgba(239, 158, 145, 0.4);
}

.choice-panel {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed rgba(33, 28, 21, 0.28);
  border-radius: 12px;
}

.choice-warning {
  margin-bottom: 8px;
  color: #735719;
  font-size: 0.85rem;
  font-weight: 800;
}

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

.choice-button {
  text-align: left;
}

.choice-button.selected {
  border-color: #516f59;
  background: rgba(81, 111, 89, 0.22);
}

.question-status {
  display: block;
  margin-top: 8px;
  color: rgba(33, 28, 21, 0.68);
  font-size: 0.82rem;
}

.bonus-row h3 {
  margin-bottom: 5px;
}

.bonus-prompt {
  color: rgba(33, 28, 21, 0.74);
}

.round-finish {
  align-items: flex-start;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.round-finish-copy {
  flex: 1;
}

.round-finish-copy p {
  margin-bottom: 0;
}

.score-summary {
  position: sticky;
  bottom: 10px;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.score-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 9, 0.68);
}

.score-stat span,
.score-stat strong {
  display: block;
}

.score-stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-stat strong {
  margin-top: 3px;
  font-size: 1.65rem;
}

.score-stat.featured {
  border-color: rgba(239, 209, 127, 0.38);
}

.score-rule {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.84rem;
}

.identity-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.identity-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

.participation-heading {
  align-items: flex-start;
}

.connection-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.connection-pill.connected {
  color: var(--success);
  border-color: rgba(146, 210, 158, 0.38);
}

.participation-actions,
.consent-actions,
.footer-actions {
  flex-wrap: wrap;
}

.sync-message {
  margin-top: 12px;
  padding: 11px;
  border-radius: 12px;
  color: var(--success);
  background: rgba(146, 210, 158, 0.09);
}

.sync-message.error {
  color: var(--danger);
  background: rgba(239, 158, 145, 0.09);
}

.consent-panel {
  border-color: rgba(239, 209, 127, 0.44);
}

.footer-actions {
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 720px) {
  .hero-top,
  .participation-heading,
  .round-heading,
  .round-finish,
  .next-step-card {
    align-items: stretch;
    flex-direction: column;
  }

  .next-step-actions,
  .participation-actions,
  .consent-actions,
  .footer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .next-step-actions > *,
  .participation-actions > *,
  .consent-actions > *,
  .footer-actions > * {
    width: 100%;
    text-align: center;
  }

  .identity-controls {
    grid-template-columns: 1fr;
  }

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

  .score-summary {
    grid-template-columns: 1fr 1fr;
  }

  .score-stat:last-of-type {
    grid-column: 1 / -1;
  }
}
