/* PURPLE side by side - three cars redesigning themselves on one clock (test laps used). On top of lab/lab.css (tokens, type roles,
   buttons) and concept/lab/concept-lab.css (.ph / .pf / .empty). Desktop 1440×900 first with no page scroll; below 1100 px the lanes
   stack and the page scrolls. Dark only.
   Calm rules: one 4 / 8 / 12 / 16 px spacing scale, 16 px page gutters; sentence-case labels; each lane uses only its own colour as
   its accent (top rule, dot, best lap, best-so-far line) and the green of the real pole; no text under 11 px.
   The three lanes share one row grid (subgrid), so their headers, cars, numbers and charts line up whatever the text length. */
.cmp-page { --gut: 16px; --lane-a: #b26cff; --lane-b: #5fb4ff; --lane-c: #f2a541; --pole: #4ade80;
  display: flex; flex-direction: column; min-height: 100vh; height: 100vh; height: 100dvh; overflow: hidden; font-family: var(--sans); }

/* header */
.cmp-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px var(--gut); border-bottom: 1px solid var(--line); background: var(--panel); }
.cmp-brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.cmp-brand .brand { font: 700 20px/1 var(--sans); letter-spacing: .22em; color: var(--purple); flex: none; }
.cmp-titles { min-width: 0; }
.cmp-h { margin: 0; font: 600 18px/1.25 var(--sans); color: var(--text); }
.cmp-cap { margin: 4px 0 0; font: 400 14px/1.3 var(--sans); color: var(--muted); }
.cmp-ctl { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cmp-ctl .btn { font-size: 13px; padding: 6px 12px; }
.cmp-speed { display: inline-flex; gap: 4px; }
.cmp-speed .btn.on { border-color: var(--text); background: #24242c; }
#cmpPlay { min-width: 72px; }
.cmp-seed { display: inline-flex; align-items: center; gap: 8px; font: 500 13px/1.2 var(--sans); color: var(--muted); }
.cmp-seed select { background: #1a1a20; color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; font: 600 13px var(--sans); max-width: 100%; }

/* the clock */
.cmp-clock { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 8px var(--gut); border-bottom: 1px solid var(--line); }
.cmp-clock-m { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cmp-clock-l { display: flex; align-items: baseline; gap: 8px; min-width: 250px; }
.cmp-clock-v { font: 600 28px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; min-width: 4.2ch; text-align: right; }
.cmp-clock-of { font: 500 13px/1.2 var(--sans); color: var(--muted); }
.cmp-bar { position: relative; height: 8px; background: #1b1b22; border-radius: 4px; overflow: visible; }
.cmp-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #5a5a66; border-radius: 4px; }
.cmp-bar-marks { position: absolute; inset: -4px 0; pointer-events: none; }
.cmp-bar-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; border-radius: 1px; opacity: .35; transition: opacity .3s; }
.cmp-bar-mark.on { opacity: 1; }
.cmp-clock-r { font: 400 12px/1.35 var(--sans); color: var(--muted); }
/* who is ahead now (compare.js standings) */
.cmp-stand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cmp-stand-h { flex: none; font: 500 12px/1.2 var(--sans); color: var(--muted); }
.cmp-stand-none { font: 500 13px/1.3 var(--sans); color: var(--text); }
.cmp-stand-l { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cmp-stand-l li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--r); font: 500 13px/1.2 var(--sans); color: var(--muted); white-space: nowrap; }
.cmp-stand-l li i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--lc); }
.cmp-stand-l li b { font: 600 13px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.cmp-stand-l li.lead { border-color: var(--lc); color: var(--text); }
.cmp-stand-n { font: 600 12px/1 var(--mono); color: var(--muted); }
.cmp-clock-r b { color: var(--text); font-weight: 600; }

/* lanes: one shared row grid (header, car, numbers, badge, chart, source) */
.cmp-lanes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto minmax(0, 1fr) auto auto auto auto; column-gap: 12px; row-gap: 0; padding: 12px var(--gut) 8px; }
.cmp-lane { grid-row: 1 / span 6; display: grid; grid-template-rows: subgrid; min-height: 0; overflow: hidden; border-top: 3px solid var(--lc); }
.cmp-lane.a { --lc: var(--lane-a); }
.cmp-lane.b { --lc: var(--lane-b); }
.cmp-lane.c { --lc: var(--lane-c); }
.cmp-lh { padding: 12px 12px 8px; }
.cmp-lt { display: flex; align-items: center; gap: 8px; font: 600 15px/1.25 var(--sans); color: var(--text); }
.cmp-lt i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--lc); }
.cmp-ltt { min-width: 0; }
.cmp-rank { margin-left: auto; flex: none; font: 600 12px/1 var(--sans); }
.cmp-rank.on { padding: 4px 8px; border-radius: var(--r); color: #0a0a0c; background: var(--lc); }
.cmp-lw { margin-top: 4px; font: 400 12px/1.4 var(--sans); color: var(--muted); }
.cmp-car { position: relative; min-height: 150px; background: radial-gradient(120% 90% at 50% 45%, #18181f 0%, var(--panel) 62%); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cmp-car-view { position: absolute; inset: 0; }
.cmp-car-view canvas { display: block; width: 100% !important; height: 100% !important; }
.cmp-car-wait { position: absolute; inset: 0; z-index: 1; background: var(--panel); display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; font: 400 12px/1.4 var(--sans); color: var(--muted); pointer-events: none; }
.cmp-car-tag { position: absolute; left: 8px; top: 8px; z-index: 2; font: 500 11px/1.3 var(--sans); color: var(--muted); background: rgba(10, 10, 12, .6); padding: 2px 8px; border-radius: var(--r); pointer-events: none; }
.cmp-car-tag:empty { display: none; }
.cmp-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 4px 12px; padding: 12px 12px 8px; }
.cmp-best { display: flex; flex-direction: column; gap: 4px; }
.cmp-best-l { font: 500 12px/1.2 var(--sans); color: var(--muted); }
.cmp-best-v { font: 600 30px/1 var(--mono); color: var(--lc); font-variant-numeric: tabular-nums; }
.cmp-best-v small { font-size: 14px; color: var(--muted); margin-left: 2px; }
.cmp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; text-align: right; }
.cmp-gap { font: 600 13px/1.2 var(--mono); }
.cmp-gap.under { color: var(--pole); } .cmp-gap.over { color: var(--muted); }
.cmp-last { font: 400 12px/1.3 var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cmp-last b { font: 600 12px var(--mono); color: var(--text); }
.cmp-badge { align-self: start; margin: 0 12px 8px; padding: 6px 12px; border-radius: var(--r); font: 600 13px/1.25 var(--sans); border: 1px dashed var(--line); color: var(--muted); }
.cmp-badge.hit { border: 1px solid var(--pole); color: #0a0a0c; background: var(--pole); animation: cmp-hit 900ms cubic-bezier(.2, .8, .2, 1); }
.cmp-badge.end { border-style: solid; }
@keyframes cmp-hit { 0% { transform: scale(.96); box-shadow: 0 0 0 0 rgba(74, 222, 128, .7); } 60% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { transform: none; } }
.cmp-chart { position: relative; height: 200px; margin: 0 8px 4px; }
.cmp-chart canvas { display: block; width: 100%; height: 100%; }
.cmp-src { padding: 8px 12px; border-top: 1px solid var(--line); font: 400 11px/1.4 var(--sans); color: var(--muted); }

/* footer */
.cmp-foot { flex: none; display: block; padding: 8px var(--gut); border-top: 1px solid var(--line); background: var(--panel); font: 400 12px/1.45 var(--sans); color: var(--muted); }
.cmp-foot b { color: var(--text); font-weight: 600; }
.cmp-foot > span { display: block; }
.cmp-foot .cmp-honest { color: var(--text); }
.cmp-foot a { color: var(--text); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
.cmp-foot a:hover { text-decoration-color: var(--text); }
.cmp-err { margin: 40px auto; max-width: 560px; }

@media (max-height: 860px) { .cmp-chart { height: 170px; } .cmp-best-v { font-size: 28px; } }
@media (min-width: 1700px) and (min-height: 1000px) { .cmp-chart { height: 230px; } }
@media (max-width: 1100px) {
  .cmp-page { height: auto; overflow: visible; }
  body.cmp-page { overflow: auto; overflow-x: hidden; }
  .cmp-top { flex-direction: column; align-items: flex-start; }
  .cmp-ctl { justify-content: flex-start; }
  .cmp-clock { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cmp-stand { flex-wrap: wrap; gap: 8px; }
  .cmp-stand-l { flex-wrap: wrap; }
  .cmp-lanes { display: flex; flex-direction: column; gap: 12px; }
  .cmp-lane { display: flex; flex-direction: column; }
  .cmp-badge { align-self: stretch; }
  .cmp-car { flex: none; height: 230px; }
  .cmp-foot > span { margin-bottom: 4px; }
}
@media (max-width: 520px) {
  .cmp-brand { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cmp-h { font-size: 16px; }
  .cmp-clock-l { min-width: 0; }
  .cmp-stand { flex-direction: column; align-items: stretch; gap: 6px; }
  .cmp-stand-l { flex-direction: column; gap: 4px; }
  .cmp-stand-l li { justify-content: flex-start; }
  .cmp-stand-l li b { margin-left: auto; }
  .cmp-best-v { font-size: 26px; }
  .cmp-stats { grid-template-columns: minmax(0, 1fr); }
  .cmp-side { align-items: flex-start; text-align: left; }
  .cmp-last { white-space: normal; }
  .cmp-car { height: 200px; }
}
@media (prefers-reduced-motion: reduce) { .cmp-badge.hit { animation: none; } }
