:root {
  color-scheme: light;
  font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --paper: #f7f5ef;
  --ui-teal: #427879;
  --foreground: #192e38;
  --muted: #4a5e66;
  --quiet: #53696f;
  --line: #c9d1ce;
  --red: #e10711;
  --map-ground: #101b29;
  --map-flow: #83d6ca;
  --map-context-flow: #a1c9db;
  --map-head: #e1eeea;
  --map-station: #b8ffee;
  --map-focus: var(--red);
  --red-text: #b40b1b;
  background: var(--paper);
  color: var(--foreground);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); }
h1, h2, h3, p { margin: 0; }
button, summary { -webkit-tap-highlight-color: transparent; cursor: pointer; }
button { color: inherit; font: inherit; }
button, .time-wheel { -webkit-user-select: none; user-select: none; }
button { border: 0; background: transparent; }
button:disabled { cursor: default; }
button:focus:not(:focus-visible), summary:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }
:where(button, summary, a):focus-visible { outline: 2px solid var(--map-focus); outline-offset: 3px; }
.shell { --columns: minmax(0, 1fr) clamp(270px, 23vw, 322px); --gutter: clamp(22px, 2.5vw, 40px); max-width: 1536px; margin: auto; padding: 28px clamp(18px, 3.4vw, 54px) 14px; }
.opening { border-top: 1px solid #9caeae; padding: 15px 0 27px; }
.edition { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.edition span:first-child { color: var(--red); font-size: 16px; font-weight: 790; letter-spacing: -.05em; }
.edition span + span { border-left: 1px solid #b4bfbc; padding-left: 12px; }
.headline { margin-top: 19px; display: grid; grid-template-columns: var(--columns); align-items: end; gap: var(--gutter); }
h1 { font-family: "Iowan Old Style", "Baskerville", Georgia, serif; font-size: clamp(46px, 5.2vw, 80px); font-weight: 500; letter-spacing: -.065em; line-height: .91; text-wrap: balance; }
.headline p { color: var(--muted); font-size: clamp(15px, 1.25vw, 19px); line-height: 1.35; text-wrap: pretty; padding-bottom: .12em; }
.workspace { display: grid; grid-template-columns: var(--columns); gap: var(--gutter); align-items: start; }
.map-column, .inspector { min-width: 0; }
.map-frame { position: relative; isolation: isolate; overflow: hidden; height: clamp(460px, calc(100svh - 235px), 790px); background: var(--map-ground); border: 1px solid #294458; border-radius: 8px; box-shadow: 0 2px 6px #23343b14; }
#wm-map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#wm-map:hover:active { cursor: grabbing; }
.map-stamp { position: absolute; pointer-events: none; top: 21px; left: 23px; color: var(--map-head); isolation: isolate; text-shadow: 0 1px 4px #07111e; }
.map-stamp::before { content: ''; position: absolute; z-index: -1; pointer-events: none; inset: -20px -22px -14px -24px; background: linear-gradient(105deg, #101b29c9, #101b2970 66%, transparent); mask-image: linear-gradient(to bottom, black 55%, transparent); }
.map-stamp strong { display: block; font-family: "Iowan Old Style", Georgia, serif; font-weight: 500; font-size: clamp(24px, 2.4vw, 38px); letter-spacing: -.045em; line-height: 1.02; }
.map-stamp span { display: block; margin-top: 7px; color: #c7d9d8; font-size: 13px; font-variant-numeric: tabular-nums; }
#day-volume { position: relative; width: 126px; height: 3px; margin-top: 11px; background: #b8ffee26; }
#day-volume::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--volume, 0%); background: var(--map-flow); box-shadow: 0 0 8px #83d6ca77; transition: width .15s ease-out; }
#day-volume::after { content: ''; position: absolute; left: var(--median, 0%); top: -2px; height: 7px; border-left: 1px solid var(--map-focus); }
@media (prefers-reduced-motion: reduce) { #day-volume::before { transition: none; } }
#wm-map:focus { outline: none; }
.map-keyboard { position: absolute; right: 12px; bottom: 12px; margin: 0; padding: 6px 9px; border: 1px solid #93bebf; border-radius: 4px; background: #132632; color: #e1eeea; font-size: 12px; pointer-events: none; opacity: 0; }
#wm-map:focus-visible:not(.pointer-input) ~ .map-keyboard { opacity: 1; }
.map-legend { display: flex; align-items: baseline; gap: 4px 17px; flex-wrap: wrap; color: var(--muted); margin-top: 10px; font-size: 12px; line-height: 1.45; }
.map-legend > span { display: inline-flex; align-items: baseline; gap: 7px; }
.map-legend > span::before { content: ''; flex: none; align-self: start; margin-top: .4em; }
.key-station::before { width: 7px; height: 7px; background: #457b7e; border-radius: 50%; border: 1px solid #3a686a; }
.key-connection::before { width: 19px; height: 4px; background: var(--ui-teal); clip-path: polygon(0 50%, 100% 0, 100% 100%, 0 61%); box-shadow: 0 0 7px #83d6ca88; }
body[data-view="period"]:has(#station-inspect:not([hidden]), #period-inspect:not([hidden])) .key-connection::before { background: var(--map-focus); }
body[data-view="day"] .key-connection::before { width: 11px; height: 8px; background: #547784; clip-path: polygon(0 0, 100% 50%, 0 100%, 23% 50%); box-shadow: none; }
#station-tooltip { position: absolute; z-index: 2; pointer-events: none; max-width: min(255px, 85%); padding: 8px 10px; background: #e1eeea; color: #0c1926; font-size: 12px; line-height: 1.3; border-radius: 3px; box-shadow: 0 5px 20px #000a; }
#station-tooltip strong { display: block; font-size: 12px; font-weight: 760; }
#station-tooltip span { display: block; margin-top: 2px; color: #46606d; font-size: 11px; font-weight: 620; }
.story-edition, #bike-story-link { color: var(--foreground); font-size: 13px; text-underline-offset: 3px; }
#bike-story-link { display: block; }
.inspector { border-top: 1px solid #9caeae; }
#instrument { display: grid; justify-items: center; padding: 10px 0 19px; }
#time-wheel { width: min(100%, 245px); }
.time-wheel { display: block; width: 100%; height: auto; touch-action: none; overflow: visible; cursor: grab; -webkit-tap-highlight-color: transparent; }
.time-wheel:active { cursor: grabbing; }
.time-wheel:focus { outline: none; }
.time-wheel .focus-mark { opacity: 0; }
.time-wheel:focus-visible:not(.pointer-input) .focus-mark { opacity: 1; }
.time-wheel-track { fill: none; stroke: #a8b8b6; stroke-width: 1; }
.time-wheel-progress { fill: none; stroke: var(--red); stroke-width: 2.25; }
.time-wheel-bar { stroke: var(--ui-teal); }
.time-wheel-bar.current-spoke { stroke: var(--map-focus); stroke-width: 2.5; opacity: 1; }
.time-wheel-mark { stroke: #75909c; stroke-width: 1; }
.time-wheel-label, .time-wheel-caption, .time-wheel-value { text-anchor: middle; }
.time-wheel-label { fill: var(--muted); font-size: 10px; font-weight: 600; }
.time-wheel-caption { fill: var(--muted); font-size: 9px; }
.time-wheel-value { fill: var(--foreground); font-family: "Iowan Old Style", Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.time-wheel-hand { stroke: var(--map-focus); stroke-width: 2; }
.time-wheel-hub { fill: var(--map-focus); stroke: var(--paper); stroke-width: 2; }
.transport { display: grid; justify-items: center; gap: 9px; }
.play { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; background: var(--map-focus); color: white; border-radius: 24px; padding: 9px 19px; font-size: 14px; font-weight: 720; box-shadow: 0 2px 5px #a010111b; }
.play:hover { background: #c50610; }
#play-icon { display: inline-block; width: 10px; height: 12px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.play[data-playing="true"] #play-icon { clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }
.wheel-key { color: var(--muted); font-size: 12px; line-height: 1.45; text-align: center; max-width: 30ch; text-wrap: pretty; }
.story { border-top: 1px solid var(--line); padding: 18px 0 15px; }
#period-panel:has(#period-hint[hidden] + #period-inspect[hidden] + #station-inspect[hidden]) { display: none; }
body[data-view="period"].calendar-gap :is(#period-panel, #change-view, #map-legend) { visibility: hidden; }
#period-hint .route-stops { min-height: 3.8em; }
.story h2 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 680; color: var(--muted); margin-bottom: 9px; }
.story h3 { font-family: "Iowan Old Style", Georgia, serif; font-size: clamp(18px, 1.65vw, 25px); font-weight: 500; line-height: 1.13; letter-spacing: -.035em; text-wrap: pretty; }
.route-card { display: block; width: 100%; text-align: left; border-radius: 3px; padding: 4px 2px 3px 0; }
.route-stops { --step: 4px; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(22px, auto); gap: var(--step); padding-left: 19px; container-type: inline-size; }
.route-stops span { position: relative; overflow-wrap: anywhere; font-size: clamp(13px, 4.68cqi, 16px); line-height: 1.25; align-content: center; font-weight: 520; letter-spacing: -.018em; }
.route-stops span::before { content: ''; position: absolute; width: 8px; height: 8px; border: 1.5px solid var(--ui-teal); border-radius: 50%; left: -17px; top: calc(50% - 4px); box-sizing: border-box; background: var(--paper); }
.route-stops span:first-child::after { content: ''; position: absolute; top: calc(50% + 4px); left: -14px; width: 1px; height: calc(100% + var(--step) - 8px); background: var(--ui-teal); }
.route-stops span:last-child::before { background: var(--ui-teal); }
.route-foot { margin: 12px 0 0 21px; display: flex; gap: 10px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.route-arrow { background: #e1eae6; color: #315f64; padding: 0 8px 2px; border-radius: 50%; line-height: 24px; }
.route-card:hover .route-stops, .chapter-link:hover { color: var(--red-text); }
.route-card:hover .route-arrow { background: var(--map-focus); color: white; }
.story p, #range-message, #day-load-status { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 7px; }
#range-message, #day-load { padding: 15px 0; }
#show-overview { color: var(--muted); }
#pair-days { display: block; width: 100%; height: 38px; margin-top: 12px; }
#pair-days path { fill: var(--ui-teal); }
.ticks { display: flex; justify-content: space-between; color: var(--quiet); font-size: 10px; }
.text-link { min-height: 36px; padding: 7px 0; font-weight: 620; color: var(--foreground); text-decoration: underline; text-decoration-color: #809b99; text-underline-offset: 3px; text-align: left; font-size: 13px; }
.text-link:hover { color: var(--red-text); text-decoration-color: currentColor; }
.chapter-link { border-block: 1px solid var(--line); width: 100%; display: flex; align-items: center; gap: 12px; justify-content: space-between; text-align: left; padding: 15px 1px; font-size: 14px; font-weight: 650; }
.chapter-arrow { font-size: 18px; color: var(--red-text); }
body[data-view="day"] .chapter-arrow { transform: rotate(180deg); }
footer { margin-top: 19px; padding-top: 9px; border-top: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.notes { min-width: 0; }
.notes summary { display: inline-flex; gap: 7px; align-items: center; min-height: 34px; font-size: 13px; font-weight: 620; list-style: none; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary::after { content: '+'; font-size: 17px; color: var(--red-text); }
.notes[open] summary::after { content: '−'; }
.note-body { max-width: 70ch; font-size: 13px; color: var(--muted); line-height: 1.5; }
.note-body p { margin: 4px 0 9px; }
.credits { display: flex; flex-wrap: wrap; gap: 3px 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.credits a { color: inherit; text-underline-offset: 2px; }
@media (max-width: 900px) {
  .shell { padding: 19px 19px 12px; --gutter: 19px; --columns: minmax(0, 1fr) 250px; }
  .headline { margin-top: 13px; }
  .headline p { max-width: none; margin-top: 9px; }
  .opening { padding-bottom: 17px; }
  #time-wheel { max-width: 209px; }
}
@media (min-width: 681px) and (max-width: 1150px) {
  #period-hint .route-foot { min-height: 30px; }
  #period-hint .route-stops { grid-auto-rows: 2.5em; }
  .chapter-link { min-height: 66px; }
}
@media (max-width: 680px) {
  .shell { padding: 12px 14px; }
  .opening { padding: 10px 0 15px; }
  h1 { font-size: clamp(36px, 9vw, 51px); line-height: .96; }
  .edition { font-size: 11px; }
  .edition span:first-child { font-size: 15px; }
  .headline { display: block; margin-top: 13px; }
  .headline p { font-size: 14px; margin-top: 9px; }
  .workspace { display: block; }
  .map-frame { height: clamp(272px, 88vw, 435px); border-radius: 6px; }
  .map-stamp { top: 12px; left: 13px; }
  .map-stamp strong { font-size: 23px; }
  .map-stamp span { font-size: 11px; margin-top: 3px; }
  .map-legend { font-size: 11px; gap: 3px 12px; margin-top: 7px; }
  .inspector { display: flex; flex-direction: column; margin-top: 12px; }
  .story:has(#period-inspect:not([hidden]), #station-inspect:not([hidden]), #clear-bike:not([hidden])) { order: -1; border-top: 0; border-bottom: 1px solid var(--line); }
  #instrument { width: 100%; grid-template-columns: minmax(130px, 1fr) minmax(125px, 1fr); align-items: center; justify-content: center; max-width: 400px; margin: auto; padding: 3px 0; }
  #time-wheel { max-width: 188px; }
  .transport { padding: 0 4px; }
  .play { font-size: 13px; padding-inline: 14px; }
  .wheel-key { font-size: 11px; }
  .story { padding: 13px 0; }
  .story h3 { font-size: 21px; }
  .route-foot { margin-top: 6px; }
  footer { margin-top: 13px; display: block; }
  .credits { padding-top: 2px; }
  #station-connections button { min-height: 32px; }
}
@media (forced-colors: active) {
  .time-wheel:focus-visible { outline: 2px solid Highlight; }
  #play-icon, .route-stops span::before, .route-stops span::after { background: ButtonText; }
}

.station-connections { margin-top: 16px; border-top: 1px solid var(--line); }
.station-directions-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 10px 0 5px; }
.station-directions-head > span { color: var(--muted); font-size: 11px; }
.station-connections h4 { margin: 0; color: var(--muted); font-size: 11px; font-weight: 680; letter-spacing: .08em; text-transform: uppercase; }
#station-connections { display: grid; gap: 0; max-height: 225px; overflow-y: auto; scrollbar-color: #839b9c transparent; padding: 0; margin: 0; list-style: none; }
#station-connections li { border-bottom: 1px solid #c9d1ce; }
#station-connections button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; width: 100%; padding: 7px 0; color: var(--foreground); text-align: left; font-size: 12px; line-height: 1.25; }
#station-connections button:hover { color: var(--red-text); }
.station-connection-name { min-width: 0; overflow-wrap: anywhere; }
.station-connection-count { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 4.3em; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.station-connection-count::before { content: ''; width: 22px; height: var(--stroke-width); border-radius: 8px; background: var(--map-focus); }
