/*
  Learn F1. Same tokens as the dashboard; this file only adds the explainer layout and figures.
  Long-running motion (spinning tyres, the timing bar, the safety car loop) is transform or opacity
  only, and switched on just while it's on screen.
*/
.learn-page .topbar .pages { display: flex; gap: 22px; margin-right: auto; }
.learn-page .topbar .pages a { text-decoration: none; color: var(--dust); font-size: var(--t-s); transition: color 200ms; }
.learn-page .topbar .pages a:hover { color: var(--chalk); }

/* ---------- intro ---------- */
.l-hero { padding: 72px 0 40px; }
.l-hero h1 {
  margin: 0 0 22px; font-size: clamp(3.4rem, 9vw, 7.5rem); font-weight: 870; font-stretch: 75%;
  text-transform: uppercase; line-height: .86; letter-spacing: -0.01em;
  animation: lift 900ms var(--ease-out) 120ms both;
}
.l-lede { margin: 0 0 40px; max-width: 60ch; font-size: 1.125rem; line-height: 1.65; color: var(--dust); animation: fade 800ms var(--ease-out) 300ms both; }
.l-lede a { color: var(--chalk); }

.gantry { display: flex; gap: 10px; }
.gantry i { position: relative; display: block; border-radius: 50%; background: var(--pit-2); border: 1px solid var(--line); transition: background-color 120ms, box-shadow 120ms; }
.gantry i.on { background: #e3261f; border-color: #ff5a4f; box-shadow: 0 0 0 4px rgb(227 38 31 / .18), 0 0 18px rgb(227 38 31 / .55); }
.gantry i.jump { background: color-mix(in srgb, var(--warn) 60%, var(--pit-2)); }
.gantry.intro { margin-bottom: 26px; }
.gantry.intro i { width: 16px; height: 16px; }

.toc { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; counter-reset: none; }
.toc li { animation: lift 700ms var(--ease-out) both; animation-delay: calc(380ms + var(--n, 0) * 40ms); }
.toc li:nth-child(1) { --n: 0 } .toc li:nth-child(2) { --n: 1 } .toc li:nth-child(3) { --n: 2 } .toc li:nth-child(4) { --n: 3 } .toc li:nth-child(5) { --n: 4 }
.toc li:nth-child(6) { --n: 5 } .toc li:nth-child(7) { --n: 6 } .toc li:nth-child(8) { --n: 7 } .toc li:nth-child(9) { --n: 8 }
.toc a {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: baseline; height: 100%;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--pit); text-decoration: none;
  transition: transform 300ms var(--ease-out), border-color 200ms;
}
.toc a:hover { transform: translate3d(0, -3px, 0); border-color: var(--dust); }
.toc b { grid-row: span 2; font-size: var(--t-2xl); font-weight: 850; font-stretch: 75%; color: var(--faint); line-height: 1; }
.toc span { font-weight: 700; font-stretch: 112%; }
.toc small { color: var(--dust); font-size: var(--t-s); }

/* ---------- layout ---------- */
.l-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 56px; align-items: start; }
.rail {
  position: sticky; top: calc(var(--bar-h) + 32px); display: grid; gap: 2px; padding-left: 16px;
  border-left: 1px solid var(--line);
}
.rail a { display: flex; gap: 10px; padding: 6px 0; font-size: var(--t-s); color: var(--dust); text-decoration: none; transition: color 200ms; }
.rail a b { font-stretch: 75%; color: var(--faint); font-weight: 700; min-width: 2ch; transition: color 200ms; }
.rail a:hover, .rail a[aria-current="true"] { color: var(--chalk); }
.rail a[aria-current="true"] b { color: var(--chalk); }
.rail .ink {
  position: absolute; left: -1px; top: 0; width: 2px; height: 0; background: var(--chalk); opacity: 0; border-radius: 2px;
  transition: transform 450ms var(--ease-out), height 450ms var(--ease-out), opacity 300ms;
}
.rail .score { margin: 18px 0 0; font-size: var(--t-xs); color: var(--dust); }
.chapters { max-width: 860px; }

/* ---------- chapter ---------- */
.chapter { padding: 88px 0 24px; border-top: 1px solid var(--line); }
.chapter:first-child { border-top: 0; padding-top: 24px; }
.ch-head { display: grid; grid-template-columns: auto 1fr; gap: 0 22px; align-items: start; margin-bottom: 26px; }
.ch-num { font-size: clamp(3rem, 7vw, 5.4rem); font-weight: 870; font-stretch: 75%; line-height: .8; color: transparent; -webkit-text-stroke: 1.5px var(--faint); }
.ch-head h2 { margin: 2px 0 10px; font-size: clamp(2rem, 4.4vw, 3.2rem); font-weight: 850; font-stretch: 75%; text-transform: uppercase; line-height: .92; }
.ch-key { margin: 0; font-size: clamp(1.1rem, 2vw, 1.333rem); font-weight: 600; line-height: 1.4; max-width: 44ch; }
.ch-text p { margin: 0 0 16px; max-width: 66ch; font-size: 1.0625rem; line-height: 1.7; color: color-mix(in srgb, var(--chalk) 86%, var(--dust)); }
.ch-text b { color: var(--chalk); }

.fig { margin: 8px 0 28px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--pit); }
.fig figcaption { margin-top: 14px; font-size: var(--t-s); color: var(--dust); }
.fig figcaption b { color: var(--chalk); }
.fig-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 18px; }

.live-tie { position: relative; margin: 0 0 22px; padding: 14px 16px 14px 18px; border-radius: 10px; background: color-mix(in srgb, var(--chalk) 5%, transparent); font-size: var(--t-s); line-height: 1.6; max-width: 70ch; }
.live-tie:empty { display: none; }
.live-tie::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ok); }
.muted { color: var(--dust); }

.see-live { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 600; font-size: var(--t-s); color: var(--chalk); text-decoration: none; }
.see-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.see-live::after { content: "→"; transition: transform 300ms var(--ease-out); }
.see-live:hover::after { transform: translate3d(4px, 0, 0); }

.play {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px 7px 13px; border-radius: 999px; border: 0;
  background: var(--chalk); color: var(--asphalt); font-weight: 600; font-size: var(--t-s); cursor: pointer;
  transition: transform 200ms var(--ease-out), opacity 200ms;
}
.play:hover { transform: translate3d(0, -1px, 0); }
.play .tri { width: 0; height: 0; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

/* ---------- quick checks ---------- */
.quiz { margin: 6px 0 22px; padding: 18px 20px; border: 1px dashed var(--line); border-radius: 14px; }
.q-k { margin: 0 0 4px; font-size: var(--t-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dust); }
.q { margin: 0 0 14px; font-weight: 700; font-size: 1.0625rem; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--pit); font-size: var(--t-s); cursor: pointer; text-align: left;
  transition: border-color 200ms, background-color 200ms, transform 200ms var(--ease-out);
}
.opts button:hover { border-color: var(--dust); transform: translate3d(0, -1px, 0); }
.quiz.answered .opts button { cursor: default; transform: none; }
.quiz.answered .opts button:not(.right):not(.wrong) { opacity: .5; }
.opts button.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--pit)); }
.opts button.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--pit)); }
.why { display: none; margin: 12px 0 0; font-size: var(--t-s); color: var(--dust); }
.quiz.answered .why { display: block; animation: lift 500ms var(--ease-out) both; }
.quiz.got .q-k::after { content: " · right"; color: var(--ok); }
.quiz.missed .q-k::after { content: " · not quite"; color: var(--bad); }

/* ---------- 01 season tour ---------- */
.tour { position: relative; height: 92px; margin: 10px 8px 0; }
.tour-line { position: absolute; left: 0; right: 0; top: 30px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.tour-line i { position: absolute; inset: 0; background: var(--chalk); transform: scaleX(0); transform-origin: 0 50%; transition: transform 1600ms var(--ease-out) 200ms; }
.fig.in .tour-line i { transform: scaleX(var(--f)); }
.stop {
  position: absolute; top: 31px; left: calc(var(--x) * 100%); width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0;
  border-radius: 50%; border: 2px solid var(--dust); background: var(--pit); cursor: pointer;
  transform: scale(0); transition: transform 500ms var(--ease-out), background-color 200ms;
  transition-delay: calc(300ms + var(--i) * 45ms);
}
.fig.in .stop { transform: scale(1); }
.stop.done { background: var(--chalk); border-color: var(--chalk); }
.stop.next { border-color: var(--chalk); background: var(--asphalt); }
.stop.next::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; background: var(--chalk); opacity: 0; animation: ping 2.2s var(--ease-out) infinite; }
.stop:hover, .stop:focus-visible { transform: scale(1.35); transition-delay: 0ms; }
.months { position: absolute; left: 0; right: 0; top: 56px; height: 20px; }
.mo { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); font-size: var(--t-xs); color: var(--faint); }
.mo::before { content: ""; position: absolute; left: 50%; top: -20px; width: 1px; height: 8px; background: var(--line); }

.stack { display: grid; gap: 18px; }
.team-l { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: var(--t-s); }
.team-l em { font-style: normal; font-weight: 750; font-stretch: 75%; font-size: var(--t-l); line-height: 1; }
.segs {
  display: flex; gap: 2px; height: 14px; width: calc(var(--w) * 100%);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 1100ms var(--ease-out); transition-delay: calc(200ms + var(--i) * 140ms);
}
.fig.in .segs { transform: scaleX(1); }
.segs i { height: 100%; border-radius: 3px; background: var(--c); }
.segs i.b { background: repeating-linear-gradient(135deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 55%, var(--pit)) 5px 10px); }
.team-sum { margin: 6px 0 0; font-size: var(--t-s); color: var(--dust); }

/* ---------- 02 weekend ---------- */
.days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.day { display: grid; align-content: start; gap: 8px; padding: 12px; border-radius: 12px; background: var(--asphalt); border: 1px solid var(--tarmac-edge); }
.day p { margin: 0 0 2px; font-size: var(--t-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dust); }
.sess {
  position: relative; padding: 11px 12px; border-radius: 9px; text-align: left; font-weight: 600; font-size: var(--t-s); cursor: pointer;
  border: 1px solid var(--line); background: var(--pit); color: var(--chalk);
  transition: background-color 300ms, color 300ms, border-color 300ms, transform 300ms var(--ease-out);
}
.sess::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--k); }
.sess:hover { transform: translate3d(0, -2px, 0); }
.sess.on { background: var(--chalk); color: var(--asphalt); border-color: var(--chalk); }
.k-practice { --k: var(--dust); } .k-quali, .k-squali { --k: var(--pb); } .k-sprint { --k: var(--warn); } .k-race { --k: var(--bad); }
.session-card { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); animation: fade 400ms var(--ease-out); }
.session-card h3 { margin: 2px 0 8px; font-size: var(--t-xl); font-weight: 820; font-stretch: 75%; text-transform: uppercase; line-height: 1; }
.session-card p { margin: 0 0 10px; font-size: var(--t-s); line-height: 1.6; max-width: 64ch; }
.sc-k { font-size: var(--t-xs) !important; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--dust); margin: 0 !important; }
.stake { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700; border: 1px solid var(--k); color: var(--chalk); }
.sc-local { margin: 10px 0 0 !important; color: var(--dust); }
.sc-local b { color: var(--chalk); }

/* ---------- 03 qualifying ---------- */
.quali-state { margin: 0 0 12px; min-height: 3em; font-size: var(--t-s); color: var(--dust); }
.quali { position: relative; overflow: hidden; }
.qr {
  position: absolute; left: 0; right: 0; top: 0; height: 30px; display: grid; align-items: center;
  grid-template-columns: 2.4ch 4px 4ch minmax(0, 1fr) auto 7ch; gap: 10px; padding: 0 10px;
  font-size: var(--t-s); border-radius: 6px; font-variant-numeric: tabular-nums;
  transition: transform 800ms var(--ease-out), opacity 500ms, background-color 400ms;
}
.qr i { height: 16px; border-radius: 2px; background: var(--c); }
.qr .qp { color: var(--dust); text-align: right; font-stretch: 75%; font-weight: 700; }
.qr b { font-weight: 750; }
.qr .qn { color: var(--dust); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr .qtime { font-style: normal; text-align: right; font-stretch: 87%; }
.qr .qtag { font-size: var(--t-xs); font-weight: 700; color: var(--dust); }
.qr.danger { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.qr.danger .qtag { color: var(--bad); }
.qr.out { opacity: .38; }
.qr.pole { background: color-mix(in srgb, var(--pb) 16%, transparent); }
.qr.pole .qtag { color: var(--pb); }
.qcut { position: absolute; left: 0; right: 0; top: 0; height: 0; border-top: 2px dashed var(--bad); transition: transform 800ms var(--ease-out); z-index: 1; }
.qcut span { position: absolute; right: 8px; top: -11px; padding: 0 6px; background: var(--pit); font-size: var(--t-xs); font-weight: 700; color: var(--bad); }

/* ---------- 04 start ---------- */
.start-fig { display: grid; justify-items: center; gap: 18px; padding: 28px 20px; text-align: center; }
.gantry.game { padding: 14px 18px; border-radius: 12px; background: #0d0f12; gap: 14px; }
.gantry.game i { width: clamp(34px, 9vw, 56px); height: clamp(34px, 9vw, 56px); background: #1d2127; border-color: #2b3038; }
.gantry.game i.on { background: #e3261f; border-color: #ff5a4f; }
.gantry.game i.jump { background: #8a6a12; border-color: #b98a18; }
.react {
  width: min(100%, 420px); padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--chalk); color: var(--asphalt);
  font-size: var(--t-l); font-weight: 800; font-stretch: 112%; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: background-color 150ms, color 150ms;
}
.react.armed { background: var(--pit-2); color: var(--chalk); }
.react-out { margin: 0; min-height: 3em; max-width: 52ch; font-size: var(--t-s); color: var(--dust); }
.react-out b { color: var(--chalk); font-size: var(--t-l); }

/* ---------- 05 tyres ---------- */
.tyres { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.tyre { display: grid; justify-items: center; gap: 6px; text-align: center; }
.tyre svg { width: min(100%, 110px); }
.tyre .rubber { fill: #15171a; }
:root[data-theme="light"] .tyre .rubber { fill: #23272c; }
.tyre .band { fill: none; stroke: var(--tc); stroke-width: 5; }
.tyre.hard .band { stroke: #eceef0; }
.tyre .rim { fill: #3a3f46; }
.tyre .spoke { stroke: #5b616a; stroke-width: 3; stroke-linecap: round; }
.tyres.spin .tyre svg { animation: spin 5s linear infinite; }
.tyres.spin .tyre:nth-child(1) svg { animation-duration: 3.2s; }
.tyres.spin .tyre:nth-child(2) svg { animation-duration: 4.2s; }
@keyframes spin { to { transform: rotate(360deg); } }
.tyre b { font-weight: 750; font-size: var(--t-s); }
.tyre small { color: var(--dust); font-size: var(--t-xs); }
.tyre .bars { display: grid; gap: 4px; width: 100%; max-width: 120px; }
.tyre .bars > span { display: grid; grid-template-columns: 3ch 1fr; gap: 6px; align-items: center; font-size: 0.6875rem; color: var(--dust); text-align: left; }
.tyre .bars i { display: block; height: 5px; border-radius: 3px; background: var(--tc); transform: scaleX(0); transform-origin: 0 50%; transition: transform 1000ms var(--ease-out) 300ms; }
.tyre.hard .bars i { background: var(--hard); }
.fig.in .tyre .bars i { transform: scaleX(var(--v)); }

.deg { display: block; width: 100%; height: auto; overflow: visible; }
.deg .gl { stroke: var(--line); }
.deg text { fill: var(--dust); font-size: 11px; font-variant-numeric: tabular-nums; }
.deg .axl { fill: var(--faint); }
.deg .dl { fill: none; stroke: var(--tc); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.deg .dlab { font-size: 12px; font-weight: 700; }
:root[data-theme="light"] .deg .dl.hard { stroke: var(--hard); }

.mini-stints { display: grid; gap: 6px; margin: -8px 0 24px; }
.mini-stints:empty { display: none; }
.ms { display: grid; grid-template-columns: 8ch 1fr; gap: 10px; align-items: center; font-size: var(--t-xs); }
.ms b { font-weight: 700; }
.ms-lane { position: relative; height: 14px; }
.ms-lane i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--tc); border: 1px solid var(--asphalt); transform: scaleX(0); transform-origin: 0 50%; transition: transform 900ms var(--ease-out); transition-delay: calc(var(--i) * 80ms); }
.ms-lane i[data-c="HARD"] { background: transparent; border: 2px solid var(--hard); }
.mini-stints.in .ms-lane i { transform: none; }

/* ---------- 06 strategy simulator ---------- */
.slider { display: grid; gap: 4px; font-size: var(--t-xs); color: var(--dust); min-width: 200px; }
.slider b { color: var(--chalk); font-size: var(--t-s); }
.slider input { width: 100%; accent-color: var(--chalk); }
.sim { display: grid; gap: 10px; }
.lane { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 7.5rem; gap: 16px; align-items: center; padding: 10px 12px; border-radius: 10px; transition: background-color 300ms; }
.lane.lead { background: color-mix(in srgb, var(--chalk) 6%, transparent); }
.lane-l b { display: block; font-weight: 750; }
.lane-l span { font-size: var(--t-xs); color: var(--dust); line-height: 1.4; display: block; }
.lane-track { position: relative; height: 34px; overflow: hidden; }      /* the moving layer must not widen the page */
.road { position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line); border-radius: 2px; }
.pitlane { position: absolute; left: 0; right: 0; top: 22px; height: 0; border-top: 1px dashed var(--line); }
.flagline { position: absolute; right: 7px; top: 0; width: 2px; height: 22px; background: var(--chalk); opacity: .5; border-radius: 1px; }
.sim-lap { margin: 0 0 6px; font-size: var(--t-s); font-weight: 600; font-variant-numeric: tabular-nums; }
.sim-axis { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 7.5rem; gap: 16px; padding: 0 12px; }
.sim-axis .ticks { position: relative; height: 18px; margin-right: 16px; }
.sim-axis .ticks span { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); font-size: 0.6875rem; color: var(--faint); white-space: nowrap; }
.sim-axis .ticks span:last-child { transform: translateX(-70%); color: var(--dust); font-weight: 600; }
.car-wrap { position: absolute; left: 0; top: 2px; width: calc(100% - 16px); height: 16px; will-change: transform; }
.car { position: absolute; left: 0; top: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--pit); border: 4px solid var(--tc, var(--dust)); box-shadow: 0 0 0 2px var(--pit); transition: border-color 300ms; }
.lane-r { display: grid; text-align: right; }
.lane-r .pos { font-size: var(--t-l); font-weight: 800; font-stretch: 75%; line-height: 1; }
.lane-r .info { font-size: var(--t-xs); color: var(--dust); }
.sim-result { margin: 14px 0 0; min-height: 1.6em; font-size: var(--t-s); }

/* ---------- 07 safety car ---------- */
.sc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 13rem; gap: 20px; align-items: center; }
.sc-track { width: 100%; height: auto; display: block; }
.sc-road { fill: none; stroke: var(--pit-2); stroke-width: 30; stroke-linejoin: round; }
.sc-edge { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 8; }
.sc-sf { stroke: var(--chalk); stroke-width: 3; }
.sc-c circle { fill: var(--c); stroke: var(--pit); stroke-width: 2.5; }
.sc-c text { fill: var(--chalk); font-size: 10px; font-weight: 700; }
.sc-sc { opacity: 0; transition: opacity 400ms; }
.sc-sc.on { opacity: 1; }
.sc-sc rect { fill: #f2a900; }
.sc-sc text { fill: #111; font-size: 9px; font-weight: 800; }
.sc-read { margin: 0; display: grid; gap: 14px; }
.sc-read dt { font-size: var(--t-xs); color: var(--dust); }
.sc-read dd { margin: 2px 0 0; font-size: var(--t-l); font-weight: 750; font-stretch: 87%; font-variant-numeric: tabular-nums; }
.sc-read div:last-child dd { font-size: var(--t-s); font-weight: 600; }

.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 24px; }
.flag { display: grid; grid-template-columns: 44px 1fr; gap: 2px 12px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.flag svg { grid-row: span 2; width: 44px; border-radius: 3px; transform-origin: 0 50%; }
.flag:hover svg { animation: wave 900ms ease-in-out; }
@keyframes wave { 25% { transform: skewY(4deg) scaleX(.96); } 75% { transform: skewY(-3deg) scaleX(.98); } }
.flag b { font-size: var(--t-s); }
.flag span { font-size: var(--t-xs); color: var(--dust); line-height: 1.45; }

/* ---------- 08 points ---------- */
.ladders { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; align-items: start; }
.ladder p { margin: 0 0 10px; font-size: var(--t-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--dust); }
.rung { display: grid; grid-template-columns: 3ch 1fr 3ch; gap: 10px; align-items: center; height: 24px; font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.rung span { color: var(--dust); font-stretch: 87%; }
.rung i { height: 12px; border-radius: 3px; background: var(--chalk); opacity: calc(.35 + var(--w) * .65); transform: scaleX(0); transform-origin: 0 50%; transition: transform 900ms var(--ease-out); transition-delay: calc(150ms + var(--i) * 55ms); }
.fig.in .rung i { transform: scaleX(var(--w)); }
.rung b { text-align: right; font-weight: 750; }
.whatif-q { margin: 0 0 12px; font-weight: 700; }
.whatif { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.whatif label { display: grid; gap: 6px; font-size: var(--t-xs); color: var(--dust); font-weight: 600; }
.whatif select { color: var(--chalk); font-size: var(--t-s); }
.whatif-out { margin: 14px 0 0; font-size: var(--t-s); line-height: 1.6; }

/* ---------- 09 timing ---------- */
.c-pb { color: var(--pb); } .c-pers { color: var(--ok); } .c-slow { color: var(--warn); }
.lapbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; align-items: end; }
.sec { position: relative; display: grid; gap: 2px; padding: 10px 12px 12px; border-radius: 10px; background: var(--asphalt); overflow: hidden; }
.sec i { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; transform: scaleX(0); transform-origin: 0 50%; background: var(--dust); }
.sec span { font-size: var(--t-xs); color: var(--dust); }
.sec b { font-size: var(--t-l); font-weight: 750; font-stretch: 87%; font-variant-numeric: tabular-nums; color: var(--faint); }
.laptime { padding: 10px 14px 12px; display: grid; gap: 2px; }
.laptime span { font-size: var(--t-xs); color: var(--dust); }
.laptime b { font-size: var(--t-xl); font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums; color: var(--faint); }
/* One timed lap, looping while on screen: each sector fills, then takes its colour. */
.lapbar.run .s1 i { animation: sfill 6s linear infinite; --sc: var(--pb); }
.lapbar.run .s2 i { animation: sfill2 6s linear infinite; --sc: var(--ok); }
.lapbar.run .s3 i { animation: sfill3 6s linear infinite; --sc: var(--warn); }
.lapbar.run .s1 b { animation: scol1 6s linear infinite; }
.lapbar.run .s2 b { animation: scol2 6s linear infinite; }
.lapbar.run .s3 b { animation: scol3 6s linear infinite; }
.lapbar.run .laptime b { animation: lapcol 6s linear infinite; }
@keyframes sfill  { 0% { transform: scaleX(0); background: var(--dust); } 22% { transform: scaleX(1); background: var(--dust); } 23%, 92% { transform: scaleX(1); background: var(--pb); } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes sfill2 { 0%, 22% { transform: scaleX(0); } 45% { transform: scaleX(1); background: var(--dust); } 46%, 92% { transform: scaleX(1); background: var(--ok); } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes sfill3 { 0%, 45% { transform: scaleX(0); } 68% { transform: scaleX(1); background: var(--dust); } 69%, 92% { transform: scaleX(1); background: var(--warn); } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes scol1 { 0%, 22% { color: var(--faint); } 23%, 92% { color: var(--pb); } 100% { color: var(--faint); } }
@keyframes scol2 { 0%, 45% { color: var(--faint); } 46%, 92% { color: var(--ok); } 100% { color: var(--faint); } }
@keyframes scol3 { 0%, 68% { color: var(--faint); } 69%, 92% { color: var(--warn); } 100% { color: var(--faint); } }
@keyframes lapcol { 0%, 68% { color: var(--faint); } 69%, 92% { color: var(--chalk); } 100% { color: var(--faint); } }

.gloss { margin: 8px 0 26px; }
.gloss-search input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--pit); color: var(--chalk); font: inherit;
  margin-bottom: 14px;
}
.gloss-search input:focus { outline: none; border-color: var(--dust); }
.gloss dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gloss dl div { background: var(--pit); padding: 12px 14px; }
.gloss dt { font-weight: 700; font-size: var(--t-s); }
.gloss dd { margin: 3px 0 0; font-size: var(--t-s); color: var(--dust); line-height: 1.5; }

.l-done { padding: 96px 0 24px; border-top: 1px solid var(--line); text-align: left; }
.l-done h2 { margin: 0 0 14px; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 850; font-stretch: 75%; text-transform: uppercase; line-height: .95; max-width: 20ch; }
.l-done p { color: var(--dust); max-width: 56ch; margin: 0 0 22px; }
.learn-link.big { display: inline-block; padding: 13px 22px; font-size: var(--t-m); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .l-layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .l-hero { padding-top: 44px; }
  .toc { grid-template-columns: minmax(0, 1fr); }
  .toc a { padding: 12px 14px; }
  .chapter { padding-top: 64px; }
  .ch-head { grid-template-columns: minmax(0, 1fr); }
  .ch-num { font-size: 2.6rem; margin-bottom: 6px; }
  .fig { padding: 16px; margin-left: calc(var(--gut) * -.5); margin-right: calc(var(--gut) * -.5); }
  .days { grid-template-columns: minmax(0, 1fr); }
  .day { grid-template-columns: 5.5rem 1fr; align-items: start; }
  .day p { grid-row: span 3; padding-top: 10px; }
  .qr { grid-template-columns: 2.4ch 4px 4ch minmax(0, 1fr) 7ch; gap: 8px; padding: 0 6px; }
  .qr .qtag { display: none; }
  .tyres { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 20px; }
  .lane { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l r" "t t"; gap: 6px 10px; padding: 10px 8px; }
  .lane-l { grid-area: l; } .lane-r { grid-area: r; } .lane-track { grid-area: t; }
  .sim-axis { grid-template-columns: minmax(0, 1fr); padding: 0 8px; }
  .sim-axis > span:not(.ticks) { display: none; }
  .slider { min-width: 0; width: 100%; }
  .sc-wrap { grid-template-columns: minmax(0, 1fr); }
  .sc-read { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ladders, .whatif { grid-template-columns: minmax(0, 1fr); }
  .lapbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .laptime { grid-column: 1 / -1; padding: 6px 2px 0; }
  .gloss dl { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .tyres.spin .tyre svg, .lapbar.run * { animation: none !important; }
  .lapbar .sec i { transform: none; }
  .lapbar .s1 i { background: var(--pb); } .lapbar .s2 i { background: var(--ok); } .lapbar .s3 i { background: var(--warn); }
}
