/* runphilio: the training program as one metro line.
   Midnight enamel ground, raised navy panels split by hairline seams, porcelain type.
   Four line inks with fixed meaning: green Base, amber Build, scarlet Peak, cobalt Taper.
   Session types borrow them: easy/recovery green, gym/drills amber, tempo/interval scarlet, long cobalt.
   State is drawn with station glyphs: filled dot (done), half dot (partial), hollow ring (upcoming),
   interchange ring (today), scarlet diamond (missed). Light theme = the printed porcelain station map. */

@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/hanken-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/hanken-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --ground: #0a1430;
  --panel: #101d42;
  --panel-2: #172857;
  --seam: #2a3f7a;
  --seam-2: #3d5598;
  --ink: #f2f4f7;
  --ink-2: #aab6d6;
  --ink-3: #8794bb;
  --base: #22b14c;  --base-ink: #4fd47a;
  --build: #ffc20e; --build-ink: #ffd25a;
  --peak: #ff3d4a;  --peak-ink: #ff7c84;
  --peak-fill: #d41f2e;
  --taper: #4c7dff; --taper-ink: #8eaeff;
  --unplanned: #5b6b9c;
  --heat-0: color-mix(in srgb, var(--ink) 7%, var(--panel)); --heat-1: color-mix(in srgb, var(--ink) 28%, var(--panel));
  --heat-2: color-mix(in srgb, var(--ink) 50%, var(--panel)); --heat-3: color-mix(in srgb, var(--ink) 75%, var(--panel)); --heat-4: var(--ink);
  --shadow: none;
  --r: 6px; --r-sm: 4px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --ease: cubic-bezier(.16, 1, .3, 1);
  --rail-w: 236px;
}
@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) {
    color-scheme: light;
    --ground: #f6f7f9; --panel: #fcfcfd; --panel-2: #eef0f5; --seam: #c3cbdd; --seam-2: #9ba7c4;
    --ink: #0b1533; --ink-2: #47526f; --ink-3: #5d6888;
    --base: #16a043; --base-ink: #0d7a31; --build: #f2b100; --build-ink: #845b00;
    --peak: #e21d2d; --peak-ink: #b8121f; --peak-fill: #d41f2e; --taper: #1e5bff; --taper-ink: #1747c7; --unplanned: #9aa6c4;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f6f7f9; --panel: #fcfcfd; --panel-2: #eef0f5; --seam: #c3cbdd; --seam-2: #9ba7c4;
  --ink: #0b1533; --ink-2: #47526f; --ink-3: #5d6888;
  --base: #16a043; --base-ink: #0d7a31; --build: #f2b100; --build-ink: #845b00;
  --peak: #e21d2d; --peak-ink: #b8121f; --peak-fill: #d41f2e; --taper: #1e5bff; --taper-ink: #1747c7; --unplanned: #9aa6c4;
}

/* ink roles: a session type or phase picks one */
.ink-base, .t-easy, .t-recovery { --c: var(--base); --c-ink: var(--base-ink); }
.ink-build, .t-gym, .t-drills { --c: var(--build); --c-ink: var(--build-ink); }
.ink-peak, .t-tempo, .t-interval { --c: var(--peak); --c-ink: var(--peak-ink); }
.ink-taper, .t-long { --c: var(--taper); --c-ink: var(--taper-ink); }
.t-race { --c: var(--ink); --c-ink: var(--ink); }
.t-rest, .t-custom { --c: var(--seam-2); --c-ink: var(--ink-2); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--ground); scrollbar-color: var(--seam-2) var(--ground); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--font); font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased; caret-color: var(--taper); accent-color: var(--taper); }
::selection { background: var(--taper); color: #fff; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 3px; }
a, button, summary, select, label:has(input) { cursor: pointer; }
:focus-visible { outline: 2px solid var(--taper-ink); outline-offset: 2px; border-radius: 6px; }
code { font: .88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.num, td.r, .fig { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--panel); padding: 10px 14px; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.unit { font-size: max(.42em, 12px); font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: .15em; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.rail {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; align-items: stretch; gap: 0;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--seam);
  padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.brand { display: none; }
.nav { display: flex; flex: 1; }
.nav a, .tool {
  flex: 1; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; padding: 4px 2px;
  text-decoration: none; color: var(--ink-2); font: 600 11px/1.2 var(--font); letter-spacing: .02em;
  border: 0; background: none; border-radius: var(--r-sm); position: relative;
}
.nav a:hover, .tool:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] .ico { color: var(--peak); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; top: -5px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--peak); }
.rail-tools { display: flex; }
.rail-tools .tool { min-width: 60px; }
.tool-txt { font-size: 11px; }
.logout { display: none; }
.main {
  width: 100%; max-width: 1280px; min-width: 0;
  padding: calc(16px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: grid; gap: 16px; align-content: start; grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .rail {
    top: 0; right: auto; width: 88px; flex-direction: column; align-items: stretch; gap: 18px;
    border-top: 0; border-right: 1px solid var(--seam); background: var(--panel);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    padding: calc(18px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .brand { display: flex; justify-content: center; text-decoration: none; padding: 4px 0 6px; }
  .brand span { display: none; }
  .brand-mark { width: 40px; height: 40px; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
  .nav { flex-direction: column; flex: 1; gap: 4px; }
  .nav a, .tool { flex: none; min-height: 60px; font-size: 12px; }
  .nav a:hover, .tool:hover { background: var(--panel-2); }
  .nav a[aria-current="page"] { background: var(--panel-2); }
  .nav a[aria-current="page"]::after { top: 14px; bottom: 14px; left: -10px; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .rail-tools { flex-direction: column; gap: 4px; }
  .logout { display: block; }
  .logout .tool { width: 100%; }
  .shell { padding-left: 88px; }
  .main { padding: calc(28px + env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 56px 28px; gap: 20px; }
}
@media (min-width: 1100px) {
  .rail { width: var(--rail-w); padding: 28px 16px 20px; gap: 26px; }
  .brand { justify-content: flex-start; align-items: center; gap: 10px; padding: 0 8px; }
  .brand span { display: inline; font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
  .brand-mark { width: 34px; height: 34px; }
  .nav a, .tool { display: flex; justify-content: flex-start; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; font-size: 15px; letter-spacing: 0; }
  .nav a[aria-current="page"]::after { top: 10px; bottom: 10px; left: -16px; }
  .tool-txt { font-size: 14px; }
  .shell { padding-left: var(--rail-w); }
  .main { padding: 36px 44px 64px; gap: 22px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px 20px; padding: 4px 2px 2px; }
.page-head h1 { font-size: clamp(30px, 5.2vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.crumb:hover { color: var(--ink); }
.crumb .ico { width: 18px; height: 18px; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--base); box-shadow: 0 0 0 3px color-mix(in srgb, var(--base) 25%, transparent); }
.sync.is-stale::before { background: var(--build); box-shadow: 0 0 0 3px color-mix(in srgb, var(--build) 25%, transparent); }
.sync.is-bad::before { background: var(--peak); box-shadow: 0 0 0 3px color-mix(in srgb, var(--peak) 25%, transparent); }
.sync.is-stale { color: var(--build-ink); } .sync.is-bad { color: var(--peak-ink); }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--seam-2); border-radius: var(--r); padding: 18px; min-width: 0; display: grid; gap: 14px; align-content: start; box-shadow: var(--shadow); }
@media (min-width: 768px) { .panel { padding: 22px; } }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.panel-head h2 { font-size: 13px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.panel-head p { color: var(--ink-2); font-size: 14px; }
.panel-head .link { font-size: 14px; }
.empty { color: var(--ink-2); padding: 6px 0; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 > :first-child { grid-column: 1 / -1; } .grid-3, .grid-2 { gap: 20px; } }
@media (min-width: 1100px) { .grid-3 { grid-template-columns: 1.25fr 1fr 1fr; } .grid-3 > :first-child { grid-column: auto; } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* big figures */
.fig { font-weight: 800; letter-spacing: -.035em; line-height: .95; }
.fig-xl { font-size: clamp(48px, 9vw, 76px); }
.fig-l { font-size: clamp(36px, 6vw, 48px); }
.fig-m { font-size: 28px; letter-spacing: -.02em; }
.delta { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--base-ink); } .delta.down { color: var(--peak-ink); } .delta.flat { color: var(--ink-2); }

/* key–value rows ("departure board") */
.rows { display: grid; }
.rows > div, .rows > li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--seam); }
.rows > :first-child { border-top: 0; padding-top: 0; }
.rows dt, .rows .k { color: var(--ink-2); font-size: 14px; }
.rows dd, .rows .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.rows .v small, .rows dd small { font-weight: 600; color: var(--ink-2); font-size: 13px; margin-left: 6px; }

/* ---------- THE LINE (signature) ---------- */
.line-panel { padding: 0; overflow: hidden; gap: 0; }
.line-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 24px; padding: 18px 18px 0; }
@media (min-width: 768px) { .line-top { padding: 22px 24px 0; } }
.line-title { display: grid; gap: 4px; }
.line-title h2 { font-size: clamp(20px, 3vw, 26px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.line-title p { color: var(--ink-2); font-size: 14px; }
.countdown { display: flex; align-items: baseline; gap: 10px; }
.countdown .fig { font-size: clamp(44px, 7vw, 64px); color: var(--ink); }
.countdown span { color: var(--ink-2); font-weight: 600; line-height: 1.2; }
.line-wrap { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding: 0 0 6px; }
.line { --lw: 8px; --ly: 80px; position: relative; min-width: 760px; height: 150px; margin: 0 40px 0 32px; }
@media (min-width: 768px) { .line { min-width: 600px; } }
.track, .leg, .passed { position: absolute; top: calc(var(--ly) - var(--lw) / 2); height: var(--lw); border-radius: calc(var(--lw) / 2); }
.track { left: 0; right: 0; height: 0; border-top: var(--lw) dashed var(--unplanned); border-radius: 0; }
.line.is-planned .track { border-top-style: solid; border-top-color: color-mix(in srgb, var(--unplanned) 45%, transparent); }
.leg { background: var(--c); border-radius: 0; }
.leg.is-first { border-radius: calc(var(--lw) / 2) 0 0 calc(var(--lw) / 2); }
.leg.is-last { border-radius: 0 calc(var(--lw) / 2) calc(var(--lw) / 2) 0; }
.leg-label { position: absolute; top: calc(var(--ly) + 20px); padding-left: 2px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink); white-space: nowrap; }
.leg-label small { display: block; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--ink-2); }
.tick { position: absolute; top: calc(var(--ly) + var(--lw) / 2 + 3px); width: 1.5px; height: 5px; margin-left: -.75px; background: var(--seam-2); }
.passed { left: 0; z-index: 1; background: var(--ink); }
.line:not(.is-planned) .passed { background: var(--ink-2); }
.stn, .here, .term, .origin { position: absolute; z-index: 2; top: var(--ly); width: 0; height: 0; }
.stn i, .here i, .term i, .origin i { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: block; border-radius: 50%; box-sizing: border-box; }
.origin i { width: 16px; height: 16px; background: var(--panel); border: 4px solid var(--ink); }
.stn i { width: 18px; height: 18px; background: var(--panel); border: 4px solid var(--ink); }
.stn.is-past i { background: var(--ink); }
.stn.is-quiet i { width: 12px; height: 12px; border-width: 3px; }
.term i { width: 30px; height: 30px; background: var(--panel); border: 7px solid var(--ink); }
.here i { width: 24px; height: 24px; background: var(--peak-fill); border: 4px solid var(--ink); }
.stn b, .term b, .here b { position: absolute; white-space: nowrap; font-size: 13px; font-weight: 700; }
.stn b { left: 0; transform: translateX(-50%); bottom: 18px; text-align: center; }
.stn small, .term small { display: block; font-weight: 600; color: var(--ink-2); font-size: 12px; }
.term b { right: -15px; bottom: 24px; text-align: right; }
.here b { left: -12px; bottom: 20px; background: var(--peak-fill); color: #fff; padding: 3px 9px; border-radius: 999px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.origin b { display: none; }
.line-foot { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 18px 18px; color: var(--ink-2); font-size: 14px; border-top: 1px solid var(--seam); padding-top: 14px; }
@media (min-width: 768px) { .line-foot { padding: 14px 24px 20px; } }
.line-foot strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.line-foot .link { margin-left: auto; }
/* one authored moment: the line draws itself, then the station settles */
@media (prefers-reduced-motion: no-preference) {
  .line .passed { animation: draw .9s var(--ease) both; transform-origin: left center; }
  .line .here i { animation: arrive .7s .55s var(--ease) both; }
  @keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
  @keyframes arrive { from { transform: translate(-50%, -50%) scale(.4); } to { transform: translate(-50%, -50%) scale(1); } }
}

/* ---------- station glyphs (status) ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--ink); }
.st-g { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2.5px solid var(--ink-3); background: transparent; }
.st-done .st-g { background: var(--ink); border-color: var(--ink); }
.st-partial .st-g { border-color: var(--ink); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.st-missed .st-g { border: 0; border-radius: 2px; transform: rotate(45deg) scale(.85); background: var(--peak); }
.st-missed { color: var(--peak-ink); }
.st-skipped .st-g { background: linear-gradient(135deg, transparent 42%, var(--ink-3) 42% 58%, transparent 58%); }
.st-skipped, .st-upcoming, .st-unmarked, .st-rest { color: var(--ink-2); }
.st-today .st-g { width: 14px; height: 14px; border: 3px solid var(--ink); background: var(--peak); }
.st-rest .st-g { border: 0; border-radius: 2px; height: 3px; background: var(--ink-3); }

/* session type chip: a short piece of line in the session's ink */
.type { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--c-ink); white-space: nowrap; }
.type::before { content: ""; width: 16px; height: 5px; border-radius: 3px; background: var(--c); }

/* ---------- Today panels ---------- */
.now { gap: 16px; }
.now-session { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--seam); }
.now-session:last-of-type { border-bottom: 0; padding-bottom: 0; }
.now-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.now-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink-2); font-size: 14px; }
.now-meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.ready { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--seam); border-radius: var(--r-sm); overflow: hidden; }
.ready > div { padding: 10px 12px; display: grid; gap: 2px; border-right: 1px solid var(--seam); border-bottom: 1px solid var(--seam); }
.ready > div:nth-child(2n) { border-right: 0; } .ready > div:nth-last-child(-n+2) { border-bottom: 0; }
.ready b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ready small { color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.run-hero { display: grid; gap: 6px; }
.run-name { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.when { color: var(--ink-2); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 11px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--seam); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips li span { color: var(--ink-2); font-weight: 600; margin-right: 4px; }
.note { color: var(--ink-2); font-style: italic; }
.bar { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; position: relative; }
.bar span { position: absolute; inset: 0 auto 0 0; background: var(--taper); border-radius: 4px; }
.bar .plan { background: none; border-right: 2px solid var(--ink); border-radius: 0; }

/* ---------- week as stations ---------- */
.stops { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: relative; gap: 0; }
.stops::before { content: ""; position: absolute; left: calc(100% / 14); right: calc(100% / 14); top: 32px; height: 6px; border-radius: 3px; background: var(--seam-2); }
.stop { position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; padding: 0 2px; min-width: 0; text-decoration: none; }
.stop-day { height: 18px; line-height: 18px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.stop.is-today .stop-day { color: var(--ink); }
.stop-dot { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: var(--ground); border: 4px solid var(--c, var(--seam-2)); }
.stop.st-done .stop-dot, .stop.st-partial .stop-dot { background: var(--c, var(--ink)); }
.stop.st-partial .stop-dot { background: linear-gradient(90deg, var(--c) 50%, var(--ground) 50%); }
.stop.st-missed .stop-dot { border-color: var(--peak); border-radius: 4px; transform: rotate(45deg) scale(.85); }
.stop.is-today .stop-dot { width: 30px; height: 30px; margin: -4px 0; border-width: 5px; border-color: var(--ink); background: var(--peak); }
.stop.st-rest .stop-dot { width: 12px; height: 12px; margin: 5px 0; border-width: 3px; }
.stop-km { font-weight: 800; font-size: 17px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stop-km small { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stop-what { font-size: 12px; color: var(--ink-2); line-height: 1.25; overflow-wrap: anywhere; max-width: 100%; }
a.stop:hover .stop-km { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 420px) { .stop-what { display: none; } .stop-km { font-size: 15px; } }

/* ---------- totals strip ---------- */
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.totals > div { padding: 14px 4px 14px 0; display: grid; gap: 4px; border-top: 1px solid var(--seam); }
.totals > div:nth-child(-n+2) { border-top: 0; padding-top: 0; }
@media (min-width: 1100px) { .totals { grid-template-columns: repeat(4, minmax(0, 1fr)); } .totals > div { border-top: 0; padding: 0 16px; border-left: 1px solid var(--seam); } .totals > div:first-child { border-left: 0; padding-left: 0; } }
.totals small { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }

/* ---------- charts ---------- */
.chart { position: relative; height: 280px; width: 100%; }
.chart-sm { height: 230px; }
.chart-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 14px; text-align: center; padding: 16px; }
.table-view summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--taper-ink); font-weight: 700; }
.table-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--seam); border-radius: var(--r-sm); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--seam); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); color: var(--ink-2); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:hover td { background: var(--panel-2); }
.r { text-align: right; }
td.wrap { white-space: normal; min-width: 220px; }

/* ---------- best efforts: a timetable ---------- */
.board { display: grid; }
.board li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--seam); }
.board li:first-child { border-top: 0; padding-top: 0; }
.board .dist { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.board .time { display: grid; justify-items: end; font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: right; line-height: 1.1; }
.board .time .unit { margin: 2px 0 0; font-size: 12px; }
.board .where { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.board .where b { color: var(--ink); font-weight: 600; }
@media (max-width: 520px) { .board li { grid-template-columns: minmax(0, 1fr) auto; } .board .where { grid-column: 1 / -1; } }

/* heatmap */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { display: grid; grid-auto-flow: column; grid-template-columns: 30px; grid-auto-columns: minmax(12px, 1fr); gap: 3px; min-width: 430px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 11px; color: var(--ink-2); padding-right: 4px; }
.heat-days span { display: flex; align-items: center; line-height: 1; }
.heat-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--heat-0); }
.cell.lv1 { background: var(--heat-1); } .cell.lv2 { background: var(--heat-2); } .cell.lv3 { background: var(--heat-3); } .cell.lv4 { background: var(--heat-4); }
.cell.future { background: transparent; box-shadow: inset 0 0 0 1px var(--seam); }
.legend-row { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 13px; color: var(--ink-2); }
.legend-row .cell { width: 12px; display: inline-block; }

/* shoes */
.shoes { display: grid; gap: 14px; }
.shoe { display: grid; gap: 8px; }
.shoe-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.shoe-name { font-weight: 700; overflow-wrap: anywhere; }
.shoe-km { font-size: 20px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--build); }
.meter.is-worn span { background: var(--peak); }

/* this week's activities */
.acts { display: grid; }
.act { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--seam); }
.act:first-child { border-top: 0; padding-top: 0; }
.act-name { font-weight: 700; overflow-wrap: anywhere; }
.act-sub { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); }
.act-stats { display: grid; justify-items: end; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.act-stats b { color: var(--ink); font-size: 15px; }

/* tooltip */
.tip { position: fixed; z-index: 40; pointer-events: none; max-width: 260px; padding: 7px 10px; font-size: 13px; background: var(--panel-2); color: var(--ink); border: 1px solid var(--seam-2); border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- buttons, links, forms ---------- */
.link { color: var(--taper-ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.link:hover { text-decoration: underline; }
.link .ico { width: 18px; height: 18px; }
.btn { font: inherit; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--peak-fill); color: #fff; text-decoration: none; transition: transform .15s var(--ease), background-color .15s; }
.btn:hover { background: color-mix(in srgb, var(--peak-fill) 88%, #000); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--seam-2); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-danger { background: transparent; color: var(--peak-ink); border-color: var(--peak); }
.btn-danger:hover, .btn-danger:focus-visible { background: var(--peak-fill); color: #fff; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--seam-2); color: var(--ink); text-decoration: none; background: transparent; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn .ico { width: 20px; height: 20px; }
.form { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; align-content: start; }
.field.wide, .actions.wide, .form-err { grid-column: 1 / -1; }
.field > label, legend { font-size: 14px; font-weight: 700; padding: 0; }
.sub-label { font-size: 13px; color: var(--ink-2); }
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--ground); width: 100%; min-height: 46px;
  border: 1px solid var(--seam-2); border-radius: var(--r-sm); padding: 9px 12px;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--taper); }
input[aria-invalid="true"] { border-color: var(--peak); border-width: 2px; }
input[type="date"], input[type="time"] { color-scheme: inherit; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 13px; border: 1px solid var(--seam-2); border-radius: 999px; font-size: 14px; font-weight: 600; }
.seg label:hover { background: var(--panel-2); }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--ground); }
.seg input { width: 16px; height: 16px; margin: 0; accent-color: var(--peak); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--taper-ink); outline-offset: 2px; }
.err, .form-err { color: var(--peak-ink); font-size: 14px; font-weight: 700; }
.hint { font-size: 13px; color: var(--ink-2); }
.actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.repeat-box { border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 14px; }
.rep-detail { display: grid; gap: 8px; margin-top: 8px; }
.narrow { max-width: 120px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form-compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
/* destructive actions live apart, outlined until chosen */
.danger-zone { border-color: color-mix(in srgb, var(--peak) 45%, var(--seam)); }
.danger-zone summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--peak-ink); font-weight: 700; }
.del-confirm { display: grid; gap: 14px; justify-items: start; padding-top: 10px; }
.notice { padding: 14px 18px; font-weight: 700; border-color: color-mix(in srgb, var(--base) 50%, var(--seam)); }
.notice-err { color: var(--peak-ink); border-color: var(--peak); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 14px !important; font-family: ui-monospace, monospace !important; }
.steps { padding-left: 22px; display: grid; gap: 8px; list-style: decimal; }

section[id], article[id], li[id] { scroll-margin-top: 16px; }

/* ---------- program ---------- */
.subnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--panel); border: 1px solid var(--seam); border-radius: 999px; width: max-content; max-width: 100%; }
.subnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--ink); color: var(--ground); }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; min-width: 0; }
.wk-sum { display: grid; min-width: 0; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 0; border: 1px solid var(--seam); border-radius: var(--r-sm); overflow: hidden; }
.wk-sum > div { padding: 12px 14px; display: grid; gap: 2px; border-right: 1px solid var(--seam); }
.wk-sum > div:last-child { border-right: 0; }
.wk-sum dt { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.wk-sum strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wk-sum dd span { color: var(--ink-2); font-size: 14px; }

.days { display: grid; gap: 0; }
.dayrow { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--seam); position: relative; }
.dayrow:first-child { border-top: 0; }
.dayrow-date { display: grid; justify-items: start; text-decoration: none; }
.dayrow-date b { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.dayrow-date span { font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dayrow.is-today .dayrow-date b { color: var(--peak-ink); }
.dayrow.is-today { background: linear-gradient(90deg, color-mix(in srgb, var(--peak) 9%, transparent), transparent 60%); margin: 0 -14px; padding-left: 14px; padding-right: 14px; border-radius: var(--r-sm); }
.occs { display: grid; gap: 8px; }
.occ { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.occ-link { text-decoration: none; display: grid; gap: 3px; min-width: 0; }
.occ-link:hover .occ-title { text-decoration: underline; }
.occ-title { font-weight: 700; overflow-wrap: anywhere; }
.occ-meta { font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.occ-len { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--c); opacity: .85; max-width: 100%; }
.occ-act { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.occ-act b { color: var(--ink); }
.extra { font-size: 13px; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--seam-2); }
.dayrow .empty { padding: 2px 0; font-size: 14px; }

/* month */
.mgrid { display: grid; gap: 4px; }
.mrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mhead span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: center; padding: 4px 0; }
.mcell { display: grid; align-content: start; gap: 6px; min-height: 64px; padding: 7px; border-radius: var(--r-sm); background: var(--panel-2); text-decoration: none; min-width: 0; border: 1px solid transparent; }
@media (min-width: 900px) { .mcell { min-height: 108px; } }
.mcell:hover { border-color: var(--seam-2); }
.mcell.out { opacity: .4; }
.mcell.is-today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.mday { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mdots { display: flex; flex-wrap: wrap; gap: 4px; }
.mdot { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid var(--c, var(--ink-3)); background: transparent; }
.mdot.st-done { background: var(--c, var(--ink)); }
.mdot.st-partial { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); }
.mdot.st-missed { border-color: var(--peak); border-radius: 2px; transform: rotate(45deg) scale(.85); }
.mdot.st-extra { --c: var(--ink-2); background: var(--ink-2); border-color: var(--ink-2); width: 8px; height: 8px; }
.mtitles { display: none; }
@media (min-width: 900px) { .mtitles { display: grid; gap: 2px; font-size: 11px; color: var(--ink-2); } .mtitles span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* day */
.day-items { display: grid; gap: 14px; }
.day-item { border: 1px solid var(--seam); border-radius: var(--r-sm); padding: 16px; display: grid; gap: 12px; background: var(--ground); }
.day-item-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.occ-title-lg { font-size: 20px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.day-act { font-size: 14px; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; }
.phases { display: grid; }
.phase { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--seam); }
.phase:first-child { border-top: 0; }
.phase-name { font-weight: 800; }

/* ---------- races ---------- */
.races { display: grid; }
.race { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--seam); }
.race:first-child { border-top: 0; padding-top: 0; }
.date-stn { display: grid; justify-items: center; line-height: 1.05; padding-top: 2px; }
.date-stn b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.date-stn span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.race-name { font-weight: 700; overflow-wrap: anywhere; }
.prio { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; font-size: 12px; font-weight: 800; margin-left: 6px; vertical-align: 2px; border: 1.5px solid var(--seam-2); color: var(--ink-2); }
.prio-A { background: var(--peak-fill); border-color: var(--peak-fill); color: #fff; }
.race-side { display: grid; justify-items: end; text-align: right; gap: 2px; }
.race-time { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.race-time .unit { font-size: 13px; }
@media (max-width: 560px) { .race { grid-template-columns: 48px minmax(0, 1fr); } .race-side { grid-column: 2; justify-items: start; text-align: left; } }

/* login */
.page-login .rail { display: none; }
.page-login .shell { padding-left: 0; display: grid; place-items: center; }
.page-login .main { max-width: 440px; padding-bottom: 48px; }
.login { gap: 18px; }
.login h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login-mark { width: 56px; height: 56px; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* iPhone: a designed corridor around "you are here" instead of the whole line */
.corridor { display: none; }
@media (max-width: 767px) {
  .line-wrap:not(.keep) { display: none; }
  .corridor { display: grid; grid-template-columns: var(--cols); align-items: start; gap: 0; padding: 26px 18px 18px; }
  .cor { position: relative; min-width: 0; }
  .cor-bar { display: block; height: 8px; background: var(--c, var(--unplanned)); margin-top: 22px; }
  .cor:first-child .cor-bar { border-radius: 4px 0 0 4px; }
  .cor.is-prev .cor-bar { background: var(--ink); }
  .cor.is-stub .cor-bar { height: 0; background: none; border-top: 6px dashed var(--unplanned); margin-top: 23px; }
  .cor-lab { display: block; margin-top: 22px; padding-right: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink, var(--ink-2)); overflow-wrap: anywhere; }
  .cor-lab small { display: block; font-size: 11px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--ink-2); }
  .cor .here { top: 26px; z-index: 2; }
  .cor .here b { bottom: 20px; left: -12px; }
  .cor-term { position: relative; display: grid; justify-items: end; text-align: right; }
  .cor-term i { display: block; width: 26px; height: 26px; margin-top: 13px; border-radius: 50%; background: var(--ground); border: 6px solid var(--ink); }
  .cor-term b { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
}

/* readiness call */
.call { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--seam-2); }
.call b { font-size: 15px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.call span { color: var(--ink-2); font-size: 14px; }
.call-go b { color: var(--base-ink); } .call-easy b { color: var(--build-ink); } .call-steady b { color: var(--ink); }
.ready .delta { font-size: 12px; }

/* run history, one line, not tiles */
.history { display: grid; gap: 6px; font-size: 15px; color: var(--ink-2); padding: 14px 18px; }
.history strong { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 768px) { .history { display: flex; flex-wrap: wrap; gap: 4px 0; } .history span + span::before { content: "·"; padding: 0 12px; color: var(--ink-3); } }

/* ?still in the URL: no motion (used for screenshots) */
.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }

/* race detail */
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 768px) { .stack { gap: 20px; } }
.section-h { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.02em; }
.pager h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; min-width: 0; }
.race-name a, .now-title a { text-decoration: none; }
.race-name a:hover, .now-title a:hover { text-decoration: underline; text-underline-offset: 4px; }
.page-head .actions { gap: 10px; }
.line-gap { height: 8px; }
@media (max-width: 767px) {
  .toolbar .subnav { width: 100%; }
  .toolbar .subnav a { flex: 1; justify-content: center; padding: 0 10px; }
  .wk-sum > div { border-right: 0; border-bottom: 1px solid var(--seam); }
  .wk-sum > div:last-child { border-bottom: 0; }
}
