:root {
  --paper: #f2eee5;
  --paper-deep: #e7dfd1;
  --ink: #202521;
  --ink-soft: #5f655f;
  --line: rgba(32, 37, 33, 0.18);
  --accent: #e15134;
  --acid: #d4dc78;
  --sage: #738b72;
  --clay: #bd8066;
  --blue: #70858f;
  --gold: #c8a75b;
  --panel: #242a25;
  --panel-ink: #f2eee5;
  --panel-soft: #aeb5ad;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(56, 60, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 60, 51, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: var(--sans);
}

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

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(360px, 0.78fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 28px 36px 24px;
  overflow: clip;
  isolation: isolate;
}

.workspace::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 77% 58%, rgba(212, 220, 120, 0.18), transparent 28%),
    radial-gradient(circle at 10% 95%, rgba(225, 81, 52, 0.09), transparent 30%);
  content: "";
}

.masthead,
.inspector-topline,
.confidence-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.masthead {
  animation: reveal-down 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
}

.intro {
  position: absolute;
  z-index: 2;
  top: 105px;
  left: 36px;
  width: min(37vw, 360px);
  pointer-events: none;
  animation: reveal-up 800ms 90ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eyebrow,
.method-kind {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(50px, 4.7vw, 70px);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.86;
}

.intro-copy {
  max-width: 285px;
  margin: 21px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
}

.wheel-stage {
  position: absolute;
  right: 28px;
  bottom: 18px;
  width: min(42vw, 500px);
  aspect-ratio: 1;
  animation: wheel-enter 1100ms 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.wheel-aura {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  box-shadow:
    0 28px 80px rgba(54, 48, 36, 0.18),
    0 0 0 34px rgba(255, 255, 255, 0.16);
}

.wheel-wrap {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.wheel-wrap::after {
  position: absolute;
  inset: 4.5%;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 18px rgba(43, 39, 31, 0.13));
}

.pointer {
  position: absolute;
  z-index: 5;
  top: -11px;
  left: 50%;
  width: 42px;
  height: 76px;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 8px rgba(34, 34, 29, 0.25));
}

.pointer::before {
  position: absolute;
  top: 0;
  left: 2px;
  width: 38px;
  height: 38px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.pointer span {
  position: absolute;
  top: 27px;
  left: 8px;
  width: 0;
  height: 0;
  border-top: 44px solid var(--ink);
  border-right: 13px solid transparent;
  border-left: 13px solid transparent;
}

.spin-button {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  display: flex;
  width: 160px;
  height: 160px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  box-shadow:
    0 0 0 9px var(--paper),
    0 0 0 10px rgba(32, 37, 33, 0.28),
    0 12px 24px rgba(32, 37, 33, 0.26);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.spin-button:hover {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.05);
}

.spin-button:active {
  transform: translate(-50%, -50%) scale(0.98);
}

.spin-button:disabled {
  cursor: wait;
}

.spin-button-label {
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: -0.03em;
}

.spin-button-hint {
  position: absolute;
  bottom: 31px;
  left: 50%;
  width: max-content;
  color: rgba(242, 238, 229, 0.56);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.wheel-spinning .spin-button-label {
  animation: breathe 700ms ease-in-out infinite alternate;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 2px 0 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sound-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 13px;
}

.sound-state {
  min-width: 38px;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(32, 37, 33, 0.07);
  font-size: 8px;
  text-align: center;
}

.sound-toggle[aria-pressed="false"] {
  color: rgba(95, 101, 95, 0.62);
}

.sound-toggle[aria-pressed="false"] .sound-icon {
  opacity: 0.55;
}

.inspector {
  position: relative;
  z-index: 10;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 29px 42px 26px;
  overflow: auto;
  color: var(--panel-ink);
  background:
    radial-gradient(circle at 110% -10%, rgba(212, 220, 120, 0.16), transparent 35%),
    var(--panel);
  box-shadow: -14px 0 36px rgba(31, 35, 31, 0.08);
}

.inspector-topline {
  padding-bottom: 17px;
  border-bottom: 1px solid rgba(242, 238, 229, 0.17);
  color: var(--panel-soft);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.method-card {
  padding-top: 36px;
}

.method-card.is-changing {
  animation: card-change 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.method-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 44px;
  place-items: center;
  border: 1px solid rgba(242, 238, 229, 0.25);
  border-radius: 50%;
  color: var(--acid);
  font-family: var(--serif);
  font-size: 29px;
}

.method-kind {
  margin-bottom: 10px;
  color: var(--acid);
}

h2 {
  max-width: 420px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(36px, 3vw, 54px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.94;
}

.method-summary {
  max-width: 500px;
  margin: 20px 0 18px;
  color: var(--panel-soft);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
}

.guide-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 30px;
  padding: 14px 0;
  border-top: 1px solid rgba(242, 238, 229, 0.17);
  border-bottom: 1px solid rgba(242, 238, 229, 0.17);
  color: var(--acid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    color 180ms ease,
    padding 180ms ease;
}

.guide-link span:last-child {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  transition: transform 180ms ease;
}

.guide-link:hover {
  padding-right: 3px;
  color: var(--panel-ink);
}

.guide-link:hover span:last-child {
  transform: translateX(3px);
}

.confidence-block {
  padding: 20px 0 22px;
  border-top: 1px solid rgba(242, 238, 229, 0.17);
  border-bottom: 1px solid rgba(242, 238, 229, 0.17);
}

.confidence-heading {
  gap: 20px;
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.confidence-heading span {
  color: var(--panel-soft);
}

.confidence-heading strong {
  color: var(--acid);
  font-size: 10px;
}

.confidence-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 13px 0 10px;
}

.confidence-scale span {
  height: 5px;
  background: rgba(242, 238, 229, 0.13);
}

.confidence-scale[data-score="3"] span:nth-child(-n + 3),
.confidence-scale[data-score="2"] span:nth-child(-n + 2),
.confidence-scale[data-score="1"] span:nth-child(1) {
  background: var(--acid);
}

.confidence-block p {
  margin: 0;
  color: var(--panel-soft);
  font-size: 11px;
  line-height: 1.45;
}

.instructions,
.evidence,
.sources {
  padding-top: 24px;
}

.instructions h3,
.evidence h3,
.sources h3 {
  margin: 0 0 13px;
  color: var(--panel-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.instructions ol {
  margin: 0;
  padding: 0;
  counter-reset: method-step;
  list-style: none;
}

.instructions li {
  position: relative;
  margin: 0;
  padding: 9px 0 9px 31px;
  border-bottom: 1px solid rgba(242, 238, 229, 0.09);
  color: var(--panel-ink);
  font-size: 13px;
  line-height: 1.35;
  counter-increment: method-step;
}

.instructions li::before {
  position: absolute;
  top: 10px;
  left: 0;
  color: var(--acid);
  font-family: var(--serif);
  font-size: 12px;
  content: "0" counter(method-step);
}

.evidence p {
  margin: 0;
  color: var(--panel-soft);
  font-size: 12px;
  line-height: 1.55;
}

.source-link {
  display: grid;
  grid-template-columns: 34px 1fr 16px;
  gap: 8px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid rgba(242, 238, 229, 0.09);
  color: var(--panel-ink);
  font-size: 11px;
  line-height: 1.35;
  text-decoration: none;
  transition: color 180ms ease;
}

.source-link:hover {
  color: var(--acid);
}

.source-link-index {
  color: var(--panel-soft);
}

.source-link-arrow {
  font-size: 15px;
  transition: transform 180ms ease;
}

.source-link:hover .source-link-arrow {
  transform: translate(2px, -2px);
}

.disclaimer {
  margin: 30px 0 0;
  padding-top: 15px;
  border-top: 1px solid rgba(242, 238, 229, 0.17);
  color: #858d85;
  font-size: 9px;
  line-height: 1.45;
}

.result-toast {
  position: fixed;
  z-index: 30;
  bottom: 28px;
  left: 28px;
  display: flex;
  min-width: 280px;
  flex-direction: column;
  gap: 3px;
  padding: 15px 20px;
  border-left: 4px solid var(--accent);
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 12px 35px rgba(32, 37, 33, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
}

.result-toast.show {
  animation: toast 3.4s ease both;
}

.result-toast span {
  color: rgba(242, 238, 229, 0.56);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.result-toast strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
}

@keyframes reveal-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}

@keyframes wheel-enter {
  from {
    opacity: 0;
    transform: translate(80px, 80px) rotate(12deg) scale(0.85);
  }
}

@keyframes breathe {
  to {
    opacity: 0.45;
  }
}

@keyframes card-change {
  0% {
    opacity: 0.35;
    transform: translateX(14px);
  }
}

@keyframes toast {
  0%,
  100% {
    opacity: 0;
    transform: translateY(18px);
  }
  10%,
  86% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.8fr);
  }

  .workspace {
    padding-right: 28px;
    padding-left: 28px;
  }

  .intro {
    left: 28px;
    width: 310px;
  }

  .wheel-stage {
    width: min(46vw, 470px);
    right: 0;
    bottom: 24px;
  }

  .inspector {
    padding-right: 28px;
    padding-left: 28px;
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }

  .workspace {
    display: block;
    height: auto;
    min-height: 0;
    padding: 22px 20px 18px;
    overflow: hidden;
  }

  .intro {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    margin-top: 35px;
  }

  h1 {
    font-size: clamp(40px, 12.8vw, 64px);
  }

  .intro-copy {
    max-width: 330px;
    margin-top: 19px;
    font-size: 14px;
  }

  .wheel-stage {
    position: relative;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(calc(100vw - 8px), 590px);
    margin: 26px 0 0;
    transform: translateX(-50%);
  }

  .pointer {
    top: -2px;
  }

  .spin-button {
    width: 132px;
    height: 132px;
  }

  .spin-button-label {
    font-size: 24px;
  }

  .spin-button-hint {
    bottom: 25px;
  }

  .sound-toggle {
    gap: 6px;
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .sound-icon {
    width: 28px;
    height: 28px;
  }

  .sound-state {
    min-width: 34px;
  }

  .inspector {
    min-height: 100svh;
    padding: 24px 22px 30px;
    box-shadow: 0 -18px 40px rgba(31, 35, 31, 0.12);
  }

  .method-symbol {
    margin-bottom: 34px;
  }

  h2 {
    font-size: 44px;
  }

  .result-toast {
    right: 18px;
    bottom: 18px;
    left: 18px;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
