/*
 * Design tokens lifted from money-ration-web (src/styles.css): same OKLCH palette, same semantic
 * layer. Components use semantic tokens only. The four sector colours are the one addition.
 */
:root {
  --palette-groente-50: oklch(98% 0.022 130);
  --palette-groente-100: oklch(96% 0.043 130);
  --palette-groente-200: oklch(93% 0.079 130);
  --palette-groente-300: oklch(90.4% 0.115 130);
  --palette-groente-400: oklch(86.7% 0.149 130);
  --palette-groente-500: oklch(82.3% 0.173 130);
  --palette-groente-600: oklch(74.6% 0.18 130);
  --palette-groente-600-50: oklch(74.6% 0.18 130 / 0.5);
  --palette-groente-700: oklch(62.9% 0.155 130);
  --palette-groente-950: oklch(29.5% 0.072 130);

  --palette-coral-100: oklch(93.4% 0.032 20.4);
  --palette-coral-200: oklch(88% 0.062 20.4);
  --palette-coral-500: oklch(66.8% 0.175 20.4);
  --palette-coral-600: oklch(60.3% 0.182 20.4);
  --palette-coral-700: oklch(52.4% 0.157 20.4);

  --palette-aston-50: oklch(98.5% 0.003 106.4);
  --palette-aston-50-30: oklch(98.5% 0.003 106.4 / 0.3);
  --palette-aston-100: oklch(97% 0.003 106.4);
  --palette-aston-200: oklch(95.5% 0.003 106.4);
  --palette-aston-300: oklch(91.5% 0.003 106.4);
  --palette-aston-300-50: oklch(91.5% 0.003 106.4 / 0.5);
  --palette-aston-400: oklch(86% 0.003 106.4);
  --palette-aston-400-68: oklch(86% 0.003 106.4 / 0.68);
  --palette-aston-500-18: oklch(78.1% 0.003 106.4 / 0.18);
  --palette-aston-600: oklch(68.4% 0.003 106.4);
  --palette-aston-600-11: oklch(68.4% 0.003 106.4 / 0.11);

  --palette-charred-200: oklch(86.1% 0 0);
  --palette-charred-300: oklch(75.7% 0 0);
  --palette-charred-400: oklch(62.7% 0 0);
  --palette-charred-500: oklch(53.5% 0 0);
  --palette-charred-900: oklch(36% 0 0);
  --palette-charred-950: oklch(25.2% 0 0);

  --palette-warning-100: oklch(94.3% 0.036 72.5);
  --palette-warning-700: oklch(49.5% 0.102 72.5);

  --palette-info-100: oklch(94.6% 0.021 231.2);
  --palette-info-500: oklch(69.3% 0.086 231.2);
  --palette-info-700: oklch(51.2% 0.077 231.2);

  /* Sector colours (F1 / LiveSplit style). Same chroma arc as the ramps above. */
  --palette-violet-500: oklch(62% 0.19 300);
  --palette-violet-700: oklch(50% 0.19 300);
  --palette-sun-400: oklch(86% 0.16 95);
  --palette-sun-700: oklch(58% 0.12 85);

  /* Text */
  --text-high: var(--palette-charred-950);
  --text-default: var(--palette-charred-900);
  --text-medium: var(--palette-charred-500);
  --text-low: var(--palette-charred-400);
  --text-faint: var(--palette-charred-300);
  --text-inverse: var(--palette-aston-50);
  --text-primary: var(--palette-groente-700);
  --text-on-primary: var(--palette-groente-950);
  --text-success: var(--palette-groente-700);
  --text-danger: var(--palette-coral-700);
  --text-on-danger: var(--palette-aston-50);
  --text-warning: var(--palette-warning-700);
  --text-info: var(--palette-info-700);

  /* Backgrounds */
  --bg-canvas: var(--palette-aston-100);
  --bg-surface: var(--palette-aston-50);
  --bg-sunken: var(--palette-aston-100);
  --bg-muted: var(--palette-aston-200);
  --bg-control: var(--palette-aston-300);
  --bg-glass: var(--palette-aston-600-11);
  --bg-glass-header: var(--palette-aston-50-30);
  --bg-glass-light: var(--palette-aston-300-50);
  --bg-neutral: var(--palette-charred-300);
  --bg-neutral-light: var(--palette-charred-200);
  --bg-inverse: var(--palette-charred-950);
  --bg-primary: var(--palette-groente-300);
  --bg-primary-subtle: var(--palette-groente-50);
  --bg-primary-glass: var(--palette-groente-600-50);
  --bg-success-subtle: var(--palette-groente-100);
  --bg-danger: var(--palette-coral-600);
  --bg-danger-subtle: var(--palette-coral-100);
  --bg-warning-subtle: var(--palette-warning-100);
  --bg-info: var(--palette-info-500);
  --bg-info-subtle: var(--palette-info-100);

  /* Borders */
  --border-subtle: var(--palette-aston-200);
  --border-default: var(--palette-aston-300);
  --border-strong: var(--palette-aston-400);
  --border-inverse: var(--palette-charred-950);
  --border-glass: var(--palette-aston-500-18);
  --border-glass-strong: var(--palette-aston-400-68);
  --border-focus: var(--palette-groente-400);
  --border-primary: var(--palette-groente-500);
  --border-danger-subtle: var(--palette-coral-200);

  /* Sectors: fill + readable text */
  --seg-purple: var(--palette-violet-500);
  --seg-green: var(--palette-groente-600);
  --seg-yellow: var(--palette-sun-400);
  --seg-red: var(--palette-coral-500);
  --seg-none: var(--palette-aston-400);
  --seg-purple-text: var(--palette-violet-700);
  --seg-green-text: var(--palette-groente-700);
  --seg-yellow-text: var(--palette-sun-700);
  --seg-red-text: var(--palette-coral-700);

  --route-line: var(--palette-aston-600);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 300ms;
}

@font-face {
  font-family: 'Satoshi-Variable';
  src: url('fonts/Satoshi-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Satoshi-Variable', system-ui, sans-serif;
  background: var(--bg-canvas);
  color: var(--text-high);
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input {
  font: inherit;
  -webkit-user-select: auto;
  user-select: auto;
}

.i {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex-shrink: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- page shell (base-page) ---------- */

.page {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

.page-spacer {
  height: 6px;
  flex-shrink: 0;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding-bottom: 140px;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar,
.cards::-webkit-scrollbar,
.rw::-webkit-scrollbar,
.splits::-webkit-scrollbar {
  display: none;
}

.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: 16px;
}

.hdr-inner {
  position: relative;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: var(--safe-top);
}

.hdr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  min-width: 0;
}

.hdr-title {
  font-size: 30px;
  line-height: 36px;
  font-weight: 700;
  color: var(--text-high);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-actions {
  display: flex;
  gap: 8px;
  margin-right: 16px;
}

.blur-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: linear-gradient(180deg, #f5f5f46f 80%, transparent 100%);
  mask-image: linear-gradient(180deg, black 68%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, black 68%, transparent 100%);
  pointer-events: none;
}

.blur-overlay.from-bottom {
  background: linear-gradient(0deg, #f5f5f46f 80%, transparent 100%);
  mask-image: linear-gradient(0deg, black 68%, transparent 100%);
  -webkit-mask-image: linear-gradient(0deg, black 68%, transparent 100%);
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding-top: 24px;
}

.footer-content {
  position: relative;
  z-index: 10;
  padding: 0 16px max(24px, calc(var(--safe-bottom) + 8px));
}

/* ---------- buttons ---------- */

.glass-circle {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 24px;
  color: var(--text-default);
  background: var(--bg-glass-header);
  border: 1px solid var(--border-glass-strong);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.15s ease-out;
}

.glass-circle.back {
  width: 44px;
  height: 44px;
  font-size: 28px;
  border-color: var(--border-strong);
}

.glass-circle:active {
  transform: scale(1.1);
  filter: brightness(1.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.glass-circle.on {
  color: var(--text-info);
}

.pill {
  height: 70px;
  border-radius: 999px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--border-glass);
  transition: all 0.35s ease-out;
}

.pill .i {
  font-size: 26px;
}

.pill:active {
  transform: scale(1.03);
  filter: brightness(1.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pill.primary {
  background: var(--bg-primary-glass);
  border-color: var(--border-primary);
  color: var(--text-on-primary);
}

.pill:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.circle-70 {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--text-default);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.15s ease-out;
}

.circle-70:active {
  transform: scale(1.1);
  filter: brightness(1.15);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  color: var(--text-low);
  transition: transform 0.15s ease-out;
}

.icon-btn:active {
  transform: scale(1.1);
  color: var(--text-danger);
}

.danger-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-danger);
  background: var(--bg-danger-subtle);
  border: 2px solid var(--border-danger-subtle);
  transition: all 0.35s ease-out;
}

.danger-row .i {
  font-size: 20px;
}

.danger-row:active {
  transform: scale(1.02);
  filter: brightness(1.05);
}

/* ---------- cards ---------- */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 16px 16px;
}

.pad {
  padding: 16px;
}

.cards {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  padding: 0 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.stat {
  flex: 0 0 100%;
  scroll-snap-align: center;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat h2 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--text-medium);
  margin-bottom: 8px;
}

.stat-val {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.stat-val .big {
  font-size: 48px;
  line-height: 1;
  font-weight: 700;
  color: var(--text-high);
  font-variant-numeric: tabular-nums;
}

.stat-val .unit {
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  min-height: 28px;
}

.stat-foot > span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-medium);
}

.chip {
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chip.success {
  background: var(--bg-success-subtle);
  color: var(--text-success);
}
.chip.danger {
  background: var(--bg-danger-subtle);
  color: var(--text-danger);
}
.chip.info {
  background: var(--bg-info-subtle);
  color: var(--text-info);
}
.chip.muted {
  background: var(--bg-muted);
  color: var(--text-medium);
}

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-neutral-light);
  transition: all 0.3s;
}

.dot.on {
  width: 24px;
  background: var(--bg-neutral);
}

.minis {
  display: flex;
  gap: 8px;
  margin: 0 16px 16px;
}

.mini {
  flex: 1 1 50%;
  padding: 16px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini h2 {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

.mini p {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-default);
  font-variant-numeric: tabular-nums;
}

.sec {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-medium);
  margin: 16px 0 8px;
  padding-left: 24px;
}

.sec span {
  color: var(--text-faint);
}

.empty {
  text-align: center;
  margin: 16px;
  padding: 24px 16px;
  color: var(--text-low);
}

.empty .i {
  font-size: 48px;
}

.empty p {
  margin-top: 8px;
}

.empty small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}

/* route switcher (segmented control) */
.seg {
  display: flex;
  margin: 0 16px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-control);
}

.seg button {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--text-high);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.3s var(--ease);
}

.seg button.on {
  background: var(--bg-surface);
}

/* ---------- run rows (transaction-row) ---------- */

.rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rw {
  display: flex;
  gap: 16px;
  padding: 0 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.row {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  text-align: left;
  transition: all 0.35s ease-out;
}

.row:active {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.row-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--text-high);
  flex-shrink: 0;
}

.minis.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.mini p small {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-faint);
}

.street {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
}

.street + .street {
  border-top: 1px solid var(--border-subtle);
}

.street span:first-child {
  font-weight: 600;
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.street span:last-child {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-low);
  font-variant-numeric: tabular-nums;
}

.lookup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-medium);
}

.lookup small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
}

.soft-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--text-default);
  background: var(--bg-control);
  transition: all 0.35s ease-out;
}

.soft-btn .i {
  font-size: 18px;
}

.soft-btn:active {
  transform: scale(1.03);
  filter: brightness(1.05);
}

.map-card.tall {
  height: 46dvh;
  margin-bottom: 16px;
}

.row.dnf .row-icon,
.row.dnf .row-time {
  color: var(--text-faint);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
  opacity: 0.75;
}

.bars {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.bars i {
  flex: 1;
  height: 4px;
  border-radius: 9px;
  background: var(--seg-none);
}

.row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: 8px;
  flex-shrink: 0;
}

.row-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-default);
  font-variant-numeric: tabular-nums;
}

.row-delta {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.del-wrap {
  display: flex;
  padding: 4px 16px 4px 0;
  scroll-snap-align: end;
}

.del {
  width: 88px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--text-on-danger);
  background: var(--bg-danger);
  transition: all 0.35s ease-out;
}

.list {
  margin: 0 16px;
  padding: 4px 12px;
}

.sr {
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr auto 56px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
  text-align: left;
  transition: opacity 0.3s var(--ease);
}

.sr.dim {
  opacity: 0.35;
}

.sname {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sname .ss {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

.sr + .sr {
  border-top: 1px solid var(--border-subtle);
}

.sr .sn {
  font-weight: 600;
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr .st {
  font-weight: 600;
  color: var(--text-medium);
  font-variant-numeric: tabular-nums;
}

.sr .sx {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sd {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--seg-none);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 0 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-low);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend .sd {
  width: 8px;
  height: 8px;
}

/* sector colour classes: s-* fills, c-* text */
.s-purple { background: var(--seg-purple) !important; }
.s-green { background: var(--seg-green) !important; }
.s-yellow { background: var(--seg-yellow) !important; }
.s-red { background: var(--seg-red) !important; }
.c-purple { color: var(--seg-purple-text); }
.c-green { color: var(--seg-green-text); }
.c-yellow { color: var(--seg-yellow-text); }
.c-red { color: var(--seg-red-text); }
.c-none { color: var(--text-low); }

@keyframes expand-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scaleY(0.96);
  }
}

/* ---------- run page (map + timer) ---------- */

.run {
  position: fixed;
  inset: 0;
  background: var(--bg-canvas);
  overflow: hidden;
}

.run-map,
.edit-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-muted);
}

.run-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: calc(16px + var(--safe-top)) 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.run-top > * {
  pointer-events: auto;
}

.route-chip {
  height: 44px;
  min-width: 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-default);
  background: color-mix(in oklch, var(--bg-surface) 70%, transparent);
  border: 1px solid var(--border-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.route-chip span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gps {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--seg-none);
}

.run-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding: 0 16px max(24px, calc(var(--safe-bottom) + 8px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timer {
  padding: 6px;
  background: color-mix(in oklch, var(--bg-surface) 84%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.splits {
  max-height: 186px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sp {
  display: grid;
  grid-template-columns: 1fr auto 72px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 18px;
  font-size: 15px;
  transition: background 0.3s var(--ease);
}

.sp.cur {
  background: var(--bg-control);
}

.sp .n {
  font-weight: 600;
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp .d {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sp .t {
  text-align: right;
  font-weight: 600;
  color: var(--text-medium);
  font-variant-numeric: tabular-nums;
}

.sp .t.cmp {
  color: var(--text-faint);
}

.tm {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 6px;
  margin-top: 2px;
  border-top: 1px solid var(--border-subtle);
}

.tm-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 4px;
}

.tm-meta span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

.tm-meta b {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-default);
  font-variant-numeric: tabular-nums;
}

.big-timer {
  font-size: 58px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-high);
  transition: color 0.3s;
}

.big-timer small {
  font-size: 30px;
  font-weight: 700;
}

.big-timer.ahead { color: var(--seg-green-text); }
.big-timer.behind { color: var(--seg-red-text); }
.big-timer.gold { color: var(--seg-purple-text); }

.tf {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

.tf b {
  color: var(--text-default);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  gap: 24px;
}

.banner {
  align-self: center;
  animation: pop 420ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.chip.gold {
  background: var(--seg-purple);
  color: var(--text-inverse);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* ---------- map markers ---------- */

.cp {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Satoshi-Variable', system-ui, sans-serif;
  color: var(--text-high);
  background: var(--bg-surface);
  border: 2px solid var(--border-strong);
  box-shadow: 0 2px 8px oklch(0% 0 0 / 0.15);
  flex-shrink: 0;
}

.cp .i {
  font-size: 15px;
}

.cp.start,
.cp.finish {
  background: var(--bg-inverse);
  color: var(--text-inverse);
  border-color: var(--border-inverse);
}

.cp.next {
  background: var(--bg-primary);
  border-color: var(--border-primary);
  color: var(--text-on-primary);
  animation: ring 1.6s ease-out infinite;
}

.cp.passed {
  color: var(--text-inverse);
  border-color: transparent;
}

.cp.skipped {
  opacity: 0.45;
}

@keyframes ring {
  0% { box-shadow: 0 0 0 0 var(--palette-groente-600-50); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

.me {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--bg-info);
  border: 3px solid var(--bg-surface);
  box-shadow: 0 1px 6px oklch(0% 0 0 / 0.3);
}

.route-line {
  stroke: var(--route-line);
  stroke-width: 3;
  stroke-dasharray: 2 8;
  stroke-linecap: round;
  fill: none;
}

.trail-line {
  stroke: var(--bg-info);
  stroke-width: 5;
  stroke-opacity: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.trail-line.tr-purple { stroke: var(--seg-purple); }
.trail-line.tr-green { stroke: var(--seg-green); }
.trail-line.tr-yellow { stroke: var(--seg-yellow); }
.trail-line.tr-red { stroke: var(--seg-red); }
.trail-line.tr-none { stroke: var(--bg-info); }
.trail-line { transition: stroke-opacity 0.3s; }
.trail-line.faded { stroke-opacity: 0.15; }

.cp-ring {
  stroke: var(--border-primary);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  fill: var(--bg-primary);
  fill-opacity: 0.25;
}

.me-acc {
  stroke: none;
  fill: var(--bg-info);
  fill-opacity: 0.12;
}

.leaflet-container {
  font-family: 'Satoshi-Variable', system-ui, sans-serif;
  background: var(--bg-muted);
}

/* OSM's colourful style, muted into the aston greys so the route and sectors carry the colour. */
.leaflet-tile-pane {
  filter: grayscale(1) contrast(0.85) brightness(1.08);
}

.leaflet-control-attribution {
  font-size: 9px;
  background: color-mix(in oklch, var(--bg-surface) 60%, transparent) !important;
  color: var(--text-low);
  border-radius: 8px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--text-medium);
}

.run .leaflet-bottom {
  bottom: var(--timer-h, 0px);
}

/* ---------- route editor ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-medium);
}

.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-default);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--border-focus);
}

.map-card {
  position: relative;
  height: 42dvh;
  margin: 0 16px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  isolation: isolate;
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tools .glass-circle {
  width: 44px;
  height: 44px;
  font-size: 22px;
  background: color-mix(in oklch, var(--bg-surface) 70%, transparent);
}

.map-hint {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1000;
  max-width: calc(100% - 80px);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-medium);
  background: color-mix(in oklch, var(--bg-surface) 75%, transparent);
  border: 1px solid var(--border-glass-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cp-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 16px 16px;
}

.cp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 12px;
  animation: expand-in 240ms var(--ease) backwards;
}

.cp-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cp-text input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-default);
}

.cp-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-low);
}

/* ---------- page transitions (money-ration) ---------- */

@keyframes page-slide-in-right { from { transform: translateX(100%); } }
@keyframes page-slide-in-left { from { transform: translateX(-100%); } }
@keyframes page-slide-out-left { to { transform: translateX(-30%); } }
@keyframes page-slide-out-right { to { transform: translateX(30%); } }

::view-transition-old(root),
::view-transition-new(root) {
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  animation: var(--dur) var(--ease) both page-slide-out-left;
}

::view-transition-new(root) {
  animation: var(--dur) var(--ease) both page-slide-in-right;
}

html.nav-back::view-transition-old(root) {
  animation: var(--dur) var(--ease) both page-slide-out-right;
}

html.nav-back::view-transition-new(root) {
  animation: var(--dur) var(--ease) both page-slide-in-left;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  .cp.next,
  .cp-row,
  .banner {
    animation: none;
  }
}
