/* Lap analysis. Driver A is blue, driver B apricot, matching the comparison palette. */
#analysis-root{--an-a:var(--blue);--an-b:var(--orange);--an-neutral:#5a6a80;--an-ground:#0b111b}
.an-progress{display:flex;align-items:center;gap:14px;margin:0 0 20px;color:var(--muted);font-size:14px}
.an-progress progress{flex:1;max-width:320px;height:6px;accent-color:var(--blue)}
.an-wait{color:var(--muted)}
.an-primary{background:var(--blue);border-color:var(--blue);color:#101723;font-weight:600}
.an-primary:hover{border-color:var(--ink)}
.an-gate{max-width:720px}
.an-gate h2{font:600 30px/1.1 var(--display);margin:6px 0 10px;text-wrap:balance}
.an-gate-actions{display:flex;gap:16px;align-items:center;flex-wrap:wrap;margin-top:16px}

/* Session story */
.an-story{margin:0 0 26px}
.an-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px}
.an-card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px 20px;display:flex;flex-direction:column;gap:10px;min-width:0}
.an-card p{margin:0;font-size:15px;line-height:1.5}
.an-card:first-child p{font:600 21px/1.25 var(--display);letter-spacing:.2px}
.an-card button{align-self:flex-start;margin-top:auto;background:transparent;color:var(--blue)}
.an-card-straight .eyebrow{color:var(--green)}
.an-card-corner .eyebrow{color:var(--orange)}

/* Lap duel */
.an-duel{margin:0 0 26px}
.an-duel-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;flex-wrap:wrap}
.an-duel-head .section-title{margin:0 0 4px}
.an-duel-controls{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap}
.an-duel-controls label{gap:6px}
.an-duel-controls select{min-width:0;max-width:260px}
.an-a-label,.an-b-label{display:flex;align-items:center;gap:8px;font-weight:600;color:var(--ink)}
.an-a-label::before,.an-b-label::before{content:"";width:12px;height:4px;border-radius:2px;background:var(--an-a)}
.an-b-label::before{background:var(--an-b)}
.an-swap{min-width:44px;font-size:18px;line-height:1}
.an-chips{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:18px 0 8px}
.an-chip{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:12px;background:var(--panel2);border:1px solid var(--line);border-left:4px solid var(--an-a);min-width:0}
.an-chip.an-b{border-left-color:var(--an-b)}
.an-chip strong{display:block;font:600 24px/1.05 var(--display)}
.an-chip span{color:var(--muted);font-size:13px}
.an-chip-meta{margin-left:auto;text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:2px}
.an-chip-meta b{font:600 24px/1 var(--display);font-variant-numeric:tabular-nums}
.an-tyre{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);white-space:nowrap}
.an-tyre i{width:9px;height:9px;border-radius:50%;border:2.5px solid #c9ced6}
.an-tyre-soft i{border-color:#ff6f6f}.an-tyre-medium i{border-color:#ffd166}.an-tyre-hard i{border-color:#eef1f5}
.an-tyre-intermediate i{border-color:#62d394}.an-tyre-wet i{border-color:#6fb6ff}
.an-headline{font:600 27px/1.2 var(--display);margin:10px 0 18px;text-wrap:balance}
.an-duel-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:start}
.an-map{margin:0;background:var(--an-ground);border:1px solid var(--line);border-radius:12px;padding:10px 10px 12px}
.an-map svg{display:block;width:100%;height:auto}
.an-map figcaption{display:flex;flex-wrap:wrap;align-items:center;gap:4px 0;color:var(--muted);font-size:13px;padding:6px 6px 0}
.an-key{display:inline-block;width:16px;height:5px;border-radius:3px;margin:0 6px 0 14px;background:var(--an-a)}
.an-key:first-child{margin-left:0}
.an-key-b{background:var(--an-b)}.an-key-n{background:var(--an-neutral)}
.an-track{fill:none;stroke:#223047;stroke-width:24;stroke-linecap:round;stroke-linejoin:round}
.an-zone{fill:none;stroke-width:9;stroke-linecap:round;stroke-linejoin:round;transition:stroke-width .15s ease}
.an-zone-a{stroke:var(--an-a)}.an-zone-b{stroke:var(--an-b)}.an-zone-n{stroke:var(--an-neutral)}
.an-zone.is-active{stroke-width:20}
.an-corner{fill:var(--muted);font:600 22px var(--sans);text-anchor:middle;paint-order:stroke;stroke:var(--an-ground);stroke-width:6px}
.an-line{fill:var(--ink)}
.an-ghost{stroke:var(--an-ground);stroke-width:5}
.an-ghost-a{fill:var(--an-a)}.an-ghost-b{fill:var(--an-b)}
.an-story-list{min-width:0}
.an-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.an-item{display:flex;align-items:flex-start;gap:14px;width:100%;min-height:44px;text-align:left;background:var(--panel2);border:1px solid var(--line);border-radius:10px;padding:12px 14px;color:var(--ink);cursor:pointer;font:inherit}
.an-item:hover,.an-item.is-active{border-color:var(--ink)}
.an-item:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.an-item-time{flex:0 0 84px;font:600 19px/1.15 var(--display);font-variant-numeric:tabular-nums;color:var(--an-a)}
.an-gain-b .an-item-time{color:var(--an-b)}
.an-item-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
.an-item-copy strong{font-size:15px}
.an-item-copy span{color:var(--muted);font-size:14px;line-height:1.45}
.an-even{color:var(--muted)}
.an-sectors{width:100%;border-collapse:collapse;margin-top:16px;font-size:14px;font-variant-numeric:tabular-nums}
.an-sectors caption{text-align:left;color:var(--muted);font-size:13px;font-weight:600;padding-bottom:6px}
.an-sectors th,.an-sectors td{padding:7px 8px;border-bottom:1px solid var(--line);text-align:left}
.an-sectors .num{text-align:right}
.an-good-a{color:var(--an-a)}.an-good-b{color:var(--an-b)}

/* Traces */
.an-traces-wrap{margin-top:24px}
.an-traces-head{display:flex;justify-content:space-between;gap:16px;align-items:center;flex-wrap:wrap}
.an-traces-head .sub{margin:0;max-width:70ch}
.an-traces{margin-top:10px;overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:var(--an-ground);cursor:crosshair;touch-action:pan-x pan-y}
.an-traces:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.an-traces svg{display:block;width:100%;min-width:760px;height:auto}
.an-band{fill:transparent}
.an-band-corner{fill:rgba(255,255,255,.025)}
.an-band.is-active{fill:rgba(112,200,255,.09)}
.an-sector{stroke:#46566c;stroke-dasharray:4 5}
.an-zero{stroke:#46566c}
.an-axis{fill:var(--muted);font:11px var(--sans)}
.an-axis-corner{text-anchor:middle;font-weight:600}
.an-row-label{fill:var(--muted);font:600 12px var(--sans)}
.an-gap{fill:none;stroke:var(--ink);stroke-width:2}
.an-line-a,.an-line-b{fill:none;stroke-width:2;stroke-linejoin:round}
.an-line-a{stroke:var(--an-a)}.an-line-b{stroke:var(--an-b)}
.an-thin{stroke-width:1.5}
.an-brake-a{fill:var(--an-a)}.an-brake-b{fill:var(--an-b)}
.an-cursor{stroke:var(--ink);stroke-width:1.5;pointer-events:none}
.an-readout{min-height:3em;margin:10px 0 0;font-size:14px;font-variant-numeric:tabular-nums}

.an-zoom{display:flex;align-items:flex-end;gap:8px;flex-wrap:wrap}
.an-zoom-pick{flex-direction:row;align-items:center;gap:8px}
.an-zoom-pick select{max-width:230px}
.an-zoom button[data-an-zoom="in"],.an-zoom button[data-an-zoom="out"]{min-width:44px;font-size:18px;line-height:1;padding:6px 0}
.an-zoom button:disabled{opacity:.4;cursor:default}
.an-traces svg{user-select:none;-webkit-user-select:none}
.an-tick{stroke:#46566c}
.an-brush{fill:rgba(112,200,255,.14);stroke:var(--blue);stroke-width:1;pointer-events:none}
.an-sample{stroke:var(--an-ground);stroke-width:1}
.an-sample-a{fill:var(--an-a)}.an-sample-b{fill:var(--an-b)}
.an-overview{display:block;width:100%;min-width:0;height:auto;margin-top:8px;border:1px solid var(--line);border-radius:10px;background:var(--an-ground);cursor:grab;touch-action:none}
.an-overview .an-band-corner{fill:rgba(255,255,255,.04)}
.an-ov-line{fill:none;stroke:var(--muted);stroke-width:1.5;opacity:.7}
.an-ov-window{fill:rgba(112,200,255,.12);stroke:var(--blue);stroke-width:2}
.an-ov-window.is-whole{fill:transparent;stroke:transparent}
/* Braking and energy */
.an-pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;margin:0 0 24px}
.an-pair .panel{min-width:0}
.an-pair .sub{max-width:62ch}
.an-chipset{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
.an-chipset button{min-height:40px;padding:6px 13px;border-radius:20px;font-size:13px}
.an-chipset button[aria-pressed="true"]{border-color:var(--blue);color:var(--blue)}
.an-plot{overflow-x:auto}
.an-plot svg{display:block;width:100%;height:auto}
.an-res{fill:rgba(255,255,255,.045)}
.an-dot circle{stroke:var(--an-ground);stroke-width:2}
.an-dot text{fill:var(--muted);font:600 11px var(--sans);text-anchor:middle}
.an-dot-a circle{stroke:var(--an-a);stroke-width:3}.an-dot-b circle{stroke:var(--an-b);stroke-width:3}
.an-dot-a text,.an-dot-b text{fill:var(--ink)}
.an-dumb line{stroke:var(--an-neutral);stroke-width:3;stroke-linecap:round}
.an-peak{fill:var(--an-ground);stroke:var(--muted);stroke-width:2}
.an-end{stroke:var(--an-ground);stroke-width:2}
.an-code,.an-val{fill:var(--muted);font:600 12px var(--sans);font-variant-numeric:tabular-nums}
.an-row-a .an-code,.an-row-b .an-code,.an-row-a .an-val,.an-row-b .an-val{fill:var(--ink)}
.an-row-a line{stroke:var(--an-a)}.an-row-b line{stroke:var(--an-b)}
.an-details summary{display:flex;align-items:center;min-height:44px;color:var(--muted);cursor:pointer}

/* Entry points elsewhere in the app */
.an-session-card{display:flex;justify-content:space-between;align-items:center;gap:22px;margin-top:22px}
.an-session-card h2{font:600 26px/1.1 var(--display);margin:6px 0 8px}
.an-session-card ul{margin:6px 0 0;padding-left:18px;display:flex;flex-direction:column;gap:4px}
.an-session-card .primary-link{white-space:nowrap}
.an-link-row{margin:14px 0 0}
.an-link-row a,.replay-analysis-link{color:var(--blue);display:inline-flex;align-items:center;min-height:44px}

.an-method{margin:4px 0 0;font-size:13px}
.an-method a{color:var(--muted);display:inline-flex;align-items:center;min-height:44px}
.an-views{display:none}
.an-focus{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin:0 0 12px;padding:12px 14px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);border-left:4px solid var(--an-a)}
.an-focus.an-gain-b{border-left-color:var(--an-b)}.an-focus.an-gain-n{border-left-color:var(--an-neutral)}
.an-focus strong{display:block;font-size:15px}
.an-focus span{display:block;color:var(--muted);font-size:14px;line-height:1.45;margin-top:2px}
.an-focus button{flex:0 0 auto}
.an-traces svg.is-small{min-width:0}
.an-traces svg.is-small .an-axis{font-size:15px}
.an-traces svg.is-small .an-row-label{font-size:15px}
.an-plot:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:8px}
@media(max-width:1050px){.an-pair{grid-template-columns:minmax(0,1fr)}}
@media(max-width:900px){.an-duel-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:650px){
 .an-chips{grid-template-columns:minmax(0,1fr)}
 .an-cards{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;gap:12px;padding-bottom:6px;margin-right:-18px;padding-right:18px;scrollbar-width:none}
 .an-cards::-webkit-scrollbar{display:none}
 .an-card{flex:0 0 84%;scroll-snap-align:start}
 .an-card:first-child p{font-size:19px}
 .an-duel-controls{width:100%}
 .an-duel-controls label{flex:1 1 150px}
 .an-duel-controls select{max-width:none;width:100%}
 .an-headline{font-size:22px}
 .an-item-time{flex-basis:70px;font-size:17px}
 .an-views{display:flex;gap:6px;margin:0 0 12px;padding:4px;background:var(--panel2);border:1px solid var(--line);border-radius:12px}
 .an-views button{flex:1 1 0;min-height:40px;padding:6px 8px;border:0;background:transparent;font-size:14px;color:var(--muted);border-radius:8px}
 .an-views button[aria-pressed="true"]{background:var(--bg);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line)}
 .an-view-traces .an-duel-grid{display:none}
 .an-view-map .an-traces-wrap,.an-view-map .an-story-list{display:none}
 .an-view-story .an-traces-wrap,.an-view-story .an-map{display:none}
 .an-traces{overflow-x:visible}
 .an-traces-head{gap:10px}
 .an-traces-head .sub{font-size:13px}
 .an-zoom{width:100%}
 .an-zoom-pick{flex:1 1 100%}
 .an-zoom-pick select{max-width:none;flex:1}
 .an-sectors{table-layout:fixed;font-size:13px}
 .an-sectors th,.an-sectors td{padding:7px 4px}
 .an-sectors th:first-child{width:52px}
 .an-session-card{flex-direction:column;align-items:flex-start}
}
@media(prefers-reduced-motion:reduce){.an-zone{transition:none}}

.an-more{margin-top:10px;background:transparent;color:var(--blue);border-color:var(--line)}

/* Home hero lap duel */
.home-duel{--an-a:var(--blue);--an-b:var(--orange);--an-neutral:#5a6a80;--an-ground:#0b111b;min-width:0}
.home-duel-fallback{max-width:520px}
.hd-card{background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:22px 24px;display:flex;flex-direction:column;gap:16px}
.hd-head{display:flex;justify-content:space-between;align-items:flex-end;gap:12px 24px;flex-wrap:wrap}
.hd-where{margin:0 0 4px;color:var(--muted);font-size:14px}
.hd-head h2{font:600 34px/1.05 var(--display);margin:0}
.hd-a{color:var(--an-a)}.hd-b{color:var(--an-b)}
.hd-gap{margin:0;font-size:15px;color:var(--ink);max-width:46ch}
.hd-body{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.6fr);gap:22px;align-items:center}
.hd-map-wrap{background:var(--an-ground);border:1px solid var(--line);border-radius:12px;padding:8px}
.hd-map{display:block;width:100%;height:auto;max-height:300px}
.hd-traces{min-width:0}
.hd-rows{display:flex;flex-direction:column;gap:8px;background:var(--an-ground);border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.hd-row{display:grid;grid-template-columns:70px minmax(0,1fr);align-items:center;gap:10px}
.hd-row span{color:var(--muted);font-size:13px}
.hd-row svg{display:block;width:100%}
.hd-row:nth-child(1) svg{height:120px}.hd-row:nth-child(2) svg{height:44px}.hd-row:nth-child(3) svg{height:16px}
.hd-line{fill:none;stroke-width:2;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.hd-line.hd-a{stroke:var(--an-a)}.hd-line.hd-b{stroke:var(--an-b)}
.hd-brake.hd-a{fill:var(--an-a)}.hd-brake.hd-b{fill:var(--an-b)}
.hd-band{fill:rgba(112,200,255,.12)}
.hd-key{display:flex;flex-wrap:wrap;align-items:center;gap:4px 0;margin:10px 0 0;color:var(--muted);font-size:13px}
.hd-key-band{display:inline-block;width:16px;height:12px;border-radius:3px;background:rgba(112,200,255,.25);margin:0 6px 0 14px}
.hd-story{border-left:3px solid var(--an-a);padding:2px 0 2px 14px}
.hd-story p{margin:0;font-size:16px;line-height:1.5;max-width:75ch}
.hd-open{align-self:flex-start}
@media(max-width:900px){.hd-body{grid-template-columns:minmax(0,1fr)}.hd-map{max-height:260px}}
@media(max-width:650px){.hd-card{padding:18px 16px}.hd-head h2{font-size:28px}.hd-row{grid-template-columns:56px minmax(0,1fr)}.hd-row:nth-child(1) svg{height:96px}}
.an-phases{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:12px 0 0}
.an-phases .sub{margin-right:4px}
.an-phases button{min-height:40px;padding:6px 14px;border-radius:20px;font-size:13px}
.an-phases button[aria-pressed=true]{border-color:var(--blue);color:var(--blue)}
.an-phase-note{margin:8px 0 0}
