:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #5b6964;
  --paper: #fffaf0;
  --paper-2: #f7efe1;
  --line: #23342d;
  --green: #32b77d;
  --yellow: #ffbf3d;
  --blue: #4e8df5;
  --red: #f26a58;
  --violet: #8862d8;
  --cyan: #15a8aa;
  --shadow: 0 18px 45px rgba(31, 38, 32, 0.12);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(90deg, rgba(23, 33, 29, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 29, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(20px, calc((100vw - var(--max)) / 2));
  border-bottom: 2px solid rgba(23, 33, 29, 0.12);
  background: rgba(255, 250, 240, 0.9);
  backdrop-filter: blur(12px);
}

.brand,
.nav-links {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--line);
}

.nav-links {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  text-decoration: none;
}

.nav-links a:hover {
  background: rgba(23, 33, 29, 0.08);
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  border-bottom: 3px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 191, 61, 0.28), rgba(50, 183, 125, 0.22)),
    #fff4db;
}

.hero::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 244, 219, 0.98) 0%, rgba(255, 244, 219, 0.9) 44%, rgba(255, 244, 219, 0.2) 74%, transparent 100%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.78) 0%, transparent 34%);
  content: "";
}

#heroCanvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.82;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100% - 40px));
  padding: 128px max(20px, calc((100vw - var(--max)) / 2)) 36px;
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 12px;
  color: #6d4a00;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 6.7rem);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow:
    0 2px 0 rgba(255, 250, 240, 0.9),
    0 0 28px rgba(255, 250, 240, 0.9);
}

.hero-copy {
  max-width: 680px;
  margin: 24px 0 0;
  color: #34423d;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero-actions,
.scenario-list,
.protocol-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 30px;
}

.action,
.protocol-tab,
.scenario,
.impact-tile {
  cursor: pointer;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf6;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--line);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
}

.action:hover,
.protocol-tab:hover,
.scenario:hover,
.impact-tile:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--line);
}

.action.primary,
.protocol-tab.active,
.scenario.active,
.impact-tile.active {
  background: var(--yellow);
}

.action.full {
  width: 100%;
}

.section {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 76px 0;
  scroll-margin-top: 92px;
}

.section-heading {
  max-width: 820px;
  margin-bottom: 28px;
}

.section-heading.compact {
  max-width: 740px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.section-heading p:not(.eyebrow) {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.intro-grid,
.impact-grid,
.source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.answer-card,
.protocol-panel,
.diagram-panel,
.route-lab,
.swap-stage,
.swap-flow,
.impact-detail,
.fit-guide,
.fit-detail,
.quiz-card,
.glossary details,
.source-group {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf6;
  box-shadow: var(--shadow);
}

.answer-card {
  min-height: 270px;
  padding: 20px;
  box-shadow: 5px 5px 0 var(--line);
}

.answer-card h2 {
  margin: 18px 0 12px;
  font-size: 1.4rem;
  line-height: 1.08;
}

.answer-card p,
.protocol-panel p,
.swap-stage p,
.impact-detail p,
.quiz-card p,
.glossary p {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.accent-green {
  background: linear-gradient(180deg, rgba(50, 183, 125, 0.2), #fffdf6 52%);
}

.accent-yellow {
  background: linear-gradient(180deg, rgba(255, 191, 61, 0.32), #fffdf6 52%);
}

.accent-blue {
  background: linear-gradient(180deg, rgba(78, 141, 245, 0.18), #fffdf6 52%);
}

.accent-red {
  background: linear-gradient(180deg, rgba(242, 106, 88, 0.18), #fffdf6 52%);
}

.protocol-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.protocol-tabs {
  grid-row: 1 / span 2;
  flex-direction: column;
  align-content: stretch;
}

.protocol-panel,
.diagram-panel {
  grid-column: 2;
}

.protocol-tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  text-align: left;
}

.tab-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
}

.rgb-icon {
  background: conic-gradient(from 20deg, var(--green), var(--blue), var(--red), var(--green));
}

.ark-icon {
  background: linear-gradient(135deg, #fff 0 35%, var(--yellow) 35% 65%, var(--green) 65%);
}

.lightning-icon {
  clip-path: polygon(52% 0, 12% 55%, 44% 55%, 32% 100%, 88% 42%, 56% 42%);
  background: var(--yellow);
}

.spark-icon {
  background:
    linear-gradient(90deg, transparent 38%, var(--line) 38% 48%, transparent 48%),
    linear-gradient(180deg, var(--cyan) 0 48%, var(--violet) 48%);
}

.protocol-panel {
  min-height: 500px;
  padding: 24px;
}

.protocol-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.protocol-panel h3 {
  margin: 12px 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.fact-list,
.step-list {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.fact-list li,
.step-list li,
.quiz-option {
  border: 2px solid rgba(23, 33, 29, 0.14);
  border-radius: var(--radius);
  background: #fffaf0;
}

.fact-list li {
  padding: 12px;
}

.fact-list strong {
  display: block;
  margin-bottom: 4px;
}

.watch-box {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px solid rgba(23, 33, 29, 0.13);
}

.watch-box h4 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  text-transform: uppercase;
}

.watch-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  counter-reset: watch;
  list-style: none;
}

.watch-list li {
  position: relative;
  min-height: 74px;
  padding: 12px 12px 12px 50px;
  border: 2px solid rgba(23, 33, 29, 0.14);
  border-radius: var(--radius);
  background: #fffaf0;
}

.watch-list li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  counter-increment: watch;
  content: counter(watch);
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 0.82rem;
  font-weight: 950;
}

.watch-list strong {
  display: block;
  margin-bottom: 4px;
}

.watch-list span {
  color: var(--muted);
}

.term {
  position: relative;
  display: inline;
  cursor: help;
  border-bottom: 2px dotted rgba(23, 33, 29, 0.45);
  font-weight: 850;
  outline: none;
}

.term:focus {
  border-radius: 3px;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.term::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: min(300px, calc(100vw - 44px));
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #17211d;
  color: #fffaf0;
  box-shadow: 4px 4px 0 rgba(23, 33, 29, 0.28);
  content: attr(data-tip);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 8px);
  transition:
    opacity 130ms ease,
    transform 130ms ease;
}

.term::before {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  z-index: 31;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background: #17211d;
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px) rotate(45deg);
  transition:
    opacity 130ms ease,
    transform 130ms ease;
}

.term:hover::after,
.term:focus::after,
.term:hover::before,
.term:focus::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.diagram-panel {
  min-height: 500px;
  padding: 16px;
}

#protocolDiagram {
  display: block;
  width: 100%;
  min-height: 560px;
  color: var(--line);
  border: 2px solid rgba(23, 33, 29, 0.12);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 191, 61, 0.14), transparent 34%),
    #fffdf6;
}

.diagram-grid {
  display: none;
}

.diagram-headline {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 950;
}

.diagram-lane {
  stroke: rgba(23, 33, 29, 0.12);
  stroke-width: 2;
}

.diagram-lane-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.diagram-link {
  fill: none;
  stroke: var(--line);
  stroke-width: 4;
  marker-end: url(#arrow);
}

.diagram-link.soft {
  stroke: rgba(23, 33, 29, 0.32);
  stroke-dasharray: 8 9;
}

.diagram-connector {
  fill: none;
  stroke: var(--line);
  stroke-linecap: round;
  stroke-width: 2.4;
  marker-end: url(#arrow);
}

.diagram-connector.soft {
  stroke: rgba(23, 33, 29, 0.46);
  stroke-dasharray: 6 9;
  stroke-width: 2.2;
}

.diagram-link-label rect {
  fill: #fffdf6;
  stroke: rgba(23, 33, 29, 0.16);
  stroke-width: 2;
}

.diagram-link-label text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 950;
}

.diagram-card-shadow {
  fill: var(--line);
  opacity: 0.9;
}

.diagram-card {
  stroke: var(--line);
  stroke-width: 3;
}

.diagram-step-badge {
  fill: #fffdf6;
  stroke: var(--line);
  stroke-width: 3;
}

.diagram-step-number,
.diagram-card-title {
  fill: var(--ink);
  font-weight: 950;
}

.diagram-step-number {
  font-size: 13px;
}

.diagram-card-title {
  font-size: 14px;
}

.diagram-card-detail {
  fill: #33443e;
  font-size: 10.5px;
  font-weight: 800;
}

.diagram-node rect,
.diagram-node circle,
.diagram-node polygon {
  stroke: var(--line);
  stroke-width: 3;
  filter: drop-shadow(4px 4px 0 rgba(23, 33, 29, 0.9));
}

.diagram-node text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
}

.diagram-legend {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.legend-heading {
  margin: 2px 0 4px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend-key {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
}

.legend-line {
  width: 34px;
  border-top: 4px solid var(--line);
}

.legend-line.dotted {
  border-top-color: rgba(23, 33, 29, 0.42);
  border-top-style: dashed;
}

.interaction-band {
  width: 100%;
  max-width: none;
  padding: 76px max(20px, calc((100vw - var(--max)) / 2));
  border-block: 3px solid var(--line);
  background: #eaf7ef;
}

.route-lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 16px;
  background: #fffdf6;
}

.route-board {
  display: grid;
  gap: 10px;
  min-height: 360px;
  padding: 14px;
  border: 2px solid rgba(23, 33, 29, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(23, 33, 29, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 29, 0.05) 1px, transparent 1px),
    #f5fbff;
  background-size: 30px 30px;
}

#routeSvg {
  width: 100%;
  height: 100%;
  min-height: 330px;
  border: 2px solid rgba(23, 33, 29, 0.08);
  border-radius: var(--radius);
  background: rgba(245, 251, 255, 0.76);
}

.route-link {
  stroke: #92a09a;
  stroke-width: 8;
  stroke-linecap: round;
}

.route-link.hot {
  stroke: var(--yellow);
}

.route-link.fail {
  stroke: var(--red);
}

.route-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.route-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.route-key span {
  padding: 8px 10px;
  border: 2px solid rgba(23, 33, 29, 0.12);
  border-radius: var(--radius);
  background: #fffdf6;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.25;
}

.route-key strong {
  color: var(--ink);
}

.route-node circle {
  stroke: var(--line);
  stroke-width: 3;
  filter: drop-shadow(3px 3px 0 rgba(23, 33, 29, 0.9));
}

.route-node text {
  fill: var(--ink);
  font-weight: 900;
}

.control-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border-left: 2px solid rgba(23, 33, 29, 0.12);
}

.control-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

output {
  font-size: 1.6rem;
  font-weight: 950;
}

.status {
  min-height: 86px;
  margin: 0;
  padding: 12px;
  border: 2px dashed rgba(23, 33, 29, 0.24);
  border-radius: var(--radius);
  color: var(--muted);
}

.route-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.swap-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) minmax(380px, 0.78fr);
  gap: 16px;
}

.scenario-list {
  flex-direction: column;
}

.scenario {
  min-height: 54px;
  padding: 12px;
  text-align: left;
}

.swap-stage,
.swap-flow {
  padding: 22px;
}

.swap-stage h3,
.impact-detail h3,
.quiz-card h3 {
  margin: 0 0 12px;
  font-size: 1.7rem;
  line-height: 1.08;
}

.step-list {
  counter-reset: step;
}

.step-list li {
  position: relative;
  padding: 12px 12px 12px 48px;
}

.step-list li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  counter-increment: step;
  content: counter(step);
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  font-size: 0.78rem;
  font-weight: 900;
}

.swap-flow {
  display: grid;
  gap: 16px;
  min-width: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 191, 61, 0.34), transparent 34%),
    linear-gradient(135deg, rgba(78, 141, 245, 0.18), rgba(50, 183, 125, 0.13)),
    #fffdf6;
  overflow: hidden;
}

.swap-flow-title {
  display: grid;
  gap: 6px;
}

.swap-flow-title span,
.swap-token span,
.swap-core span,
.swap-mini-steps button {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.swap-flow-title strong {
  font-size: 1.1rem;
  line-height: 1.16;
}

.swap-visual {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 174px;
  min-width: 0;
  padding: 3px;
  overflow: hidden;
}

.swap-visual::before {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 50%;
  height: 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, var(--green) 0 18px, var(--yellow) 18px 36px, var(--blue) 36px 54px);
  content: "";
  transform: translateY(-50%);
}

.swap-token,
.swap-core {
  position: relative;
  z-index: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--line);
}

.swap-token {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 108px;
  padding: 12px;
  overflow: hidden;
  background: rgba(255, 250, 240, 0.94);
}

.swap-token strong {
  display: block;
  max-width: 100%;
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.swap-token.from {
  transform: rotate(-1.5deg);
}

.swap-token.to {
  transform: rotate(1.5deg);
}

.swap-core {
  display: grid;
  justify-self: center;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
}

.swap-core span {
  align-self: end;
  margin-bottom: 10px;
  padding: 2px 7px;
  max-width: 74px;
  border: 2px solid rgba(23, 33, 29, 0.18);
  border-radius: 999px;
  background: #fffaf0;
  font-size: 0.66rem;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
}

.swap-pulse {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fffdf6;
  font-size: 1.35rem;
  font-weight: 950;
}

.swap-pulse.run {
  animation: swap-run 900ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.swap-mini-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.swap-mini-steps button {
  display: grid;
  min-height: 38px;
  place-items: center;
  cursor: pointer;
  border: 2px solid rgba(23, 33, 29, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.swap-mini-steps button:hover {
  border-color: var(--line);
}

.swap-mini-steps button.active {
  border-color: var(--line);
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--line);
}

.swap-mini-steps button.done {
  border-color: var(--line);
  background: #bcefcf;
}

.swap-state {
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border: 2px dashed rgba(23, 33, 29, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.swap-token.active {
  background: #fff2bd;
}

.swap-token.done {
  background: #e1f8e9;
}

@keyframes swap-run {
  0% {
    transform: scale(1) rotate(0deg);
  }
  55% {
    transform: scale(1.18) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

.impact-grid {
  margin-bottom: 16px;
}

.impact-tile {
  min-height: 116px;
  padding: 16px;
  text-align: left;
  font-size: 1.1rem;
}

.tile-number {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.impact-detail {
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255, 191, 61, 0.25), transparent 34%),
    #fffdf6;
}

.impact-detail ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.impact-detail li {
  padding: 12px;
  border: 2px solid rgba(23, 33, 29, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

.fit-guide {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.fit-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fit-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 2px solid rgba(23, 33, 29, 0.14);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.dot.green,
.fit-cell.green {
  background: #bcefcf;
}

.dot.yellow,
.fit-cell.yellow {
  background: #ffe08a;
}

.dot.red,
.fit-cell.red {
  background: #ffb2a7;
}

.fit-card-list {
  display: grid;
  gap: 12px;
}

.fit-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 2px solid rgba(23, 33, 29, 0.14);
  border-radius: var(--radius);
  background: #fffaf0;
}

.fit-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.fit-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fit-cell {
  display: grid;
  width: 100%;
  min-height: 72px;
  align-content: start;
  gap: 4px;
  padding: 10px;
  cursor: pointer;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  box-shadow: 3px 3px 0 var(--line);
}

.fit-cell:hover,
.fit-cell[aria-pressed="true"] {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--line);
}

.fit-status {
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.fit-label {
  font-size: 0.95rem;
  font-weight: 850;
}

.fit-protocol {
  color: rgba(23, 33, 29, 0.72);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.fit-detail {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(50, 183, 125, 0.16), transparent 34%),
    #fffdf6;
}

.fit-detail h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.fit-detail p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
}

.comparison-table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf6;
  box-shadow: var(--shadow);
}

.comparison-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.comparison-table caption {
  padding: 14px;
  text-align: left;
  font-weight: 950;
}

.comparison-table th,
.comparison-table td {
  padding: 14px;
  border-top: 2px solid rgba(23, 33, 29, 0.12);
  text-align: left;
  vertical-align: top;
}

.comparison-table th {
  background: #f3ead9;
  font-size: 0.86rem;
  text-transform: uppercase;
}

.quiz-card {
  max-width: 860px;
  padding: 24px;
  box-shadow: 5px 5px 0 var(--line);
}

.quiz-options {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.quiz-option {
  padding: 12px;
  cursor: pointer;
  text-align: left;
}

.quiz-option:hover {
  border-color: var(--line);
}

.quiz-option.correct {
  background: rgba(50, 183, 125, 0.18);
  border-color: var(--green);
}

.quiz-option.wrong {
  background: rgba(242, 106, 88, 0.16);
  border-color: var(--red);
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  color: var(--muted);
  font-weight: 850;
}

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

.glossary details {
  padding: 14px;
}

.glossary summary {
  cursor: pointer;
  font-weight: 950;
}

.source-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.source-group {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  box-shadow: 3px 3px 0 var(--line);
}

.source-group h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.source-group a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid rgba(23, 33, 29, 0.13);
  border-radius: var(--radius);
  background: #fffaf0;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.source-group a:hover {
  background: #eef8ff;
  border-color: var(--line);
}

.footer {
  padding: 24px max(20px, calc((100vw - var(--max)) / 2));
  border-top: 3px solid var(--line);
  background: var(--ink);
  color: #fffaf0;
}

.footer p {
  max-width: 820px;
  margin: 0;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    min-height: 760px;
  }

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

  .protocol-layout,
  .swap-layout,
  .route-lab {
    grid-template-columns: 1fr;
  }

  .protocol-tabs,
  .protocol-panel,
  .diagram-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .protocol-tabs,
  .scenario-list {
    flex-direction: row;
  }

  .protocol-tab,
  .scenario {
    width: auto;
    flex: 1 1 150px;
  }

  .control-panel {
    border-left: 0;
    border-top: 2px solid rgba(23, 33, 29, 0.12);
  }

  .impact-detail ul,
  .fit-card,
  .glossary {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 620px) {
  .nav-links {
    display: none;
  }

  .hero {
    min-height: 700px;
  }

  .hero-content {
    padding-top: 88px;
  }

  .intro-grid,
  .impact-grid {
    grid-template-columns: 1fr;
  }

  .fit-options,
  .source-grid,
  .swap-visual {
    grid-template-columns: 1fr;
  }

  .route-key {
    grid-template-columns: 1fr;
  }

  .swap-visual::before {
    left: 50%;
    right: auto;
    top: 8%;
    width: 8px;
    height: 84%;
    transform: translateX(-50%);
  }

  .swap-token.from,
  .swap-token.to {
    transform: none;
  }

  .section {
    width: min(100% - 28px, var(--max));
    padding: 56px 0;
  }

  .interaction-band {
    padding: 56px 14px;
  }

  .answer-card {
    min-height: auto;
  }

  .route-board,
  #routeSvg {
    min-height: 300px;
  }
}

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