:root {
  /* Surface */
  --bg: #efeae0;
  --paper: #fbf9f4;
  --paper-deep: #f4efe4;
  --ink: #1a1814;
  --ink-soft: #2f2a23;
  --muted: #6b6660;
  --muted-soft: #a8a299;
  --rule: #d9d3c7;
  --rule-soft: #ebe5d8;

  /* Motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-quick: 160ms;
  --t-standard: 220ms;
  --t-slow: 340ms;

  /* Warm-tinted shadow that sits on paper rather than floating */
  --shadow-soft:
    0 1px 0 rgba(40,30,15,0.04),
    0 12px 30px -18px rgba(60,40,20,0.20),
    0 48px 80px -48px rgba(60,40,20,0.22);

  /* Subtle paper grain — SVG noise, multiplied onto bg */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Fraunces', Georgia, serif;
  margin: 0;
  padding: clamp(10px, 2.4vw, 32px);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  mix-blend-mode: multiply;
}

main.container {
  position: relative;
  z-index: 1;
  max-width: min(1440px, 100%);
  margin: 0 auto;
}

header.app-header {
  padding: clamp(22px, 3.4vw, 44px) 0 0;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(10px, 1.5vw, 16px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--muted);
  opacity: 0.45;
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-variation-settings: "opsz" 144;
  font-size: clamp(34px, 5.4vw, 64px);
  letter-spacing: -0.028em;
  margin: 0 0 clamp(22px, 3vw, 36px);
  line-height: 1.0;
  text-wrap: balance;
  color: var(--ink);
}
h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}

section.view {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: var(--shadow-soft);
  padding: clamp(28px, 4vw, 56px) clamp(20px, 3.6vw, 52px);
  margin-block-start: clamp(20px, 2.8vw, 36px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
}
section.view.in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-head {
  margin-bottom: clamp(20px, 2.4vw, 32px);
  max-width: 68ch;
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(10px, 1.5vw, 14px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.section-num::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--muted);
  opacity: 0.45;
}
h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-variation-settings: "opsz" 48;
  font-size: clamp(24px, 3.4vw, 40px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 clamp(8px, 1.2vw, 14px);
  color: var(--ink);
  text-wrap: balance;
}
.section-desc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 60ch;
}

.chart-wrap { position: relative; width: 100%; }
svg.chart {
  display: block;
  width: 100%;
  height: auto;
}

/* Fullscreen toggle button — sits in the upper-right corner of each chart */
.chart-fullscreen-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--t-quick) var(--ease-out),
              border-color var(--t-quick) var(--ease-out),
              transform var(--t-quick) var(--ease-out);
}
.chart-fullscreen-btn:hover { opacity: 1; border-color: var(--ink-soft); }
.chart-fullscreen-btn:active { transform: scale(0.94); }
.chart-fullscreen-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  opacity: 1;
}
.chart-fullscreen-btn svg { width: 14px; height: 14px; }
.chart-fullscreen-btn .icon-close { display: none; }

/* Fullscreen state — chart-wrap takes over the viewport */
.chart-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  padding: clamp(14px, 2.4vw, 28px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.chart-wrap.is-fullscreen svg.chart {
  width: 100%;
  height: 100%;
  max-height: 100%;
}
.chart-wrap.is-fullscreen .chart-fullscreen-btn {
  top: clamp(14px, 2.4vw, 28px);
  right: clamp(14px, 2.4vw, 28px);
  opacity: 1;
  width: 36px;
  height: 36px;
}
.chart-wrap.is-fullscreen .chart-fullscreen-btn .icon-expand { display: none; }
.chart-wrap.is-fullscreen .chart-fullscreen-btn .icon-close { display: block; }

/* Rotate hint — only shown inside fullscreen, on portrait + narrow viewport */
.rotate-hint {
  display: none;
  position: absolute;
  bottom: clamp(14px, 2.4vw, 28px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}
@media (orientation: portrait) and (max-width: 900px) {
  .chart-wrap.is-fullscreen .rotate-hint { display: block; }
}

.axis text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  fill: var(--muted);
}
.axis line, .axis path { stroke: var(--rule); }
.axis .domain { stroke: var(--ink); stroke-width: 1; }
.gridline { stroke: var(--rule-soft); stroke-dasharray: 1,3; }

.runner-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.runner-dot {
  stroke: var(--paper);
  stroke-width: 2;
  cursor: pointer;
  transition: r 160ms var(--ease-out);
}
.axis-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: var(--muted);
}
.avg-line { stroke-dasharray: 2,4; stroke-width: 1; opacity: 0.35; }
.avg-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.segment-band { fill: var(--ink); opacity: 0.025; }

/* Chart entrance — chart svg gets .drawn class when its view becomes active */
.chart .runner-line {
  stroke-dasharray: var(--len, 1400);
  stroke-dashoffset: var(--len, 1400);
  transition: stroke-dashoffset 1100ms var(--ease-in-out);
  transition-delay: var(--draw-delay, 0ms);
}
.chart.drawn .runner-line { stroke-dashoffset: 0; }
.chart .runner-dot,
.chart .drop-line,
.chart .avg-line,
.chart .axis-label,
.chart .gridline,
.chart .axis text {
  opacity: 0;
  transition: opacity 380ms var(--ease-out);
  transition-delay: 650ms;
}
.chart.drawn .runner-dot,
.chart.drawn .drop-line,
.chart.drawn .axis-label,
.chart.drawn .gridline,
.chart.drawn .axis text { opacity: 1; }
.chart.drawn .drop-line { opacity: 0.45; }
.chart.drawn .avg-line { opacity: 0.35; }

.legend {
  margin-top: clamp(20px, 2.5vw, 30px);
  padding-top: clamp(16px, 2vw, 24px);
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 28px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
}
.legend.shown .legend-item { opacity: 1; transform: translateY(0); }
.legend.shown .legend-item:nth-child(1) { transition-delay: 680ms; }
.legend.shown .legend-item:nth-child(2) { transition-delay: 720ms; }
.legend.shown .legend-item:nth-child(3) { transition-delay: 760ms; }
.legend.shown .legend-item:nth-child(4) { transition-delay: 800ms; }
.legend.shown .legend-item:nth-child(5) { transition-delay: 840ms; }
.legend.shown .legend-item:nth-child(6) { transition-delay: 880ms; }
.legend.shown .legend-item:nth-child(7) { transition-delay: 920ms; }
.legend-swatch { width: 22px; flex-shrink: 0; }
.legend-name { color: var(--ink); font-weight: 500; }
.legend-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 13px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.96) translateY(2px);
  transform-origin: top left;
  transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
  white-space: nowrap;
  z-index: 10;
  border-radius: 4px;
  box-shadow: 0 8px 24px -12px rgba(0,0,0,0.45);
}
.tooltip.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.tooltip .name { font-weight: 600; }
.tooltip .meta { color: #b8b3a8; }

/* Map view */
#map {
  width: calc(100% + 2 * clamp(20px, 3.6vw, 52px));
  margin: 0 calc(-1 * clamp(20px, 3.6vw, 52px));
  aspect-ratio: 1 / 1;
  max-height: min(620px, 78vh);
  min-height: 360px;
  background: var(--paper-deep);
  position: relative;
}
.map-controls {
  padding-top: clamp(18px, 2.2vw, 26px);
}

.clock-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.clock {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(30px, 3.4vw, 42px);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.012em;
}
.clock-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Segmented speed control — sliding ink pill behind the active option */
.speed-pills {
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
  position: relative;
}
.speed-pills::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  width: var(--pill-w, 0);
  background: var(--ink);
  border-radius: 999px;
  transform: translateX(var(--pill-x, 3px));
  transition: transform var(--t-slow) var(--ease-out), width var(--t-slow) var(--ease-out);
}
.pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  transition: color var(--t-quick) var(--ease-out), transform var(--t-quick) var(--ease-out);
}
.pill:hover { color: var(--ink-soft); }
.pill:active { transform: scale(0.94); }
.pill.active { color: var(--paper); }
.pill:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Compact mobile alternative to .speed-pills — shown only via media query */
.speed-select {
  display: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  background-color: var(--paper-deep);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%231a1814' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 7px 26px 7px 14px;
  margin-left: auto;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color var(--t-quick) var(--ease-out), transform var(--t-quick) var(--ease-out);
}
.speed-select:hover { border-color: var(--ink-soft); }
.speed-select:active { transform: scale(0.97); }
.speed-select:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.scrub-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(16px, 2vw, 22px);
}

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: transform var(--t-quick) var(--ease-out), background var(--t-quick) var(--ease-out);
}
.play-btn:hover { background: var(--ink-soft); }
.play-btn:active { transform: scale(0.94); }
.play-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.play-btn svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  fill: var(--paper);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 140ms var(--ease-out), transform 180ms var(--ease-out);
}
.play-btn[data-state="paused"]  .icon-play,
.play-btn[data-state="playing"] .icon-pause,
.play-btn[data-state="done"]    .icon-replay {
  opacity: 1;
  transform: scale(1);
}

/* Range slider */
input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 24px;
  cursor: pointer;
  margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
}
input[type=range]::-moz-range-track {
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--ink);
  border-radius: 50%;
  margin-top: -6px;
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}
input[type=range]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--ink);
  border-radius: 50%;
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type=range]:active::-moz-range-thumb { transform: scale(1.25); }
input[type=range]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 4px rgba(26,24,20,0.18);
}
input[type=range]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 4px rgba(26,24,20,0.18);
}

.leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 6px 28px;
}
.runner-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 3px;
  transition: background var(--t-standard) var(--ease-out);
}
.runner-row.finished {
  background: var(--paper-deep);
}
.runner-dot-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  flex-shrink: 0;
}
.runner-name { color: var(--ink); font-weight: 500; min-width: 70px; }
.runner-dist { color: var(--muted); font-variant-numeric: tabular-nums; }
.runner-status {
  color: var(--muted);
  margin-left: auto;
  font-style: italic;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.runner-status.finished {
  color: var(--ink);
  font-weight: 600;
  font-style: normal;
}

/* Leaflet markers */
.runner-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.1);
  transition: transform 0.08s linear;
  position: relative;
}
.runner-marker::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: inherit;
  z-index: -1;
  animation: runner-pulse 2.8s ease-in-out infinite;
  opacity: 0.5;
}
@keyframes runner-pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}
.runner-marker.finished {
  animation: finish-flash 1.6s var(--ease-out) 1;
}
@keyframes finish-flash {
  0%   { box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.1), 0 0 0 0 rgba(255,255,255,0.85); }
  60%  { box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.1), 0 0 0 16px rgba(255,255,255,0); }
  100% { box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.1), 0 0 0 0 rgba(255,255,255,0); }
}

.km-marker {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  border-radius: 50%;
  width: 26px !important;
  height: 26px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background var(--t-standard) var(--ease-out), color var(--t-standard) var(--ease-out);
}
.km-marker.reached {
  background: var(--ink);
  color: var(--paper);
}
.km-marker.pulse {
  animation: km-pulse 720ms var(--ease-out) 1;
}
@keyframes km-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(26, 24, 20, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(26, 24, 20, 0); }
}

.start-marker {
  background: #4B7F52;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 18px !important;
  height: 18px !important;
}

/* Chip-rad */
.chip-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  margin-block: clamp(20px, 2.8vw, 36px);
  padding: 0;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1 1 auto; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.65rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.825rem;
  line-height: 1;
  transition: border-color 160ms ease, opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
@starting-style {
  .chip {
    opacity: 0;
    transform: scale(0.94);
  }
}
.chip[data-status="loading"] { color: var(--muted); }
.chip[data-status="error"] { color: #8b3a3a; border-color: #d9b8b3; background: var(--paper); }
.chip[data-status="dns"] { border-style: dashed; }
.chip[data-status="dns"] .chip-name,
.chip[data-status="dns"] .chip-no { color: var(--muted); }
.chip[data-status="dns"] .chip-dot { opacity: 0.4; }
.chip-badge {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.625rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: var(--muted-soft); color: var(--paper);
  line-height: 1;
}
.chip-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--ink);
}
.chip-spin {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--rule); border-top-color: var(--ink);
  animation: chip-spin 700ms linear infinite;
}
@keyframes chip-spin { to { transform: rotate(360deg); } }
.chip-err {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  background: #b22; color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip-name { font-weight: 500; color: var(--ink); }
.chip[data-status="loading"] .chip-name,
.chip[data-status="error"] .chip-name { color: inherit; }
.chip-no { color: var(--muted); font-size: 0.7rem; }
.chip-remove {
  width: 20px; height: 20px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms, color 120ms, transform var(--t-quick) var(--ease-out);
}
.chip-remove:hover { background: var(--rule); color: var(--ink); }
.chip-remove:active { transform: scale(0.88); }

.chip-input-wrap {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border: 1px dashed var(--muted-soft); border-radius: 999px;
  padding: 0.25rem 0.25rem 0.25rem 0.75rem;
  background: transparent;
  transition: border-color var(--t-quick) var(--ease-out), border-style var(--t-quick) var(--ease-out);
}
.chip-input-wrap:focus-within {
  border-style: solid;
  border-color: var(--ink);
}
.chip-input-wrap input {
  border: none; outline: none; background: transparent;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.825rem; width: 12ch; color: var(--ink);
}
.chip-input-wrap input::placeholder { color: var(--muted); }
.chip-input-wrap button {
  border: none; background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: 0.35rem 0.75rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem; cursor: pointer;
  transition: background var(--t-quick) var(--ease-out), transform var(--t-quick) var(--ease-out);
}
.chip-input-wrap button:hover { background: var(--ink-soft); }
.chip-input-wrap button:active { transform: scale(0.96); }
.chip-input-wrap.is-full { opacity: 0.5; border-style: solid; border-color: var(--rule); }
.chip-input-wrap input:disabled { cursor: not-allowed; }
.chip-input-wrap button:disabled { cursor: not-allowed; background: var(--muted-soft); }
.chip-input-wrap button:disabled:hover { background: var(--muted-soft); }

.chip-input-hint {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.empty-state {
  display: none;
  text-align: center;
  padding: clamp(2rem, 5vw, 4rem) 1rem;
}
.empty-state.shown { display: block; }
.empty-state h2 {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 0.75rem;
}
.empty-state p {
  color: var(--muted); font-size: 0.95rem; max-width: 42ch;
  margin: 0 auto;
}

.site-footer {
  text-align: center;
  padding: clamp(36px, 6vw, 64px) 1rem clamp(20px, 3vw, 36px);
  max-width: min(1440px, 100%);
  margin: 0 auto;
}
.site-footer p {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  .leaderboard { grid-template-columns: 1fr; }
  .speed-pills { display: none; }
  .speed-select { display: inline-block; }
  .clock-row { gap: 12px; }
  .scrub-row { gap: 12px; }
  .chip-input-wrap input { width: 11ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .runner-marker::before { display: none; }
}
