:root {
  --paper: #f4ede1;
  --paper-deep: #ece2d1;
  --paper-light: #faf6ee;
  --ink: #241e1a;
  --muted: #655a50;
  --wine: #5a1f2a;
  --wine-deep: #43151e;
  --gold: #7d5a22;
  --line: rgba(36, 30, 26, 0.16);
  --line-strong: rgba(36, 30, 26, 0.32);
  --shadow: 0 24px 60px rgba(36, 30, 26, 0.16);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 2px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--wine);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--wine-deep);
}

p {
  margin: 0 0 1em;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(3rem, 8vw, 6.4rem);
}

h2 {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
}

h3 {
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
}

.container {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
}

.container.narrow {
  width: min(800px, 100% - 48px);
}

.kicker,
.mini-label {
  margin: 0 0 18px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand:hover {
  color: var(--wine);
}

.author-line {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.author-line .x,
.footer-author .x {
  color: var(--gold);
  margin-inline: 4px;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  color: var(--ink);
  font-size: 0.86rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-bottom-color: var(--wine);
  color: var(--wine);
}

.menu-toggle {
  display: none;
  margin-left: auto;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Buttons */

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.button:hover {
  background: var(--ink);
  color: var(--paper);
}

.button.button-primary {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--paper-light);
}

.button.button-primary:hover {
  background: var(--wine-deep);
  border-color: var(--wine-deep);
  color: var(--paper-light);
}

.button:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

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

.button:disabled:hover {
  background: transparent;
  color: var(--ink);
}

.button.button-primary:disabled:hover {
  background: var(--wine);
  color: var(--paper-light);
}

.text-button {
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.text-button:hover {
  border-bottom-color: var(--wine);
  color: var(--wine);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* Hero */

.hero {
  padding: clamp(64px, 10vw, 120px) 0 clamp(64px, 9vw, 104px);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 1000px;
}

.hero h1 {
  max-width: 900px;
  margin-bottom: 0.12em;
}

.hero-subtitle {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  font-style: italic;
  color: var(--wine);
  margin-bottom: 36px;
}

.hero-lead {
  max-width: 680px;
  font-size: 1.05rem;
}

.hero-quote {
  margin: 36px 0 0;
  padding-left: 22px;
  border-left: 2px solid var(--gold);
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.25;
  color: var(--wine);
}

/* Sections */

.section {
  padding: clamp(56px, 8vw, 96px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 88px;
}

.section-tinted {
  background: var(--paper-deep);
}

.prose {
  max-width: 68ch;
}

.prose p {
  margin-bottom: 1.1em;
}

.subhead {
  margin-top: 48px;
}

.card-parts {
  display: grid;
  gap: 22px;
  margin: 28px 0 36px;
  padding: 0;
}

.card-parts > div {
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}

.card-parts dt {
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--wine);
}

.card-parts dd {
  margin: 0;
  color: var(--muted);
}

/* Acts */

.acts-lead {
  max-width: 760px;
  margin-bottom: 48px;
}

.acts-slogan {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  color: var(--wine);
}

.acts {
  display: grid;
  gap: 0;
}

.act {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(24px, 5vw, 72px);
  padding: 40px 0;
  border-top: 1px solid var(--line-strong);
}

.act:first-child {
  border-top: 0;
}

.act h3 {
  margin-bottom: 14px;
}

.act-question {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--wine);
}

.act blockquote {
  margin: 28px 0;
  padding-left: 20px;
  border-left: 2px solid var(--gold);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.4;
  color: var(--wine);
}

.act-cards {
  margin-top: 28px;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.94rem;
}

.card-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.card-number {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* How */

.how-grid,
.teams-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 48px;
  margin-top: 40px;
}

.how-grid article,
.teams-grid article {
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}

.how-grid h3,
.teams-grid h3 {
  font-size: 1.3rem;
}

.route-card {
  margin-top: 44px;
  padding: clamp(26px, 4vw, 44px);
  background: var(--wine);
  color: var(--paper-light);
}

.route-card h3 {
  color: var(--paper-light);
}

.route-card .button {
  border-color: var(--paper-light);
  color: var(--paper-light);
}

.route-card .button:hover {
  background: var(--paper-light);
  color: var(--wine);
}

.route-steps {
  margin: 24px 0;
  padding-left: 22px;
}

.route-steps li {
  margin-bottom: 10px;
}

.curiosity {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}

/* Teams */

.task-list {
  margin: 24px 0;
  padding: 0;
  list-style: none;
  max-width: 900px;
}

.task-list li {
  padding: 12px 0 12px 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.task-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
}

.note {
  max-width: 760px;
  font-size: 0.92rem;
  color: var(--muted);
}

.important {
  margin-top: 44px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--wine);
}

.important h3 {
  font-size: 1.25rem;
  color: var(--wine);
}

/* Author, beyond */

.author-text {
  font-size: 1.05rem;
}

.beyond-list {
  max-width: 720px;
  margin: 28px 0;
  padding: 0;
  list-style: none;
}

.beyond-list li {
  padding: 12px 0 12px 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.beyond-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
}

/* Footer */

.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(48px, 7vw, 80px) 0 28px;
}

.footer-inner {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-brand {
  max-width: 560px;
}

.footer-title {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.footer-author {
  margin-top: 18px;
  font-size: 0.86rem;
  color: rgba(244, 237, 225, 0.72);
}

.footer-author a {
  color: var(--paper);
}

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

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--paper);
  font-size: 0.92rem;
}

.footer-note {
  width: min(1200px, 100% - 48px);
  margin: 48px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(244, 237, 225, 0.2);
  font-size: 0.78rem;
  color: rgba(244, 237, 225, 0.6);
}

/* Draw page */

.draw-page {
  padding: clamp(36px, 6vw, 64px) 0 96px;
}

.draw-container {
  max-width: 1180px;
}

.draw-head {
  max-width: 820px;
  margin-bottom: 28px;
}

.draw-head h1 {
  margin-bottom: 0.2em;
}

.draw-intro {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: var(--wine);
}

.status {
  margin: 0 0 26px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}

.setup {
  margin-bottom: 40px;
}

.draw-step-title {
  margin-bottom: 16px;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.mode-button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.fieldset {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.fieldset legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--wine);
  color: var(--wine);
}

.chip.is-active {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--paper-light);
}

.draw-button {
  margin-top: 8px;
  min-width: 220px;
}

.route-note {
  max-width: 620px;
  color: var(--muted);
}

.error-panel {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--wine);
}

.error-panel p {
  margin-bottom: 14px;
}

.deal {
  scroll-margin-top: 92px;
}

.deal-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}

.deal-counter,
.deal-sphere {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.deal-counter {
  text-transform: none;
  letter-spacing: 0.06em;
}

.deal-sphere {
  text-align: right;
  text-transform: uppercase;
  color: var(--muted);
}

.cards {
  display: grid;
  gap: clamp(18px, 2.6vw, 32px);
  justify-content: center;
  align-items: start;
  margin: 0 auto;
}

.cards.count-1 {
  grid-template-columns: minmax(0, 430px);
}

.cards.count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 820px;
}

.cards.count-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1120px;
}

.card {
  min-width: 0;
}

.card-media {
  position: relative;
  aspect-ratio: 1024 / 1536;
  perspective: 1800px;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}

.card-inner {
  position: absolute;
  inset: 0;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 300ms ease;
}

.card.is-flipped .card-inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background: var(--paper-deep);
}

.card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-face.back {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.card-controls .button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 9px 12px;
  font-size: 0.86rem;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.pager-button {
  min-width: 140px;
}

.deal-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.finale,
.completion {
  margin-top: 40px;
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line-strong);
  background: var(--paper-light);
  scroll-margin-top: 92px;
}

.completion {
  text-align: center;
}

.completion-text {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.3;
  color: var(--wine);
  margin-bottom: 28px;
}

.guide {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.guide summary {
  cursor: pointer;
  padding: 12px 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.guide-body {
  display: grid;
  gap: 24px;
  margin-top: 22px;
}

.guide-body h3 {
  font-size: 1.2rem;
}

/* Mobile */

@media (max-width: 1100px) {
  .site-nav ul {
    gap: 4px 10px;
  }

  .site-nav a {
    font-size: 0.78rem;
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
  }

  .site-nav {
    display: none;
    flex-basis: 100%;
    margin-left: 0;
    padding-bottom: 16px;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    display: grid;
    gap: 0;
  }

  .site-nav a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .act {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .how-grid,
  .teams-grid {
    grid-template-columns: 1fr;
  }
}

.cards.route {
  display: block;
  max-width: 460px;
  margin-inline: auto;
}

.cards.route .card {
  display: none;
}

.cards.route .card.is-current {
  display: block;
}

@media (max-width: 1023px) {
  .cards.count-2,
  .cards.count-3 {
    display: block;
    max-width: 430px;
  }

  .cards.count-2 .card,
  .cards.count-3 .card {
    display: none;
  }

  .cards.count-2 .card.is-current,
  .cards.count-3 .card.is-current {
    display: block;
  }

  .cards.route {
    max-width: 460px;
  }
}

@media (min-width: 1024px) {
  .pager:not(.is-route) {
    display: none !important;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .container,
  .container.narrow,
  .header-inner,
  .footer-inner,
  .footer-note {
    width: calc(100% - 32px);
  }

  .hero h1 {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .card-list {
    grid-template-columns: 1fr;
  }

  .card-parts {
    gap: 14px;
  }

  .deal-meta {
    display: block;
  }

  .deal-sphere {
    text-align: left;
    margin-top: 4px;
  }

  .card-controls .button {
    flex-basis: 100%;
  }

  .pager-button {
    flex: 1;
    min-width: 0;
  }
}

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

  .card-inner {
    transition: none;
  }

  .button {
    transition: none;
  }
}
