@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../reference/media/caa3a2e1cccd8315-s.p.0zr6hhvz-h9nw.woff2") format("woff2");
}

:root {
  --bg: #000;
  --surface: #0b0b0b;
  --surface-elevated: #161616;
  --surface-active: #1d1d1d;
  --primary: #f45b48;
  --color-primary: var(--primary);
  --text: #e5e7eb;
  --text-secondary: #b0b3b8;
  --text-muted: #909090;
  --line: rgba(255, 255, 255, .07);
  --grid: rgba(255, 255, 255, .08);
  --sidebar: 256px;
  --bar: 56px;
  --sans: Geist, "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Pretendard Variable", Pretendard, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; }
img { display: block; }
svg.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.icon-solid { fill: currentColor; stroke: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#content:focus { outline: none; }

.skip { position: fixed; top: -48px; left: 12px; z-index: 110; padding: 8px 16px; background: var(--surface-elevated); border-radius: 999px; }
.skip:focus { top: 12px; }

/* Sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  display: flex; flex-direction: column;
  width: var(--sidebar);
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.sidebar-head { display: flex; align-items: center; height: var(--bar); padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.nav { padding: 8px; overflow-y: auto; }
.nav-label { height: 28px; padding: 0 12px; display: flex; align-items: center; color: var(--text-muted); font: 600 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.nav ul { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.nav-link svg.icon { font-size: 18px; }
.nav-link:hover { background: var(--surface-elevated); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--surface-elevated); color: var(--text); }
.nav-link[aria-current="page"] svg.icon { color: var(--primary); }
.backdrop { display: none; }

/* Top bar */
.main { margin-left: var(--sidebar); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: var(--bar); padding: 0 24px;
  background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 15px; font-weight: 600; }
.menu-btn, .mobile-logo { display: none; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn:hover { background: var(--surface-elevated); }
.search {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; max-width: 288px; height: 36px; margin-left: auto;
  padding: 0 10px 0 14px;
  border-radius: 999px;
  background: var(--surface-elevated);
  transition: background-color .15s;
  cursor: text;
}
.search:focus-within { background: var(--surface-active); }
.search-icon { display: inline-flex; color: var(--text-muted); font-size: 16px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; caret-color: var(--primary); }
.search input::placeholder { color: var(--text-muted); }
.search input::-webkit-search-cancel-button { display: none; }
.keys { display: flex; gap: 4px; }
kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: var(--text-secondary); font: 500 10px/1 var(--sans); }

/* Content */
.content { width: 100%; max-width: 1536px; margin: 0 auto; padding: 24px; flex: 1; }
.notice {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 12px;
}
.notice b { flex: none; color: var(--primary); font-weight: 600; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; font-weight: 600; }
.month > .section-head h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: .9em;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--primary);
  vertical-align: -.08em;
}
.month { margin-top: 20px; }
.month + .month { margin-top: 32px; }
.month > .section-head h3 { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.more { color: var(--text-secondary); font-size: 13px; }
.more:hover { color: var(--text); }
.count { color: var(--text-muted); font: 12px var(--mono); }
.note { color: var(--text-muted); font-size: 12px; margin-top: 12px; }

/* Cards */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { padding: 20px; border-radius: 24px; background: var(--surface); }
.tile-label { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.tile-label svg.icon { font-size: 14px; }
.tile-value { margin-top: 12px; font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-value small { margin-left: 3px; color: var(--text-muted); font-size: 14px; font-weight: 500; letter-spacing: 0; }

/* Weekly bars */
.weeks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: 12px; }
.week-card { padding: 20px; border-radius: 24px; background: var(--surface); }
.week-title { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.week-total { margin-top: 6px; font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.week-total small { margin-left: 3px; color: var(--text-muted); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 16px; }
.week-col { display: flex; flex-direction: column; align-items: center; cursor: default; }
.week-track {
  display: flex; align-items: flex-end; justify-content: center;
  width: 100%; height: 88px;
  border-bottom: 1px solid var(--grid);
}
.week-bar { width: min(60%, 28px); border-radius: 4px 4px 0 0; background: var(--primary); transition: opacity .12s; }
.week-chart:hover .week-bar { opacity: .45; }
.week-chart .week-col:hover .week-bar { opacity: 1; }
.week-day { margin-top: 8px; color: var(--text-muted); font-size: 12px; }
.is-today .week-day { color: var(--text); font-weight: 700; }
.is-future .week-day { opacity: .5; }
.week-today {
  width: 0; height: 0; margin-top: 4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid var(--primary);
}

/* Races */
.race-filters { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 4px; }
.race-filters .chips { margin-bottom: 0; }
.race-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.race { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; border-radius: 24px; background: var(--surface); }
.race-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dday {
  display: inline-flex; align-items: center; flex: none;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--color-primary) 15%, transparent); color: var(--color-primary);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.race-region { color: var(--text-muted); font-size: 12px; }
.race-name { font-size: 16px; font-weight: 600; line-height: 1.35; }
.race-when { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.race-where { color: var(--text-secondary); font-size: 13px; }
.race-dists { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dist { height: 22px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-elevated); color: var(--text-secondary); font-size: 12px; }
.race-reg, .race-note { color: var(--text-muted); font-size: 12px; }
.race-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--primary); font-size: 13px; font-weight: 500; align-self: flex-start; }
.race-link:hover { text-decoration: underline; }
.race-link svg.icon { font-size: 13px; }
.next-race { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-radius: 24px; background: var(--surface); transition: background-color .15s; }
.next-race:hover { background: var(--surface-elevated); }
.next-race-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.next-race-body b { font-size: 15px; font-weight: 600; }
.next-race-body small { color: var(--text-secondary); font-size: 13px; }

/* Shoe mileage */
.more-btn { padding: 0; border: 0; background: none; cursor: pointer; }
.toolbar-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.shoe-card { padding: 8px 20px 16px; border-radius: 24px; background: var(--surface); }
.shoe-row { display: grid; grid-template-columns: 44px 1fr 84px; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.shoe-row:first-child { border-top: 0; }
.shoe-thumb {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; overflow: hidden;
  border-radius: 50%; background: #ececec; color: #555; font-size: 18px;
}
.shoe-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shoe-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.shoe-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.shoe-bar { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-active); }
.shoe-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.gear-card-body .shoe-bar, .run > .shoe-bar { width: 70%; margin: 6px auto 0; }
.shoe-km { text-align: right; white-space: nowrap; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.shoe-km small { margin-left: 2px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.shoe-foot { margin-top: 6px; color: var(--text-muted); font-size: 12px; }
.gear-km { margin-top: 6px; color: var(--primary); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dialog-wide { width: min(560px, calc(100vw - 32px)); }
.shoe-runs { display: flex; flex-direction: column; max-height: 44dvh; overflow-y: auto; border-top: 1px solid var(--line); }
.shoe-run { display: grid; grid-template-columns: 1fr minmax(120px, 44%); align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.shoe-run-info { min-width: 0; color: var(--text-secondary); }
.shoe-run-info b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.shoe-run select, .run-shoe select {
  width: 100%; height: 36px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 10px; outline: 0;
  background: var(--surface-elevated); color: var(--text); font: inherit; font-size: 13px;
}
.shoe-run select:focus, .run-shoe select:focus { border-color: var(--primary); }
.run-shoe { margin-top: 14px; }
.run-shoe-field { max-width: 320px; }
.run-shoe-text { color: var(--text-secondary); font-size: 13px; }

/* This week's training plan */
.plan-card { padding: 12px 20px; border-radius: 24px; background: var(--surface); }
.plan-list { display: flex; flex-direction: column; }
.plan-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 12px; margin: 0 -12px;
  border-top: 1px solid var(--line);
}
.plan-row:first-child { border-top-color: transparent; }
.can-edit .plan-row { grid-template-columns: 44px 1fr auto 32px; }
.plan-row.is-today { border-radius: 14px; border-top-color: transparent; background: var(--surface-elevated); }
.plan-row.is-today + .plan-row { border-top-color: transparent; }
.plan-day b { display: block; font-size: 14px; font-weight: 600; }
.plan-day small { display: block; color: var(--text-muted); font: 11px var(--mono); }
.is-today .plan-day b { color: var(--primary); }
.plan-what { min-width: 0; }
.plan-type { display: block; font-size: 14px; font-weight: 600; }
.plan-type.is-rest { color: var(--text-secondary); font-weight: 500; }
.plan-note { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-empty { color: var(--text-muted); font-size: 13px; }
.plan-status { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plan-status.done { color: var(--primary); font-weight: 600; }
.plan-status.missed { color: var(--text-secondary); }
.plan-edit { display: inline-flex; width: 32px; height: 32px; font-size: 15px; color: var(--text-muted); }
.plan-edit:hover { color: var(--text); }
.field select {
  width: 100%; height: 40px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 12px; outline: 0;
  background: var(--surface-elevated); color: var(--text);
  font: inherit; font-size: 14px;
}
.field select:focus { border-color: var(--primary); }
.field input:disabled { opacity: .45; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.run {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 176px; padding: 16px 12px;
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
  transition: background-color .15s;
}
.run:hover { background: var(--surface-elevated); }
.run-icon { display: inline-flex; color: var(--text); font-size: 26px; }
.run:hover .run-icon { color: var(--primary); animation: stride .55s ease-in-out 2; }
.run-km { margin-top: 12px; font-size: 24px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.run-km small { margin-left: 3px; color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.run-meta { margin-top: 6px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.run-name { margin-top: 8px; color: var(--text-muted); font: 12px var(--mono); }
@keyframes stride {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-3px) rotate(-8deg); }
  75% { transform: translateX(3px) rotate(8deg); }
}

.empty { padding: 56px 16px; border-radius: 24px; background: var(--surface); color: var(--text-muted); text-align: center; }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 12px; }
.chart-card { padding: 20px; border-radius: 24px; background: var(--surface); min-width: 0; }
.chart-card h2 { font-size: 14px; font-weight: 600; }
.chart-sub { color: var(--text-muted); font-size: 12px; }
.chart { position: relative; height: 240px; margin-top: 12px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart text.value { fill: var(--text); font-size: 14px; font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--primary); transition: opacity .12s; }
.chart.hovering .bar:not(.on) { opacity: .4; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--text-muted); stroke-width: 1; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-active);
  border: 1px solid var(--line);
  font-size: 12px; line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tooltip b { display: block; font-weight: 600; }
.tooltip span { color: var(--text-secondary); }

.stats-table { margin-top: 12px; }
.table-wrap { margin-top: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th { color: var(--text-muted); font-weight: 500; border-top: 0; }

/* Personal bests */
.best-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.best { padding: 20px; border-radius: 24px; background: var(--surface); }
.best-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.best-head svg.icon { color: var(--primary); font-size: 18px; }
.best-time { margin-top: 16px; font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.best-time.none { color: var(--text-muted); font-size: 18px; font-weight: 500; letter-spacing: 0; line-height: 37px; }
.best-meta { margin-top: 8px; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.best-name { margin-top: 4px; color: var(--text-muted); font: 12px var(--mono); }

/* Route map */
.run-open {
  position: absolute; inset: 0;
  border: 0; border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.run-open:focus-visible { outline-offset: -2px; }
.dialog-map { width: min(760px, calc(100vw - 32px)); padding: 20px; }
.map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.map-head .icon-btn { display: inline-flex; flex: none; margin: -4px -4px 0 0; }
.run-map { height: min(56dvh, 420px); border-radius: 16px; overflow: hidden; background: #e8e8e4; isolation: isolate; }
.run-map .maplibregl-ctrl-attrib { font-size: 10px; color: #333; }
.map-error { display: flex; height: 100%; align-items: center; justify-content: center; padding: 16px; color: #333; font-size: 13px; text-align: center; }
.run-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 0; }
.run-stats div { min-width: 0; }
.run-stats dt { color: var(--text-muted); font-size: 12px; }
.run-stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Gear */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.chip {
  height: 32px; padding: 0 14px;
  border: 0; border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.chip:hover { background: var(--surface-active); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary); color: #fff; font-weight: 600; }
.gear-note { margin-top: 2px; color: var(--text-muted); font-size: 12px; }
/* Photos sit in a ring that rises above the card, so rows need extra room on top. */
.gear-grid { row-gap: 32px; padding-top: 16px; }
.run.has-photo { justify-content: flex-start; padding-top: 0; }
.gear-photo {
  display: block; flex: none;
  width: 86px; height: 86px;
  margin-top: -15px;
  /* White gap inside a thin brand ring, like a profile badge. */
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--primary), 0 4px 12px rgba(0, 0, 0, .35);
  object-fit: cover;
  background: #ececec;
}
.gear-card-body { width: 100%; padding-top: 12px; }
.has-photo .run-km { margin-top: 0; }
.photo-field { display: flex; align-items: center; gap: 14px; }
.photo-preview {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 88px; height: 88px;
  border-radius: 14px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 26px;
  overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.gear-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.gear-toolbar .chips { margin-bottom: 0; }
.run { position: relative; }
.edit-btn {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--text-muted);
  font-size: 15px; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.edit-btn:hover { background: var(--surface-active); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  height: 36px; padding: 0 16px;
  border: 0; border-radius: 999px;
  background: var(--surface-elevated); color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-active); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #f6715f; }
.btn-danger { margin-right: auto; background: transparent; color: var(--primary); }

.dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dialog h2 { font-size: 16px; font-weight: 600; }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.form-hint { padding: 8px 12px; border-radius: 12px; background: var(--surface-elevated); color: var(--text-secondary); font-size: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--text-secondary); font-size: 12px; }
.field input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 12px;
  outline: 0;
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit; font-size: 14px;
  caret-color: var(--primary);
}
.field input:focus { border-color: var(--primary); background: var(--surface-active); }
.form-error { color: var(--primary); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Phones: the sidebar becomes a drawer and search takes its own row. */
@media (max-width: 639px) {
  .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .2s ease, visibility .2s;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .backdrop { position: fixed; inset: 0; z-index: 55; display: block; border: 0; background: rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .topbar { flex-wrap: wrap; height: auto; padding: 0 16px 10px; gap: 0 8px; }
  .menu-btn { display: inline-flex; margin: 10px 0 0 -8px; }
  .mobile-logo { display: block; margin-top: 10px; }
  .page-title { margin: 10px 0 0 auto; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
  .search { flex: 0 0 100%; max-width: none; margin: 10px 0 0; }
  .keys { display: none; }
  .content { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tile-value { font-size: 24px; }
  .run-stats { grid-template-columns: repeat(2, 1fr); }
  .week-last { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.next-race-go { display: inline-flex; margin-left: auto; color: var(--text-muted); font-size: 18px; }
.next-race:hover .next-race-go { color: var(--primary); }
.home-pair { display: grid; grid-template-columns: 1fr; gap: 32px 16px; margin-top: 32px; }
.home-pair > .section { display: flex; flex-direction: column; margin-top: 0; }
/* Side by side, the shoe card takes the training plan's height and scrolls when shoes outgrow it. */
@media (min-width: 1080px) {
  .home-pair { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .home-pair .shoe-card { display: flex; flex-direction: column; flex: 1; min-height: 0; contain: size; }
  .home-pair .shoe-list { flex: 1; min-height: 0; overflow-y: auto; margin-right: -12px; padding-right: 12px; scrollbar-width: thin; scrollbar-color: var(--surface-active) transparent; }
}
.ext-arrow { transform-box: view-box; }
.next-race:hover .ext-arrow, .next-race:focus-visible .ext-arrow { animation: ext-nudge .6s ease-in-out; }
@keyframes ext-nudge {
  0% { transform: translate(0, 0); }
  40% { transform: translate(1.5px, -1.5px); }
  75% { transform: translate(-0.4px, 0.4px); }
  100% { transform: translate(0, 0); }
}

/* Footer */
.site-footer { margin-top: 48px; padding: 24px 24px 40px; text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 32px; }
.footer-nav a, .footer-note a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 14px; transition: color .15s; }
.footer-nav a:hover, .footer-note a:hover { color: var(--text); }
.footer-note { margin-top: 24px; color: var(--text-muted); font-size: 14px; text-wrap: balance; }
.footer-note a.footer-name { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; white-space: nowrap; }
.footer-note a.footer-name:hover { color: var(--primary); opacity: .85; }
.footer-nav svg.icon { font-size: 14px; }
@media (max-width: 639px) {
  .site-footer { margin-top: 32px; padding: 24px 16px 32px; }
  .footer-nav { gap: 12px 20px; }
}

/* Large faded wordmark closing the page. Sized to the footer width so the sidebar never pushes it off screen. */
.site-footer { container-type: inline-size; padding-bottom: 0; }
.footer-wordmark { margin-top: 40px; padding: 0 8px; overflow: hidden; pointer-events: none; user-select: none; }
.footer-wordmark span {
  display: block;
  font-size: min(17cqw, 17rem);
  font-weight: 700;
  line-height: .78;
  white-space: nowrap;
  text-align: center;
  color: transparent;
  background: linear-gradient(to bottom, rgba(229, 231, 235, .22), rgba(229, 231, 235, .00));
  -webkit-background-clip: text;
  background-clip: text;
}

/* Footer external links: the arrow darts up-right and settles back on hover. */
.foot-arrow { transform-box: fill-box; transform-origin: 50% 50%; }
.footer-nav a:hover .foot-arrow, .footer-nav a:focus-visible .foot-arrow { animation: foot-nudge .6s ease-in-out; }
@keyframes foot-nudge {
  0% { transform: translate(0, 0); }
  40% { transform: translate(3px, -3px); }
  75% { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}

/* Several races on the same day stack as rows inside one card. */
.next-races { display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: var(--surface); }
.next-races .next-race { border-radius: 0; background: transparent; }
.next-races .next-race + .next-race { border-top: 1px solid var(--line); }
.next-races .next-race:hover { background: var(--surface-elevated); }

/* Plus icons spin a quarter turn with a small pop when their button is hovered. */
.plus-pop { transform-box: view-box; transform-origin: 12px 12px; }
button:hover .plus-pop, button:focus-visible .plus-pop { animation: plus-pop .5s ease-in-out forwards; }
@keyframes plus-pop {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(45deg) scale(1.2); }
  100% { transform: rotate(90deg) scale(1); }
}

/* Home shoe gauges fill from empty, one row after another. */
.shoe-card .shoe-bar > span { transform-origin: left center; animation: gauge-fill .9s cubic-bezier(.33, 1, .68, 1) both; animation-delay: calc(var(--i, 0) * 80ms); }
.shoe-card .shoe-row { --i: 0; }
.shoe-card .shoe-row .shoe-bar > span { animation-delay: calc(var(--i) * 80ms); }
@keyframes gauge-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Stats charts on entry: bars rise from the baseline, the pace line draws left to right, then its dots pop in. */
.chart.enter .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-rise .7s cubic-bezier(.33, 1, .68, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.chart.enter .line { stroke-dasharray: 1; animation: line-draw 1s ease-out both; }
.chart.enter .dot { transform-box: fill-box; transform-origin: center; animation: dot-pop .35s ease-out both; animation-delay: calc(250ms + var(--i, 0) * 90ms); }
.chart.enter text.value { animation: value-in .4s ease-out .7s both; }
@keyframes bar-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes line-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dot-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes value-in { from { opacity: 0; } to { opacity: 1; } }

/* Home weekly bars rise from the baseline, Monday first. */
.week-bar { transform-origin: 50% 100%; animation: bar-rise .7s cubic-bezier(.33, 1, .68, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }

/* Heart rate */
.chart-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.run-stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 639px) { .run-stats { grid-template-columns: repeat(2, 1fr); } }

/* Online admin mode (/admin) */
.admin-pill {
  flex: none; height: 28px; padding: 0 12px; margin-left: 10px;
  display: inline-flex; align-items: center; border-radius: 999px;
  background: color-mix(in oklab, var(--color-primary) 15%, transparent); color: var(--color-primary);
  font-size: 12px; font-weight: 600; text-decoration: none;
}
.run-upload { position: relative; margin-left: auto; cursor: pointer; }
.run-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.run-upload:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.run-upload-status {
  white-space: pre-line; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); color: var(--text-secondary); font-size: 13px; line-height: 1.6;
}
.run-delete { margin-top: 14px; padding: 0; height: auto; }
