/* Track Wednesday — public site. Colours follow the coaching convention: red = race, orange = hard, green = easy. */
:root {
  color-scheme: light;
  --tw-ink: #1a2b3c;
  --tw-muted: #4b5b6b;
  --tw-bg: #ffffff;
  --tw-surface: #ffffff;
  --tw-tint: #f3f6fa;
  --tw-pink: #e8148c;
  --tw-line: #e1e7ee;
  --tw-accent: #0a64e8;
  --tw-accent-dark: #021f7a;
  --tw-hard: #f08a1c;
  --tw-easy: #2a9d63;
  --tw-race: #d12f33;
  --tw-taper: #4a7fb5;
}

html { font-size: 16px; }
body.tw-body {
  background: var(--tw-bg);
  color: var(--tw-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.tw-main { flex: 1 0 auto; }
a { color: var(--tw-accent-dark); }
a:hover { color: var(--tw-accent); }
h1, h2, h3 { letter-spacing: -0.01em; text-wrap: balance; }
.text-muted, .tw-muted { color: var(--tw-muted) !important; }

.tw-skip { position: absolute; left: 8px; top: 8px; z-index: 100; background: var(--tw-surface); padding: .5rem .75rem; border-radius: .25rem; }

/* header */
.tw-header { background: var(--tw-surface); border-bottom: 1px solid var(--tw-line); }
.tw-header .nav-link { color: var(--tw-ink); }
.tw-header .nav-link:hover { color: var(--tw-accent); }
.tw-brand { font-weight: 700; display: inline-flex; align-items: center; gap: .6rem; color: var(--tw-ink); }

/* buttons */
/* .btn-tw (primary) and the other button colours live in buttons.css, shared with /Admin */
.btn-tw-outline { border: 1.5px solid currentColor; color: inherit; font-weight: 600; background: transparent; }
.btn-tw-outline:hover { background: rgba(255,255,255,.12); color: inherit; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--tw-accent) 35%, transparent);
  border-color: var(--tw-accent);
}

/* hero */
.tw-hero { position: relative; min-height: 460px; display: flex; align-items: center; text-align: center; overflow: hidden; color: #fff; }
.tw-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 32%; }
.tw-hero-tint { position: absolute; inset: 0; background: rgba(10, 14, 12, 0.6); }
.tw-hero .container { position: relative; z-index: 1; padding-top: 4.5rem; padding-bottom: 4.5rem; }
.tw-hero h1 { font-size: clamp(1.75rem, 3.6vw, 2.9rem); font-weight: 800; line-height: 1.15; color: #fff; }
.tw-hero .lead { max-width: 620px; margin-left: auto; margin-right: auto; color: #f0f2ee; }
.tw-hero .btn-tw-outline { color: #fff; }

/* sections */
.tw-section { padding: 4rem 0; }
.tw-section-tint { background: var(--tw-tint); border-top: 1px solid var(--tw-line); border-bottom: 1px solid var(--tw-line); }
.tw-section h2 { font-weight: 750; font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 1.75rem; }
.tw-section h2.center { text-align: center; }
.tw-card {
  background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; padding: 1.5rem; height: 100%;
}
.tw-step-num {
  width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--tw-accent); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem;
}
.tw-compare { width: 100%; border-collapse: collapse; }
.tw-compare th, .tw-compare td { padding: .65rem .75rem; border-bottom: 1px solid var(--tw-line); vertical-align: top; }
.tw-compare th { text-align: left; font-weight: 650; }
.tw-cta { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 1rem; padding: 2.5rem 1.5rem; text-align: center; }

/* forms / auth */
.tw-auth { max-width: 460px; margin: 3rem auto; }
.tw-auth.tw-auth-wide { max-width: 640px; }   /* the contact form: roomier on desktop; phones are unaffected (it is still full width below 640px) */
.tw-panel { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; padding: 1.75rem; }
.form-label { font-weight: 600; }
.form-text { color: var(--tw-muted); }

/* account + plans */
.tw-page { padding-top: 2.5rem; padding-bottom: 3.5rem; }
.tw-plan-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap;
  padding: 1rem 1.25rem; border: 1px solid var(--tw-line); border-radius: .6rem; background: var(--tw-surface); text-decoration: none; color: inherit; }
.tw-plan-row:hover { border-color: var(--tw-accent); color: inherit; }
.tw-stat { text-align: center; padding: 1rem; background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .6rem; }
.tw-stat strong { display: block; font-size: 1.6rem; line-height: 1.1; }

.tw-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 650; color: #fff; white-space: nowrap; }
.tw-badge-build { background: var(--tw-hard); color: #1a1205; }
.tw-badge-recovery { background: #1f7a4c; }   /* darker than the chart green so white text passes WCAG AA (5.3:1) */
.tw-badge-taper { background: #3f6d9c; }   /* white text 5.4:1 */
.tw-badge-race { background: var(--tw-race); }
.tw-base-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tw-muted); }

.tw-table { width: 100%; border-collapse: collapse; }
.tw-table th, .tw-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--tw-line); }
.tw-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tw-muted); }
.tw-table td.num, .tw-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tw-table tr.is-race td { font-weight: 700; background: color-mix(in srgb, var(--tw-race) 10%, transparent); }

/* The width attribute is the chart at twice its natural size, so a short plan stays small; long plans shrink to the card. */
.tw-chart { max-width: 100%; height: auto; display: block; }
.tw-chart .bar-build { fill: var(--tw-hard); }
.tw-chart .bar-recovery { fill: var(--tw-easy); }
.tw-chart .bar-taper { fill: var(--tw-taper); }
.tw-chart .bar-race { fill: var(--tw-race); }
.tw-chart .tw-bar { cursor: pointer; outline: none; }
.tw-chart .tw-bar-hit { fill: transparent; }
.tw-chart .tw-bar rect:not(.tw-bar-hit) { transition: filter .15s, opacity .15s; }
.tw-chart:has(.tw-bar-active) .tw-bar:not(.tw-bar-active) rect:not(.tw-bar-hit) { opacity: .45; }
.tw-chart .tw-bar-active rect:not(.tw-bar-hit) { filter: brightness(.92) saturate(1.15); }
.tw-chart .tw-bar:focus-visible .tw-bar-hit { stroke: var(--tw-accent); stroke-width: 1.5; rx: 3; }
.tw-tip {
  position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: .05rem; min-width: 8.5rem;
  background: var(--tw-ink); color: #fff; border-radius: .6rem; padding: .55rem .8rem; box-shadow: 0 .5rem 1.25rem rgba(18, 38, 63, .25);
}
.tw-tip[hidden] { display: none; }
.tw-tip-km { font-size: 1.25rem; font-weight: 800; line-height: 1.15; }
.tw-tip-sub { font-size: .8rem; color: #dbe5f1; }
.tw-tip-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--tw-hard); }
.tw-tip[data-kind="cutback"] .tw-tip-type { color: #6fd39b; }
.tw-tip[data-kind="taper"] .tw-tip-type { color: #8db6e4; }
.tw-tip[data-kind="race week"] .tw-tip-type { color: #ff8a8d; }
/* run tooltip on the plan's day tiles (see plan-run-tip.js) */
.tw-run-pop {
  position: fixed; z-index: 1080; display: flex; flex-direction: column; gap: .2rem; max-width: min(18rem, calc(100vw - 1rem)); pointer-events: none;
  background: var(--tw-ink); color: #fff; border-radius: .6rem; padding: .6rem .8rem; font-size: .85rem; line-height: 1.35; box-shadow: 0 .5rem 1.25rem rgba(18, 38, 63, .25);
}
.tw-run-pop[hidden] { display: none; }
.tw-run-pop-title { font-size: .95rem; font-weight: 800; }
.tw-run-pop-note { color: #dbe5f1; }
.tw-run-pop-session { color: var(--tw-hard); font-weight: 600; }
.tw-run-pop-meta { font-size: .75rem; color: #b8c6d8; }
.tw-run-pop-guide { align-self: flex-start; margin-top: .25rem; background: #fff; color: var(--tw-ink); border: 0; border-radius: 1rem; padding: .2rem .75rem; font-size: .8rem; font-weight: 700; cursor: pointer; }
.tw-run-pop-guide:hover, .tw-run-pop-guide:focus-visible { background: #dbe5f1; }
[data-run-tip]:not([data-run-tip="hover"]) { cursor: pointer; }

.tw-chart .axis { stroke: var(--tw-line); stroke-width: 1; }
.tw-chart text { fill: var(--tw-muted); font-size: 10px; font-family: inherit; }
.tw-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .85rem; color: var(--tw-muted); }

/* footer */
.tw-footer { border-top: 1px solid var(--tw-line); padding: 1.5rem 0; color: var(--tw-muted); font-size: .9rem; background: var(--tw-surface); }
.tw-footer-links { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin-bottom: .75rem; }
.tw-footer-links a { color: var(--tw-ink); font-weight: 600; text-decoration: none; }
.tw-footer-links a:hover { color: var(--tw-accent); text-decoration: underline; }
.tw-footer-linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--tw-ink); cursor: pointer; }
.tw-footer-linkbtn:hover { color: var(--tw-accent); text-decoration: underline; }
.tw-consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1080; background: var(--tw-surface); border-top: 1px solid var(--tw-line); box-shadow: 0 -4px 16px rgba(26, 43, 60, .12); padding: .85rem 0; }
.tw-consent[hidden] { display: none; }
.tw-consent-inner { display: flex; flex-direction: column; gap: .75rem; }
.tw-consent-text { margin: 0; font-size: .9rem; line-height: 1.45; }
.tw-consent-actions { display: flex; gap: .5rem; }
.tw-consent-actions .btn { flex: 1 1 0; }
@media (min-width: 768px) {
  .tw-consent-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 1.5rem; }
  .tw-consent-actions .btn { flex: 0 0 auto; min-width: 9rem; }
}
.tw-error-links { padding-left: 1.1rem; }
.tw-footer-legal { margin: 0; font-size: .85rem; line-height: 1.5; text-wrap: pretty; }
.tw-footer-legal a { color: inherit; }

.tw-prose { max-width: 70ch; }
.tw-prose h2 { font-size: 1.3rem; margin-top: 2rem; }
/* A wider measure for intro blocks, with wrapping that avoids a lone word on the last line. */
.tw-prose-wide { max-width: 60rem; }
.tw-prose-wide p, .tw-prose-wide li { text-wrap: pretty; }
.tw-prose-wide .lead { text-wrap: balance; }
.tw-about-photo { width: 100%; max-width: 420px; height: auto; border-radius: .75rem; display: block; margin: 1.25rem 0 1.75rem; box-shadow: 0 12px 30px rgba(0,0,0,.2); }

@media print {
  .tw-header, .tw-footer, .no-print, .alert { display: none !important; }
  body.tw-body { background: #fff; color: #000; }
  .tw-page { padding: 0; }
}

/* holding-site sections */
.tw-checklist-panel { background: #eef4ff; border: 1px solid var(--tw-line); border-radius: .75rem; padding: 1.75rem; }
.tw-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.tw-checklist li { display: flex; gap: .6rem; align-items: flex-start; color: var(--tw-muted); font-size: .92rem; }
.tw-checklist svg { flex: none; margin-top: 1px; width: 22px; height: 22px; }
.tw-checklist svg circle { fill: var(--tw-accent); stroke: var(--tw-accent); }
.tw-checklist svg path { stroke: #fff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.tw-photo { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .75rem; display: block; }
.tw-stat-num { font-size: 1.5rem; font-weight: 700; color: var(--tw-accent); }
.tw-stat-num.sm { font-size: 1.1rem; padding-top: .3rem; }
.tw-coach { width: 100%; }
.tw-link-arrow { font-weight: 600; text-decoration: none; }
.tw-link-arrow::after { content: " \2192"; }
.tw-link-arrow:hover { text-decoration: underline; }
.tw-coach img { width: 100%; height: auto; border-radius: .75rem; display: block; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.tw-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--tw-accent); }
.tw-hero-link { color: #fff; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.tw-hero-link:hover { color: #dbe9ff; }

/* pace chart */
.tw-controls { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; padding: 1.4rem 1.5rem; margin: 1.5rem 0; }
.tw-reset-btn { background: none; border: none; padding: 0; color: var(--tw-accent-dark); font-size: .8rem; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tw-chip-group { margin-bottom: .9rem; }
.tw-chip-group:last-child { margin-bottom: 0; }
.tw-chip-label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tw-muted); margin-bottom: .5rem; }
.tw-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.tw-chip { font: inherit; font-size: .82rem; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--tw-line); background: var(--tw-surface); color: var(--tw-muted); cursor: pointer; }
.tw-chip:hover { border-color: var(--tw-accent); }
.tw-chip[aria-pressed="true"] { background: var(--tw-accent); border-color: var(--tw-accent); color: #fff; }
.tw-table-card { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; overflow: hidden; }
.tw-table-scroll { overflow: auto; max-height: 62vh; }
.tw-pace-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .86rem; }
.tw-pace-table thead th { position: sticky; top: 0; background: var(--tw-ink); color: #fff; text-align: right; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: .65rem .9rem; white-space: nowrap; z-index: 2; }
.tw-pace-table thead th:first-child, .tw-pace-table tbody td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; }
.tw-pace-table thead th:first-child { z-index: 3; }
.tw-pace-table tbody td { text-align: right; padding: .5rem .9rem; white-space: nowrap; border-bottom: 1px solid var(--tw-line); color: var(--tw-ink); }
.tw-pace-table tbody td:first-child { background: #eef4ff; color: var(--tw-accent-dark); font-weight: 700; border-right: 1px solid var(--tw-line); }
.tw-pace-table tbody tr:nth-child(even) td { background: #f3f6fa; }
.tw-pace-table tbody tr:nth-child(even) td:first-child { background: #e2ebfb; }
.tw-pace-table tbody tr:hover td { background: #eef4ff; }
.tw-pace-table tbody tr:hover td:first-child { background: #d9e6fb; }
@media (max-width: 720px) { .tw-table-scroll { max-height: 56vh; } }
.tw-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.tw-header .nav-link { white-space: nowrap; }

/* plan wizard */
.tw-steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 1rem 0 1.5rem; }
.tw-steps li { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: .5rem; background: var(--tw-tint); color: var(--tw-muted); font-size: .88rem; border: 1px solid var(--tw-line); }
.tw-steps-num { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; align-items: center; justify-content: center; background: var(--tw-line); color: var(--tw-ink); font-weight: 700; font-size: .8rem; flex: none; }
.tw-steps li.is-current { background: #eef4ff; border-color: var(--tw-accent); color: var(--tw-ink); font-weight: 600; }
.tw-steps li.is-current .tw-steps-num, .tw-steps li.is-done .tw-steps-num { background: var(--tw-accent); color: #fff; }
.tw-steps li.is-done { color: var(--tw-ink); }
@media (max-width: 560px) { .tw-steps-name { display: none; } .tw-steps li.is-current .tw-steps-name { display: inline; } .tw-steps li { flex: none; } .tw-steps li.is-current { flex: 1; } }
.tw-summary { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 1rem 0 1.5rem; }
.tw-summary dt { color: var(--tw-muted); font-weight: 600; }
.tw-summary dd { margin: 0; }
.tw-resume { border: 1px solid var(--tw-accent); background: #eef4ff; border-radius: .75rem; padding: 1.1rem 1.25rem; }

/* weekly breakdown */
.tw-week { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; overflow: hidden; }
.tw-week { scroll-margin-top: 5rem; }
.tw-week-flash { animation: tw-week-flash 1.4s ease-out; }
@keyframes tw-week-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--tw-accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .tw-week-flash { animation: none; } }
.tw-week-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; padding: .65rem 1rem; background: var(--tw-tint); border-bottom: 1px solid var(--tw-line); }
.tw-week-num { font-weight: 700; }
.tw-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.tw-day { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .5rem; border-right: 1px solid var(--tw-line); min-height: 4.6rem; font-size: .85rem; }
.tw-day:last-child { border-right: 0; }
.tw-day { position: relative; }
.tw-day-rename {
  position: absolute; top: .3rem; right: .3rem; width: 1.7rem; height: 1.7rem; border: 0; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, .85); color: var(--tw-muted); font-size: .85rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  opacity: 0; transition: opacity .15s, background-color .15s, color .15s;
}
.tw-day-rename-second { right: 2.2rem; }
.tw-day:hover .tw-day-rename, .tw-day:focus-within .tw-day-rename, .tw-day-rename:focus-visible { opacity: 1; }
.tw-day-rename:hover { background: var(--tw-ink); color: #fff; }
.tw-day-race .tw-day-rename { background: rgba(255, 255, 255, .25); color: #fff; }
.tw-day-race .tw-day-rename:hover { background: #fff; color: #8c1c20; }
@media (hover: none) { .tw-day-rename { opacity: 1; } }
.tw-rename-input { max-width: 16rem; }
.tw-km-input { width: 5.5rem; }
/* The recent weeks on the plan form: a row each (the week, then a box sized to the number, then its unit), never more than a phone's width. */
.tw-weeks { max-width: 22rem; border: 1px solid var(--tw-line); border-radius: .7rem; background: var(--tw-surface); overflow: hidden; }
.tw-weeks-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.tw-weeks-row + .tw-weeks-row { border-top: 1px solid var(--tw-line); }
.tw-weeks-row.is-estimate { background: var(--tw-tint); }
.tw-weeks-row label { flex: 1 1 auto; margin: 0; font-weight: 600; white-space: nowrap; }
.tw-weeks-row .form-control { flex: none; width: 4.75rem; text-align: right; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.tw-weeks-row .form-control::-webkit-outer-spin-button, .tw-weeks-row .form-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tw-weeks-unit { flex: none; width: 1.5rem; color: var(--tw-muted); font-size: .9rem; }
.tw-weeks-tag { display: inline-block; margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--tw-accent) 12%, transparent); color: var(--tw-accent-dark); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; vertical-align: .1em; }
.tw-day-name { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tw-muted); }
.tw-day-kind { font-weight: 600; line-height: 1.15; }
.tw-day-km { font-variant-numeric: tabular-nums; }
.tw-day-session { display: block; font-size: .8rem; opacity: .8; line-height: 1.25; }
.tw-day-rest { color: var(--tw-muted); }
.tw-day-rest .tw-day-kind { font-weight: 400; }
.tw-day-easy { background: color-mix(in srgb, var(--tw-easy) 13%, transparent); }
.tw-day-long { background: #f5e8c1; }
.tw-day-hard { background: #FCB481; }
.tw-day.tw-day-race { background: #8c1c20; color: #fff; font-weight: 700; }   /* solid, also on the blocked (striped) race-day cell in the editor */
.tw-day-race .tw-day-name { color: rgba(255, 255, 255, .8); }
.tw-chip-key { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; border: 1px solid var(--tw-line); }
.tw-chip-key.tw-day-hard { background: #FCB481; } .tw-chip-key.tw-day-long { background: #f5e8c1; }
.tw-chip-key.tw-day-easy { background: var(--tw-easy); } .tw-chip-key.tw-day-race { background: #8c1c20; }
@media (max-width: 640px) {
  .tw-days { grid-template-columns: 1fr; }
  .tw-day { flex-direction: row; align-items: baseline; gap: .75rem; min-height: 0; border-right: 0; border-bottom: 1px solid var(--tw-line); padding: .45rem 1rem; }
  .tw-day:last-child { border-bottom: 0; }
  .tw-day-name { width: 2.2rem; }
  .tw-day-km { margin-left: auto; }
}
@media print { .tw-week { break-inside: avoid; } }

/* plan editor */
.tw-day[data-drag="1"] { cursor: grab; }
/* Only where there is a real pointer: on a phone a :hover style makes iOS treat the first tap as a hover and hold back the click. */
@media (hover: hover) {
  .tw-day[data-drag="1"]:hover, .tw-day[data-drop="1"]:hover { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tw-accent) 45%, transparent); }
}
.tw-day.tw-dragging { opacity: .45; }
.tw-day.tw-over { box-shadow: inset 0 0 0 2px var(--tw-accent); }
.tw-day.tw-selected, .tw-day.tw-editing { box-shadow: inset 0 0 0 3px var(--tw-accent); }
.tw-day.tw-changed { box-shadow: inset 0 0 0 2px var(--tw-accent); }
/* A soft wash over the days a move changed, on top of each run's own colour so its type still reads. */
.tw-day.tw-changed::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: color-mix(in srgb, var(--tw-accent) 9%, transparent); animation: tw-changed-pulse 1.1s ease-out; }
@keyframes tw-changed-pulse { 0% { background: color-mix(in srgb, var(--tw-accent) 30%, transparent); } 100% { background: color-mix(in srgb, var(--tw-accent) 9%, transparent); } }
@media (prefers-reduced-motion: reduce) { .tw-day.tw-changed::after { animation: none; } }
.tw-day-blocked { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--tw-muted) 18%, transparent) 6px 12px); }
.tw-pin { color: var(--tw-accent); font-size: .6rem; margin-left: .25rem; vertical-align: 1px; }
.tw-week-frozen { opacity: .62; }
.tw-week-notes { padding: .5rem 1rem; font-size: .85rem; background: color-mix(in srgb, var(--tw-hard) 12%, transparent); border-bottom: 1px solid var(--tw-line); }
.tw-week-bar { padding: .65rem 1rem; font-size: .9rem; border-top: 1px solid var(--tw-line); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.tw-week-bar[hidden] { display: none; }
.tw-week-bar-ok { background: color-mix(in srgb, var(--tw-accent) 9%, transparent); }
.tw-week-bar-bad { background: color-mix(in srgb, var(--tw-race) 12%, transparent); }
.tw-week-bar ul { flex-basis: 100%; margin: 0; }


.tw-dialog { border: 1px solid var(--tw-line); border-radius: .75rem; padding: 1.25rem; width: min(30rem, calc(100vw - 2rem)); background: var(--tw-surface); color: inherit; overflow: visible; }   /* visible so the date picker's calendar isn't clipped */
.tw-narrow-select { flex: 0 0 auto; width: 4.75rem; max-width: 100%; }   /* time dropdowns only need room for two digits */
.tw-dialog-scroll { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }   /* tall dialogs scroll on small screens */
.tw-dialog-wide { width: min(42rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.tw-dialog-close { position: sticky; top: 0; float: right; margin: -.5rem -.5rem 0 .5rem; z-index: 1; }
.tw-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.d-contents { display: contents; }

/* "Back to ..." links above page headings: 8px (Bootstrap mb-2) plus 10px */
.tw-back { margin-bottom: 18px; }

/* ---------------------------------------------------------------------------------------------------------------
   Polish: depth, rhythm and the small details that make the site feel finished.
   --------------------------------------------------------------------------------------------------------------- */
:root {
  --tw-shadow: 0 1px 2px rgba(18, 38, 63, .05), 0 10px 28px -14px rgba(18, 38, 63, .18);
  --tw-shadow-lift: 0 2px 4px rgba(18, 38, 63, .06), 0 16px 34px -14px rgba(18, 38, 63, .26);
  --tw-ease: cubic-bezier(.2, .7, .2, 1);
}
body.tw-body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* header: sticks to the top, lines up with the page content, and has room at the edges on a phone */
.tw-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.5) blur(10px); -webkit-backdrop-filter: saturate(1.5) blur(10px); }
.tw-header .navbar { padding: calc(.5rem + 10px) .75rem; }
.tw-brand { letter-spacing: -.01em; padding: .25rem 0; }
.tw-logo { display: block; height: 2.75rem; width: auto; }
.tw-header .nav-link { font-weight: 500; transition: color .2s; }
/* wide screens: the menu sits on the bottom edge of the logo rather than its middle */
@media (min-width: 992px) {
  .tw-header .navbar, .tw-header .navbar-collapse, .tw-header .navbar-nav { align-items: flex-end !important; }
  .tw-header .navbar-collapse { margin-bottom: -7px; }
}
@media (max-width: 991.98px) {
  .tw-header .navbar-collapse { padding: .5rem 0 1rem; }
  .tw-header .navbar-nav { gap: .15rem; }
  /* open menu reads as a list: call to action first, links indented under it, account items last */
  .tw-header .navbar-collapse.show, .tw-header .navbar-collapse.collapsing { display: flex; flex-direction: column; align-items: stretch; }
  .tw-header .navbar-collapse > .navbar-nav:last-child { display: contents; }
  .tw-header .nav-cta { order: -1; margin: .25rem 0 .5rem 1rem; }
  .tw-header .navbar-collapse > .navbar-nav:last-child > .nav-item:not(.nav-cta) { order: 1; }
  .tw-header .navbar-nav .nav-link { padding: .6rem 0 .6rem 1rem; text-align: left; }
}

/* cards and rows */
.tw-card, .tw-panel, .tw-week, .tw-stat, .tw-table-card, .tw-controls { box-shadow: var(--tw-shadow); }
.tw-plan-row { box-shadow: var(--tw-shadow); transition: border-color .2s, box-shadow .25s var(--tw-ease), transform .25s var(--tw-ease); }
.tw-plan-row:hover { box-shadow: var(--tw-shadow-lift); transform: translateY(-1px); }
.tw-section-tint .tw-card { border-color: transparent; }
.tw-lede { max-width: 46rem; }

/* pricing */
.tw-plan-card { display: flex; flex-direction: column; padding: 1.9rem; }
.tw-plan-card-premium { border-color: var(--tw-accent); box-shadow: 0 0 0 1px var(--tw-accent), var(--tw-shadow-lift); background: linear-gradient(180deg, #f6f9ff 0%, var(--tw-surface) 55%); }
.tw-week-summary, .tw-week-prompt { margin: .5rem .75rem; padding: .55rem .75rem; border-radius: .5rem; font-size: .92rem; line-height: 1.4; }
.tw-week-summary { background: #eef5ff; border: 1px solid #c7dcf7; }
.tw-week-prompt { background: #fff6e0; border: 1px solid #f0c969; }
.tw-day-skipped { color: var(--tw-muted); font-style: italic; }
.tw-confirm > summary { list-style: none; display: inline-block; cursor: pointer; }
.tw-confirm > summary::-webkit-details-marker { display: none; }
.tw-offer-banner { background: #fff6e0; border: 1px solid #f0c969; border-radius: .5rem; padding: .6rem .8rem; margin: 0 0 .75rem; font-size: .95rem; line-height: 1.35; }
.tw-price { margin: 0; }
.tw-price-was { font-size: 1.4rem; font-weight: 600; color: var(--tw-muted, #6b7280); margin-right: .25rem; }
.tw-price-amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.tw-tick-list { list-style: none; padding: 0; margin: 1.1rem 0 1.6rem; display: grid; gap: .65rem; }
.tw-tick-list li { position: relative; padding-left: 1.7rem; line-height: 1.4; }
.tw-tick-list li::before {
  content: ""; position: absolute; left: 0; top: .12rem; width: 1.25rem; height: 1.25rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='11' fill='%230a64e8' stroke='none'/%3E%3Cpath d='m7.5 12.3 3 3 6-6.8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tw-tick-list li:has(> strong:only-child)::before { display: none; }
.tw-tick-list li:has(> strong:only-child) { padding-left: 0; }

/* the day cells */
.tw-day { transition: box-shadow .15s, background-color .2s; }
.tw-day:focus-visible { outline: 2px solid var(--tw-accent); outline-offset: -2px; }
.tw-week-head { font-size: .95rem; }

/* the bar under a week in the editor: edit a run or a race, or review a move */
.tw-week-bar { padding: .9rem 1rem; gap: .75rem 1rem; }
.tw-bar-title { flex-basis: 100%; font-weight: 700; }
.tw-bar-fields { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
.tw-bar-field { display: flex; flex-direction: column; gap: .25rem; margin: 0; }
.tw-bar-label { font-size: .78rem; font-weight: 600; color: var(--tw-muted); }
.tw-bar-check { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 .5rem; cursor: pointer; font-weight: 500; }
.tw-bar-check input { width: 1.15rem; height: 1.15rem; margin: 0; flex: none; }
.tw-bar-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .5rem; }
.tw-bar-hint { flex-basis: 100%; font-size: .8rem; color: var(--tw-muted); }
.tw-bar-error { flex-basis: 100%; color: #b42318; font-weight: 600; }
.tw-bar-error:empty { display: none; }
.tw-rename-input { width: min(16rem, 100%); max-width: none; }
.tw-km-input { width: 6rem; }

/* "Saved" note after an edit */
.tw-toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 200; max-width: calc(100vw - 2rem);
  background: var(--tw-ink); color: #fff; padding: .75rem 1.35rem; border-radius: 999px; font-weight: 600; font-size: .92rem;
  box-shadow: 0 14px 34px -10px rgba(18, 38, 63, .5); animation: tw-toast-in .3s var(--tw-ease);
}
.tw-toast-out { opacity: 0; transition: opacity .6s; }
@keyframes tw-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* popups */
.tw-dialog { box-shadow: 0 24px 60px -18px rgba(18, 38, 63, .45); }
.tw-dialog[open] { animation: tw-pop .2s var(--tw-ease); }
@keyframes tw-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .tw-dialog[open], .tw-toast { animation: none; } }

/* flash messages */
.alert { border-radius: .7rem; }

/* editor day cells on a phone: name, run, distance, then the pencil, all in one tidy row */
@media (max-width: 640px) {
  .tw-day { min-height: 3.25rem; }   /* the same row height with or without the pencil, including in a move preview */
  .tw-day-name { order: 1; }
  .tw-day-kind { order: 2; }
  .tw-day-km { order: 3; margin-left: auto; }
  .tw-day-rename { position: static; order: 4; flex: none; align-self: center; opacity: 1; width: 2rem; height: 2rem; }
  .tw-day-rename-second { right: auto; }
  .tw-section { padding: 3rem 0; }
  .tw-page { padding-top: 1.75rem; }
  .tw-plan-card { padding: 1.4rem; }
  .tw-tick-list li { font-size: .95rem; }
  .tw-toast { bottom: 1rem; border-radius: 1rem; text-align: center; }
}

.tw-day-log {
  position: absolute; top: .3rem; right: .3rem; width: 1.7rem; height: 1.7rem; border: 0; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, .85); color: var(--tw-muted); font-size: 1.1rem; font-weight: 700; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  opacity: 0; transition: opacity .15s, background-color .15s, color .15s;
}
.tw-day:hover .tw-day-log, .tw-day:focus-within .tw-day-log, .tw-day-log:focus-visible { opacity: 1; }
.tw-day-log:hover { background: var(--tw-ink); color: #fff; }
.tw-day-race .tw-day-log { background: rgba(255, 255, 255, .25); color: #fff; }
.tw-day-race .tw-day-log:hover { background: #fff; color: #8c1c20; }
@media (hover: none) { .tw-day-log { opacity: 1; } }
.tw-day-ran { font-size: .75rem; font-weight: 600; color: var(--tw-ink); }
.tw-day-race .tw-day-ran, .tw-day-hard .tw-day-ran { color: inherit; }


/* phone polish: calmer wizard panel, bigger tap targets, readable chart axis, "this week" marker */
.tw-panel > h2:first-child { margin-top: 0; }
.tw-day-rename[data-add-run] { border: 1px solid var(--tw-line); background: #fff; color: var(--tw-ink); font-size: 1.1rem; }
/* the current week has its "this week" tag and today's marked day; no ring around the whole week (removed 2026-11-09) */
.tw-now-tag { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tw-accent); }
.tw-plan-notes li + li { margin-top: .35rem; }
@media (max-width: 575.98px) {
  .tw-panel { padding: 1.1rem; }
  .tw-footer a, .tw-back a { display: inline-block; padding: .55rem 0; }
  .tw-chart text { font-size: 16px; }
  .tw-chart .tw-wk-minor { display: none; }
  .tw-day-rename { width: 2.25rem; height: 2.25rem; }
  .tw-day-rest .tw-day-rename { margin-left: auto; }
  .tw-main details > summary { padding: .5rem 0; }
  .tw-main .btn-link, .tw-main .btn-sm { min-height: 2.5rem; }
  .tw-main ul.list-unstyled > li > a { display: inline-block; padding: .4rem 0; }
}

/* Add-event preview: the weeks an event would change */
.tw-event-preview { max-height: 14rem; overflow-y: auto; font-size: .9rem; }
.tw-preview-week { border: 1px solid var(--tw-line); border-radius: .5rem; padding: .5rem .75rem; margin-bottom: .5rem; }
.tw-preview-head { font-weight: 600; }
.tw-week-warnings { color: var(--bs-warning-text-emphasis, #664d03); }


/* ==== Plan page, mobile first (docs/roadmap.md "Design principle") =====================================================
   The phone layout is written first; the wider rules under @media (min-width: 768px) restore the week grid and the hover popups.
   Everything is scoped to .tw-plan / .tw-today so the plan editor (which shares .tw-day) is untouched. */

/* ---- Today card + week strip ---- */
.tw-today { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: 1rem; padding: 1rem; margin-bottom: 1rem; box-shadow: var(--tw-shadow); }
.tw-today-eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tw-muted); }
.tw-today-title { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.tw-today-run { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .75rem 1rem; border-radius: .75rem; margin-bottom: .6rem; }
.tw-today-run.tw-day-race { color: #fff; }
.tw-today-km { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tw-today-session { font-weight: 600; }
.tw-today-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 .25rem; }
.tw-today-actions .btn { min-height: 2.9rem; flex: 1 1 10rem; display: inline-flex; align-items: center; justify-content: center; }
.tw-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; margin-top: .9rem; }
.tw-strip-day { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .4rem 0; border-radius: .6rem; text-decoration: none; color: var(--tw-muted); min-height: 3.1rem; }
.tw-strip-day:hover { background: var(--tw-tint); color: var(--tw-ink); }
.tw-strip-name { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tw-strip-dot { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; color: var(--tw-ink); border: 2px solid transparent; }
.tw-strip-dot.tw-strip-rest { background: var(--tw-tint); border-color: var(--tw-line); }
.tw-strip-dot.tw-day-hard { background: #FCB481; } .tw-strip-dot.tw-day-long { background: #f5e8c1; }
.tw-strip-dot.tw-day-easy { background: color-mix(in srgb, var(--tw-easy) 30%, #fff); } .tw-strip-dot.tw-day-race { background: #8c1c20; color: #fff; }
.tw-strip-today { background: var(--tw-tint); color: var(--tw-ink); box-shadow: inset 0 0 0 2px var(--tw-accent); }
.tw-strip-done .tw-strip-dot { border-color: var(--tw-easy); }

/* ---- Chart is collapsed on phones (it opens by itself on wide screens) ---- */
.tw-chart-details > summary { cursor: pointer; list-style: none; }
.tw-chart-details > summary::-webkit-details-marker { display: none; }
.tw-chart-details > summary::after { content: "\25BE"; float: right; color: var(--tw-muted); }
.tw-chart-details[open] > summary::after { content: "\25B4"; }

/* ---- Weeks are collapsible cards; this week starts open ---- */
.tw-plan > details.tw-week > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .3rem .6rem; padding: .8rem 1rem; min-height: 3rem; }
.tw-plan > details.tw-week > summary::-webkit-details-marker { display: none; }
.tw-week-title { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.tw-week-total { white-space: nowrap; }
.tw-plan .tw-week-progress { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .2rem; }
.tw-plan .tw-week-progress progress { width: 100%; height: .45rem; accent-color: var(--tw-easy); }
.tw-plan > details.tw-week > summary::after { content: "\25BE"; grid-column: 3; grid-row: 1; justify-self: end; color: var(--tw-muted); font-size: 1.1rem; transition: transform .15s; }
.tw-plan > details.tw-week[open] > summary::after { transform: rotate(180deg); }
.tw-plan .tw-week-progress progress { -webkit-appearance: none; appearance: none; border: 0; border-radius: .25rem; background: var(--tw-line); overflow: hidden; }
.tw-plan .tw-week-progress progress::-webkit-progress-bar { background: var(--tw-line); border-radius: .25rem; }
.tw-plan .tw-week-progress progress::-webkit-progress-value { background: var(--tw-easy); border-radius: .25rem; }
.tw-plan .tw-week-progress progress::-moz-progress-bar { background: var(--tw-easy); border-radius: .25rem; }
/* the four plan totals are a compact strip on phones */
@media (max-width: 767.98px) {
  .tw-stat { padding: .5rem .4rem; }
  .tw-stat strong { font-size: 1.05rem; }
  .tw-stat span { font-size: .75rem; }
}
.tw-plan > details.tw-week:not([open]) > summary { border-bottom: 0; }

/* ---- A day, phone first: date column, content, one round action button ---- */
.tw-plan .tw-days { grid-template-columns: 1fr; }
.tw-plan .tw-day { display: grid; grid-template-columns: 3rem 1fr 2.9rem; column-gap: .6rem; row-gap: .1rem; align-items: start; min-height: 3.4rem; padding: .65rem .9rem; border-right: 0; border-bottom: 1px solid var(--tw-line); font-size: .95rem; }
.tw-plan .tw-day:last-child { border-bottom: 0; }
.tw-plan .tw-day-name { grid-column: 1; grid-row: 1 / span 6; display: flex; flex-direction: column; align-items: center; width: auto; line-height: 1.1; }
.tw-plan .tw-day-abbr { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tw-muted); line-height: 1.5rem; height: 1.5rem; }   /* the same line height as the run title, so the two sit on one line */
.tw-plan .tw-day-date { font-size: 1.25rem; font-weight: 800; line-height: 1.1; }
.tw-plan .tw-day-main { grid-column: 2; display: flex; justify-content: space-between; align-items: center; gap: .6rem; min-height: 1.5rem; }
.tw-plan .tw-day-kind { font-weight: 700; font-size: 1rem; line-height: 1.5rem; }
.tw-plan .tw-day-km { margin-left: 0; font-weight: 700; font-size: 1rem; line-height: 1.5rem; font-variant-numeric: tabular-nums; white-space: nowrap; }   /* the same size and weight as the run title */
.tw-plan .tw-day-session, .tw-plan .tw-day-note, .tw-plan .tw-day-ran, .tw-plan .tw-day-guide { grid-column: 2; }
.tw-plan .tw-day-session { font-size: .9rem; font-weight: 600; opacity: 1; }
.tw-plan .tw-day-note { font-size: .82rem; opacity: .8; line-height: 1.3; }
.tw-plan .tw-day-ran { font-size: 1rem; font-weight: 700; line-height: 1.5rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }   /* under the planned distance: right-aligned, same size and weight */
.tw-plan .tw-day-label { color: var(--tw-muted); font-weight: 600; }   /* the grey used on the date */
.tw-plan .tw-day-race .tw-day-label { color: #fff; opacity: .85; }   /* race days are white throughout */
.tw-plan .tw-day-guide, .tw-today-guide { appearance: none; border: 1px solid currentColor; background: transparent; border-radius: 1rem; padding: .25rem .8rem; font-size: .8rem; font-weight: 700; min-height: 2rem; justify-self: start; margin-top: .2rem; cursor: pointer; color: inherit; }
.tw-plan .tw-day-rest { min-height: 0; padding-top: .65rem; padding-bottom: .65rem; }
.tw-plan .tw-day-rest .tw-day-kind { font-weight: 400; }
.tw-plan .tw-day-today { box-shadow: inset 4px 0 0 var(--tw-accent); }
.tw-plan .tw-day-today .tw-day-date { color: var(--tw-accent-dark); }
.tw-plan .tw-day-past:not(.tw-day-race) .tw-day-session { font-weight: 500; }
.tw-plan .tw-day .tw-day-log { position: static; grid-column: 3; grid-row: 1 / span 2; align-self: center; justify-self: end; width: 2.75rem; height: 2.75rem; font-size: 1.5rem; opacity: 1; background: #fff; border: 1px solid var(--tw-line); color: var(--tw-ink); box-shadow: 0 1px 2px rgba(18, 38, 63, .12); }
.tw-plan .tw-day .tw-day-log.tw-day-logged { background: var(--tw-easy); border-color: var(--tw-easy); color: #fff; font-size: 1.2rem; }
.tw-plan .tw-day-race .tw-day-log { background: rgba(255, 255, 255, .9); color: #8c1c20; }
.tw-plan .tw-day-race .tw-day-log.tw-day-logged { background: #fff; color: var(--tw-easy); }

/* ---- The log dialog is a bottom sheet on phones: thumb reach, 16px inputs (no iOS zoom), 44px targets ---- */
.tw-dialog-scroll .form-control, .tw-dialog-scroll .form-select { font-size: 1rem; min-height: 2.75rem; }
.tw-dialog-scroll .btn { min-height: 2.75rem; }
.tw-dialog-scroll [data-log-save] { min-width: 9rem; }
@media (max-width: 767.98px) {
  dialog.tw-dialog-scroll { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 1.1rem 1.1rem 0 0; border-bottom: 0; max-height: 92dvh; padding: 1.1rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
  dialog.tw-dialog-scroll[open] { animation: tw-sheet-up .22s var(--tw-ease, ease-out); }
  dialog.tw-dialog-scroll::backdrop { background: rgba(0, 0, 0, .5); }
  .tw-run-pop { display: none !important; }   /* no hover popups on phones: the day shows its session, note and guide itself */
}
@keyframes tw-sheet-up { from { transform: translateY(40%); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog.tw-dialog-scroll[open] { animation: none; } }

/* ---- Wider screens: the week grid and the hover popups come back ---- */
@media (min-width: 768px) {
  .tw-plan > details.tw-week > summary { grid-template-columns: 1fr auto auto; }
  .tw-plan .tw-week-progress { flex-direction: row; align-items: center; gap: .75rem; }
  .tw-plan .tw-week-progress progress { max-width: 12rem; }
  .tw-plan .tw-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }   /* minmax(0, ...) lets a column shrink and its text wrap, so a narrow window does not push the week off screen */
  .tw-plan .tw-day { display: flex; flex-direction: column; gap: .1rem; min-height: 4.6rem; padding: .6rem .5rem; border-right: 1px solid var(--tw-line); border-bottom: 0; font-size: .85rem; }
  .tw-plan .tw-day:last-child { border-right: 0; }
  .tw-plan .tw-day-name { flex-direction: row; gap: .3rem; align-items: baseline; }
  .tw-plan .tw-day-date { font-size: .8rem; font-weight: 600; color: var(--tw-muted); }
  .tw-plan .tw-day-main { display: contents; }
  .tw-plan .tw-day-kind { font-size: inherit; font-weight: 600; line-height: 1.15; }
  .tw-plan .tw-day-abbr { line-height: inherit; height: auto; }
  .tw-plan .tw-day-date { line-height: inherit; }
  .tw-plan .tw-day-km { font-weight: 400; font-size: inherit; line-height: inherit; }
  .tw-plan .tw-day-ran { font-size: inherit; line-height: inherit; text-align: left; }
  .tw-plan .tw-day-label { display: block; font-size: .72rem; line-height: 1.25; }   /* narrow columns: the label sits above the distance so neither is cut off */
  .tw-plan .tw-day-km, .tw-plan .tw-day-ran { overflow-wrap: anywhere; }
  .tw-plan .tw-day-main { min-height: 0; }
  .tw-plan .tw-day-note, .tw-plan .tw-day-guide { display: none; }   /* the hover popup carries these */
  .tw-plan .tw-day-session { font-size: .8rem; font-weight: 400; opacity: .8; }
  .tw-plan .tw-day .tw-day-log { position: absolute; top: .3rem; right: .3rem; width: 1.7rem; height: 1.7rem; font-size: 1.1rem; opacity: 0; background: #fff; border: 1px solid #aebac7; color: var(--tw-ink); box-shadow: 0 1px 2px rgba(18, 38, 63, .15); }
  .tw-plan .tw-day-name { padding-right: 1.9rem; flex-wrap: wrap; }   /* leaves the corner to the + button; in a narrow column the date wraps under the day name instead of sitting under the button */
  .tw-plan .tw-day:hover .tw-day-log, .tw-plan .tw-day:focus-within .tw-day-log, .tw-plan .tw-day .tw-day-log:focus-visible, .tw-plan .tw-day .tw-day-log.tw-day-logged { opacity: 1; }
  .tw-plan .tw-day-rest { padding-top: .6rem; padding-bottom: .6rem; align-items: stretch; }
  .tw-plan .tw-day-today { box-shadow: inset 0 3px 0 var(--tw-accent); }
}
@media (min-width: 1250px) {
  .tw-plan .tw-day-label { display: inline; font-size: inherit; line-height: inherit; }   /* wide columns: label and distance on one line */
}
@media print { .tw-today, .tw-chart-details > summary::after { display: none; } }
.tw-plan .tw-day-km.tw-day-km-future { font-weight: 700; }   /* a day still to come: the distance alone, bold, at every width */

.tw-header-actions { flex-wrap: wrap; }
/* On a phone: Edit Plan and Share share the row evenly, the gear is a square beside them, all the same height */
@media (max-width: 575.98px) {
  .tw-header-actions { width: 100%; display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.9rem; gap: .5rem; align-items: stretch; }
  .tw-header-actions .btn:not(.btn-link) { width: 100%; gap: .35rem; height: 2.9rem; min-height: 2.9rem; padding-left: .25rem; padding-right: .25rem; font-size: .95rem; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }
  .tw-header-actions .dropdown { min-width: 0; }
  .tw-header-actions .btn.tw-gear:not(.btn-link) { width: 2.9rem; min-width: 2.9rem; padding: 0; }
}
.tw-chart-details:not([open]) { padding-bottom: 1rem; } .tw-chart-details:not([open]) > summary { margin-bottom: 0 !important; }

/* the colour key: one line each on a phone, a row on wider screens */
.tw-legend.tw-legend-stacked { flex-direction: column; align-items: flex-start; gap: .4rem; }
.tw-note-buttons { width: 100%; }
@media (min-width: 768px) { .tw-legend.tw-legend-stacked { flex-direction: row; flex-wrap: wrap; gap: .4rem 1rem; } .tw-note-buttons { width: auto; margin-left: auto; } }


/* ==== Plan editor, mobile first (same principles as the plan page above) ========================================
   Scoped to .tw-edit-weeks / .tw-edit-* so the plan page's own .tw-plan rules are untouched. */

.tw-edit-how { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.tw-edit-how li { display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: .75rem; padding: .6rem .8rem; }
.tw-edit-how-icon { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--tw-tint); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.tw-edit-actions, .tw-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.tw-edit-actions .btn, .tw-dialog-actions .btn { min-height: 2.9rem; flex: 1 1 9rem; }

/* weeks are collapsible cards, as on the plan page */
.tw-edit-weeks > details.tw-week > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .75rem; padding: .8rem 2.4rem .8rem 1rem; min-height: 3rem; position: relative; }
.tw-edit-weeks > details.tw-week > summary::-webkit-details-marker { display: none; }
.tw-edit-weeks > details.tw-week > summary::after { content: "\25BE"; position: absolute; right: 1rem; top: 50%; margin-top: -.7rem; color: var(--tw-muted); font-size: 1.1rem; transition: transform .15s; }
.tw-edit-weeks > details.tw-week[open] > summary::after { transform: rotate(180deg); }
.tw-edit-weeks .tw-week-title { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.tw-edit-weeks .tw-week-total { white-space: nowrap; }
.tw-edit-weeks .tw-week-tools { margin-left: auto; }   /* stays at the right when it wraps under the week title */
.tw-edit-weeks .tw-reset-week { min-height: 2.5rem; padding: 0 .25rem !important; }

/* a day: date, run, distance, then round 44px action buttons (always visible; no hover on a phone) */
@media (max-width: 767.98px) {
  .tw-edit-weeks .tw-day { min-height: 3.6rem; padding: .5rem .9rem; gap: .5rem; align-items: center; font-size: .95rem; }
  .tw-edit-weeks .tw-day-name { width: 2.6rem; }
  .tw-edit-weeks .tw-day-kind, .tw-edit-weeks .tw-day-km { font-size: 1rem; font-weight: 700; }
  .tw-edit-weeks .tw-day-rest .tw-day-kind { font-weight: 400; }
  .tw-edit-weeks .tw-day-rename { width: 2.75rem; height: 2.75rem; font-size: 1.1rem; background: #fff; border: 1px solid var(--tw-line); color: var(--tw-ink); box-shadow: 0 1px 2px rgba(18, 38, 63, .12); }
  .tw-edit-weeks .tw-day-race .tw-day-rename { background: rgba(255, 255, 255, .9); color: #8c1c20; }
  .tw-edit-weeks .tw-day.tw-selected { box-shadow: inset 0 0 0 3px var(--tw-accent); }
  /* the edit / review bar under a week: full-width fields, 16px inputs (no iOS zoom), big buttons */
  .tw-week-bar { padding: 1rem; }
  .tw-bar-fields { flex-direction: column; align-items: stretch; }
  .tw-bar-field { width: 100%; }
  .tw-week-bar .form-control, .tw-week-bar .form-select, .tw-week-bar .form-control-sm, .tw-week-bar .form-select-sm { font-size: 1rem; min-height: 2.75rem; width: 100%; max-width: none; }
  .tw-bar-actions, .tw-week-bar { gap: .6rem; }
  .tw-week-bar .btn { min-height: 2.75rem; flex: 1 1 8rem; }
  .tw-bar-check { min-height: 2.75rem; margin: 0; }
  .tw-bar-check input { width: 1.4rem; height: 1.4rem; }
}

/* dialogs on the editor are bottom sheets on phones, like the log dialog */
@media (max-width: 767.98px) {
  dialog.tw-dialog-wide.tw-dialog-scroll { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 1.1rem 1.1rem 0 0; border-bottom: 0; max-height: 92dvh; padding: 1.1rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
  dialog.tw-dialog-wide.tw-dialog-scroll[open] { animation: tw-sheet-up .22s var(--tw-ease, ease-out); }
}

/* the run(s) a save just changed glow briefly after the page reloads */
.tw-day-flash { animation: tw-day-flash 2.4s ease-out; }
@keyframes tw-day-flash { 0%, 55% { box-shadow: inset 0 0 0 3px var(--tw-accent); } 100% { box-shadow: inset 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .tw-day-flash { animation: none; box-shadow: inset 0 0 0 3px var(--tw-accent); } }

/* Which days can you run: seven big tap targets in a row (phone first) */
.tw-daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.tw-daypick-item { position: relative; margin: 0; }
.tw-daypick-item input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.tw-daypick-item span { display: flex; align-items: center; justify-content: center; min-height: 3rem; border: 1px solid var(--tw-line); border-radius: .6rem; background: var(--tw-surface); color: var(--tw-muted); font-weight: 600; font-size: .85rem; }
.tw-daypick-item input:checked + span { background: var(--tw-accent); border-color: var(--tw-accent); color: #fff; }
.tw-daypick-item input:focus-visible + span { outline: 3px solid var(--tw-accent); outline-offset: 2px; }

/* Click-through guide shown once, full window, after a plan is made */
dialog.tw-guide { position: fixed; inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; padding: 0; color: inherit;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--tw-accent, #0a64e8) 14%, var(--tw-surface, #fff)) 0%, var(--tw-surface, #fff) 60%); }
dialog.tw-guide[open] { display: flex; flex-direction: column; }
.tw-guide-top { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1.25rem; padding-top: calc(.75rem + env(safe-area-inset-top)); width: min(60rem, 100%); margin: 0 auto; }
.tw-guide-count { font-size: .85rem; color: var(--tw-muted); font-weight: 600; }
.tw-guide-skip { text-decoration: none; min-height: 2.75rem; }
.tw-guide-body { flex: 0 1 auto; overflow-y: auto; padding: 1rem 1.25rem; width: min(40rem, 100%); margin: auto auto 0; }   /* text and button sit together, centred in the window */
.tw-guide-step h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1rem; }
.tw-guide-step p, .tw-guide-step li { font-size: 1.1rem; line-height: 1.5; }
.tw-guide-step li { margin-bottom: .6rem; }
.tw-guide-step[hidden] { display: none; }
.tw-guide-hero { text-align: center; }
.tw-guide-hero h2 { font-size: clamp(2.5rem, 8vw, 4rem); font-weight: 800; letter-spacing: -.02em; }
.tw-guide-hero .tw-guide-lead { font-size: 1.35rem; }
.tw-guide-nav { display: flex; gap: .75rem; padding: .75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); width: min(40rem, 100%); margin: 0 auto auto; }
.tw-guide-nav .btn { flex: 1; min-height: 3rem; font-size: 1.05rem; }
.tw-guide-nav .btn[hidden] { display: none; }

/* Plan settings (gear) and cross-training */
.tw-gear { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; padding: 0; }
.tw-settings-section { padding: 0 0 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--tw-line); }
.tw-settings-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.tw-day-cross { font-size: .8rem; color: var(--tw-muted); }
.tw-bar-field[hidden] { display: none; }

/* Plan settings: collapsible sections, zones as tiles */
.tw-settings .tw-set { border: 1px solid var(--tw-line); border-radius: .7rem; margin-bottom: .75rem; background: var(--tw-surface); }
.tw-settings .tw-set > summary { padding: .85rem 1rem; font-weight: 600; cursor: pointer; min-height: 2.75rem; }
.tw-settings .tw-set-body { padding: 0 1rem 1rem; }
.tw-zones { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.tw-zones > button, .tw-zones > div { border: 1px solid var(--tw-line); border-radius: .6rem; padding: .55rem .7rem; display: flex; flex-direction: column; align-items: flex-start; text-align: left; background: var(--tw-surface); color: inherit; font: inherit; cursor: pointer; min-height: 3.5rem; }
.tw-zones > button:hover, .tw-zones > button:focus-visible { border-color: var(--tw-accent); }
.tw-zones em { font-style: normal; font-size: .7rem; color: var(--tw-accent); margin-top: .15rem; }
.tw-zones span { font-size: .75rem; color: var(--tw-muted); }
.tw-zones strong { font-size: 1.15rem; }
.tw-zones small { font-size: .7rem; color: var(--tw-muted); }

/* Edit page: the two top buttons sit on one line at the same height on a phone */
@media (max-width: 575.98px) {
  .tw-edit-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
  .tw-edit-actions .btn:not(.btn-link) { width: 100%; height: 2.9rem; padding-left: .5rem; padding-right: .5rem; white-space: nowrap; }
}

/* Colour squares in the tour's "Reading a day" step */
.tw-guide-key { list-style: none; padding-left: 0; }
.tw-guide-key li { display: flex; gap: .75rem; align-items: baseline; }
.tw-guide-key .tw-chip-key { flex: none; width: 1.1rem; height: 1.1rem; margin-right: 0; vertical-align: baseline; transform: translateY(.2rem); }
.tw-chip-key.tw-chip-rest { background: var(--tw-tint, #f3f6fa); }

/* A race day is white text on its dark red cell, in every view (the day name, date, run, distance and notes) */
.tw-plan .tw-day-race .tw-day-abbr, .tw-plan .tw-day-race .tw-day-date, .tw-plan .tw-day-today.tw-day-race .tw-day-date,
.tw-plan .tw-day-race .tw-day-kind, .tw-plan .tw-day-race .tw-day-km, .tw-plan .tw-day-race .tw-day-session, .tw-plan .tw-day-race .tw-day-note,
.tw-plan .tw-day-race .tw-day-ran, .tw-plan .tw-day-race .tw-day-guide, .tw-day-race .tw-day-name, .tw-day-race .tw-day-kind, .tw-day-race .tw-day-km { color: #fff; }

/* Edit page, phone: on a rest day the + and the lightning bolt sit together at the right (only the first button takes the free space) */
@media (max-width: 575.98px) {
  .tw-edit-weeks .tw-day .tw-day-rename + .tw-day-rename { margin-left: .5rem; }
}

/* Fixed widths (inline style attributes are blocked by the Content Security Policy) */
.tw-w-6rem { max-width: 6rem; }

/* "Why are we asking?" note: a tap-to-open info icon beside a form option (no hover needed). */
.tw-why-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 .75rem; }
.tw-why-row .form-check { flex: 1 1 0; min-width: 0; }
.tw-why-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; margin-right: -.6rem; padding: 0; border: 0; background: none; cursor: pointer; }
.tw-why-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border: 1.5px solid #4a5a6e; border-radius: 50%; font: italic 700 .85rem/1 Georgia, serif; color: #4a5a6e; }
.tw-why-btn[aria-expanded="true"] .tw-why-icon { background: #4a5a6e; color: #fff; }
.tw-why-text { flex-basis: 100%; padding-top: .25rem; }
.tw-why-text[hidden] { display: none; }

/* FAQ page: one tappable row per question, answer opens beneath. */
.tw-faq h2 { margin-top: 2rem; margin-bottom: .75rem; }
.tw-faq details { border-bottom: 1px solid var(--tw-line); }
.tw-faq details > summary { cursor: pointer; list-style: none; position: relative; padding: .9rem 2rem .9rem 0; font-weight: 600; min-height: 44px; }
.tw-faq details > summary::-webkit-details-marker { display: none; }
.tw-faq details > summary::after { content: "+"; position: absolute; right: .25rem; top: .75rem; font-size: 1.25rem; line-height: 1.4; color: var(--tw-muted); }
.tw-faq details[open] > summary::after { content: "\2212"; }
.tw-faq details > :not(summary) { margin-bottom: 1rem; }
.tw-cookie-table { font-size: .92rem; }
.tw-cookie-table th { white-space: nowrap; }
.tw-cookie-table td:first-child { white-space: nowrap; }
@media (max-width: 575.98px) {
  /* a phone shows each cookie as a small card instead of a table that scrolls sideways */
  .tw-cookie-table thead { display: none; }
  .tw-cookie-table, .tw-cookie-table tbody, .tw-cookie-table tr, .tw-cookie-table td { display: block; width: 100%; }
  .tw-cookie-table tr { border: 1px solid var(--tw-line); border-radius: .6rem; padding: .6rem .8rem; margin-bottom: .75rem; background: var(--tw-surface); }
  .tw-cookie-table td { border: 0; padding: .15rem 0; white-space: normal !important; overflow-wrap: anywhere; }
  .tw-cookie-table td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--tw-muted); margin-top: .35rem; }
  .tw-cookie-table td:first-child::before { margin-top: 0; }
}
.tw-faq-search { margin: 1.25rem 0 .5rem; }
.tw-faq-search[hidden], .tw-faq-group[hidden], .tw-faq details[hidden] { display: none; }
