:root {
  color-scheme: light;
  --ink: #171716;
  --muted: #5f625d;
  --line: #24251f;
  --bg: #eeece4;
  --rail: #242a34;
  --paper-shadow: 0 24px 58px rgba(5, 7, 10, 0.32);
  --focus: #0f6ea8;
  --accent: #b5272f;
  --green: #29715c;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(180deg, #29303a 0%, #1d2229 460px, #1a1f27 100%);
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(180px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px clamp(16px, 3vw, 32px);
  color: #fffdf4;
  background: rgba(21, 24, 28, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  flex: 0 0 auto;
}

.wordmark {
  color: #fffdf4;
  font-weight: 950;
  letter-spacing: 0;
}

.wordmark span {
  color: #f2c94c;
}

.tagline {
  margin: 24px 0 0;
}

.tagline .wordmark {
  display: inline-block;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.top-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #ece6d8;
  font-size: 0.92rem;
}

.meter {
  position: relative;
  width: min(460px, 100%);
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: #f2c94c;
  border-radius: inherit;
  transition: width 280ms ease;
}

.mobile-nav-toggle {
  display: none;
  min-height: 40px;
  padding: 0 14px;
  color: #fffdf4;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: clamp(20px, 4vw, 52px);
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.sidebar {
  position: sticky;
  top: 82px;
  align-self: start;
  color: #f8f1df;
}

.sidebar-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  opacity: 0.72;
}

.nav-item:hover,
.nav-item.current {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-item.completed .nav-dot {
  color: #182019;
  background: #f2c94c;
  border-color: #f2c94c;
}

.nav-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #f8f1df;
  font-size: 0.78rem;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
}

.nav-label {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  min-width: 0;
}

.intro {
  min-height: auto;
  display: flex;
  align-items: flex-start;
  padding: 0 0 clamp(28px, 5vh, 48px);
  color: #fffdf4;
}

.intro-copy {
  max-width: 760px;
}

.kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro .kicker {
  color: #f2c94c;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.85rem, 8.8vw, 6.25rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.intro p:not(.kicker) {
  max-width: 690px;
  color: #efe9dc;
  font-size: clamp(1.08rem, 2vw, 1.38rem);
  line-height: 1.5;
}

.ballot-stack {
  display: grid;
  gap: 28px;
}

.ballot-sheet {
  position: relative;
  scroll-margin-top: 82px;
  min-height: auto;
  padding: clamp(22px, 4vw, 44px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.06) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.08)),
    var(--paper);
  border: 3px solid var(--line);
  box-shadow: var(--paper-shadow);
}

.ballot-sheet::before {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  content: "";
  border: 1px dashed rgba(0, 0, 0, 0.28);
}

.sheet-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.42);
}

.sheet-number {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: #fffdf4;
  font-weight: 900;
  background: var(--line);
  border-radius: 4px;
}

.question-wording {
  margin-bottom: 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.22rem, 2vw, 1.72rem);
  line-height: 1.22;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.answer-button {
  min-height: 76px;
  padding: 12px;
  color: var(--ink);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.52);
  border: 2px solid var(--line);
  border-radius: 6px;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.answers-2 .answer-button {
  overflow-wrap: anywhere;
}

.answer-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.8);
}

.answer-button.selected {
  color: #fffdf4;
  background: var(--line);
}

.answer-button.selected:hover,
.answer-button.selected:focus-visible {
  color: #fffdf4;
  background: var(--line);
}

.button {
  min-height: 46px;
  padding: 0 18px;
  font-weight: 900;
  border: 2px solid var(--line);
  border-radius: 6px;
}

.button.primary {
  color: #fffdf4;
  background: var(--line);
}

.button.secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.explainer {
  display: none;
  width: 100%;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid rgba(0, 0, 0, 0.36);
}

.ballot-sheet.revealed .explainer {
  display: block;
  animation: expandIn 260ms ease both;
}

.explainer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.explain-block {
  padding: 18px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(0, 0, 0, 0.26);
  border-radius: 8px;
}

.explain-block h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.explain-block p {
  margin-bottom: 0;
  color: #34352f;
  line-height: 1.5;
}

.recommendation {
  display: grid;
  gap: 10px;
  padding: 20px;
  color: #fffdf4;
  background: var(--line);
  border-radius: 8px;
}

.recommendation strong {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.continue-row {
  margin-top: 20px;
}

.final-panel {
  scroll-margin-top: 82px;
  margin-top: 32px;
  padding: clamp(26px, 5vw, 56px);
  color: #fffdf4;
  background: #171716;
  border: 3px solid #f2c94c;
  box-shadow: var(--paper-shadow);
}

.final-panel h2 {
  max-width: 780px;
  margin-bottom: 16px;
  font-size: clamp(2.4rem, 6vw, 5.2rem);
  line-height: 0.95;
}

.final-panel p {
  max-width: 760px;
  color: #eee7d8;
  font-size: 1.12rem;
  line-height: 1.55;
}

.final-lockup {
  margin: 28px 0;
  font-size: clamp(1.9rem, 5vw, 4.3rem);
  font-weight: 950;
  line-height: 1;
}

.final-lockup .wordmark {
  display: inline-block;
}

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

.final-panel .button.secondary {
  color: #fffdf4;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.52);
}

.final-panel .button.primary {
  color: #171716;
  background: #f2c94c;
  border-color: #f2c94c;
}

.hidden {
  display: none !important;
}

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  padding: 12px;
  background: rgba(0, 0, 0, 0.5);
}

.mobile-nav[hidden] {
  display: none;
}

.mobile-nav-panel {
  max-height: min(620px, 88vh);
  padding: 18px;
  overflow: auto;
  color: #fffdf4;
  background: #1b2028;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

.mobile-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mobile-nav-head button {
  min-height: 36px;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
}

@keyframes expandIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .top-progress {
    grid-column: 1 / -1;
    order: 3;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .layout {
    display: block;
    width: min(100% - 24px, 760px);
    padding-top: 24px;
  }

  .sidebar {
    display: none;
  }

  .intro {
    min-height: auto;
    padding-top: 28px;
  }

}

@media (max-width: 620px) {
  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand span {
    font-size: 0.95rem;
  }

  .top-progress {
    align-items: start;
    flex-direction: column;
    gap: 7px;
  }

  .meter {
    width: 100%;
  }

  .intro {
    padding: 28px 0 22px;
  }

  .ballot-sheet {
    padding: 22px 18px;
    border-width: 2px;
  }

  .question-wording {
    font-size: 1.42rem;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
