/* Numbers: Saira Semi Condensed (SIL Open Font License, fonts/OFL.txt),
   bundled so the app works offline. Figures only; text stays on the system
   font so Dynamic Type keeps working. */
@font-face {
  font-family: "Saira Semi Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/saira-semi-condensed-500.woff2") format("woff2");
}
@font-face {
  font-family: "Saira Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/saira-semi-condensed-700.woff2") format("woff2");
}
:root {
  --bg: #0a100c;
  --surface: #111a14;
  --surface-2: #17231b;
  --surface-3: #1f2e24;
  --line: #27382c;
  --line-strong: #3a5040;
  --text: #f1f3ec;
  --text-2: #b9c4b9;
  --text-3: #8a978c;
  --lime: #c8f24a;
  --lime-ink: #142006;
  --quicker: #3fdc9a;
  --slower: #ff8a5c;
  --same: #c4ccc6;
  --reference: #6fb9ff;
  /* Timing colours riders know: purple best, green gaining, orange losing. */
  --best: #c38bff;
  --best-ink: #1d0b33;
  --attention: #ffbe3d;
  --danger: #ff6b6b;
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: clamp(16px, 2.6vw, 40px);
  --font:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Figures: lap times, gaps, the four numbers, records. */
  --num: "Saira Semi Condensed", "Avenir Next Condensed", system-ui, sans-serif;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
/* iPhone app: follow the rider's text size (Settings > Display > Text Size).
   Every font size below is in rem, so the whole app scales with it. */
@supports (font: -apple-system-body) {
  html.ios-app {
    font: -apple-system-body;
    font-family: var(--font);
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll {
  overflow: hidden;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 {
  /* Capped by the screen width so the largest text sizes still fit. */
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  overflow-wrap: anywhere;
  font-weight: 700;
}
h1:focus {
  outline: none;
}
h2 {
  font-size: 1.25rem;
  font-weight: 650;
}
h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}
p {
  margin: 0;
}
button,
input {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
table.sr-only {
  display: block;
  left: 0;
  top: 0;
}
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 200;
}
.skip:focus {
  left: 8px;
}
.muted {
  color: var(--text-2);
}
.fineprint {
  color: var(--text-3);
  font-size: 0.875rem;
  margin-top: 12px;
}
.eyebrow {
  color: var(--lime);
  font: 600 0.75rem/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.lede {
  color: var(--text-2);
  font-size: 1.125rem;
  margin-top: 8px;
  max-width: 62ch;
}
.tone-quicker {
  color: var(--quicker);
}
.tone-slower {
  color: var(--slower);
}
.tone-same {
  color: var(--same);
}
.error {
  color: var(--danger);
  margin-top: 8px;
}

/* App shell */
.app {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 1.125rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: block;
  flex: none;
}
/* The wordmark: condensed capitals (Big Shoulders Display when installed). */
.wordmark,
.intro-brand {
  font-family: "Big Shoulders Display", "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topnav {
  display: flex;
  gap: 4px;
}
.topnav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-2);
  font-weight: 550;
}
.topnav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.topnav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-3);
}
.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-3);
  min-height: 20px;
}
.save--ok {
  color: var(--quicker);
}
.save--bad {
  color: var(--attention);
}
main {
  padding: 28px var(--gutter) 64px;
}
.page {
  max-width: 1720px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 48px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head--moto {
  align-items: flex-end;
}
.h1-sub {
  color: var(--text-3);
  font-weight: 500;
  font-size: 0.6em;
  margin-left: 8px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--text-2);
  padding: 8px 0;
  margin-bottom: 4px;
  cursor: pointer;
  min-height: 44px;
}
.back:hover {
  color: var(--text);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 0;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.button:hover {
  filter: brightness(1.06);
}
.button--large {
  min-height: 56px;
  font-size: 1.125rem;
  padding: 0 26px;
}
.button--small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9375rem;
}
.button--secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.button--danger {
  background: var(--danger);
  color: #2a0505;
}
.link {
  background: none;
  border: 0;
  color: var(--lime);
  font-weight: 600;
  cursor: pointer;
  padding: 10px 2px;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.link--danger {
  color: var(--danger);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(17, 26, 20, 0.86);
  color: var(--text);
  cursor: pointer;
}
.icon-button:hover {
  background: var(--surface-3);
}
.icon-button--solid,
.icon-button--solid:hover {
  background: var(--lime);
  color: var(--lime-ink);
  border: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
}
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.segmented--wrap {
  flex-wrap: wrap;
}
.segmented button {
  min-height: 44px;
  min-width: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
}
.segmented button[aria-pressed="true"] .muted {
  color: var(--lime-ink);
  opacity: 0.7;
}

/* Stats */
.stat-row {
  display: flex;
  gap: 12px;
  margin: 0;
  flex-wrap: wrap;
}
.stat-row > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 130px;
}
.stat-row dt {
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 600;
}
.stat-row dd {
  margin: 2px 0 0;
  font-size: 1.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-row small {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}

/* Banners and notes */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}
.banner--info {
  border-color: rgba(200, 242, 74, 0.35);
  background: rgba(200, 242, 74, 0.06);
}
.banner--good {
  border-color: rgba(63, 220, 154, 0.4);
  background: rgba(63, 220, 154, 0.08);
  margin-top: 16px;
  cursor: pointer;
}
.note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}
.note svg {
  flex: none;
  margin-top: 3px;
  color: var(--quicker);
}
.note--warn {
  background: rgba(255, 190, 61, 0.08);
  border: 1px solid rgba(255, 190, 61, 0.3);
}
.note--good {
  background: rgba(63, 220, 154, 0.08);
}

/* Map */
.map {
  position: relative;
  margin: 0;
  height: clamp(360px, 60vh, 760px);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d150f;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.map-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  /* Let a finger scroll the page past the map; full screen takes over gestures. */
  touch-action: pan-y pinch-zoom;
}
.map--expanded .map-canvas {
  touch-action: none;
}
@media (pointer: coarse) {
  .map:not(.map--expanded) svg {
    cursor: default;
  }
}
.map svg:has(.is-selected) .map-layer[data-select]:not(.is-selected) .map-line {
  opacity: 0.4;
}
.map svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.map svg:active {
  cursor: grabbing;
}
.map--expanded {
  position: fixed;
  inset: 0;
  z-index: 120;
  height: 100% !important;
  border-radius: 0;
  border: 0;
}
.map-imagery image {
  opacity: 0.82;
}
.map-outline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-linejoin: round;
  stroke-linecap: round;
}
.map-line,
.map-hit {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-hit {
  stroke: transparent;
  cursor: pointer;
}
.route-main .map-line {
  stroke: var(--lime);
}
.route-context .map-line {
  stroke: rgba(255, 255, 255, 0.6);
}
.route-muted .map-line {
  stroke: #9aa59d;
}
.route-attention .map-line {
  stroke: var(--attention);
}
.route-quicker .map-line {
  stroke: var(--quicker);
}
.route-slower .map-line {
  stroke: var(--slower);
}
.route-same .map-line {
  stroke: var(--same);
}
.route-reference .map-line {
  stroke: var(--reference);
}
.map-layer.is-selected .map-line {
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}
.map-layer[data-select]:hover .map-line {
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.6));
}
.map-marker circle {
  stroke: #0a100c;
}
.map-marker text {
  font-weight: 800;
  font-family: var(--font);
  pointer-events: none;
}
.marker-start circle {
  fill: var(--lime);
}
.marker-end circle {
  fill: #fff;
}
.marker-gate circle {
  fill: #0a100c;
  stroke: #fff;
}
.marker-gate text {
  fill: #fff;
}
.marker-finish circle {
  fill: #fff;
  stroke: #0a100c;
}
.marker-finish text {
  fill: #0a100c;
}
.marker-rider circle {
  fill: var(--lime);
}
.marker-ref circle {
  fill: var(--reference);
}
.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  font-size: 0.875rem;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.map-credit {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  margin: 0;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.62);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}
.key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.key::before {
  content: "";
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
}
.key-main::before {
  background: var(--lime);
}
.key-context::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.7) 0 5px,
    transparent 5px 8px
  );
}
.key-attention::before {
  background: var(--attention);
}
.key-outline::before {
  background: rgba(255, 255, 255, 0.3);
  height: 6px;
}
.key-quicker::before {
  background: var(--quicker);
}
.key-slower::before {
  background: var(--slower);
}
.key-same::before {
  background: var(--same);
}
.key-reference::before {
  background: repeating-linear-gradient(
    90deg,
    var(--reference) 0 5px,
    transparent 5px 8px
  );
}

/* Day timeline */
.timeline {
  margin-bottom: 20px;
}
.timeline-track {
  position: relative;
  height: 60px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.timeline-spark {
  position: absolute;
  inset: 8px 0;
  width: 100%;
  height: calc(100% - 16px);
}
.timeline-spark path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.2;
}
.timeline-block {
  position: absolute;
  top: 7px;
  bottom: 7px;
  border-radius: 7px;
  border: 2px solid var(--lime);
  background: rgba(200, 242, 74, 0.16);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  min-width: 10px;
}
.timeline-block-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text);
}
.timeline-block.status-checked {
  background: var(--lime);
}
.timeline-block.status-checked .timeline-block-label {
  color: var(--lime-ink);
}
.timeline-block.status-unsure {
  border-color: var(--attention);
  background: rgba(255, 190, 61, 0.15);
}
.timeline-block.status-not-moto,
.timeline-block.kind-other.status-to-check {
  border-color: #6f7c73;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.05);
}
.timeline-block.is-selected {
  box-shadow:
    0 0 0 3px var(--bg),
    0 0 0 5px #fff;
  z-index: 2;
}
.timeline-axis {
  position: relative;
  height: 22px;
  font-size: 0.8125rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.timeline-axis span {
  position: absolute;
  top: 4px;
}
.timeline-axis .mid {
  transform: translateX(-50%);
}

/* Day layout */
.day-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "map" "body" "trace" "list";
}
.run-list {
  grid-area: list;
}
.check-head {
  grid-area: head;
}
.day-map {
  grid-area: map;
  min-width: 0;
}
.day-trace {
  grid-area: trace;
  min-width: 0;
}
.check-body {
  grid-area: body;
}
@media (min-width: 760px) {
  .day-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
    grid-template-areas: "head head" "map body" "trace body" "list list";
    align-items: start;
  }
}
@media (min-width: 1240px) {
  .day-grid {
    grid-template-columns: 290px minmax(0, 1fr) 420px;
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "list map head" "list map body" "list trace body";
  }
  .run-list {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow: auto;
    padding-right: 4px;
  }
  .day-map .map {
    height: clamp(460px, calc(100vh - 380px), 820px);
  }
}
.list-title {
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.list-title .muted {
  font-size: 0.875rem;
  font-weight: 500;
}
.run-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
@media (min-width: 760px) and (max-width: 1239px) {
  .run-list ol {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}
.run-card {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  min-height: 64px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.run-card:hover {
  border-color: var(--line-strong);
}
.run-card.is-selected {
  border-color: var(--lime);
  background: var(--surface-2);
}
.run-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.run-card-meta {
  color: var(--text-2);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.status-dot {
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  white-space: nowrap;
}
.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--lime);
}
.status-dot.status-checked {
  color: var(--quicker);
}
.status-dot.status-checked::before {
  background: var(--quicker);
  border-color: var(--quicker);
}
.status-dot.status-unsure::before {
  border-color: var(--attention);
}
.status-dot.status-not-moto::before {
  border-color: #6f7c73;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(200, 242, 74, 0.12);
  color: var(--lime);
  margin-bottom: 10px;
}
.status-chip.status-checked {
  background: rgba(63, 220, 154, 0.14);
  color: var(--quicker);
}
.status-chip.status-unsure {
  background: rgba(255, 190, 61, 0.14);
  color: var(--attention);
}
.status-chip.status-not-moto {
  background: var(--surface-3);
  color: var(--text-2);
}
.check-head h2 {
  font-size: clamp(1.5rem, 2vw, 1.875rem);
}
.check-when {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.check-when strong {
  color: var(--text);
}
.because {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.because li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
}
.because li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.6em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--lime);
  transform: rotate(45deg);
}
.question {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 10px;
}
.question--attention {
  border-color: rgba(255, 190, 61, 0.45);
}
.question--done h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.question--done h3 svg {
  color: var(--quicker);
}
.choices {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.choices--row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.choice:hover {
  border-color: var(--text-3);
}
.choice--primary {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}
.choice--primary:hover {
  filter: brightness(1.06);
}
.choice--quiet {
  background: none;
  border-color: transparent;
  color: var(--text-2);
}
.lap-picker {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
}
.lap-pick {
  width: 100%;
  min-height: 64px;
  display: grid;
  gap: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.lap-pick strong {
  font-size: 0.9375rem;
}
.lap-pick.is-on {
  border-color: var(--lime);
  background: rgba(200, 242, 74, 0.1);
}
.lap-pick.is-edge {
  box-shadow: inset 0 0 0 1px var(--lime);
}
.lap-pick.is-flag {
  border-color: var(--slower);
  background: rgba(255, 138, 92, 0.12);
}
.adjust-summary {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.answers {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.answers li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  min-height: 48px;
}

/* Speed trace */
.trace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 10px;
}
.trace-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.trace-head .muted {
  font-weight: 400;
}
.trace-plot {
  position: relative;
  height: 128px;
  padding-left: 34px;
}
.trace-plot svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.trace-dim {
  fill: rgba(0, 0, 0, 0.35);
}
.trace-band {
  fill: rgba(255, 190, 61, 0.22);
}
.trace-on {
  fill: rgba(200, 242, 74, 0.07);
}
.trace-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.trace-mark {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}
.trace-line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.trace-y {
  position: absolute;
  left: 0;
  font-size: 0.75rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.trace-y.top {
  top: -6px;
}
.trace-y.mid {
  top: calc(50% - 8px);
}
.trace-hover {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
}
.trace-hover span {
  position: absolute;
  top: -4px;
  left: 6px;
  white-space: nowrap;
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.trace-axis {
  display: flex;
  justify-content: space-between;
  padding-left: 34px;
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-top: 4px;
}

/* Moto review */
.compare-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 8px 8px 18px;
}
.compare-strip strong {
  font-size: 1.0625rem;
}
.moto-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .moto-grid {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
    align-items: start;
  }
  .moto-side {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow: auto;
  }
}
@media (min-width: 1500px) {
  .moto-grid {
    grid-template-columns: minmax(440px, 0.85fr) minmax(0, 1.15fr) 420px;
  }
  .moto-grid > .moto-main {
    display: contents;
  }
  .moto-main > :first-child {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 84px;
  }
  .moto-main > .laps {
    grid-column: 2;
    grid-row: 1;
  }
  .moto-grid > .moto-side {
    grid-column: 3;
    grid-row: 1;
  }
  .moto-main > .map,
  .moto-map > .map {
    height: calc(100vh - 300px);
    min-height: 520px;
  }
  .replay .map {
    height: calc(100vh - 470px);
    min-height: 380px;
  }
}
.moto-main {
  display: grid;
  gap: 24px;
  min-width: 0;
}
.moto-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.side-title {
  font-size: 1.125rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
}
.side-title .muted {
  font-size: 0.875rem;
  font-weight: 400;
}
.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.section-row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 18px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  min-height: 64px;
}
.section-row:hover {
  border-color: var(--line-strong);
}
.section-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-weight: 800;
  font-size: 0.875rem;
}
.section-row.tone-slower .section-num {
  color: var(--slower);
}
.section-row.tone-quicker .section-num {
  color: var(--quicker);
}
.section-name {
  display: grid;
  min-width: 0;
}
.section-name strong {
  color: var(--text);
}
.section-name .muted {
  font-size: 0.875rem;
}
.delta {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chev {
  color: var(--text-3);
}
.mini-stats,
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 16px 0 0;
}
.mini-stats > div,
.facts > div {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.mini-stats dt,
.facts dt {
  font-size: 0.8125rem;
  color: var(--text-3);
  font-weight: 600;
}
.mini-stats dd,
.facts dd {
  margin: 2px 0 0;
  font-size: 1.1875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mini-stats small,
.facts small {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}
.facts--row {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.section-detail h2 {
  font-size: 1.625rem;
}
.section-detail h3 {
  margin-top: 22px;
}
.big-delta {
  font-size: 1.875rem;
  font-weight: 800;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.plain {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--text-2);
}
.focus-offer {
  margin-top: 24px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(200, 242, 74, 0.45);
  background: rgba(200, 242, 74, 0.05);
  display: grid;
  gap: 12px;
}
.focus-offer h3 {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--lime);
}
.focus-option {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.focus-option:last-of-type {
  border-bottom: 0;
}
.focus-action {
  font-size: 1.125rem;
  font-weight: 650;
}
.focus-section {
  color: var(--lime);
  font-weight: 700;
}

/* Laps */
.laps {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.lap-rows {
  display: grid;
  gap: 4px;
}
.lap-head {
  display: grid;
  grid-template-columns: 64px 56px 110px 64px minmax(0, 1fr);
  gap: 12px;
  padding: 0 13px 6px;
  font-size: 0.8125rem;
  color: var(--text-3);
  font-weight: 600;
}
.split--head {
  background: none;
}
.lap-row {
  display: grid;
  grid-template-columns: 64px 56px 110px 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.lap-row:hover:not(:disabled) {
  border-color: var(--line-strong);
}
.lap-row:disabled {
  cursor: default;
}
.lap-row.is-out {
  background: none;
  border: 1px dashed var(--line);
  color: var(--text-3);
}
.lap-row.is-selected {
  border-color: var(--lime);
}
.lap-time {
  font-size: 1.0625rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--lime);
  color: var(--lime-ink);
  padding: 1px 6px;
  border-radius: 5px;
}
.lap-delta {
  font-weight: 650;
}
.lap-splits {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.875rem;
}
.split {
  min-width: 48px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}
.split.tone-quicker {
  background: rgba(63, 220, 154, 0.12);
}
.split.tone-slower {
  background: rgba(255, 138, 92, 0.12);
}
@media (max-width: 640px) {
  .lap-head {
    display: none;
  }
  .lap-row {
    grid-template-columns: minmax(3.5em, auto) minmax(0, 1fr) auto;
  }
  .lap-clock,
  .lap-splits {
    display: none;
  }
  .lap-row.is-out .lap-splits {
    display: block;
    grid-column: 1 / -1;
    font-size: 0.8125rem;
  }
}

/* Replay */
.replay {
  display: grid;
  gap: 12px;
}
.replay-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.replay-bar input[type="range"] {
  flex: 1;
  min-width: 160px;
  accent-color: var(--lime);
  height: 32px;
}
.replay-time {
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  font-weight: 650;
}
.replay-gap {
  font-size: 1.125rem;
  font-weight: 650;
}
.replay-splits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.replay-splits li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  display: grid;
  opacity: 0.55;
}
.replay-splits li.is-passed {
  opacity: 1;
}

/* Sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 22px;
  display: grid;
  gap: 12px;
}
.sheet:focus {
  outline: none;
}
.sheet h3 {
  margin-top: 10px;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.option-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.option {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}
.option.is-selected {
  border-color: var(--lime);
}
.option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.confirm {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 107, 0.5);
}

/* Home */
.hero {
  display: grid;
  gap: 28px;
  padding: clamp(24px, 3vw, 44px);
  border-radius: 20px;
  background:
    radial-gradient(
      120% 140% at 0% 0%,
      rgba(200, 242, 74, 0.12),
      transparent 55%
    ),
    var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 24px;
}
@media (min-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}
.hero h1 {
  font-size: clamp(2rem, 1.6rem + 1.6vw, 3.25rem);
  overflow-wrap: anywhere;
}
.hero-action {
  margin-top: 24px;
  display: grid;
  gap: 10px;
  justify-items: start;
}
.stat-row--hero > div {
  background: rgba(10, 16, 12, 0.5);
}
.home-grid,
.progress-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}
/* Progress: one column on a phone, in reading order; on wide screens a main
   column (the track) and a side column (you), each a stack, so cards of
   different heights never leave holes. */
.pg-main,
.pg-side {
  display: contents;
}
.pg-1 { order: 1; }
.pg-2 { order: 2; }
.pg-3 { order: 3; }
.pg-4 { order: 4; }
.pg-5 { order: 5; }
.pg-6 { order: 6; }
.pg-7 { order: 7; }
.pg-8 { order: 8; }
.pg-9 { order: 9; }
.progress-grid > * > div:empty {
  display: none;
}
.progress-grid > * > div > .card {
  height: auto;
}
@media (min-width: 900px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .progress-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
    align-items: start;
  }
  .pg-main,
  .pg-side {
    display: grid;
    gap: 20px;
    align-content: start;
    min-width: 0;
  }
}
@media (min-width: 1400px) {
  .progress-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(380px, 1fr);
    max-width: 1500px;
  }
}
@media (min-width: 1400px) {
  .home-grid {
    grid-template-columns: 1.1fr 1.3fr 0.9fr;
    align-items: start;
  }
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card--quiet {
  background: none;
}
.card--wide {
  grid-column: 1 / -1;
}
.pace-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.pace-row {
  width: 100%;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 64px 16px;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.pace-row:hover {
  background: var(--surface-2);
}
.pace-label {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.pace-label .muted {
  font-size: 0.8125rem;
}
.pace-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}
.pace-bar span {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: transparent;
  border: 1.5px solid var(--lime);
}
.pace-bar span.is-checked {
  background: var(--lime);
}
.pace-value {
  font-weight: 650;
  text-align: right;
}
.big-number {
  font-size: 2.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Progress chart */
.pace-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.pace-chart .grid {
  stroke: var(--line);
}
.pace-chart .axis {
  fill: var(--text-3);
  font-size: 0.75rem;
  font-family: var(--font);
}
.pace-chart .hit {
  fill: transparent;
}
.pace-chart .is-hover .hit {
  fill: rgba(255, 255, 255, 0.04);
}
.pace-chart .dot {
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.5;
  opacity: 0.8;
}
.pace-chart .is-checked .dot {
  fill: var(--lime);
  stroke: none;
}
.pace-chart .avg {
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
}
.pace-readout {
  margin-top: 8px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-height: 24px;
}
.focus-progress {
  display: grid;
  gap: 10px;
}
.focus-progress h3 {
  margin-top: 12px;
}
.result {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

/* Phone */
@media (max-width: 759px) {
  .topbar {
    height: 56px;
    /* A backdrop filter would trap the fixed bottom navigation inside the header. */
    backdrop-filter: none;
    background: var(--bg);
  }
  .topnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    justify-content: space-around;
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .topnav a {
    flex-direction: column;
    flex: 1 1 0;
    gap: 2px;
    /* Like iOS tab bars, labels grow a little with large text, then stop. */
    font-size: min(0.75rem, 15px);
    padding: 6px 4px;
    min-width: 0;
    min-height: 52px;
  }
  main {
    padding-top: 20px;
    padding-bottom: 104px;
  }
  .map {
    height: min(58vh, 440px);
  }
  .stat-row > div {
    flex: 1 1 40%;
    min-width: 0;
    padding: 12px 14px;
  }
  .stat-row dd {
    font-size: 1.375rem;
  }
  .lede {
    font-size: 1.0625rem;
  }
  .compare-strip {
    width: 100%;
  }
  .map-legend {
    font-size: 0.8125rem;
    right: 64px;
  }
  .button--large {
    width: 100%;
  }
  .hero-action {
    justify-items: stretch;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.more-options summary {
  cursor: pointer;
  color: var(--lime);
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.more-options .focus-option {
  margin-top: 8px;
}

/* Lap analysis */
.lap-pickers {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.picker {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--lime);
  border-radius: var(--radius);
  padding: 8px 14px;
}
.picker--b {
  border-left-color: var(--reference);
}
.picker span {
  grid-column: 1 / -1;
  font-size: 0.8125rem;
  color: var(--text-3);
  font-weight: 600;
}
.picker select {
  min-height: 40px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  font: inherit;
  max-width: 230px;
}
.picker strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.laps-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "map" "side" "charts";
}
.laps-map {
  grid-area: map;
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.laps-charts {
  grid-area: charts;
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}
.laps-side {
  grid-area: side;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
@media (min-width: 900px) {
  .laps-grid {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
    grid-template-areas: "map side" "charts side";
    align-items: start;
  }
}
@media (min-width: 1500px) {
  .laps-grid {
    grid-template-columns: minmax(460px, 1.15fr) minmax(0, 1fr) 380px;
    grid-template-areas: "map charts side";
  }
  .laps-map {
    position: sticky;
    top: 84px;
  }
  .laps-map .map {
    height: calc(100vh - 300px);
  }
  .laps-side {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow: auto;
  }
}
.cursor-readout {
  min-height: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.dchart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 8px;
}
.dchart-head {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.dchart-plot {
  position: relative;
  margin-left: 40px;
  cursor: crosshair;
  touch-action: pan-y;
}
.dchart-plot svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.dchart-corner {
  fill: rgba(255, 255, 255, 0.04);
}
.dchart-corner.is-selected {
  fill: rgba(200, 242, 74, 0.12);
}
.dchart-zero {
  stroke: var(--line-strong);
  stroke-width: 1;
}
.dchart-line {
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.line-a {
  stroke: var(--lime);
}
.line-ref {
  stroke: var(--reference);
  stroke-dasharray: 5 4;
}
.line-gap {
  stroke: var(--text-2);
}
.dchart-cursor {
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1;
}
.dchart-tag {
  position: absolute;
  top: -16px;
  transform: translateX(-50%);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
}
.dchart-y {
  position: absolute;
  left: -40px;
  width: 34px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.dchart-y.top {
  top: -6px;
}
.dchart-y.bottom {
  bottom: -6px;
}
.dchart-axis {
  display: flex;
  justify-content: space-between;
  margin-left: 40px;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
}
.side-sub {
  margin: 20px 0 8px;
  font-size: 1rem;
}
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.mini-table th {
  text-align: left;
  color: var(--text-3);
  font-weight: 600;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}
.mini-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.coach-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 138, 92, 0.4);
  background: rgba(255, 138, 92, 0.06);
  display: grid;
  gap: 8px;
}
.coach-card--good {
  border-color: rgba(63, 220, 154, 0.4);
  background: rgba(63, 220, 154, 0.06);
}

/* Clickable stat tiles */
.stat-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}
.stat-row > div:has(.stat-link):hover {
  border-color: var(--lime);
}
.stat-more {
  display: block;
  font-size: 0.75rem;
  color: var(--lime);
  font-weight: 600;
  margin-top: 4px;
}

/* Opportunities */
.opps {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.opp {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}
.opp:hover {
  border-color: var(--line-strong);
}
.opp-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 800;
  font-size: 0.875rem;
}
.opp strong {
  display: block;
}
.opp .delta {
  color: var(--slower);
}
.insights {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 24px;
}
@media (min-width: 900px) {
  .insights {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }
}
@media (min-width: 1400px) {
  .insights {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  }
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.field {
  display: grid;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text-2);
}
.field select,
.field input,
.field textarea {
  min-height: 44px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 1rem;
}
.field textarea {
  min-height: 72px;
  resize: vertical;
}
.field--wide {
  grid-column: 1 / -1;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-toggle {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}
.chip-toggle[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
}
.compare-pick {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}
.compare-pick .field {
  flex: 1 1 120px;
}
.moto-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.moto-table th {
  text-align: left;
  font-size: 0.8125rem;
  color: var(--text-3);
  font-weight: 600;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.moto-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.moto-table tr:hover td {
  background: var(--surface-2);
}
.table-scroll {
  overflow-x: auto;
}

.stat-tile {
  display: grid;
  gap: 2px;
  align-content: start;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 130px;
  cursor: pointer;
  color: inherit;
}
.stat-tile:hover {
  border-color: var(--lime);
}
.stat-label {
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 600;
}
.stat-value {
  font-size: 1.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-tile small {
  font-size: 0.8125rem;
  color: var(--text-2);
}
@media (max-width: 759px) {
  .stat-tile {
    flex: 1 1 40%;
    min-width: 0;
    padding: 12px 14px;
  }
  .stat-value {
    font-size: 1.375rem;
  }
}
.sheet--wide {
  width: min(760px, 100%);
}
.moto-changes {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.side-intro {
  margin: -6px 0 12px;
  font-size: 0.875rem;
}
.side-title--gap {
  margin-top: 28px;
}
.opps-wrap {
  display: grid;
  gap: 12px;
}

.button:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
  filter: none;
}

.ride-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ride-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  min-height: 72px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.ride-row:hover {
  border-color: var(--line-strong);
}
.ride-date {
  display: grid;
}
.ride-date strong {
  font-size: 1.125rem;
}
.ride-stats {
  display: flex;
  gap: 16px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .ride-row {
    grid-template-columns: minmax(0, 1fr) 18px;
  }
  .ride-stats {
    grid-column: 1;
    justify-content: flex-start;
    gap: 10px;
    font-size: 0.875rem;
  }
}
.notice-bar {
  max-width: 1720px;
  margin: 0 auto 16px;
}
/* iPhone: respect the notch and home indicator */
.topbar {
  padding-top: env(safe-area-inset-top);
  height: calc(64px + env(safe-area-inset-top));
}
@media (max-width: 759px) {
  .topbar {
    height: calc(56px + env(safe-area-inset-top));
  }
}

.home-grid--after {
  max-width: 1720px;
  margin: 24px auto 0;
}

.view-switch {
  margin-bottom: 10px;
}
.moto-replay {
  display: grid;
  gap: 10px;
}
.replay-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: end;
}
.replay-head .field {
  min-width: 170px;
}

.trace-head {
  align-items: center;
}
.trace-expand {
  margin-left: auto;
  width: 40px;
  height: 40px;
}
.trace--expanded {
  position: fixed;
  inset: 0;
  z-index: 130;
  border-radius: 0;
  padding: calc(16px + env(safe-area-inset-top)) 20px
    calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.trace--expanded .trace-plot {
  flex: 1;
  height: auto;
  margin-top: 24px;
}
.trace-lap {
  position: absolute;
  top: -18px;
  transform: translateX(2px);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
}

.because-details summary {
  cursor: pointer;
  color: var(--text-2);
  font-weight: 600;
  margin-top: 12px;
  min-height: 32px;
}
.check-progress {
  display: none;
}
@media (max-width: 759px) {
  .page--day.is-checking > .timeline,
  .page--day.is-checking > .insights,
  .page--day.is-checking .run-list {
    display: none;
  }
  .page--day.is-checking .check-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: -8px 0 12px;
    min-height: 44px;
  }
  .page--day.is-checking .day-map .map {
    height: min(38vh, 320px);
  }
  .page--day.is-checking .day-grid {
    gap: 12px;
  }
  /* Answers stay in view under the map while scrolling. */
  .page--day.is-checking .check-body {
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 20;
    max-height: 48vh;
    overflow: auto;
    border-radius: var(--radius);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.55);
  }
  .page--day.is-checking .check-body .question {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }
  .page--day.is-checking .check-head h2 {
    font-size: 1.375rem;
  }
}

.garage-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  margin-top: 20px;
}
.garage-form {
  display: grid;
  gap: 12px;
}
.garage-form h4 {
  margin: 8px 0 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}
.setup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.setup-row {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.875rem;
}
.setup-row:hover {
  border-color: var(--line-strong);
}
.conditions-summary {
  padding-left: 18px;
  color: var(--text);
}
.field select:disabled {
  opacity: 0.5;
}
@media (max-width: 759px) {
  .page--day.is-checking .check-body {
    max-height: 42vh;
  }
  .page--day.is-checking .check-body .question {
    padding: 14px;
    gap: 8px;
  }
  .page--day.is-checking .check-body .question > p.muted,
  .page--day.is-checking .check-body .question > .fineprint {
    display: none;
  }
  .page--day.is-checking .check-body .question h3 {
    font-size: 1rem;
  }
  .page--day.is-checking .check-body .choices {
    grid-template-columns: 1fr;
  }
  .page--day.is-checking .check-body .choice {
    min-height: 48px;
    padding: 0 12px;
    font-size: 0.9375rem;
  }
  .page--day.is-checking .day-map .map {
    height: min(34vh, 290px);
  }
}
/* On touch screens the inline map only offers full screen; zoom happens there. */
@media (pointer: coarse) {
  .map:not(.map--expanded) .map-tools .icon-button:not(:last-child) {
    display: none;
  }
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  margin-left: -6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--lime);
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
}
.back-button:hover {
  background: var(--surface-2);
}
@media (max-width: 759px) {
  .topbar.has-back .brand {
    font-size: 1rem;
  }
  .topbar.has-back .brand-mark {
    display: none;
  }
}
/* No copy/paste pop-ups or text selection on interactive things in the app. */
button,
.map,
.dchart-plot,
.trace-plot,
.pace-chart,
.timeline {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.route-ghost2 .map-line {
  stroke: #ff7fc8;
}
.marker-ghost2 circle {
  fill: #ff7fc8;
}
.key-ghost2::before {
  background: repeating-linear-gradient(
    90deg,
    #ff7fc8 0 5px,
    transparent 5px 8px
  );
}

@media (max-width: 759px) {
  /* Phone: the save confirmation is a tick, so the top bar stays on one line. */
  .save {
    font-size: 0;
    gap: 0;
  }
  .save svg {
    width: 20px;
    height: 20px;
  }
  .map-credit {
    font-size: 0.5625rem;
    bottom: 4px;
    opacity: 0.8;
  }
}

/* The top bar has Back on every inner screen, so page-level back links go. */
.page-head .back {
  display: none;
}
/* Phone and tablet: what changed comes straight after the map, then every lap. */
@media (max-width: 1099px) {
  .moto-grid > .moto-main {
    display: contents;
  }
  .moto-main > :first-child {
    order: 1;
  }
  .moto-grid > .moto-side {
    order: 2;
    scroll-margin-top: calc(72px + env(safe-area-inset-top));
  }
  .moto-main > .laps {
    order: 3;
  }
}
.facts {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.tone-attention {
  color: var(--attention);
}
.pace-chart .axis {
  font-size: 0.75rem;
}
.mini-stats {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

/* Track vocabulary: sections holding their turns */
.part-group + .part-group {
  margin-top: 14px;
}
.part-head {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 8px;
}
.opp-where {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-bottom: 2px;
}
.turn-links {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.turn-link {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}
.turn-link:hover {
  border-color: var(--line-strong);
}
.turn-link .muted {
  font-size: 0.8125rem;
}

/* Ride switcher: Overview · Motos · Analysis */
.ride-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin: -8px 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.ride-bar-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  font-size: 0.9375rem;
}
.ride-bar-title .muted {
  font-size: 0.875rem;
}
.ride-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.ride-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 9px;
  text-decoration: none;
  font-weight: 650;
  color: var(--text-2);
}
.ride-tabs a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.ride-tabs a[aria-current] {
  color: var(--lime-ink);
  background: var(--lime);
}
.ride-tabs a[aria-current="true"] {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--lime);
}
.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--attention);
  color: #241a00;
  font-size: 0.8125rem;
  font-weight: 800;
}
.page-head--tab {
  margin-bottom: 20px;
}
.overview-check {
  margin-bottom: 20px;
}
.page--overview .stat-row {
  margin-bottom: 20px;
}
.overview-grid,
.analysis-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  margin: 20px 0;
}
@media (min-width: 900px) {
  .overview-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
  }
  .analysis-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
  }
  .analysis-grid {
    grid-template-rows: auto 1fr;
  }
  .analysis-grid > .card--opps {
    grid-row: span 2;
  }
  .analysis-grid > :not(.card--opps) {
    align-self: start;
  }
}
@media (min-width: 1400px) {
  .analysis-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  }
  .analysis-grid > .card--opps {
    grid-row: auto;
  }
}
@media (max-width: 759px) {
  .ride-bar {
    margin: -6px 0 16px;
    padding-bottom: 12px;
  }
  .ride-tabs {
    width: 100%;
  }
  .ride-tabs a {
    flex: 1;
    padding: 0 8px;
  }
  /* Phone check mode keeps the map and answers on screen together. */
  .page--day.is-checking > .ride-bar {
    display: none;
  }
}
@media (max-width: 759px) {
  .overview-check {
    flex-direction: column;
    align-items: stretch;
  }
  .overview-check .button {
    justify-content: center;
  }
}

/* First use: welcome */
.welcome {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.welcome-side {
  padding: 24px var(--gutter) 0;
  display: grid;
  gap: 20px;
  align-content: start;
}
.welcome-brand {
  margin: 0;
}
.welcome-promises {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 18px;
}
.welcome-promises li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  color: var(--text-2);
}
.welcome-promises svg {
  color: var(--lime);
  margin-top: 2px;
}
.welcome-promises strong {
  color: var(--text);
}
.welcome-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}
.welcome-steps li {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  font-size: 0;
  color: transparent;
}
.welcome-steps li.is-done,
.welcome-steps li.is-now {
  background: var(--lime);
}
.welcome-step-dot {
  display: none;
}
.welcome-main {
  padding: 20px var(--gutter) 48px;
  max-width: 680px;
  width: 100%;
}
.welcome-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -8px 0 12px;
}
.welcome-nav .link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  padding-left: 0;
}
.welcome-step {
  display: grid;
  gap: 16px;
  justify-items: start;
}
.welcome-step .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.welcome-step h1 {
  font-size: clamp(1.875rem, 1.5rem + 1.4vw, 2.875rem);
  overflow-wrap: anywhere;
}
.welcome-step h1:focus {
  outline: none;
}
.welcome-step > .garage-form,
.welcome-step > .note,
.welcome-step > .unit-choice,
.welcome-step > .record-steps {
  width: 100%;
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 8px;
}
.welcome-bikes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.welcome-bikes li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.welcome-bikes svg {
  color: var(--quicker);
}
.unit-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.unit-option {
  position: relative;
  display: grid;
  gap: 4px;
  text-align: left;
  min-height: 96px;
  padding: 18px;
  border-radius: var(--radius);
  border: 2px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
}
.unit-option strong {
  font-size: 1.625rem;
}
.unit-choice {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.unit-option:has(input:focus-visible) {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}
.unit-option:has(input:checked) {
  border-color: var(--lime);
  background: var(--surface-2);
}
.unit-tick {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--lime);
}
.record-steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.record-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 2px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.record-steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 800;
  line-height: 1;
}
.record-steps strong {
  color: var(--text);
}
.hero--first .record-steps li {
  background: rgba(10, 16, 12, 0.5);
}
@media (min-width: 1100px) {
  .hero--first {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: start;
  }
}
@media (min-width: 900px) {
  .welcome {
    grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  }
  .welcome-side {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 48px clamp(28px, 4vw, 64px);
    align-content: center;
    gap: 40px;
    background:
      radial-gradient(
        120% 90% at 0% 0%,
        rgba(200, 242, 74, 0.14),
        transparent 60%
      ),
      var(--surface);
    border-right: 1px solid var(--line);
  }
  .welcome-promises {
    display: grid;
  }
  .welcome-steps {
    display: grid;
    gap: 10px;
  }
  .welcome-steps li {
    height: auto;
    background: none;
    font-size: 0.9375rem;
    color: var(--text-3);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .welcome-steps li.is-done,
  .welcome-steps li.is-now {
    background: none;
  }
  .welcome-steps li.is-now {
    color: var(--text);
    font-weight: 650;
  }
  .welcome-steps li.is-done {
    color: var(--text-2);
  }
  .welcome-step-dot {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    font-size: 0.8125rem;
    font-weight: 800;
  }
  .is-now .welcome-step-dot {
    border-color: var(--lime);
    color: var(--lime);
  }
  .is-done .welcome-step-dot {
    border-color: var(--quicker);
    background: var(--quicker);
    color: var(--lime-ink);
  }
  .welcome-main {
    align-self: center;
    padding: 64px clamp(28px, 5vw, 96px);
    max-width: 760px;
  }
}
.welcome--intro .welcome-promises {
  display: grid;
}
@media (max-width: 899px) {
  .welcome--intro {
    align-content: start;
  }
  .welcome--intro .welcome-main {
    order: -1;
    padding-top: 32px;
  }
  .welcome--intro .welcome-side {
    padding-bottom: 40px;
  }
  .welcome--intro .welcome-brand {
    display: none;
  }
}
@media (max-width: 899px) {
  .welcome {
    align-content: start;
  }
}

/* Large text: the top bar and switchers grow a little, then hold, like iOS bars. */
.brand,
.back-button,
.topbar .save {
  white-space: nowrap;
}
.brand {
  font-size: min(1.125rem, 22px);
}
.back-button {
  font-size: min(1rem, 20px);
}
@media (max-width: 759px) {
  .topbar.has-back .brand {
    font-size: min(1rem, 20px);
  }
}
.ride-tabs {
  flex-wrap: wrap;
}
.ride-tabs a {
  flex: 1 1 auto;
  font-size: min(1rem, 22px);
}
.tab-badge {
  min-width: 1.4em;
  height: auto;
  min-height: 1.4em;
  padding: 0 0.4em;
  border-radius: 0.7em;
  font-size: min(0.8125rem, 18px);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .lap-pickers {
    width: 100%;
  }
  .picker {
    flex: 1 1 12rem;
    min-width: 0;
  }
  .picker select {
    max-width: 100%;
    min-width: 0;
  }
}

/* Large text: a long result ("About the same") wraps instead of crushing the name. */
.section-row .delta {
  white-space: normal;
  text-align: right;
  max-width: 7.5em;
}

/* Phone check mode: the page heading stays for screen readers, out of sight. */
@media (max-width: 759px) {
  .page--day.is-checking > .page-head {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    margin: 0;
  }
}
/* Form fields never run past their column (inputs have an intrinsic width). */
.field {
  min-width: 0;
}
.field select,
.field input,
.field textarea {
  width: 100%;
  min-width: 0;
}
.field-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
}
/* iPhone: content never shows through the status bar on screens without a top bar. */
.welcome::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: var(--bg);
  z-index: 70;
}

/* Wide screens have room for the shape of the day on Home; phones keep Home short. */
@media (max-width: 1099px) {
  .wide-only {
    display: none;
  }
}

/* Add a ride from a file */
.add-file {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.add-file .button {
  cursor: pointer;
}
.add-file .button:has(input:focus-visible) {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}

/* First screen: the brand, as on the launch screen, then the promise */
.brand-lockup {
  display: grid;
  justify-items: start;
  gap: 14px;
  margin-bottom: 8px;
}
.brand-lockup .brand-mark {
  font-weight: 850;
  letter-spacing: -0.02em;
}
.brand-lockup-name {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
  margin: 0;
}
.welcome-step--intro h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.5rem);
  color: var(--text-2);
  font-weight: 650;
}
@media (prefers-reduced-motion: no-preference) {
  .welcome-step--intro {
    animation: brand-in 600ms ease-out both;
  }
  @keyframes brand-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}
@media (max-width: 899px) {
  .welcome--intro .welcome-main {
    padding-top: 12vh;
  }
}
/* Wide screens: the brand panel already carries the name on the intro. */
@media (min-width: 900px) {
  .welcome--intro .welcome-side .welcome-brand {
    display: none;
  }
}

/* Race replay: gains and losses painted as you go */
.race {
  display: grid;
  gap: 10px;
}
.route-ahead .map-line {
  stroke: rgba(255, 255, 255, 0.22);
}
.route-painted .map-line {
}
.marker-dot circle {
  stroke: #0a100c;
}
.marker-rider.marker-dot circle {
  fill: var(--lime);
}
.marker-callout.tone-slower circle {
  fill: var(--slower);
  stroke: #0a100c;
}
.marker-callout.tone-quicker circle {
  fill: var(--quicker);
  stroke: #0a100c;
}
.marker-callout.tone-same circle {
  fill: #fff;
  stroke: #0a100c;
}
.marker-callout text {
  fill: #0a100c;
}
.map-badge rect {
  fill: rgba(10, 16, 12, 0.92);
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: calc(var(--s) * 1);
}
.map-badge text {
  font-weight: 800;
  fill: #fff;
}
.marker-callout.tone-slower .map-badge text {
  fill: var(--slower);
}
.marker-callout.tone-quicker .map-badge text {
  fill: var(--quicker);
}
.race-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 84px);
  padding: 10px 14px 12px;
  border-radius: 14px;
  background: rgba(10, 16, 12, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  pointer-events: none;
  display: grid;
  gap: 2px;
}
.race-gap {
  font-size: clamp(2rem, 1.6rem + 1.6vw, 3rem);
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.race-gap small {
  font-size: 0.45em;
  font-weight: 700;
  margin-left: 2px;
}
.race-gap.tone-same {
  color: var(--text);
}
.race-sub {
  font-size: 0.8125rem;
  color: var(--text-2);
}
.race-where {
  font-size: 0.875rem;
  font-weight: 650;
  margin-top: 4px;
}
.race-speeds {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.race-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.race-dot--a {
  background: var(--lime);
}
.race-dot--b {
  background: var(--reference);
  margin-left: 6px;
}
.race-strip {
  position: relative;
  height: 64px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.race-strip svg {
  display: block;
  width: 100%;
  height: 100%;
}
.race-zero {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.race-line {
  fill: none;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.race-line--all {
  stroke: rgba(255, 255, 255, 0.12);
}
.race-line.tone-slower {
  stroke: var(--slower);
}
.race-line.tone-quicker {
  stroke: var(--quicker);
}
.race-line.tone-same {
  stroke: #fff;
}
.race-cursor {
  stroke: var(--lime);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.race-strip-label {
  position: absolute;
  right: 8px;
  font-size: 0.6875rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.race-strip-label--top {
  top: 4px;
}
.race-strip-label--bottom {
  bottom: 4px;
}
.race-status {
  font-weight: 650;
  min-height: 1.5em;
}
.race-splits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 6px;
}
.race-splits li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-3);
  transition:
    border-color 200ms,
    background 200ms;
}
.race-splits li.is-passed {
  color: var(--text-2);
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.race-splits strong {
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}
.race--corner .race-hud .race-gap {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem);
}
@media (max-width: 759px) {
  /* Phone: a compact timing chip, so the track stays visible. */
  .race-hud {
    padding: 6px 10px 8px;
    top: 8px;
    left: 8px;
    max-width: calc(100% - 72px);
    gap: 0;
  }
  .race-gap {
    font-size: 1.75rem;
  }
  .race-sub,
  .race-speeds {
    font-size: 0.75rem;
  }
  .race-where {
    font-size: 0.75rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 1500px) {
  /* The replay brings its gap strip and controls; the map makes room for them. */
  .laps-map .race .map {
    height: calc(100vh - 430px);
    min-height: 420px;
  }
  .laps-map .race .fineprint {
    display: none;
  }
}

/* ---------- First screen: the hero ---------- */
.intro {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background:
    radial-gradient(
      90% 60% at 50% 0%,
      rgba(200, 242, 74, 0.1),
      transparent 70%
    ),
    radial-gradient(
      70% 50% at 100% 100%,
      rgba(63, 220, 154, 0.07),
      transparent 70%
    ),
    var(--bg);
  overflow: hidden;
}
.intro-visual {
  padding: 24px 12px 0;
}
.intro-copy {
  padding: 8px var(--gutter) 40px;
  display: grid;
  gap: 18px;
  justify-items: start;
  max-width: 640px;
}
.intro-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.intro-copy h1 {
  font-size: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.intro-copy h1:focus {
  outline: none;
}
.intro-copy .lede {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  color: var(--text-2);
}
.intro-points {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.intro-points li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--text-2);
}
.intro-points svg {
  box-sizing: content-box;
  padding: 9px;
  border-radius: 12px;
  background: rgba(200, 242, 74, 0.1);
  color: var(--lime);
}
.intro-points strong {
  color: var(--text);
}
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin-top: 8px;
}
.intro-cta {
  min-width: 15rem;
  box-shadow: 0 10px 40px -12px rgba(200, 242, 74, 0.6);
}
@media (max-width: 759px) {
  .intro-cta {
    width: 100%;
  }
}
@media (min-width: 900px) {
  .intro {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: 24px;
    padding: 40px clamp(24px, 4vw, 72px);
  }
  .intro-visual {
    padding: 0;
  }
  .intro-copy {
    padding: 0;
  }
}

/* ---------- The illustrated replay ---------- */
.hero-replay {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}
.hero-replay svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.hero-track-base {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 22;
  stroke-linejoin: round;
}
.hero-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 3;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  stroke-linecap: round;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-track {
    animation: hero-draw 1.4s ease-out both;
  }
  @keyframes hero-draw {
    from {
      stroke-dashoffset: 1;
    }
  }
}
.hero-paint {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero-paint.tone-quicker {
  stroke: var(--quicker);
}
.hero-paint.tone-slower {
  stroke: var(--slower);
}
.hero-paint.tone-same {
  stroke: #e9eee6;
}
.hero-rider {
  fill: var(--lime);
  stroke: #0a100c;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(200, 242, 74, 0.95));
}
.hero-ghost {
  fill: var(--best);
  stroke: #0a100c;
  stroke-width: 2;
  opacity: 0.9;
}
.hero-callout rect {
  fill: rgba(10, 16, 12, 0.92);
  stroke: rgba(255, 255, 255, 0.2);
}
.hero-callout text {
  font: 800 12px var(--font);
}
.hero-callout.tone-slower text {
  fill: var(--slower);
}
.hero-callout.tone-quicker text {
  fill: var(--quicker);
}
@media (prefers-reduced-motion: no-preference) {
  .hero-callout {
    animation: callout-in 300ms ease-out both;
  }
  @keyframes callout-in {
    from {
      opacity: 0;
    }
  }
}
.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 0 4%;
}
.hero-chip {
  display: grid;
  padding: 8px 14px 10px;
  border-radius: 14px;
  background: rgba(10, 16, 12, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}
.hero-chip strong {
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.hero-chip small {
  font-size: 0.45em;
  margin-left: 2px;
}
.hero-chip span {
  font-size: 0.75rem;
  color: var(--text-2);
}
.hero-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.8125rem;
  color: var(--text-2);
  margin-top: 4px;
}
.hero-key-ghost::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--best);
  margin-right: 6px;
}

/* ---------- Set-up steps ---------- */
.welcome-side-visual {
  display: none;
}
@media (min-width: 900px) {
  .welcome-side-visual {
    display: block;
  }
  .welcome-side-visual .hero-keys {
    display: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .welcome-stage {
    animation: step-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  @keyframes step-in {
    from {
      opacity: 0;
      transform: translateX(16px);
    }
  }
}
.step-illustration {
  width: 100%;
  max-width: 340px;
  margin: 0 0 4px;
}
.unit-example {
  font-size: 0.9375rem;
  color: var(--text-2);
}
.unit-example strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.watch-face .wf-strap {
  fill: #1c241f;
}
.watch-face .wf-bezel {
  fill: #2a332d;
  stroke: #3c473f;
  stroke-width: 2;
}
.watch-face .wf-screen {
  fill: #000;
}
.watch-face .wf-button {
  fill: #3c473f;
}
.watch-face .wf-start {
  fill: var(--lime);
}
.watch-face text {
  text-anchor: middle;
  font-family: var(--font);
  fill: #fff;
}
.watch-face .wf-small {
  font-size: 9px;
  font-weight: 600;
}
.watch-face .wf-state {
  font-size: 19px;
  font-weight: 800;
  fill: var(--lime);
}
.watch-face .wf-label {
  font-size: 10px;
  font-weight: 800;
  fill: var(--lime);
  text-anchor: start;
}
@media (prefers-reduced-motion: no-preference) {
  .watch-face .wf-pulse {
    animation: wf-pulse 2.4s ease-in-out infinite;
  }
  .watch-face .wf-start {
    animation: wf-press 2.4s ease-in-out infinite;
  }
  @keyframes wf-pulse {
    50% {
      opacity: 0.2;
    }
  }
  @keyframes wf-press {
    50% {
      transform: translateX(-3px);
    }
  }
}
@media (min-width: 900px) {
  .step-illustration {
    max-width: 440px;
  }
}

/* Replay layout: timing bar above the track, playback on the track. */
.race .race-hud {
  position: static;
  max-width: none;
  backdrop-filter: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "gap sub speeds" "gap where speeds";
  align-items: center;
  column-gap: 14px;
  row-gap: 0;
}
.race .race-gap {
  grid-area: gap;
}
.race .race-sub {
  grid-area: sub;
  align-self: end;
}
.race .race-where {
  grid-area: where;
  align-self: start;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.race .race-speeds {
  grid-area: speeds;
}
.race-controls {
  position: absolute;
  left: 10px;
  right: 64px;
  bottom: 30px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(10, 16, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  z-index: 2;
}
.race-controls .segmented button {
  min-height: 36px;
  padding: 0 10px;
}
.race-area {
  stroke: none;
  opacity: 0.35;
}
.race-area--behind {
  fill: var(--slower);
}
.race-area--ahead {
  fill: var(--quicker);
}
.race-line--behind {
  stroke: var(--slower);
}
.race-line--ahead {
  stroke: var(--quicker);
}
@media (max-width: 759px) {
  .race .race-hud {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "gap sub" "gap where" "speeds speeds";
    padding: 8px 12px;
  }
  .race .race-speeds {
    margin-top: 2px;
  }
  .race-controls {
    left: 6px;
    right: 6px;
    bottom: 24px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .race-controls .replay-time {
    display: none;
  }
  .race-controls .icon-button--solid {
    width: 40px;
    height: 40px;
  }
}
.race-controls {
  flex-wrap: nowrap;
}
.lines-toggle {
  justify-self: start;
  padding-top: 2px;
}
.check-head {
  scroll-margin-top: calc(72px + env(safe-area-inset-top));
}
.recorder-choice {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 10px;
}
.recorder-option {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 16px 48px 16px 18px;
  border-radius: var(--radius);
  border: 2px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
}
.recorder-option strong {
  font-size: 1.0625rem;
}
.recorder-text {
  display: grid;
  gap: 2px;
}
.recorder-option:has(input:checked) {
  border-color: var(--lime);
  background: var(--surface-2);
}
.recorder-option:has(input:focus-visible) {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}
.recorder-detail {
  display: grid;
  gap: 12px;
  justify-items: start;
  width: 100%;
}
.welcome-step > .recorder-choice,
.welcome-step > .note {
  width: 100%;
}
.race-controls {
  bottom: 8px;
}
.race-controls .icon-button {
  flex-shrink: 0;
}
.race-controls input[type="range"] {
  min-width: 0;
  flex: 1;
}
/* The image credit moves to the top so the playback bar can sit at the bottom. */
.race .map-credit {
  top: 8px;
  bottom: auto;
  right: 64px;
}

/* Wave 1 (evaluation 2 Oct): the replay never covers the track. Playback sits
   under the picture in the map's own column, and the image credit sits at the
   picture's bottom edge, at every width. */
.race .map .race-controls {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: none;
  padding: 8px 10px;
}
.race .map-credit {
  top: auto;
  bottom: 6px;
  right: 12px;
}
@media (max-width: 759px) {
  /* Give the picture back the height the controls now use. */
  .race .map:not(.map--expanded) {
    height: min(calc(58vh + 64px), 520px);
  }
}

/* One card instead of a checking queue. */
.ride-questions {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  margin-block: 12px;
  max-width: 1720px;
}
.rq-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}
.rq-row p {
  margin: 0;
  flex: 1 1 18rem;
  min-width: 0;
}
.rq-row .button {
  flex: 0 0 auto;
}
.ride-questions--compact {
  background: transparent;
  border-color: var(--line);
  margin-top: 16px;
}
.ride-questions .fineprint {
  margin: 0;
}

/* Bests are purple everywhere: the best lap of the day, a personal best, the best moto. */
.is-best,
.value-best {
  color: var(--best);
}
.badge-best {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--best);
  color: var(--best-ink);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.split--best {
  color: var(--best);
  background: rgba(195, 139, 255, 0.16);
  font-weight: 700;
}

/* Large text (iOS accessibility sizes): long words wrap instead of running off
   the screen, and switches wrap onto a second line. */
body {
  overflow-wrap: break-word;
}
.hero,
.hero-text,
.moto-main,
.moto-side,
.laps-main,
.laps-side {
  min-width: 0;
}
.segmented {
  flex-wrap: wrap;
  max-width: 100%;
}

/* Tablet (760–1023 px): the top bar keeps one line by showing tab icons only;
   the names stay for screen readers. */
@media (min-width: 760px) and (max-width: 1023px) {
  .topbar {
    gap: 12px;
  }
  .topnav a {
    padding: 10px;
  }
  .topnav a .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Motos tab, browsing (not answering): your motos come first, then the one you picked. */
@media (max-width: 759px) {
  .page--day:not(.is-checking) .day-grid {
    grid-template-areas: "list" "head" "map" "body" "trace";
  }
}
@media (min-width: 760px) and (max-width: 1239px) {
  .page--day:not(.is-checking) .day-grid {
    grid-template-areas: "list list" "head head" "map body" "trace body";
  }
}
.pace-bar span.is-top {
  border-color: var(--best);
}
.pace-bar span.is-top.is-checked {
  background: var(--best);
}
.lap-time {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  min-width: 0;
}
/* The image credit sits bottom-right, clear of the track's lower turns. */
.race .map-credit {
  left: auto;
  max-width: 60%;
  text-align: right;
}
@media (max-width: 759px) {
  /* Four sections side by side, never three and one left over. */
  .race-splits {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }
  .race-splits li {
    padding: 6px 6px;
    font-size: 0.75rem;
  }
}

/* Story: the replay leads, with your one thing and any questions beside it. */
.story-grid {
  display: grid;
  gap: 20px;
  margin-block: 20px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1720px;
}
@media (min-width: 1100px) {
  .story-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
    align-items: start;
  }
}
.story-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.story-side .ride-questions {
  margin: 0;
}
.story-replay {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.story-replay-head {
  display: grid;
  gap: 4px;
}
.story-replay-head h2 {
  font-size: 1.375rem;
}
.story-replay-more {
  justify-self: start;
}
.page--home > .story-replay {
  max-width: 1720px;
  margin: 20px auto 0;
}
@media (min-width: 1100px) {
  .story-replay--compact .race .map:not(.map--expanded) {
    height: clamp(360px, 52vh, 620px);
  }
}

/* Personal best: the one place the app celebrates. */
.best-moment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 14px;
  align-items: center;
  padding: 16px 18px;
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(195, 139, 255, 0.35);
  background: linear-gradient(
    135deg,
    rgba(195, 139, 255, 0.16),
    rgba(195, 139, 255, 0.04)
  );
}
.story-side .best-moment {
  margin-top: 0;
}
.best-moment .button {
  grid-column: 1 / -1;
  justify-self: start;
}
.best-moment .fineprint {
  grid-column: 1 / -1;
  margin: 0;
}
.best-trophy {
  color: var(--best);
  align-self: start;
}
.best-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.best-text p {
  margin: 0;
}
.best-title {
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--best);
}
.best-time {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.best-quiet {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--text-2);
  margin: 12px 0 0;
}
.best-quiet svg {
  color: var(--best);
  align-self: center;
}
@media (prefers-reduced-motion: no-preference) {
  .best-moment--new {
    animation: best-glow 2.4s ease-out 1;
  }
  .best-moment--new .best-trophy {
    animation: best-pop 700ms cubic-bezier(0.2, 1.6, 0.4, 1) 1;
  }
}
@keyframes best-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(195, 139, 255, 0.55);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(195, 139, 255, 0);
  }
}
@keyframes best-pop {
  0% {
    transform: scale(0.4) rotate(-12deg);
  }
  100% {
    transform: none;
  }
}

/* Rides list: delete sits under each ride, quiet until asked. */
.ride-delete {
  justify-self: end;
  font-size: 0.875rem;
  padding: 6px 4px;
}
.ride-list > li {
  display: grid;
  gap: 4px;
}
.ride-delete-confirm {
  margin-top: 4px;
}
/* Who's riding and privacy lists. */
.guardian {
  display: grid;
  gap: 12px;
}
.guardian-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 8px;
}
.guardian-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  color: var(--text-2);
}
.guardian-list svg {
  color: var(--quicker);
  margin-top: 3px;
}
.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.check-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--lime);
  margin: 0;
}
.rider-choice {
  display: grid;
  gap: 12px;
}

/* Folded depth on phones. */
.fold {
  display: grid;
  gap: 10px;
}
.fold > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.fold > summary::-webkit-details-marker {
  display: none;
}
.fold > summary::after {
  content: "Show";
  color: var(--lime);
  font-weight: 650;
  font-size: 0.9375rem;
}
.fold[open] > summary::after {
  content: "Hide";
}
.fold > summary h2 {
  margin: 0;
}
.lap-more {
  justify-self: start;
  margin-top: 8px;
  min-height: 44px;
}

/* Progress over time */
.history {
  display: grid;
  gap: 14px;
}
.history-headline {
  margin: 0;
}
.history-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.hc-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.hc-label {
  fill: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.hc-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.hc-line--best {
  stroke: var(--best);
}
.hc-line--three {
  stroke: var(--lime);
  stroke-dasharray: 6 5;
}
.hc-dot--best {
  fill: var(--best);
  stroke: var(--bg);
  stroke-width: 2;
}
.hc-dot--three {
  fill: var(--lime);
  stroke: var(--bg);
  stroke-width: 2;
}
.key-best::before {
  background: var(--best);
}
.key-three::before {
  background: repeating-linear-gradient(90deg, var(--lime) 0 5px, transparent 5px 8px);
}
.table-scroll {
  overflow-x: auto;
}
.history-table tr.is-current td {
  font-weight: 700;
}
.history-sections h3 {
  margin: 4px 0 8px;
}
.history-highlights {
  display: grid;
  gap: 8px;
}
.history-highlights .note {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.history-section-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.history-section-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.history-section-list strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.history-first {
  display: grid;
  gap: 8px;
}
.history-first p {
  margin: 0;
}
.record-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}
.record-stats p {
  margin: 0;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.record-stats strong {
  font-size: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.record-stats svg {
  color: var(--attention);
}
.record-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.record-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.record-list li > span {
  display: grid;
  min-width: 0;
}
.record-list .value-best {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

/* Ride mode: readable at arm's length in the paddock, gloves on. */
.recording {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  max-width: 520px;
  margin: 4vh auto 0;
  padding: 28px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.recording p {
  margin: 0;
}
.recording-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slower);
}
.recording-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--slower);
}
@media (prefers-reduced-motion: no-preference) {
  .recording-dot {
    animation: rec-pulse 1.6s ease-in-out infinite;
  }
}
@keyframes rec-pulse {
  50% {
    opacity: 0.35;
  }
}
.recording-time {
  font-size: clamp(3rem, 2rem + 6vw, 4.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.recording-gps {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text-2);
}
.recording-tip {
  color: var(--text-2);
  max-width: 34ch;
}
.recording .button--large {
  width: 100%;
  min-height: 60px;
}
.recording-confirm {
  display: grid;
  gap: 10px;
  width: 100%;
  justify-items: center;
}
.recording-confirm p {
  font-weight: 700;
}
.ride-mode-card .button--large {
  justify-self: start;
}
.share-ride {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  margin: 8px 0 0;
}
.share-ride .link {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.rider-chip {
  justify-self: start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}

/* Garage care
   Engine hours, service reminders, stock settings and setup experiments
   (garage-care.tsx), and the one-line service reminder on Home. */
.garage-bikes {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}
.bike-panel {
  gap: 18px;
}
.bike-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
}
.bike-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bike-title h2 {
  margin: 0;
}
.bike-title p {
  margin: 2px 0 0;
}
.bike-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--lime);
}
.bike-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bike-actions .button {
  min-height: 44px;
  white-space: nowrap;
}
.bike-panel-body {
  display: grid;
  gap: 18px;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}
/* Phones and tablets: the side column dissolves so service comes second. */
.bike-panel-side {
  display: contents;
}
.bike-panel-body .bike-summary { order: 1; }
.bike-panel-body > .service-panel { order: 2; }
.bike-panel-body .setups-panel { order: 3; }
.bike-panel-body .stock-panel { order: 4; }
.bike-panel-body .experiment-panel { order: 5; }
/* Tablets: service full width, setups and stock side by side. */
@media (min-width: 760px) {
  .bike-panel-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  .bike-panel-body .bike-summary,
  .bike-panel-body > .service-panel,
  .bike-panel-body .experiment-panel {
    grid-column: 1 / -1;
  }
}
/* Pit wall: the bike, what's due, setups, stock and experiments on the left;
   the service table on the right. */
@media (min-width: 1180px) {
  .bike-panel-body {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }
  .bike-panel-side {
    display: grid;
    gap: 18px;
    align-content: start;
    min-width: 0;
  }
  .bike-panel-body .bike-summary,
  .bike-panel-body .experiment-panel {
    grid-column: auto;
  }
  .bike-panel-body > .service-panel {
    grid-column: 2;
    grid-row: 1;
  }
}
.care-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.care-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.0625rem;
}
.care-panel .fineprint,
.care-panel .note {
  margin-top: 0;
}
.care-panel .setup-row {
  background: var(--surface);
}
.care-panel .button--small {
  min-height: 44px;
}
.engine-hours-figure {
  margin: 0;
  color: var(--text-2);
}
.engine-hours-figure strong {
  font-size: 1.75rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.engine-hours .fineprint {
  margin-top: 2px;
}
.due-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 190, 61, 0.08);
  border: 1px solid rgba(255, 190, 61, 0.35);
}
.due-summary h3 {
  font-size: 1rem;
  margin: 0;
}
.due-summary h3 svg {
  color: var(--attention);
}
.due-summary ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.due-item--overdue::marker {
  color: var(--danger);
}
/* What we know about the bike's schedule. */
.schedule-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.9375rem;
  max-width: 72ch;
}
.schedule-note > svg {
  flex: none;
  margin-top: 3px;
  color: var(--reference);
}
.schedule-note--ok > svg {
  color: var(--quicker);
}
.schedule-note-body {
  display: grid;
  gap: 10px;
  justify-items: start;
}
.schedule-year {
  min-width: 10rem;
}
.link--inline {
  min-height: 44px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
}
/* One line about missing history, with its button beside it. */
.service-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.service-summary p {
  margin: 0;
  flex: 1 1 18rem;
}
.service-summary .button {
  white-space: nowrap;
}
/* The service table: job · last done · next due · actions. */
.service-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.service-table thead th {
  text-align: left;
  color: var(--text-3);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
}
.service-table td,
.service-table tbody th {
  text-align: left;
  padding: 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
.service-what {
  border-left: 3px solid transparent;
}
.service-job--soon .service-what {
  border-left-color: var(--attention);
}
.service-job--overdue .service-what {
  border-left-color: var(--danger);
}
.service-name {
  display: block;
  font-weight: 650;
}
.service-interval {
  display: block;
  color: var(--text-3);
  font-size: 0.8125rem;
}
.service-next {
  white-space: nowrap;
}
.service-next .service-state {
  margin-right: 6px;
}
.service-state {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}
.service-state--soon {
  background: var(--attention);
  color: #241800;
}
.service-state--overdue {
  background: var(--danger);
  color: #2a0505;
}
[data-theme="light"] .service-state--soon,
[data-theme="light"] .service-state--overdue {
  color: #ffffff;
}
.service-bar {
  display: block;
  margin-top: 6px;
  height: 4px;
  max-width: 9rem;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.service-bar span {
  display: block;
  height: 100%;
  background: var(--quicker);
}
.service-job--soon .service-bar span {
  background: var(--attention);
}
.service-job--overdue .service-bar span {
  background: var(--danger);
}
.service-actions {
  white-space: nowrap;
  text-align: right !important;
}
.service-actions > * {
  vertical-align: middle;
}
.service-actions .button {
  min-height: 44px;
}
.service-undo {
  display: flex;
  min-height: 44px;
}
.service-more {
  display: inline-grid;
  margin-left: 6px;
  background: var(--surface);
}
.service-more svg {
  transition: transform 0.15s;
}
.service-more[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.service-details-row td {
  padding: 0 10px 14px;
  background: transparent;
}
.service-details {
  display: grid;
  gap: 12px 28px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.service-details h4 {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: var(--text-2);
}
.service-details p {
  margin: 0 0 4px;
}
.service-details .fineprint {
  margin: 4px 0;
}
.service-details ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.875rem;
  display: grid;
  gap: 4px;
}
.service-edit {
  display: grid;
  gap: 8px;
  max-width: 22rem;
}
/* Narrow (phones, or big text): each job becomes a small card; labels come
   from the cells. Measured on the panel in rem so large text stacks sooner. */
.service-panel {
  container-type: inline-size;
}
@container (max-width: 40rem) {
  .service-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .service-table,
  .service-table tbody {
    display: block;
  }
  .service-job {
    border-bottom: 1px solid var(--line);
  }
  .service-job > tr:first-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "what actions"
      "last next";
    gap: 4px 12px;
    padding: 10px 0;
  }
  .service-table td,
  .service-table tbody th {
    border: 0;
    padding: 0;
  }
  .service-what {
    grid-area: what;
    padding-left: 8px !important;
    align-self: center;
  }
  .service-last {
    grid-area: last;
    padding-left: 11px !important;
  }
  .service-next {
    grid-area: next;
    white-space: normal;
  }
  .service-actions {
    grid-area: actions;
    align-self: center;
  }
  .service-actions .when-wide {
    display: none;
  }
  .service-last::before,
  .service-next::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    color: var(--text-3);
  }
  .service-details-row {
    display: block;
  }
  .service-details-row td {
    display: block;
    padding: 0 0 12px;
  }
}
/* Very narrow: the actions get their own line. */
@container (max-width: 18rem) {
  .service-job > tr:first-child {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "what" "last" "next" "actions";
  }
}
.experiment-sections summary,
.experiment-log summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.875rem;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.experiment-sections ul,
.experiment-log ul,
.experiment-needed ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.875rem;
  display: grid;
  gap: 4px;
}
.field-help {
  margin-top: 2px;
}
.which-bike-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}
.stock-for {
  margin-top: -4px;
}
.stock-table,
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.stock-table th,
.stock-table td,
.compare-table th,
.compare-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.stock-table thead th,
.compare-table thead th {
  color: var(--text-3);
  font-weight: 600;
  font-size: 0.8125rem;
}
.stock-table tbody th {
  font-weight: 600;
}
.stock-says {
  display: block;
  font-weight: 400;
  color: var(--text-2);
  margin-top: 2px;
}
.stock-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9375rem;
}
.compare-table caption {
  text-align: left;
  color: var(--text-2);
  padding-bottom: 6px;
}
.compare-table td:last-child {
  font-weight: 650;
}
.experiment {
  display: grid;
  gap: 10px;
}
.experiment-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
}
.experiment .muted {
  margin: 0;
}
.experiment .choices {
  margin: 0;
}
.experiment-needed {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 190, 61, 0.08);
  border: 1px solid rgba(255, 190, 61, 0.3);
}
.experiment-needed p {
  margin: 0;
}
.experiment-needed .fineprint {
  margin-top: 8px;
}
.experiment-result {
  overflow-x: auto;
}
.verdict {
  border: 0;
  margin: 0;
  padding: 0;
}
.verdict legend {
  font-weight: 650;
  margin-bottom: 6px;
  padding: 0;
}
.care-nudge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 190, 61, 0.08);
  border: 1px solid rgba(255, 190, 61, 0.35);
}
.care-nudge > svg {
  flex: none;
  color: var(--attention);
}
.care-nudge > span {
  flex: 1;
  min-width: 0;
}
.care-nudge--overdue {
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.4);
}
.care-nudge--overdue > svg:first-child {
  color: var(--danger);
}
.care-nudge:hover {
  border-color: var(--attention);
}
/* Garage care on phones: less nesting padding so the content keeps its width. */
@media (max-width: 640px) {
  .bike-panel {
    padding: 14px;
  }
  .care-panel {
    padding: 12px;
  }
  .compare-table th,
  .compare-table td {
    padding: 6px 4px;
  }
}

/* ---------- Replay upgrades: turns you can tap, plates, mini-sectors ---------- */
:root {
  --sector-yellow: #ffd23f;
  --pb-ghost: #ffffff;
}
.map-marker.is-button {
  cursor: pointer;
}
.map-marker-hit {
  fill: transparent;
  stroke: none;
}
.map-marker.is-button:hover > circle:not(.map-marker-hit),
.map-marker.is-button:focus-visible > circle:not(.map-marker-hit) {
  stroke: var(--lime);
}
.map-marker.is-button:focus {
  outline: none;
}
.map-plate rect {
  stroke: #0a100c;
}
.map-plate text {
  font-weight: 900;
  font-family: var(--font);
  letter-spacing: -0.02em;
  pointer-events: none;
}
.marker-focus > circle:not(.map-marker-hit) {
  stroke: #fff;
  animation: focus-pulse 1.1s ease-in-out infinite;
}
@keyframes focus-pulse {
  50% {
    stroke-width: calc(var(--s) * 7);
  }
}
@media (prefers-reduced-motion: reduce) {
  .marker-focus > circle:not(.map-marker-hit) {
    animation: none;
    stroke-width: calc(var(--s) * 5);
  }
}
.route-sector--purple .map-line {
  stroke: var(--best);
}
.route-sector--green .map-line {
  stroke: var(--quicker);
}
.route-sector--yellow .map-line {
  stroke: var(--sector-yellow);
}
.key-purple::before {
  background: var(--best);
}
.key-yellow::before {
  background: var(--sector-yellow);
}
.key-pb::before {
  background: repeating-linear-gradient(
    90deg,
    var(--pb-ghost) 0 5px,
    transparent 5px 8px
  );
}
.marker-pb circle {
  fill: rgba(255, 255, 255, 0.35);
  stroke: var(--pb-ghost);
  stroke-dasharray: calc(var(--s) * 3) calc(var(--s) * 2);
}
.marker-pack circle {
  fill: rgba(255, 255, 255, 0.45);
  stroke: none;
  filter: none;
}
.route-pack .map-line {
  stroke: rgba(255, 255, 255, 0.28);
}
.race-stage {
  position: relative;
}
.race .race-callout {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 138, 92, 0.14);
  border: 1px solid rgba(255, 138, 92, 0.5);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.3;
}
.replay-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.replay-options .segmented button {
  min-height: 40px;
}
.chip-toggle--plain {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.plate-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 22px;
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.8125rem;
  line-height: 1;
  border: 1.5px solid #0a100c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.plate-badge--dot {
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  background: var(--lime);
}
.plate-colours {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.plate-colours legend {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 6px;
}
.plate-colour {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}
.plate-colour:has(input:checked) {
  border-color: var(--lime);
}
.plate-colour input {
  accent-color: var(--lime);
}
.marker-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}
.race-hr {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 10px;
  color: #ff6b8a;
}
.race-hr-strip {
  position: relative;
  height: 56px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.race-hr-strip > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.race-hr-line {
  fill: none;
  stroke: #ff6b8a;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.race-hr-strip .race-strip-label {
  left: 8px;
  right: auto;
  top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.route-line-ahead .map-line {
  opacity: 0.22;
}
.route-line-ahead--a .map-line {
  stroke: var(--lime);
}
.route-line-ahead--b .map-line {
  stroke: var(--reference);
}
.route-trail .map-line {
}
@media (max-width: 759px) {
  .race .race-callout {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 0.8125rem;
  }
}
.race-hr-strip .race-strip-label {
  text-transform: none;
  letter-spacing: 0;
}
.laps-map {
  scroll-margin-top: calc(68px + env(safe-area-inset-top));
}

/* ---------- Sharing: the share sheet and the ride report page ---------- */
.share-option {
  justify-content: flex-start;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
}
.share-option > span:last-child {
  display: grid;
  gap: 4px;
}
.share-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--lime);
}
/* The share sheet: the picture first, then one clear Share button, then the
   whole-ride options. It sits on top of everything, tab bar included. */
.share-backdrop {
  z-index: 155;
}
.share-sheet {
  width: min(900px, 100%);
  gap: 16px;
}
.share-body {
  display: grid;
  gap: 18px;
}
.share-preview {
  margin: 0;
  display: grid;
  justify-items: center;
}
.share-preview img,
.share-preview-wait {
  display: block;
  max-width: 100%;
  max-height: min(40vh, 520px);
  width: auto;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.share-preview-wait {
  aspect-ratio: 1080 / 1350;
  height: min(40vh, 520px);
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  background: var(--surface-2);
  color: var(--text-2);
}
.share-actions {
  display: grid;
  gap: 12px;
  align-content: start;
}
.share-main {
  display: grid;
  gap: 6px;
}
.share-primary {
  width: 100%;
}
.share-explain {
  margin: 0;
}
.share-more {
  margin: 8px 0 0;
  font-size: 1rem;
}
@media (min-width: 760px) {
  .share-body {
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    align-items: start;
  }
  .share-preview img,
  .share-preview-wait {
    max-height: min(68vh, 475px);
  }
  .share-preview-wait {
    height: min(68vh, 475px);
  }
}

/* A short confirmation after sharing or saving, above sheets and the tab bar. */
.toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 170;
  width: min(520px, calc(100% - 32px));
  display: grid;
  pointer-events: none;
}
@media (min-width: 760px) {
  .toast-host {
    bottom: 32px;
  }
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-weight: 600;
  transition: opacity 0.25s;
}
.toast svg {
  flex: none;
  color: var(--quicker);
}
.toast--problem {
  border-color: var(--danger);
}
.toast--out {
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .toast {
    animation: toast-in 0.2s ease-out;
  }
  @keyframes toast-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}
.report-body {
  margin: 0;
}
.report {
  max-width: 980px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) 40px;
  display: grid;
  gap: 18px;
}
.report-head h1 {
  margin: 4px 0 2px;
}
.report-brand {
  margin: 0;
  color: var(--lime);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.report-stat {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.report-stat span {
  font-size: 0.8125rem;
  color: var(--text-3);
}
.report-stat strong {
  font-size: 1.625rem;
  font-variant-numeric: tabular-nums;
}
.report-stat--best {
  border-color: rgba(195, 139, 255, 0.5);
}
.report-stat--best strong {
  font-size: 2.25rem;
}
.report-work {
  border-color: rgba(255, 138, 92, 0.5);
}
.report-work h2 {
  margin: 2px 0 6px;
}
.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.report-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.report-foot p {
  margin: 0 0 6px;
}
.opened-file {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 160;
  width: min(520px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px solid var(--lime);
  font-weight: 600;
}
.opened-file--bad {
  border-color: var(--danger);
}

/* ---------- Rewards: level, records, challenges, badges, sticker book ---------- */
.level-card {
  display: flex;
  gap: 16px 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.level-plate {
  flex: none;
  width: 112px;
  height: 88px;
  border-radius: 14px;
  border: 3px solid #0a100c;
  border-top: 14px solid;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.level-plate--empty {
  background: var(--surface-2);
  color: var(--text-2);
  border: 2px dashed var(--line-strong);
  border-top: 14px solid;
  box-shadow: none;
  cursor: pointer;
  align-content: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.level-plate--empty svg {
  margin: 0 auto;
}
.level-plate-link {
  justify-self: start;
  min-height: 44px;
}
.level-plate-number {
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.level-plate-level {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.75;
}
.level-text {
  flex: 1 1 200px;
  display: grid;
  gap: 6px;
}
.level-text h2 {
  margin: 0;
}
.level-bar {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.level-bar > span {
  display: block;
  height: 100%;
  background: var(--lime);
  border-radius: 99px;
}
.records-table {
  table-layout: fixed;
  max-width: 40rem;
}
.records-table th[scope="row"] {
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding: 8px 4px;
}
.records-table th,
.records-table td {
  white-space: nowrap;
}
.records-table th[scope="row"] {
  white-space: normal;
}
/* The same columns in both tables, so turns line up under sections. */
.records-table .rt-num {
  width: 5.5rem;
}
.records-table .rt-date {
  width: 7.5rem;
}
@media (max-width: 480px) {
  .records-table .rt-num {
    width: 4.25rem;
  }
  .records-table .rt-date {
    width: 4.6rem;
  }
  .records-table {
    font-size: 0.8125rem;
  }
}
.records-table tr.is-new th {
  font-weight: 700;
}
.records-card .pill {
  margin-left: 6px;
}
.time-field {
  border: 0;
  margin: 0;
  padding: 0;
}
.time-field legend {
  padding: 0;
  margin-bottom: 4px;
}
.time-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 700 1.25rem/1 var(--num);
}
.time-inputs input {
  width: 3.5rem;
  text-align: center;
  font-family: var(--num);
}
.time-inputs label:last-of-type input {
  width: 5rem;
}
.time-inputs .muted {
  font: 500 0.8125rem/1 var(--font);
  margin-left: 4px;
}
.card-action {
  justify-self: start;
}
.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 800;
  vertical-align: middle;
}
.pill--best {
  background: var(--best);
  color: var(--best-ink);
}
.challenge-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.challenge-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.challenge-list li > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.challenge-list li.is-done {
  border-color: var(--quicker);
}
.challenge-form {
  display: grid;
  gap: 10px;
}
.badge-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 8px;
}
.badge-grid li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.875rem;
}
.badge-text {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.badge-text .level-bar {
  height: 6px;
  margin-top: 3px;
}
.badge-grid li.is-earned {
  border-color: var(--best);
  background: color-mix(in srgb, var(--best) 10%, var(--surface-2));
}
.badge-art {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-3);
}
.badge-grid li.is-earned .badge-art {
  background: var(--best);
  color: var(--best-ink);
}
.badge-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.badge-chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 99px;
  border: 1px solid var(--best);
  background: color-mix(in srgb, var(--best) 10%, var(--surface-2));
  font-size: 0.875rem;
}
.badge-chips .badge-art {
  width: 28px;
  height: 28px;
  background: var(--best);
  color: var(--best-ink);
}
.badges-more {
  justify-self: start;
  min-height: 44px;
}
.sticker-book .badge-grid li {
  border-radius: 22px;
  border-style: dashed;
}
.sticker-book .badge-grid li.is-earned {
  border-style: solid;
  transform: rotate(-1.5deg);
}
.sticker-book .badge-grid li.is-earned:nth-child(2n) {
  transform: rotate(1.5deg);
}
.sticker-book .badge-art {
  width: 52px;
  height: 52px;
}
@media (prefers-reduced-motion: reduce) {
  .sticker-book .badge-grid li.is-earned {
    transform: none;
  }
}


/* ---------- Settings ---------- */
.settings-sheet {
  width: min(560px, 100%);
  align-content: start;
}
.settings-head h2 {
  font-size: 1.375rem;
}
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.settings-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.settings-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}
.settings-row:hover {
  border-color: var(--line-strong);
}
.settings-row[aria-current="true"] {
  border-color: var(--lime);
  box-shadow: inset 3px 0 0 var(--lime);
}
.settings-row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--lime);
}
.settings-row-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.settings-row-text .muted {
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.settings-group {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}
.settings-group > h2:focus {
  outline: none;
}
.settings-group h3 {
  margin-top: 10px;
}
.settings-group .card {
  margin: 0;
}
.settings-cards {
  display: grid;
  gap: 12px;
}
.setting-choice {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.toggle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}
.toggle-row .recorder-text {
  flex: 1;
  min-width: 0;
}
.toggle-row input[role="switch"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 3.1rem;
  height: 1.85rem;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background 0.15s;
}
.toggle-row input[role="switch"]::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.15s;
}
.toggle-row input[role="switch"]:checked {
  background: var(--lime);
  border-color: var(--lime);
}
.toggle-row input[role="switch"]:checked::after {
  transform: translateX(1.25rem);
  background: var(--lime-ink);
}
.palette-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch {
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid currentColor;
}
.swatch--quicker {
  color: var(--quicker);
}
.swatch--slower {
  color: var(--slower);
}
.swatch--best {
  color: var(--best);
}
.how-list,
.plain-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 6px;
}
.policy {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}
@media (min-width: 900px) {
  .settings-sheet {
    width: min(1040px, 100%);
    height: min(820px, calc(100vh - 32px));
  }
  .settings-body {
    grid-template-columns: minmax(240px, 300px) 1fr;
    gap: 28px;
    min-height: 0;
  }
  .settings-nav {
    position: sticky;
    top: 0;
    align-self: start;
  }
  .settings-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

/* ---------- Bright theme: black on white for sunshine ---------- */
:root[data-theme="light"] {
  /* A timing screen, not a bank: grey ground, white panels, hard rules. */
  --bg: #eff1eb;
  --surface: #ffffff;
  --surface-2: #f1f3ee;
  --surface-3: #e2e7dc;
  --line: #c9d1c4;
  --line-strong: #8f9b8c;
  --text: #0a0f0b;
  --text-2: #273129;
  --text-3: #4c584e;
  --lime: #3b6e00;
  --lime-ink: #ffffff;
  --quicker: #00784a;
  --slower: #b84300;
  --same: #4a554d;
  --reference: #1456c8;
  --best: #7a2fd0;
  --best-ink: #ffffff;
  --attention: #8a5a00;
  --danger: #c0262d;
  color-scheme: light;
}
[data-theme="light"] .topbar {
  background: var(--surface);
}
[data-theme="light"] .sheet-backdrop {
  background: rgba(10, 16, 12, 0.45);
}
[data-theme="light"] .stat-row--hero > div,
[data-theme="light"] .hero--first .record-steps li {
  background: rgba(255, 255, 255, 0.85);
}
[data-theme="light"] .timeline-spark path,
[data-theme="light"] .race-zero {
  stroke: rgba(10, 16, 12, 0.35);
}
[data-theme="light"] .race-line--all,
[data-theme="light"] .trace-mark {
  stroke: rgba(10, 16, 12, 0.18);
}
[data-theme="light"] .dchart-cursor {
  stroke: rgba(10, 16, 12, 0.7);
}
[data-theme="light"] .trace-hover {
  border-left-color: rgba(10, 16, 12, 0.6);
}
[data-theme="light"] .split,
[data-theme="light"] .pace-chart .is-hover .hit,
[data-theme="light"] .dchart-corner,
[data-theme="light"] .timeline-block.kind-other.status-to-check {
  background: rgba(10, 16, 12, 0.05);
  fill: rgba(10, 16, 12, 0.05);
}
[data-theme="light"] .page--day.is-checking .check-body {
  box-shadow: 0 -12px 28px rgba(10, 16, 12, 0.18);
}
/* The picture itself stays dark in the bright theme: lines and the aerial
   photo read best on it, as on a TV timing screen. Controls and legends
   under the picture follow the page's theme. */
[data-theme="light"] .map-canvas,
[data-theme="light"] .hero-replay {
  --surface: #111a14;
  --surface-2: #17231b;
  --surface-3: #1f2e24;
  --line: #27382c;
  --line-strong: #3a5040;
  --text: #f1f3ec;
  --text-2: #b9c4b9;
  --text-3: #8a978c;
  --lime: #c8f24a;
  --lime-ink: #142006;
  --quicker: #3fdc9a;
  --slower: #ff8a5c;
  --same: #c4ccc6;
  --reference: #6fb9ff;
  --best: #c38bff;
  --best-ink: #1d0b33;
  --attention: #ffbe3d;
  color: var(--text);
  color-scheme: dark;
}
[data-theme="light"] .hero-replay {
  background: #0d150f;
  border-radius: var(--radius);
}

/* ---------- Colour-blind safe timing colours ---------- */
:root[data-palette="colour-blind"],
[data-palette="colour-blind"] .map,
[data-palette="colour-blind"] .hero-replay {
  --quicker: #5aa9ff;
  --slower: #ff9f40;
  --best: #f28ad9;
  --reference: #d9d9d9;
}
:root[data-theme="light"][data-palette="colour-blind"] {
  --quicker: #0b5fc2;
  --slower: #b04a00;
  --best: #b0278f;
  --reference: #3d3d3d;
}
[data-theme="light"] .tab-badge {
  color: #ffffff;
}
[data-theme="light"] .icon-button:not(.icon-button--solid) {
  background: var(--surface);
}
/* The largest text sizes: rows keep their words inside the screen. */
.settings-row-text strong {
  overflow-wrap: anywhere;
}
.settings-row-icon {
  width: min(2.25rem, 40px);
  height: min(2.25rem, 40px);
}
@media (max-width: 899px) {
  .sheet-backdrop:has(.settings-sheet) {
    padding: 0;
    place-items: stretch;
  }
  .settings-sheet {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    padding: max(16px, env(safe-area-inset-top)) 16px
      max(24px, env(safe-area-inset-bottom));
  }
}
.settings-group > .link,
.settings-group .confirm + .link {
  justify-self: start;
}
.map.map--compact {
  height: clamp(220px, 34vh, 340px);
}
.mapped-card {
  display: grid;
  gap: 12px;
  border-color: var(--lime);
}
.mapped-card h2 svg {
  vertical-align: -2px;
  color: var(--lime);
}
.mapped-remap {
  justify-self: start;
}
.map--compact .map-tools {
  display: none;
}
.map--compact svg {
  cursor: default;
}

/* Replay legend: the same marks as on the map. */
.key-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #0a100c;
  flex: none;
}
.mark--you {
  background: var(--lime);
}
.mark--ref {
  background: var(--reference);
}
.mark--third {
  background: #ff7fc8;
}
.mark--pb {
  background: rgba(255, 255, 255, 0.35);
  border: 2px dashed #fff;
}
.mark--pack {
  background: rgba(255, 255, 255, 0.45);
  border-color: transparent;
}
.map-legend .key-mark .plate-badge {
  min-width: 26px;
  height: 18px;
  font-size: 0.75rem;
}

/* Service history when a bike is added */
.history-form {
  display: grid;
  gap: 14px;
  max-width: 920px;
}
.history-form > .muted {
  margin: 0;
  max-width: 68ch;
}
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--line);
}
.history-list li {
  display: grid;
  gap: 8px 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
@media (min-width: 700px) {
  .history-list li {
    grid-template-columns: minmax(10rem, 1fr) auto;
  }
}
.history-what {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
}
.history-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.history-list .segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 22rem);
}
.history-list .segmented button {
  padding-inline: 6px;
  white-space: nowrap;
  min-height: 44px;
}
/* "Not sure" is an answer, not a highlight. */
.history-list .segmented button.segmented-neutral[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.history-hours {
  white-space: nowrap;
  grid-template-columns: auto 6.5rem;
  align-items: center;
  gap: 8px;
}
@media (min-width: 700px) {
  /* A fixed slot for the hours box, so the choices line up row to row. */
  .history-answer {
    display: grid;
    grid-template-columns: 22rem 15rem;
  }
  .history-list .segmented {
    width: 100%;
  }
}

/* Garage page: forms keep a readable width; the empty garage explains itself. */
.garage-edit {
  scroll-margin-top: 80px;
}
.garage-edit .garage-form {
  max-width: 760px;
}
.garage-empty {
  display: grid;
  gap: 24px 48px;
  padding: 24px;
  align-items: center;
}
@media (min-width: 900px) {
  .garage-empty {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    padding: 48px;
  }
}
.garage-empty-lead {
  display: grid;
  gap: 12px;
  justify-items: start;
}
.garage-empty-lead h2,
.garage-empty-lead p {
  margin: 0;
}
.garage-empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--lime);
}
.garage-empty-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.garage-empty-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.garage-empty-points svg {
  flex: none;
  margin-top: 2px;
  color: var(--lime);
}

/* Story: the day on one strip, with a title and what it shows. */
.day-glance {
  display: grid;
  gap: 8px;
}
.day-glance h2 {
  margin: 0;
}
.day-glance p {
  margin: 0;
  max-width: 70ch;
}

/* Straights and the start/finish line on replays */
.marker-straight > circle:not(.map-marker-hit) {
  fill: rgba(10, 16, 12, 0.85);
  stroke: rgba(255, 255, 255, 0.75);
}
.marker-straight.marker-callout.tone-slower > circle:not(.map-marker-hit) {
  fill: var(--slower);
}
.marker-straight.marker-callout.tone-quicker > circle:not(.map-marker-hit) {
  fill: var(--quicker);
}
.marker-sf > circle:not(.map-marker-hit) {
  fill: #fff;
  stroke: #0a100c;
}
.marker-sf text {
  fill: #0a100c;
  letter-spacing: -0.04em;
}
.route-sf .map-line {
  stroke: #fff;
  stroke-linecap: butt;
  stroke-dasharray: calc(var(--s) * 3) calc(var(--s) * 3);
  stroke-width: calc(var(--s) * 7);
}

/* Moving maps: no SVG filters (they repaint every frame); edges come from strokes. */
.marker-dot circle {
  stroke-width: calc(var(--s) * 3);
}
.marker-rider.marker-dot circle {
  stroke: #0a100c;
}

/* ---------- Debrief components (replay session) ---------- */
.map-hud {
  position: absolute;
  left: 10px;
  right: 64px;
  bottom: 34px;
  pointer-events: none;
  z-index: 2;
}
.hud-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}
.hud-chip {
  font: 600 0.8125rem/1 var(--num);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(10, 16, 12, 0.86);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 8px;
  white-space: nowrap;
}
.hud-chip b {
  font-size: 1rem;
  font-weight: 700;
}
.hud-chip--slower {
  color: var(--slower);
  border-color: rgba(255, 138, 92, 0.6);
}
.hud-chip--quicker {
  color: var(--quicker);
  border-color: rgba(63, 220, 154, 0.6);
}
.hud-chip--hr {
  color: #ff6b8a;
}
.hud-callout {
  flex-basis: 100%;
  font: 700 0.8125rem/1.3 var(--font);
  background: rgba(10, 16, 12, 0.92);
  border: 1px solid rgba(255, 138, 92, 0.6);
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 34ch;
}
.timing-board {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.tb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tb-title {
  margin: 0;
  font: 700 0.75rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.tb-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
.tb {
  border-collapse: separate;
  border-spacing: 2px;
  font: 600 0.8125rem/1 var(--num);
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.tb th {
  font: 600 0.6875rem/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 6px 4px;
  text-align: center;
  white-space: nowrap;
}
.tb tbody th,
.tb tfoot th {
  position: sticky;
  left: 0;
  background: var(--bg);
  z-index: 1;
  text-align: left;
  padding-inline: 8px;
}
.tb td {
  padding: 0;
  text-align: center;
  border-radius: 4px;
}
.tb td button {
  width: 100%;
  min-width: 44px;
  min-height: 34px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.tb td button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 1px;
}
.tb td i {
  font-style: normal;
  font-size: 0.625rem;
}
.tb-usual,
.tb-none {
  background: var(--surface-2);
  color: var(--text-2);
}
.tb-best {
  background: var(--best);
  color: var(--best-ink);
}
.tb-better {
  background: var(--quicker);
  /* Dark on the bright green of the dark theme, white on the deep green of
     the bright theme. */
  color: var(--bg);
}
[data-theme="light"] .tb-better {
  color: #ffffff;
}
.tb-slower {
  background: rgba(255, 190, 61, 0.16);
  color: var(--attention);
}
.tb tr.is-yours th {
  color: var(--lime);
}
.tb tr.is-yours td {
  box-shadow: inset 0 2px 0 var(--lime), inset 0 -2px 0 var(--lime);
}
.tb-lapcol {
  min-width: 70px;
}
/* Sectors fit the width with sensible columns: a narrow lap name, equal
   section columns, a slightly wider lap time; never stretched past reading. */
.tb--sectors {
  table-layout: fixed;
}
.timing-board:has(.tb--sectors) {
  max-width: 52rem;
}
.tb--sectors .tb-lapname {
  width: 3rem;
}
.tb--sectors thead .tb-lapcol {
  width: 5.25rem;
}
@media (min-width: 700px) {
  .tb--sectors .tb-lapname {
    width: 4rem;
  }
  .tb--sectors thead .tb-lapcol {
    width: 6.5rem;
  }
}
.tb abbr {
  text-decoration: none;
}
.tb tfoot td {
  color: var(--text-3);
  padding: 6px 4px;
}
.tb tfoot .tb-band th,
.tb tfoot .tb-band td {
  padding-top: 0;
  font-size: 0.6875rem;
  font-weight: 500;
}
.tb-untimed td {
  padding: 0 10px;
  height: 34px;
  text-align: left;
  font: 500 0.75rem/1.2 var(--font);
  color: var(--text-3);
  border: 1px dashed var(--line);
}
.tb-untimed th {
  color: var(--text-3);
}
.tb-blank {
  color: var(--text-3);
}
.tb-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.tb-key .tb-best,
.tb-key .tb-better,
.tb-key .tb-slower {
  background: none;
  font-weight: 700;
}
.tb-key .tb-best {
  color: var(--best);
}
.tb-key .tb-better {
  color: var(--quicker);
}
.delta-trace {
  margin: 0;
  display: grid;
  gap: 6px;
}
.delta-trace figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}
.delta-trace b {
  font-family: var(--num);
}
.delta-trace svg {
  width: 100%;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: crosshair;
  touch-action: pan-y;
}
.dt-noise {
  fill: rgba(255, 255, 255, 0.06);
}
.dt-grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.dt-zero {
  stroke: var(--text-3);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.dt-section {
  stroke: var(--line-strong);
  stroke-dasharray: 3 4;
  vector-effect: non-scaling-stroke;
}
.dt-tick {
  font: 600 11px var(--num);
  fill: var(--text-3);
}
.dt-line {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.6;
}
.dt-area--behind {
  fill: rgba(255, 138, 92, 0.35);
}
.dt-area--ahead {
  fill: rgba(63, 220, 154, 0.35);
}
.dt-cursor {
  stroke: var(--lime);
  stroke-width: 2;
}
.moto-card {
  position: relative;
  aspect-ratio: 3 / 4.2;
  max-width: 300px;
  width: 100%;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: #f1f3ec;
  border: 1px solid;
  isolation: isolate;
}
.moto-card--pb {
  background: linear-gradient(160deg, #3b1d66 0%, #1d0b33 55%, #0a100c 100%);
  border-color: #c38bff;
  box-shadow: 0 0 30px rgba(195, 139, 255, 0.2);
}
.moto-card--improved {
  background: linear-gradient(160deg, #0f4a32 0%, #0a2419 55%, #0a100c 100%);
  border-color: #3fdc9a;
}
.moto-card--worked {
  background: linear-gradient(160deg, #5a4210 0%, #2a1f08 55%, #0a100c 100%);
  border-color: #ffbe3d;
}
/* The holo sheen on a personal best (still under reduced motion). */
.moto-card--pb::after {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
  animation: holo 5s ease-in-out infinite;
}
@keyframes holo {
  0%,
  100% {
    transform: translateX(-30%);
  }
  50% {
    transform: translateX(30%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .moto-card--pb::after {
    animation: none;
  }
}
.mc-top,
.mc-foot {
  display: grid;
  gap: 4px;
  font: 600 0.6875rem/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mc-rarity {
  color: #c38bff;
}
.moto-card--improved .mc-rarity {
  color: #3fdc9a;
}
.moto-card--worked .mc-rarity {
  color: #ffbe3d;
}
.mc-where {
  color: #b9c4b9;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8125rem;
}
.mc-mid {
  display: grid;
  gap: 8px;
}
.mc-big {
  font: 800 clamp(2.4rem, 9vw, 3.2rem)/0.95 var(--font);
  font-variant-numeric: tabular-nums;
}
.mc-beat {
  font: 600 0.8125rem/1.35 var(--mono);
  color: #c38bff;
}
.moto-card--improved .mc-beat {
  color: #3fdc9a;
}
.moto-card--worked .mc-beat {
  color: #ffbe3d;
}
.mc-foot {
  color: var(--lime);
  grid-auto-flow: column;
  justify-content: space-between;
}
.new-cards {
  display: grid;
  gap: 16px;
}
.new-card {
  display: grid;
  gap: 12px;
  justify-items: start;
}
.new-card-head {
  margin: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
  color: var(--best);
}
.binder-season h3 {
  margin: 4px 0 10px;
}
.binder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 12px;
}
.binder-grid .moto-card {
  max-width: none;
}
.season-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(40%, 6.5rem), 1fr));
  gap: 8px;
  margin: 4px 0 4px;
}
.season-stats p {
  margin: 0;
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.season-stats b {
  font: 700 1.5rem/1 var(--num);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.season-stats b svg {
  color: var(--attention);
}
/* Zeros are facts, not wins: quiet, never coloured. */
.season-stats .is-zero b {
  color: var(--text-3);
  font-weight: 500;
}
.season-stats span {
  font: 600 0.6875rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.season-pb b {
  color: var(--best);
}
.season-cards b {
  color: var(--quicker);
}
.season-tracks {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.season-tracks li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.season-tracks li > span {
  display: grid;
  min-width: 0;
}
.season-tracks li.is-current strong {
  color: var(--lime);
}
.season-tracks b {
  font-family: var(--num);
}
.season-moment {
  margin: 0;
}
.season-share {
  justify-self: start;
}

/* ---------- Shell: debrief + pit wall ---------- */
/* Data labels: small uppercase mono, on data only. */
.data-label,
.data-heading {
  font: 600 0.75rem/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lime);
  margin: 0;
}
.data-heading {
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.value-gain {
  color: var(--quicker);
}
.page--debrief {
  display: grid;
  gap: 16px;
}
.debrief-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.debrief-head h1 {
  margin-top: 4px;
}
.debrief-sub {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.moto-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.moto-chips a {
  flex: none;
  font: 600 0.875rem/1 var(--mono);
  padding: 9px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
}
.moto-chips a[aria-current="page"] {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}
/* The four numbers: same order, always. */
.kpi-strip {
  list-style: none;
  padding: 0;
  display: grid;
  /* Two by two; one column at the largest text sizes (the width is in rem). */
  grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.kpi {
  background: var(--surface);
  min-width: 0;
}
.kpi-label,
.kpi-value {
  display: block;
}
.kpi,
.kpi-button {
  padding: 10px 10px 12px;
}
.kpi:has(.kpi-button) {
  padding: 0;
}
.kpi-button {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.kpi-button:hover {
  background: var(--surface-2);
}
.kpi .kpi-label {
  font: 600 0.6875rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.kpi .kpi-value {
  font: 600 1.5rem / 1.1 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-key {
  margin-top: 6px;
}
/* Where the time went: chip · action and evidence · seconds. */
.where-rows {
  container-type: inline-size;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.where-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}
.where-row:hover {
  border-color: var(--line-strong);
}
.where-chip {
  font: 700 0.8125rem/1 var(--mono);
  padding: 7px 8px;
  border-radius: 7px;
  background: var(--surface-3);
  min-width: 2.6em;
  text-align: center;
}
.where-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.where-text .muted {
  font-size: 0.875rem;
}
.where-loss {
  font: 600 1.125rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--slower);
}
/* Plan → proof */
.pw-plan {
  border-color: var(--lime);
  display: grid;
  gap: 8px;
  align-content: start;
}
.plan-where {
  font-weight: 650;
}
.plan-action {
  color: var(--text-2);
}
.plan-result {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}
.plan-result svg {
  flex: none;
  margin-top: 3px;
}
.plan-result--worked {
  color: var(--quicker);
}
.plan-result--not-yet {
  color: var(--attention);
}
.plan-result--too-few,
.plan-result--inconclusive {
  color: var(--text-2);
}
.pw-plan .link {
  justify-self: start;
}
.pw-where,
.pw-kpis {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.pw-replay {
  min-width: 0;
}
.debrief-more {
  display: grid;
  gap: 16px;
}
.debrief-links {
  display: block;
}
.debrief-extra {
  display: grid;
  gap: 16px;
  align-items: start;
}
/* Phone: one column in the debrief's fixed order. */
.pitwall {
  display: grid;
  gap: 16px;
  grid-template-areas: "kpis" "replay" "trace" "where" "board" "plan";
}
.pw-kpis {
  grid-area: kpis;
}
.pw-replay {
  grid-area: replay;
}
.pw-where {
  grid-area: where;
}
.pw-board {
  grid-area: board;
  min-width: 0;
}
.pw-trace {
  grid-area: trace;
  min-width: 0;
}
.pw-plan {
  grid-area: plan;
}
.pw-side {
  display: contents;
}
.kpi-approx {
  font-size: 0.7em;
  margin-right: 1px;
  vertical-align: 0.12em;
  opacity: 0.85;
}
/* Widescreen pit wall: replay left, numbers, actions and plan right, board beneath. */
@media (min-width: 1024px) {
  .pitwall {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
    /* Reading order matches the page: numbers, replay, trace, where, board, plan. */
    grid-template-areas:
      "replay kpis"
      "replay where"
      "trace where"
      "board plan";
    grid-template-rows: auto auto 1fr auto;
    align-items: start;
  }
  .pitwall .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pitwall .kpi .kpi-value {
    font-size: 1.75rem;
  }
  .pw-side {
    grid-area: side;
    display: grid;
    gap: 16px;
    min-width: 0;
  }
  .pw-side > * {
    grid-area: auto;
  }
  .pw-side .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pw-side .kpi .kpi-value {
    font-size: 1.75rem;
  }
  .debrief-extra {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Garage badge: services due, never above the ride. */
.topnav a {
  position: relative;
}
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.4em;
  min-height: 1.4em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--attention);
  color: #241a00;
  font: 700 min(0.75rem, 16px) / 1 var(--mono);
}
[data-theme="light"] .nav-badge {
  color: #ffffff;
}
/* Paddock */
.paddock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.paddock-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.paddock-list li > span {
  display: grid;
  gap: 4px;
}
.paddock-list svg {
  flex: none;
  color: var(--lime);
  margin-top: 3px;
}
.page--paddock {
  display: grid;
  gap: 16px;
}

/* Bright theme: the numbers read like a timing board. */
[data-theme="light"] .kpi-strip {
  background: var(--line-strong);
  border-color: var(--line-strong);
}
[data-theme="light"] .data-heading,
[data-theme="light"] .kpi .kpi-label {
  color: var(--text-2);
}
[data-theme="light"] .where-row {
  background: var(--surface);
}
.kpi-help summary {
  cursor: pointer;
  color: var(--text-3);
  font-size: 0.875rem;
  width: fit-content;
}
.kpi-help p {
  margin-top: 6px;
}

/* Very large text: the corner and seconds sit above the words. */
@container (max-width: 16rem) {
  .where-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "chip loss go" "text text text";
  }
  .where-chip {
    grid-area: chip;
    justify-self: start;
  }
  .where-loss {
    grid-area: loss;
    justify-self: end;
  }
  .where-row > svg {
    grid-area: go;
  }
  .where-text {
    grid-area: text;
  }
}

/* ---------- Debrief: visual evaluation fixes ---------- */
.debrief-head .share-ride {
  margin: 0;
}
.debrief-head .share-ride .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}
.rq-slim {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--attention);
  background: var(--surface);
}
.rq-slim p {
  flex: 1 1 100%;
  margin: 0;
}
.button--small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.9375rem;
}
.kpi-help summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  list-style: none;
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.kpi-help summary::-webkit-details-marker {
  display: none;
}
.debrief-links ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.debrief-links li + li {
  border-top: 1px solid var(--line);
}
.debrief-links a {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title go" "sub go";
  gap: 2px 12px;
  align-items: center;
  padding: 12px 0;
  min-height: 56px;
  text-decoration: none;
}
.debrief-links a > span:first-child {
  grid-area: title;
  font-weight: 650;
}
.debrief-links a > .muted {
  grid-area: sub;
  font-size: 0.875rem;
}
.debrief-links a > svg {
  grid-area: go;
  color: var(--text-3);
}
/* Moto name above its time, never broken across lines. */
.pace-row {
  grid-template-columns: 6.5rem minmax(0, 1fr) auto 16px;
}
.pace-label {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.pace-label strong {
  white-space: nowrap;
}

/* ---------- Visual evaluation, wave A ---------- */
/* Back never shifts the logo and tabs on wide screens: it sits at the end. */
@media (min-width: 760px) {
  .topbar.has-back .back-button {
    order: 3;
    margin-left: auto;
  }
  .topbar.has-back .topbar-end {
    margin-left: 0;
    order: 4;
  }
}
/* Icons grow with the text beside them. */
.guardian-list svg,
.settings-row-icon svg,
.debrief-links svg,
.where-row > svg {
  width: 1em;
  height: 1em;
}
.sheet-head .icon-button {
  width: max(44px, 2.75rem);
  height: max(44px, 2.75rem);
}
.text-pretty,
.lede,
.muted,
.fineprint,
.recorder-option .muted {
  text-wrap: pretty;
}

.page--paddock {
  max-width: 880px;
}
.pw-replay-title {
  margin: 0 0 8px;
  line-height: 1.5;
}
.pw-replay-title a {
  color: var(--lime);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font, inherit);
  white-space: nowrap;
}

/* Welcome: the main button is always in reach on a phone. */
@media (max-width: 759px) {
  .intro-visual .hero-replay > svg {
    max-height: 34svh;
    width: 100%;
  }
  .intro-copy {
    padding-bottom: 150px;
  }
  .intro-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: grid;
    justify-items: center;
    gap: 6px;
    margin: 0;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .intro-actions .intro-cta {
    width: 100%;
    justify-content: center;
  }
  .intro-actions .fineprint {
    margin: 0;
  }
}
/* Welcome steps: one main button, the same size every step; the
   secondary choice sits centred beneath it. */
@media (max-width: 759px) {
  .welcome-actions {
    display: grid;
    justify-items: center;
    gap: 10px;
  }
  .welcome-actions > .button {
    width: 100%;
    min-height: 56px;
    justify-content: center;
  }
}
@media (min-width: 760px) {
  .welcome-actions > .button {
    min-width: 14rem;
    min-height: 52px;
    justify-content: center;
  }
}

.button--danger-outline {
  background: transparent;
  color: var(--slower);
  border: 1px solid currentColor;
}
.settings-group > h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  margin-bottom: 8px;
}

.field-label {
  font-weight: 600;
  margin: 8px 0 4px;
}
.check-row input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}
.recorder-detail .field,
.recorder-detail .field input {
  width: 100%;
}

.moto-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.moto-table .moto-cell {
  white-space: nowrap;
}
.moto-table .moto-cell .muted {
  display: block;
  font-size: 0.8125rem;
}
/* Where to find time: chances beside the tools on wide screens. */
@media (min-width: 1024px) {
  .analysis-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: start;
  }
  .analysis-grid {
    grid-template-rows: auto 1fr;
  }
  .analysis-grid > .card--opps {
    grid-row: span 2;
  }
  .analysis-grid > :not(.card--opps) {
    align-self: start;
  }
}

.delta-unit {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-3);
  text-align: right;
}
/* Corner rows: the turn name gets the width; the result stays short. */
.section-row {
  grid-template-columns: 2rem minmax(0, 1fr) auto;
}
.section-row > svg:last-child {
  display: none;
}
.section-row .delta {
  white-space: nowrap;
}

.check-progress {
  font: 600 0.75rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 4px;
}
/* ---------- Replay and map, fix round (3 Oct) ---------- */
/* The picture is the dark part; the frame round it follows the theme. */
.map {
  background: var(--surface);
}
.map-canvas {
  background: #0d150f;
  overflow: hidden;
}
/* Image credit: one line in the bottom-left corner; the full wording is a tap away. */
.map-canvas > .map-credit {
  position: absolute;
  top: auto;
  right: auto;
  left: 8px;
  bottom: 4px;
  right: 72px;
  max-width: calc(100% - 84px);
  margin: 0;
  display: flex;
  gap: 8px;
  font-size: 0.6875rem;
  line-height: 1.3;
  text-align: left;
  color: rgba(255, 255, 255, 0.78);
  opacity: 1;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}
.map-credit-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-credit-button {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 6px;
  margin: -2px 0 0 -6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-shadow: inherit;
  position: relative;
}
/* A finger-sized target round the small credit. */
.map-credit-button::after {
  content: "";
  position: absolute;
  inset: -10px -4px -4px;
}
.map-credit-button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-credit.is-open .map-credit-button {
  background: rgba(10, 16, 12, 0.88);
  text-shadow: none;
}
.map-credit.is-open .map-credit-button span {
  white-space: normal;
}
.map .map-credit-button svg {
  flex: none;
  width: 12px;
  height: 12px;
  cursor: inherit;
}
/* Start and finish: a chequered flag on a pole. */
.flag-pole {
  stroke: #fff;
  stroke-linecap: round;
}
.flag-cloth {
  fill: #fff;
  stroke: #0a100c;
}
.flag-check {
  fill: #0a100c;
}
.flag-foot {
  fill: #fff;
  stroke: #0a100c;
}
.marker-sf .map-badge text {
  fill: #fff;
}
/* The heads-up over the map (debrief): one small panel, top left, clear of the track. */
.map-canvas > .map-hud {
  top: 10px;
  left: 10px;
  right: 72px;
  bottom: auto;
}
.hud-box {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  padding: 6px 10px 7px;
  border-radius: 10px;
  background: rgba(10, 16, 12, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f3ec;
}
.hud-box p {
  margin: 0;
}
.hud-gap {
  font-size: 0.875rem;
  font-weight: 650;
}
.hud-gap b {
  font: 800 1.0625rem/1.1 var(--num);
  font-variant-numeric: tabular-nums;
}
.hud-box.tone-slower .hud-gap b {
  color: var(--slower);
}
.hud-box.tone-quicker .hud-gap b {
  color: var(--quicker);
}
.hud-box .hud-callout {
  flex-basis: auto;
  max-width: 34ch;
  padding: 0;
  border: 0;
  background: none;
  font: 700 0.8125rem/1.3 var(--font);
}
.hud-box .race-speeds {
  font-size: 0.75rem;
  color: #b9c4b9;
}
/* Speeds and heart rate in words, one line: "You 29 mph · Best 34 mph · HR 182". */
.race-speeds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  font-variant-numeric: tabular-nums;
}
.race-speeds > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.race-speeds > span + span::before {
  content: "·";
  margin: 0 7px;
  color: var(--text-3);
}
.race-speeds .race-dot {
  width: 8px;
  height: 8px;
}
.race-speeds .race-dot--b {
  margin-left: 0;
}
.race-speeds .race-hr {
  margin-left: 0;
  color: #ff6b8a;
}
[data-theme="light"] .race-speeds .race-hr {
  color: #b3204a;
}
.race .race-hud .race-speeds {
  justify-content: flex-end;
}
/* Playback: play, a full-width slider and the clock on one line; speed and
   the way out on the next. One line on a wide replay. */
.race {
  container-type: inline-size;
}
.race .map .race-controls,
.race-controls {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "play scrub time" "speed speed exit";
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px 10px;
}
.race-controls .replay-play,
.race-controls .icon-button--solid {
  grid-area: play;
  width: 44px;
  height: 44px;
}
.race-controls .replay-scrub,
.race-controls input[type="range"] {
  grid-area: scrub;
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  accent-color: var(--lime);
  cursor: pointer;
}
.race-controls .replay-time {
  grid-area: time;
  display: block;
  min-width: 3.6em;
  text-align: right;
}
.race-controls .replay-speed {
  grid-area: speed;
  justify-self: start;
  flex-wrap: nowrap;
}
.race-controls .replay-speed button {
  min-height: 44px;
  min-width: 52px;
  padding: 0 12px;
}
.replay-exit {
  grid-area: exit;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 600 0.9375rem var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.replay-exit:hover {
  background: var(--surface-3);
}
@container (min-width: 640px) {
  .race .map .race-controls,
  .race-controls {
    grid-template-columns: 44px minmax(0, 1fr) auto auto auto;
    grid-template-areas: "play scrub time speed exit";
  }
}
/* One labelled view control under the replay. */
.replay-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.replay-view-label {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--text-2);
}
.replay-view .segmented button {
  min-height: 44px;
}
@media (max-width: 559px) {
  .replay-view .segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
}
/* Legend: who's who, then the colours; each item stays whole. */
.map-legend {
  gap: 6px 20px;
}
.legend-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}
.legend-group--keys {
  gap: 4px 14px;
}
.map-legend .key-mark,
.map-legend .key {
  white-space: nowrap;
}
.key-mark--edit {
  min-height: 44px;
  margin: -6px 0;
  padding: 0 10px 0 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.key-mark--edit:hover {
  border-color: var(--line-strong);
}
.key-mark--edit svg {
  color: var(--text-3);
}
.map-legend .key-mark .plate-badge--dot {
  min-width: 14px;
  width: 14px;
  height: 14px;
}
.key-mark .key::before {
  width: 22px;
}
[data-theme="light"] .mark--pb {
  background: rgba(10, 16, 12, 0.12);
  border-color: var(--text-3);
}
[data-theme="light"] .mark--pack {
  background: rgba(10, 16, 12, 0.3);
}
[data-theme="light"] .race-strip-label {
  color: var(--text-3);
}
/* Section tiles: the one you're in counts up, the rest wait their turn. */
.race-splits li.is-current {
  border-color: var(--line-strong);
}
.race-splits strong:not([class*="tone-"]) {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-3);
}
.race-splits small {
  font-size: 0.6875rem;
  color: var(--text-3);
}
/* Charts: tidy scales, gridlines, and the gap shaded like the replay strip. */
.dchart-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
}
.dchart-readout {
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.dchart-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.dchart-y {
  top: 0;
  transform: translateY(-50%);
  line-height: 1;
}
.dchart-y.top,
.dchart-y.bottom {
  top: auto;
  bottom: auto;
}
.dchart-area {
  stroke: none;
  opacity: 0.35;
}
.dchart-area--ahead {
  fill: var(--quicker);
}
.dchart-area--behind {
  fill: var(--slower);
}
.dchart-side {
  position: absolute;
  right: 6px;
  font-size: 0.6875rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.dchart-side--top {
  top: 4px;
}
.dchart-side--bottom {
  bottom: 4px;
}
.dt-side {
  font: 600 10px var(--font);
  fill: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme="light"] .dt-noise {
  fill: rgba(10, 16, 12, 0.06);
}
/* Replay, time map or racing lines: one switch, three equal choices. */
.laps-map > .segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.laps-map > .segmented button {
  min-height: 44px;
  padding: 4px 8px;
  line-height: 1.2;
  text-align: center;
}
/* A turn in slow motion: the turn's own stretch stands out from the track round it. */
.race--corner .route-ahead .map-line {
  stroke: rgba(255, 255, 255, 0.5);
}
.hud-box .race-speeds {
  grid-area: auto;
  margin: 0;
}
/* "Ahead" and "behind" stay readable where the line runs under them. */
.race-strip-label,
.dchart-side {
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.2;
}
.race-strip-label--top,
.dchart-side--top {
  top: 3px;
}
.race-strip-label--bottom,
.dchart-side--bottom {
  bottom: 3px;
}
.dt-side {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.race-strip > .race-strip-label,
.dchart-side {
  right: auto;
  left: 6px;
}
.hud-box .race-speeds {
  gap: 2px 12px;
}
.hud-box .race-speeds > span + span::before {
  content: none;
}
/* Bright theme: the legend's swatches are the colours drawn on the (dark)
   map, edged so they read on white. */
[data-theme="light"] .map-legend {
  --lime: #c8f24a;
  --quicker: #3fdc9a;
  --slower: #ff8a5c;
  --reference: #6fb9ff;
  --best: #c38bff;
}
[data-theme="light"] .map-legend .key::before {
  box-shadow: 0 0 0 1px rgba(10, 16, 12, 0.6);
}
[data-theme="light"] .map-legend .mark {
  border-color: rgba(10, 16, 12, 0.75);
}
[data-theme="light"][data-palette="colour-blind"] .map-legend {
  --quicker: #5aa9ff;
  --slower: #ff9f40;
  --best: #f28ad9;
  --reference: #d9d9d9;
}

/* Bright theme: the brand's hi-vis lime stays lime wherever it's a fill
   (with dark ink on it); the darker olive is only for lime-coloured text. */
[data-theme="light"] .button:not(.button--secondary):not(.button--danger-outline):not(.link),
[data-theme="light"] .moto-chips a[aria-current="page"],
[data-theme="light"] .segmented button[aria-pressed="true"],
[data-theme="light"] .ride-tabs a[aria-current],
[data-theme="light"] .record-steps li::before,
[data-theme="light"] .rq-slim .button:not(.button--secondary) {
  background: #c8f24a;
  border-color: #b4dc3a;
  color: #142006;
}
[data-theme="light"] .segmented button[aria-pressed="true"] .muted {
  color: #142006;
}
/* No cards inside cards on the first-ride screen. */
.hero--first .record-steps li,
[data-theme="light"] .hero--first .record-steps li {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-inline: 0;
}
.hero--first .record-steps li:first-child {
  border-top: 0;
}

/* ---------- Numbers in Saira Semi Condensed (brand, 4 Oct) ---------- */
.kpi .kpi-value,
.where-loss,
.where-chip,
.moto-chips a,
.nav-badge,
.pace-value,
.stat-row dd,
.stat-value,
.big-number,
.big-delta,
.best-time,
.delta,
.replay-time,
.pace-readout,
.picker strong,
.moto-table .num,
.lap-row strong,
.lap-time,
.race-gap,
.race-splits strong,
.hero-chip strong,
.record-stats strong,
.record-list .value-best,
.recording-time,
.engine-hours-figure strong,
.report-stat strong,
.debrief-sub {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-value,
.where-loss,
.pace-value,
.big-number,
.best-time,
.stat-value,
.moto-chips a {
  font-weight: 700;
}
.debrief-sub {
  font-family: inherit;
}
/* The track history card never grows past the screen at large text. */
.card.history {
  grid-template-columns: minmax(0, 1fr);
}
.card.history > * {
  min-width: 0;
}

/* Labels never outgrow the number they name. */
.best-title {
  font-size: 0.8125rem;
}
/* Icons grow with large text. */
.button svg,
.link svg,
.eyebrow svg,
.back-button svg,
.share-ride svg {
  width: max(16px, 1.1em);
  height: max(16px, 1.1em);
}

.pw-replay-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
}
.pw-plan .button,
.debrief-more .button {
  justify-self: start;
  width: auto;
  max-width: 22rem;
}
.section-name .corner-kind {
  display: block;
  font-size: 0.875rem;
  color: var(--text-2);
}
/* Conditions spans the row on wide screens rather than leaving a hole. */
@media (min-width: 1024px) {
  .debrief-extra {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Figures in the replay, debrief and Progress pieces use the numbers face. */
.mc-big,
.mc-beat,
.records-table td,
.race-speeds,
.replay-time,
.dchart-readout,
.value-best {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
}
.mc-beat {
  font-weight: 500;
}

.check-row-help {
  display: block;
  font-size: 0.875rem;
  margin-top: 2px;
}

/* Logo on light screens: the approved black version (black on white). The
   coloured version stays on dark backgrounds. */
[data-theme="light"] .brand-mark path {
  stroke: #0a100c;
}
[data-theme="light"] .brand-mark circle {
  fill: #0a100c;
}

.settings-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.875rem;
}

/* Which riding day: a full-width picker at the top of the Debrief and Progress. */
.ride-picker {
  display: grid;
  gap: 4px;
  max-width: 34rem;
}
.ride-picker-label {
  font: 600 0.75rem/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ride-picker select {
  min-height: 48px;
  padding: 10px 40px 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.your-tracks ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.your-tracks li + li {
  border-top: 1px solid var(--line);
}
.your-track {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  min-height: 56px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.your-track[aria-current] strong::after {
  content: " · showing";
  font-weight: 500;
  color: var(--text-3);
}
.your-track-text,
.your-track-num {
  display: grid;
  gap: 2px;
}
.your-track-num {
  justify-items: end;
  font-size: 0.875rem;
}
.your-track-num .value-best {
  font-family: var(--num);
  font-weight: 700;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}
.page--progress > .ride-picker,
.page--progress > .your-tracks {
  margin-bottom: 16px;
}
/* The picker never widens the page: long lines are cut short with "…". */
.ride-picker {
  min-width: 0;
  width: 100%;
}
.ride-picker select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
/* Grid pages: a child can never push the page wider than the screen. */
.page--debrief,
.page--progress,
.pitwall {
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .pitwall {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  }
}

/* ---------- Debrief replay: the track leads ---------- */
/* The live readout sits in a strip under the map, never over the track. */
.hud-strip {
  padding: 8px 12px 0;
}
.hud-strip .hud-box {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
}
.hud-strip .hud-gap b {
  font-size: 1.375rem;
}
/* Turn numbers: smaller and quieter until passed, so the line reads first. */
.debrief-replay .marker-gate > circle:not(.map-marker-hit),
.debrief-replay .marker-gate > text {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.66);
}
.debrief-replay .marker-gate:not(.marker-callout):not(.marker-focus) > circle:not(.map-marker-hit) {
  fill-opacity: 0.55;
  stroke-opacity: 0.7;
}
/* Paused: a big play button in the middle of the map. */
.race-stage {
  position: relative;
}
.replay-centre-play {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 0;
  background: rgba(200, 242, 74, 0.92);
  color: #142006;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.replay-centre-play svg {
  margin-left: 4px;
}
@media (prefers-reduced-motion: no-preference) {
  .replay-centre-play {
    transition: transform 0.15s ease;
  }
  .replay-centre-play:active {
    transform: translate(-50%, -50%) scale(0.94);
  }
}
/* The finger-sized touch target round each marker is never drawn (a colour
   rule for markers used to paint it, making every marker look 3x its size). */
.map-marker > circle.map-marker-hit,
.map-marker.marker-callout > circle.map-marker-hit {
  fill: transparent !important;
  stroke: none !important;
}
.hud-strip {
  padding: 0 2px 8px;
}
/* Touch screens zoom with a pinch: the debrief map keeps just "fit the track"
   and full screen, smaller, so the track has the room. */
@media (pointer: coarse) {
  .debrief-replay .map-tools [aria-label="Zoom in"],
  .debrief-replay .map-tools [aria-label="Zoom out"] {
    display: none;
  }
}
.debrief-replay .map-tools .icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
}

.email-suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 4px 0 8px;
}

/* ---------- Welcome back: signing in on another device ---------- */
.intro--signin {
  justify-items: center;
}
.intro--signin .intro-copy {
  width: 100%;
  max-width: 520px;
  padding-top: max(48px, env(safe-area-inset-top));
  margin: 0 auto;
}
.intro--signin .account-sync,
.intro--signin .account-form {
  width: 100%;
}
.intro--signin .account-form {
  display: grid;
  gap: 16px;
  justify-items: start;
}
.intro--signin .account-form .field,
.intro--signin .account-form input {
  width: 100%;
}
.account-sync--bare {
  padding: 0;
  border: 0;
  background: none;
}
@media (min-width: 900px) {
  .intro--signin {
    grid-template-columns: minmax(0, 520px);
    justify-content: center;
  }
}

/* ---------- Replay: which two laps, said plainly ---------- */
.replay-compare-wrap {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.replay-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}
.replay-compare .field {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.replay-compare select {
  width: 100%;
  min-width: 0;
}
.replay-compare-vs {
  padding-bottom: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.replay-compare-says {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-2);
}
