:root {
  --ink: #172c37;
  --muted: #516672;
  --paper: #fff;
  --bg: #edf3f7;
  --line: #cbd9e0;
  --teal: #087780;
  --teal-soft: #e7f5f5;
  --orange: #b54713;
  --orange-soft: #fff0e5;
  --purple: #6845a0;
  --success: #216b42;
  --error: #a32831;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
a {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
button,
a,
input,
summary {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}
h2 {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  letter-spacing: -0.035em;
  line-height: 1.25;
}
h3 {
  font-size: 1.05rem;
}
a {
  color: var(--teal);
}
.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  background: white;
  padding: 8px;
  z-index: 10;
}
.skip:focus {
  top: 8px;
}
header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1220px;
  padding: 20px 28px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  color: var(--teal);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.1em;
}
.header-small {
  font-size: 0.85rem;
  color: var(--muted);
}
.shell {
  max-width: 1220px;
  margin: 28px auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
}
.sidebar {
  align-self: start;
  position: sticky;
  top: 24px;
}
.intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 18px;
}
.nav {
  display: grid;
  gap: 7px;
}
.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  min-height: 58px;
}
.nav button:hover {
  background: #e1ecef;
}
.nav button[aria-current="true"] {
  background: var(--teal);
  color: white;
}
.nav .number {
  font-size: 0.9rem;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  flex: none;
}
.nav .nav-copy {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.nav .nav-state {
  font-size: 0.75rem;
  opacity: 0.9;
  font-weight: 400;
  display: block;
}
.progress-wrap {
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--muted);
}
progress {
  width: 100%;
  height: 7px;
  accent-color: var(--teal);
  display: block;
  margin-top: 8px;
  border: 0;
}
.storage-note {
  font-size: 0.75rem;
  margin-top: 10px;
  color: var(--muted);
}
.stage {
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  min-width: 0;
  box-shadow: 0 8px 36px #1c526008;
}
.stage-heading {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.eyebrow {
  font-size: 0.8rem;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 6px;
}
.task {
  color: var(--muted);
  margin: 12px 0 22px;
  max-width: 60ch;
}
.button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  min-height: 46px;
  padding: 10px 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}
.button.primary:hover {
  background: #075e65;
}
.button.help {
  color: var(--teal);
  flex: none;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.feedback {
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--bg);
  min-height: 52px;
  font-size: 0.95rem;
}
.feedback.good {
  background: #edf8ef;
  color: var(--success);
}
.feedback.try {
  background: var(--orange-soft);
  color: #8a3510;
}
.source-line {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
.help-panel {
  padding: 18px;
  background: var(--teal-soft);
  border-radius: 12px;
  margin: 16px 0;
}
.help-panel h3 {
  margin-bottom: 8px;
}
.help-panel p + p {
  margin-top: 10px;
}
.help-panel details {
  margin-top: 12px;
}
.help-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--teal);
}
.help-panel details p {
  margin-top: 8px;
}
.help-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.clue {
  margin-top: 10px;
  color: var(--ink);
  border-left: 3px solid var(--teal);
  padding-left: 12px;
}
.explainer {
  background: var(--bg);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}
.mini-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 8px 0;
}
.chain {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.chain-node {
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 88px;
  flex: 1;
  text-align: center;
  background: var(--bg);
  font-size: 0.85rem;
}
.chain-node.filled {
  background: var(--teal-soft);
  border-color: #90c6c7;
}
.chain-node small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3px;
}
.chain-node.empty {
  border-style: dashed;
  background: transparent;
}
.chain-connector {
  align-self: center;
  color: var(--muted);
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  align-items: flex-start;
  min-height: 76px;
}
.choice small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}
.choice.correct {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.chart {
  width: 100%;
  display: block;
  overflow: visible;
}
.chart-wrap {
  margin: 14px 0 20px;
}
.chart text {
  font-family: inherit;
  font-size: 13px;
  fill: var(--muted);
}
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin: 10px 0;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.swatch {
  width: 24px;
  border-top: 3px solid var(--teal);
}
.swatch.target {
  border-color: var(--orange);
  border-top-style: dashed;
}
.swatch.other {
  border-color: var(--purple);
}
.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}
.range-label output {
  font-variant-numeric: tabular-nums;
  color: var(--teal);
}
input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--teal);
  cursor: pointer;
  margin: 4px 0 12px;
}
.subnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.subnav button {
  border: 1px solid var(--line);
  background: white;
  padding: 8px 12px;
  border-radius: 9px;
  min-height: 42px;
  color: var(--ink);
  font-size: 0.85rem;
}
.subnav button[aria-pressed="true"] {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 600;
}
.chart-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.chart-choice {
  padding: 12px 8px;
  display: block;
  min-width: 0;
}
.chart-choice svg {
  display: block;
  width: 100%;
  height: 120px;
}
.chart-choice svg text {
  font-size: 13px;
}
.chart-choice[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.amplitudes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.amplitudes .range-label {
  display: block;
}
.amplitudes output {
  display: block;
  font-size: 0.85rem;
}
.small-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
}
.bottom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 10px;
}
.end-note {
  font-size: 0.85rem;
  color: var(--muted);
}
footer {
  max-width: 1220px;
  margin: 0 auto;
  padding: 8px 28px 28px;
  font-size: 0.8rem;
  color: var(--muted);
}
@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
    margin: 20px auto;
    gap: 18px;
  }
  .sidebar {
    position: static;
  }
  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .nav button {
    padding: 8px;
    gap: 8px;
    min-height: 56px;
  }
  .nav .number {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
  .nav .nav-copy {
    font-size: 0.8rem;
  }
  .nav .nav-state {
    display: none;
  }
  .intro {
    margin-bottom: 10px;
  }
  .progress-wrap {
    margin-top: 10px;
  }
  .storage-note {
    display: none;
  }
  .stage {
    padding: 22px;
  }
  .header-inner {
    padding: 16px 22px;
  }
  .header-small {
    max-width: 140px;
    text-align: right;
  }
  .shell {
    padding: 0 20px;
  }
}
@media (max-width: 480px) {
  .shell {
    padding: 0 12px;
  }
  .stage {
    padding: 18px 15px;
    border-radius: 15px;
  }
  .stage-heading {
    display: block;
  }
  .stage-heading .help {
    margin-top: 12px;
  }
  .chart-cards {
    grid-template-columns: 1fr;
  }
  .chart-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
  }
  .chart-choice svg {
    width: 65%;
    height: 94px;
  }
  .amplitudes {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .amplitudes .range-label {
    display: flex;
  }
  .header-inner {
    padding: 16px;
  }
  .header-small {
    display: none;
  }
  .nav button {
    gap: 6px;
  }
  .nav .nav-copy {
    font-size: 0.75rem;
  }
  .nav .number {
    width: 22px;
    height: 22px;
  }
  .chain-node {
    min-width: 84px;
  }
  .bottom-nav {
    align-items: stretch;
  }
  .bottom-nav .button {
    font-size: 0.8rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
