:root {
  color-scheme: light;
  --background: #f8f9fc;
  --text: #192455;
  --muted: #59647a;
  --accent: #e30613;
  --line: #26348b20;
  --tile-width: 560px;
  --tile-height: 170px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
  font-synthesis: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; margin: 0; position: relative; min-width: 320px; }
main.shell { flex-shrink: 0; margin-block: auto; padding-block: 32px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 96px, 1080px); margin-inline: auto; }
.landscape { position: absolute; top: 65px; left: 0; width: 100%; height: 640px; z-index: -1; pointer-events: none; overflow: hidden; }
.landscape::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--background), transparent 25%, transparent 62%, var(--background)); }
.landscape svg { width: 100%; height: 100%; }
.masthead { display: none; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.brand svg { width: 35px; height: 32px; color: var(--accent); }
.hero { text-align: center; }
h1 { margin: 0; font-weight: 600; }
.race-name { display: flex; justify-content: center; align-items: center; gap: 18px; font-size: clamp(22px, 5.7vw, 68px); font-weight: 700; letter-spacing: -2.5px; line-height: 1.15; white-space: nowrap; color: #26348b; }
.race-logo { width: 72px; height: auto; aspect-ratio: 602 / 512; object-fit: contain; flex-shrink: 0; }
.race-date { display: flex; justify-content: center; align-items: center; gap: 9px; font-size: 28px; font-weight: 600; margin-top: 29px; letter-spacing: .2px; }
.race-date svg { width: 25px; height: 25px; stroke: var(--accent); stroke-width: 1.6; }
.timezone { color: var(--muted); font-size: 12px; letter-spacing: 0; margin: 10px 0 0; }
.countdown-panel { display: grid; grid-template-rows: minmax(48px, 1fr) auto; margin: 34px auto 0; max-width: var(--tile-width); padding: 0 28px 16px; border: 1px solid #26348b24; border-top: 4px solid #ffcd00; border-radius: 16px; background: #ffffffed; box-shadow: 0 18px 60px #00000012; backdrop-filter: blur(10px); }
.countdown-caption { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 8px; min-height: 20px; margin: 0; color: #26348b; font-size: 15px; font-weight: 600; letter-spacing: .2px; line-height: 1.4; }
.countdown-caption::after { content: ""; }
.status-dot { display: block; justify-self: end; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
[data-countdown][data-elapsed="true"] .status-dot { background: #16803c; }
[data-countdown][data-stopped="true"] .status-dot { background: var(--accent); }
.countdown { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: start; gap: 10px; }
.time-unit { display: grid; gap: 6px; min-width: 0; }
.time-value { font-family: inherit; font-size: clamp(38px, 5vw, 61px); font-weight: 500; letter-spacing: -2px; line-height: 1.12; font-variant-numeric: tabular-nums; }
.seconds { color: var(--accent); }
.preview-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.separator { color: #26348b60; font-size: 27px; line-height: 2; font-weight: 300; }
.time-label { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.no-script { max-width: 600px; margin: 35px auto 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
.tracking { margin: 32px auto 0; max-width: var(--tile-width); }
.section-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 19px; }
.section-heading h2 { font-size: 18px; font-weight: 600; margin: 0; }
.section-rule { height: 1px; background: var(--line); flex: 1; }
.cards { display: grid; align-items: start; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tracking-card { position: relative; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 24px 18px; border: 1px solid #26348b24; border-top: 4px solid #26348b; border-radius: 16px; background: #fff; box-shadow: 0 8px 30px #26348b08; text-decoration: none; color: var(--text); transition: border-color .2s, transform .2s, background .2s; }
a.tracking-card:hover { border-color: #26348b; border-top-color: #26348b; transform: translateY(-4px); background: #fff; }
a.tracking-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.card-top { display: flex; align-items: center; justify-content: center; gap: 12px; }
.card-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #e3061309; color: var(--accent); border: 1px solid #e3061320; }
.card-icon svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.card-service { font-size: 11px; font-weight: 600; letter-spacing: 1px; }
.external-arrow { position: absolute; top: 8px; right: 12px; color: var(--muted); font-size: 23px; font-weight: 300; }
.tracking-card h3 { font-size: 20px; font-weight: 600; line-height: 1.4; letter-spacing: -.3px; margin: 18px 0 0; text-wrap: pretty; }
.card-bottom { display: none; align-items: center; justify-content: space-between; gap: 10px; min-height: 57px; border-top: 1px solid var(--line); margin-top: auto; font-size: 12px; font-weight: 600; color: var(--accent); }
.card-bottom svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.5; }
.garmin .card-icon { color: #26348b; background: #26348b09; border-color: #26348b20; }
.garmin .card-bottom { color: #26348b; }
.pending { background: #fcfcff; }
.pending-pill { position: absolute; top: 8px; right: 12px; padding: 5px 8px; border: 1px solid #26348b30; border-radius: 4px; font-size: 8px; letter-spacing: 1px; color: var(--muted); }
.pending-label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 400; }
.hollow-dot { width: 6px; height: 6px; border: 1px solid #92a1a9; border-radius: 50%; }
.footer { display: flex; justify-content: flex-end; align-items: center; gap: 20px; flex-shrink: 0; margin-top: 0; padding-block: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.footer-location { font-size: 12px; letter-spacing: .5px; color: #26348b; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .shell { width: calc(100% - 40px); }
  .brand { font-size: 11px; letter-spacing: .6px; gap: 9px; }
  .brand svg { width: 29px; }
  .race-name { flex-direction: column; width: 100%; max-width: var(--tile-width); margin-inline: auto; font-size: clamp(34px, 10vw, 60px); letter-spacing: -1px; gap: 12px; white-space: normal; text-align: center; }
  .race-name > .race-title-link { width: 100%; text-wrap: balance; }
  .race-logo { width: clamp(64px, 20vw, 84px); }
  .race-date { font-size: 20px; margin-top: 24px; gap: 7px; }
  .timezone { font-size: 11px; }
  .countdown-panel { margin-top: 28px; padding: 0 16px 16px; }
  .countdown { gap: 5px; }
  .time-value { font-size: clamp(32px, 8vw, 48px); letter-spacing: -1px; }
  .separator { font-size: 20px; line-height: 1.8; }
  .time-label { font-size: 10px; }
  .countdown-caption { font-size: 12px; }
  .tracking { margin-top: 14px; }
  .section-heading { gap: 12px; }
  .section-heading h2 { font-size: 17px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tracking-card { min-width: 0; padding: 26px 8px 16px; }
  .service-logo { max-width: 100%; max-height: 40px; }
  .external-arrow { top: 6px; right: 7px; font-size: 17px; }
  .pending-pill { top: 6px; right: 7px; padding: 3px 5px; font-size: 7px; }
  .tracking-card h3 { font-size: 20px; margin-top: 18px; }
  .footer { flex-direction: column; align-items: flex-end; gap: 12px; }
  .landscape { top: 100px; height: 600px; }
}
@media (prefers-reduced-motion: reduce) { .tracking-card { transition: none; } a.tracking-card:hover { transform: none; } }

/* Shared title and description rows keep both tracking tiles aligned. */
.tracking-card .card-brand { display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; margin: 0; font-size: 21px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.service-logo { display: block; object-fit: contain; flex-shrink: 0; }
.livetrail-logo { width: 52px; height: 48px; }
.garmin-logo { width: 120px; height: 48px; }
.garmin .card-brand { gap: 8px; font-size: 18px; }
.card-description { margin: 12px 0 0; font-size: 12px; line-height: 18px; font-weight: 400; color: var(--muted); }

[data-countdown][data-elapsed="true"] .countdown { grid-template-columns: 1fr auto 1fr auto 1fr; }
[data-countdown][data-elapsed="true"] .countdown-days,
[data-countdown][data-elapsed="true"] .countdown-days-separator { display: none; }

@media (max-width: 700px) { .card-description { font-size: 10px; line-height: 15px; } }
@media (max-width: 700px) { .tracking-card .card-brand { height: 42px; } .garmin-logo { width: min(90px, 100%); } }

.last-activity { margin-left: auto; font-size: 12px; text-align: right; }
@media (max-width: 700px) { .footer { flex-direction: column; align-items: flex-start; } .footer-location { margin-right: 0; } .last-activity { margin-left: 0; text-align: left; } }

.race-title-link { color: inherit; text-decoration: none; }
.race-title-link:hover { text-decoration: none; }
.race-title-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: 4px; }

.progress-panel { max-width: var(--tile-width); margin: 32px auto 0; padding: 24px; border: 1px solid var(--line); border-top: 4px solid #26348b; border-radius: 16px; background: #fff; box-shadow: 0 8px 30px #26348b08; }
.progress-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.progress-stop + .progress-stop { border-left: 1px solid var(--line); padding-left: 24px; }
.progress-stop h2 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.progress-name { margin: 0 0 18px; font-size: 20px; line-height: 1.3; font-weight: 600; }
.progress-details { margin: 0; display: grid; gap: 12px; }
.progress-details dt { color: var(--muted); font-size: 11px; }
.progress-details dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
[data-direction="ahead"] { color: #16803c; }
[data-direction="behind"] { color: var(--accent); }
.progress-eta { font-size: 24px; font-weight: 600; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.progress-remaining { font-size: 13px; margin: 0 0 16px; }
.progress-meta { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 14px 0 0; }
.progress-updated:empty { display: none; }
.progress-notice { font-size: 14px; margin: 0; }
@media (max-width: 700px) {
  .progress-panel { margin-top: 14px; padding: 22px; }
  .progress-columns { grid-template-columns: 1fr; gap: 22px; }
  .progress-stop + .progress-stop { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 22px; }
}

html { scrollbar-gutter: stable; }
html.schedule-open { overflow: hidden; }
.schedule-toggle, .schedule-close { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; }
.schedule-toggle { position: fixed; top: 20px; right: 24px; z-index: 10; box-shadow: 0 4px 18px #26348b0d; }
.schedule-toggle svg, .schedule-close svg { display: block; width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (hover: hover) { .schedule-toggle:hover, .schedule-close:hover { border-color: #26348b; background: #f0f2fa; } }
.schedule-toggle:focus-visible, .schedule-close:focus-visible, .schedule-scroll:focus-visible { outline: 3px solid #26348b; outline-offset: 3px; }
.schedule-panel { position: fixed; inset: 0 0 0 auto; width: min(100%, 490px); max-width: 100%; height: 100%; height: 100dvh; max-height: 100%; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--background); color: var(--text); box-shadow: -12px 0 50px #19245520; }
.schedule-panel[open] { display: flex; flex-direction: column; animation: schedule-enter .22s ease-out; }
.schedule-panel::backdrop { background: #121a3d66; }
.schedule-panel:focus { outline: none; }
.schedule-header { display: flex; align-items: flex-start; gap: 16px; padding: 28px 24px 22px; border-bottom: 1px solid var(--line); }
.schedule-header > div { flex: 1; }
.schedule-header h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.3; }
.schedule-header p { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.schedule-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 24px 24px; }
.schedule-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.schedule-table th, .schedule-table td { padding: 14px 8px; border-bottom: 1px solid var(--line); }
.schedule-table thead th { position: sticky; top: 0; z-index: 1; background: var(--background); font-size: 11px; font-weight: 600; color: var(--muted); }
.schedule-table th:first-child { text-align: left; padding-left: 0; }
.schedule-table tbody th { font-weight: 500; }
.schedule-table td, .schedule-table thead th:not(:first-child) { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.schedule-table td:last-child, .schedule-table th:last-child { padding-right: 0; }
.schedule-table tbody tr:last-child { color: #26348b; background: #26348b08; }
.schedule-table tbody tr:last-child th, .schedule-table tbody tr:last-child td { font-weight: 700; }
@keyframes schedule-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 700px) {
  main.shell { padding-top: 76px; padding-bottom: 76px; }
  .schedule-toggle { top: 14px; right: 20px; }
  .schedule-header { padding: 20px 16px 18px; gap: 10px; }
  .schedule-header h2 { font-size: 20px; }
  .schedule-scroll { padding: 0 16px 20px; }
  .schedule-table { font-size: 12px; }
  .schedule-table th, .schedule-table td { padding: 13px 5px; }
}
@media (prefers-reduced-motion: reduce) { .schedule-panel[open] { animation: none; } }

/* Keep the open and close controls at the same viewport position. */
.schedule-close { position: fixed; top: 20px; right: 24px; }
.schedule-header { padding-right: 84px; }
@media (max-width: 700px) {
  .schedule-close { top: 14px; right: 20px; }
  .schedule-header { padding-right: 80px; }
}

.progress-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.progress-table th, .progress-table td { padding: 12px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.progress-table th:first-child { width: 44%; text-align: left; overflow-wrap: anywhere; }
.progress-table thead th { font-size: 11px; color: var(--muted); font-weight: 500; text-align: center; }
.progress-table tbody th { font-weight: 500; }
.progress-table td { text-align: center; font-variant-numeric: tabular-nums; }
.progress-table tr:last-child > * { border-bottom: 0; }
.progress-delta { display: block; margin-top: 3px; font-size: 11px; }
.progress-next { color: inherit; }
@media (max-width: 700px) {
  .progress-panel { padding: 16px 10px; }
  .progress-table { font-size: 12px; }
  .progress-table th, .progress-table td { padding: 11px 4px; }
}

.progress-point-meta { display: block; margin-top: 4px; font-size: 10px; font-weight: 400; color: var(--muted); }
.progress-prediction { font-style: italic; }

/* Compact passage summary, with an accessible disclosure for older rows. */
.progress-panel { position: relative; min-height: var(--tile-height); padding: 8px 16px 30px; display: flex; flex-direction: column; justify-content: center; }
.progress-panel[hidden] { display: none; }
.progress-panel .progress-table { line-height: 1.2; }
.progress-panel .progress-table th, .progress-panel .progress-table td { padding: 4px 6px; }
.progress-panel .progress-table thead th { padding-top: 3px; padding-bottom: 6px; }
.progress-panel .progress-delta, .progress-panel .progress-point-meta { margin-top: 2px; }
.progress-panel .progress-updated { position: absolute; bottom: 7px; left: 16px; right: 16px; margin: 0; font-size: 9px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 30px; text-align: left; }
.progress-toggle { position: absolute; bottom: 1px; right: 8px; width: 32px; height: 28px; padding: 5px; display: grid; place-items: center; background: transparent; color: var(--text); border: 0; border-radius: 6px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.progress-toggle[hidden] { display: none; }
.progress-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.progress-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.progress-toggle:focus-visible { outline: 2px solid #26348b; outline-offset: 1px; }
.progress-panel[data-expanded="true"] .progress-table tbody th, .progress-panel[data-expanded="true"] .progress-table tbody td { padding-top: 10px; padding-bottom: 10px; }
@media (max-width: 700px) {
  .progress-panel { padding-left: 10px; padding-right: 10px; }
  .progress-panel .progress-table th, .progress-panel .progress-table td { padding-left: 3px; padding-right: 3px; }
  .progress-panel .progress-updated { left: 10px; }
}

.progress-group { max-width: var(--tile-width); margin: 32px auto 0; display: grid; gap: 14px; }
.passage-card { position: relative; min-height: var(--tile-height); display: flex; align-items: center; padding: 22px 16px; border: 1px solid var(--line); border-top: 4px solid #26348b; border-radius: 16px; background: #fff; box-shadow: 0 8px 30px #26348b08; }
.passage-grid { display: grid; grid-template-columns: 44fr 28fr 28fr; gap: 6px; width: 100%; align-items: start; }
.passage-grid > div { min-width: 0; text-align: center; }
.passage-grid > div:first-child { text-align: left; }
.passage-grid h2 { font-size: 11px; line-height: 1.3; font-weight: 500; color: var(--muted); margin: 0 0 12px; min-height: 29px; display: flex; align-items: center; justify-content: center; }
.passage-grid > div:first-child h2 { justify-content: flex-start; }
.passage-name, .passage-value { font-size: 14px; line-height: 1.3; margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.passage-name { overflow-wrap: anywhere; }
.passage-forecast { font-style: italic; }
.passage-note { position: absolute; bottom: 6px; left: 16px; right: 16px; margin: 0; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.progress-group > .progress-panel { width: 100%; margin: 0; }
@media (max-width: 700px) {
  .progress-group { margin-top: 14px; }
  .passage-card { padding: 20px 10px; }
  .passage-grid { gap: 4px; }
  .passage-name, .passage-value { font-size: 12px; }
  .passage-grid h2 { font-size: 10px; }
  .passage-note { left: 10px; right: 10px; }
}

/* Checkpoint cards in the race preview. */
.aid-card { position: relative; max-width: var(--tile-width); min-height: var(--tile-height); margin: 32px auto 0; padding: 22px 24px 18px; border: 1px solid var(--line); border-top: 4px solid #26348b; border-radius: 16px; background: #fff; box-shadow: 0 8px 30px #26348b08; }
.aid-card + .aid-card { margin-top: 32px; }
.aid-card h2 { margin: 0 0 18px; text-align: center; font-size: 22px; line-height: 1.35; font-weight: 600; }
.aid-heading { display: flex; align-items: center; justify-content: center; gap: 8px; }
.aid-heading span { min-width: 0; }
.aid-heading svg { flex: 0 0 auto; width: 20px; height: 20px; stroke: #26348b; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.aid-heading .aid-runner { flex: 0 0 auto; width: 28px; height: 28px; object-fit: contain; }
.aid-heading .aid-arrow { width: 16px; height: 16px; }
.aid-forecast-badge { position: absolute; z-index: 1; top: -11px; left: 50%; transform: translateX(-50%); background: #fff; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .5px; line-height: 1.2; text-transform: uppercase; white-space: nowrap; }
@media (min-width: 701px) { .aid-forecast-badge { top: -13px; padding: 4px 8px; font-size: 11px; } }
.aid-stats, .aid-times, .aid-comparison { display: grid; margin: 0; text-align: center; }
.aid-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: #f8f9fc; }
.aid-stats > div { position: relative; display: flex; flex-direction: column; justify-content: center; padding-inline: 8px; }
.aid-stats > div + div::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line); }
.aid-times, .aid-comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.last-aid-comparison { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.aid-stats > div, .aid-times > div, .aid-comparison > div { min-width: 0; }
.aid-times dt, .aid-comparison dt { color: var(--muted); font-size: 11px; line-height: 1.3; }
.aid-stats dd, .aid-times dd, .aid-comparison dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aid-times dd, .aid-comparison dd { margin-top: 6px; }
.last-aid-rank-change { margin-left: 5px; font-size: 12px; }
@media (max-width: 700px) {
  .aid-card { margin-top: 14px; padding: 20px; }
  .aid-card + .aid-card { margin-top: 14px; }
  .aid-stats > div { padding-inline: 4px; }
  .aid-stats dd, .aid-times dd, .aid-comparison dd { font-size: 12px; }
}

.next-aid-times { margin-top: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 700px) {
  .next-aid-times [data-next-arrival-hour] { white-space: normal; }
}

.schedule-table .schedule-personal-assistance { font-style: italic; }
.last-aid-rank-change:empty { display: none; }
