:root {
  color-scheme: light;
  --ink: #232b30;
  --muted: #56616b;
  --paper: #faf9f6;
  --line: #d7dfdf;
  --teal: #087477;
  --teal-soft: #eaf5f3;
  --gold-soft: #fff2d7;
  --error: #a03435;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--teal); text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, input, select { min-height: 44px; border: 1px solid #aebdbc; border-radius: 6px; padding: 7px 12px; color: var(--ink); background: white; }
button { cursor: pointer; font-weight: 600; }
button:hover:not(:disabled) { background: var(--teal-soft); border-color: var(--teal); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--teal); border-color: var(--teal); color: white; }
button.primary:hover:not(:disabled) { background: #075e61; }
:focus-visible { outline: 3px solid #5b3c8c; outline-offset: 4px; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
p code { background: #edf0f0; border-radius: 3px; padding: 1px 4px; font-size: .94em; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.2; }
h1 { font-size: clamp(2.3rem, 4.8vw, 3.8rem); letter-spacing: -.045em; margin-bottom: 18px; font-weight: 650; }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); letter-spacing: -.025em; font-weight: 650; }
h3 { font-size: 1.1rem; }
.site-header { max-width: 1160px; margin: auto; padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.site-header a { text-decoration: none; font-size: .9rem; }
.site-header .wordmark { font-weight: 750; color: var(--ink); font-size: 1rem; }
.wordmark span { margin-left: 13px; padding-left: 14px; border-left: 1px solid #acb6b6; color: var(--muted); font-weight: 400; }
main { max-width: 1160px; margin: auto; padding: 0 32px; }
.introduction { padding: 55px 0 29px; }
.eyebrow { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); font-weight: 700; margin-bottom: 12px; }
.lead { font-size: 1.13rem; max-width: 660px; color: #47545d; margin-bottom: 14px; }
.scope { font-size: .86rem; color: var(--muted); margin: 0; }
.concept-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; padding: 25px 0; border-block: 1px solid var(--line); margin: 12px 0 42px; }
.concept-strip p { margin: 0; font-size: .9rem; }
.concept-strip strong, .concept-strip span { display: block; }
.concept-strip strong { margin-bottom: 4px; }
.concept-strip span { color: var(--muted); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading p:not(.eyebrow) { font-size: .87rem; color: var(--muted); margin-bottom: 23px; }
.section-heading .eyebrow { margin-bottom: 8px; }
.lab-shell { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; box-shadow: 0 12px 34px #142d2910; }
.input-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding: 20px 24px 14px; }
.input-toolbar label { flex: 1 1 300px; font-size: .88rem; font-weight: 600; }
.input-toolbar input { display: block; width: 100%; margin-top: 5px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 1.08rem; }
#input-help { flex-basis: 100%; font-size: .8rem; color: var(--muted); margin: 0; }
.error { flex-basis: 100%; color: var(--error); font-size: .88rem; margin: 0; }
.error:empty { display: none; }
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 24px 18px; border-bottom: 1px solid var(--line); }
.examples > span { font-size: .8rem; color: var(--muted); margin-right: 6px; }
.examples button { font-size: .8rem; padding: 5px 10px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 16px 24px; }
.transport { display: flex; flex-wrap: wrap; gap: 7px; }
.toolbar button, .toolbar label { font-size: .85rem; }
.toolbar label { display: flex; gap: 8px; align-items: center; }
#step-number { margin-left: auto; color: var(--muted); font-size: .8rem; }
.progress-track { height: 3px; background: #e8eded; }
#progress { height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.input-display { padding: 20px 24px 16px; }
.small-heading { margin-bottom: 11px; color: var(--muted); font-size: .8rem; }
.characters { display: flex; flex-wrap: wrap; gap: 5px; min-height: 45px; }
.character { display: inline-flex; justify-content: center; align-items: center; min-width: 30px; height: 39px; border: 1px solid #dce3e2; border-radius: 4px; background: #f8f9f8; font: 1.15rem/1 "SFMono-Regular", Consolas, monospace; }
.character.processed { color: #586e6e; }
.character.matched { color: #0a6257; background: #e2f3ec; border-color: #8ebba9; }
.character.current { outline: 2px solid #8b5d0c; outline-offset: 2px; }
.character.failed { color: var(--error); border-color: #d59a9b; background: #ffebeb; }
.empty-input { align-self: center; color: var(--muted); font-size: .9rem; }
.input-legend { font-size: .75rem; color: var(--muted); margin: 13px 0 0; }
.step-caption { padding: 21px 24px; background: #f2f8f7; border-block: 1px solid var(--line); min-height: 151px; }
.step-caption .eyebrow { margin-bottom: 9px; }
.step-caption h3 { font-size: 1.2rem; margin-bottom: 8px; }
.step-caption > p:last-child { margin: 0; font-size: .94rem; }
.step-caption.failure { background: #fff4f1; }
.trace-grid { display: grid; grid-template-columns: 1.4fr 1fr; }
.code-panel { min-width: 0; border-right: 1px solid var(--line); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 23px 24px 13px; }
.panel-heading h3 { margin: 0; }
.panel-heading span { font-size: .76rem; color: var(--muted); }
.source-code { margin: 0; padding: 12px 0; overflow: auto; font-size: 12.5px; line-height: 2; }
.source-code > code { display: block; min-width: max-content; white-space: normal; }
.source-code [data-line] { display: block; white-space: pre; border-left: 3px solid transparent; padding: 0 17px; }
.source-code [data-line].active { background: var(--gold-soft); border-left-color: #b4771e; }
.code-note { font-size: .78rem; color: var(--muted); padding: 9px 24px 22px; margin: 0; }
.stack-panel { min-width: 0; padding-bottom: 20px; }
.stack-help { color: var(--muted); font-size: .8rem; padding: 0 24px; margin-bottom: 14px; }
.stack { list-style: none; padding: 0 24px; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.stack li { border: 1px solid #cad6d5; border-left: 3px solid #a9b7b6; border-radius: 5px; background: #f7f9f8; padding: 9px 13px; display: flex; align-items: center; justify-content: space-between; }
.stack li:first-child { border-color: #559c99; background: var(--teal-soft); }
.stack code { font-size: 1.2rem; }
.stack span { font-size: .75rem; color: var(--muted); }
.empty-stack { margin: 0 24px 14px; border: 1px dashed #bbcaca; border-radius: 6px; padding: 25px 12px; text-align: center; color: var(--muted); font-size: .86rem; }
.pair-detail, .return-value { margin: 19px 24px 0; border-top: 1px solid var(--line); padding-top: 14px; }
.pair-detail h4, .return-value h4 { color: var(--muted); font-size: .77rem; margin: 0 0 7px; font-weight: 500; }
.pair-detail p { margin: 0; font-size: .84rem; }
.return-value output { font: 1rem/1.5 "SFMono-Regular", Consolas, monospace; }
.return-value output.success { color: #08705d; }
.return-value output.failure { color: var(--error); }
.trace-note { border-top: 1px solid var(--line); padding: 14px 24px; margin: 0; color: var(--muted); font-size: .78rem; }
.understand { max-width: 750px; padding-top: 42px; }
.understand p:not(.eyebrow) { color: #4b5961; }
.practice { margin: 36px 0 28px; border-block: 1px solid var(--line); padding: 28px 0; }
.practice form > p:first-child { margin-bottom: 15px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; display: flex; gap: 20px; flex-wrap: wrap; }
legend { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
fieldset label { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; }
input[type=radio] { width: 19px; height: 19px; min-height: 19px; accent-color: var(--teal); }
.feedback { margin: 0; }
.feedback:not(:empty) { padding: 12px 15px; margin-top: 16px; background: #f6f0e7; border-left: 3px solid #bd9354; font-size: .9rem; }
.feedback.correct { background: var(--teal-soft); border-left-color: var(--teal); color: #155250; }
footer { display: flex; gap: 20px; justify-content: space-between; padding: 2px 0 32px; color: var(--muted); font-size: .76rem; }
footer p { margin: 0; }
.skip-link { position: absolute; left: 16px; top: -80px; padding: 12px; z-index: 10; background: white; }
.skip-link:focus { top: 12px; }
.notice { padding: 14px; background: var(--gold-soft); }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  main { padding: 0 18px; }
  .site-header { padding: 20px 18px; }
  .wordmark span { display: block; margin: 0; padding: 0; border: 0; font-size: .8rem; }
  .introduction { padding-top: 36px; }
  .concept-strip { gap: 16px; }
  .concept-strip p { font-size: .8rem; }
  .section-heading { display: block; }
  .section-heading p:not(.eyebrow) { margin-top: -8px; }
  .trace-grid { grid-template-columns: 1fr; }
  .code-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .source-code { font-size: 12px; }
  .input-toolbar, .toolbar, .input-display, .step-caption { padding-left: 16px; padding-right: 16px; }
  .examples { padding-left: 16px; padding-right: 16px; }
  .toolbar { gap: 12px; }
  #step-number { margin-left: auto; }
  footer { flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #progress { transition: none; }
}
