/* Setup screens: the main action stays in reach at the bottom, even when a long plan scrolls. */
.screen-setup > .push-bottom, .screen-setup form > .push-bottom, #plan form > .push-bottom {
  position: sticky; bottom: 0; z-index: 1;
  padding: var(--space-3) 0 max(var(--space-1), env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--paper) 14px);
}

/* Short phones: less air above, smaller titles, so setup fits one screen (the spacing tokens change in tokens.css). */
@media (max-height: 720px) {
  .ready-map .route-map { height: clamp(160px, 30dvh, 300px); }
  .founder-map { min-height: 120px; }
  .plan-map svg { max-height: 30dvh; }
  :root { --h1: 32px; }
  .screen-setup { gap: var(--space-3); padding-bottom: var(--space-3); }
  .screen-setup .stack-lg, .screen-setup.stack-lg { gap: var(--space-4); }
  .input-big-centered { padding: var(--space-2) 0; }
  .input-big-centered input { font-size: 60px; }
  .field-big input { font-size: 28px; }
  .bullets { gap: var(--space-1); font-size: 14px; }
  .steps { gap: var(--space-1); }
  .screen-setup .card-sky.stack-sm { gap: var(--space-1); }
}
@media (max-height: 560px) {
  .ready-map .route-map { height: 26dvh; }
  .founder-map, .plan-map { display: none; }
  .plan-summary .timeline { display: none; }
}

/* Welcome: one phone screen, no scroll. The illustration takes whatever height is left. */
.screen-public:has(.welcome-hero) { height: 100dvh; min-height: 0; overflow: hidden; padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); gap: var(--space-4); }
.welcome-hero { display: flex; flex-direction: column; gap: var(--space-3); flex: none; }
.welcome-hero h1 { font-size: clamp(34px, 10.5vw, 52px); }
.welcome-art { margin: 0 calc(-1 * var(--gutter)); flex: 1 1 auto; min-height: 120px; overflow: hidden; }
.welcome-art img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.screen-public:has(.welcome-hero) .push-bottom { flex: none; margin-top: 0; }

/* Today */
.today-header .day { font-size: 14px; font-weight: 700; }
.streak { display: flex; flex-direction: column; gap: var(--space-1-5); }

/* History */
.history-row { display: grid; grid-template-columns: 74px 56px 1fr 52px; gap: var(--space-2); align-items: center; padding: var(--space-3) var(--card-pad); border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.history-row:last-child { border-bottom: 0; }
.history-row:hover { color: inherit; }
@media (hover: hover) and (pointer: fine) { .history-row:hover { background: var(--hover); } }
.history-row .w { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.history-row .note { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-row .d { text-align: right; font-size: 14px; font-weight: 700; }
.history-row .history-tags { display: flex; gap: 4px; }
.history-head a { font-weight: 700; }
/* The count and the Tags link stay one line: beside the title when they fit, under it when they don't. */
.header-plain:has(> .history-head) { flex-wrap: wrap; row-gap: var(--space-1); }
.history-head { white-space: nowrap; }

/* Tags: the last seven days as columns (weekday, date, the scale or a dash, the day's icons), the picked one
   outlined; then that day's chips and the week in a line; then what each measured tag does. */
.tag-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-1); }
.tag-day {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-height: 112px; padding: var(--space-2) 0;
  border: var(--border) solid transparent; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; touch-action: manipulation;
}
/* At 375px a day is about 41px wide: the tap area takes half the gap on each side, never the neighbour's. */
.tag-day { position: relative; }
.tag-day::before { content: ""; position: absolute; inset: 0 -2px; }
.tag-day:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.tag-day.on { background: var(--surface); border-color: var(--ink); }
.tag-day-name { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; line-height: 1; }
.tag-day-date { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; }
.tag-day.today .tag-day-date { color: var(--signal-text); }
.tag-day-weight { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.tag-day-weight.none { color: var(--dash); }
.tag-day-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 44px; }
.tag-day-icons .tag-icon-plain, .history-tags .tag-icon-plain { color: var(--green); }
@media (hover: hover) and (pointer: fine) { .tag-day:not(.on):hover { background: var(--hover); } }
@media (prefers-reduced-motion: no-preference) { .tag-day { transition: background-color 150ms ease-out, border-color 150ms ease-out; } }
.tag-week-sum { margin: 0; font-size: 14px; color: var(--muted); }
.tag-week-sum b { color: var(--ink); }
.tag-effects { display: flex; flex-direction: column; }
.tag-effect { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); border-top: 1px solid var(--line-soft); font-size: 15px; }
.tag-effect:first-child { border-top: 0; }
.tag-effect-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.tag-effect-value { font-variant-numeric: tabular-nums; font-weight: 700; }
.tag-effect-value.green { color: var(--green-deep); }

/* Me */
.pass-card { display: flex; align-items: center; gap: var(--space-3); padding: 0; overflow: hidden; }
.pass-card .badge { align-self: stretch; display: flex; align-items: center; justify-content: center; padding: var(--space-4) var(--space-3); font-weight: 700; font-size: 13px; line-height: 1.15; width: min-content; min-width: 76px; flex-shrink: 0; text-align: center; }
/* As wide as its longest word: "experimental" in Portuguese doesn't fit 76px. */
.pass-card .badge-green { background: var(--green); color: var(--paper); }
.pass-card .badge-ink { background: var(--ink); color: var(--paper); }
.pass-card .badge-blue { background: var(--blue); color: var(--paper); }
.pass-card .badge-muted { background: var(--line-soft); color: var(--muted); }
.pass-card .text { padding: var(--space-3) var(--card-pad) var(--space-3) 0; font-size: 15px; }

/* Placeholder tabs */
.placeholder { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) 0; }

/* Route */
.route-header { padding: var(--top-inset) var(--gutter) var(--header-pad); display: flex; flex-direction: column; gap: var(--space-1-5); }
.route-map-wrap { position: relative; }
/* Arrived: a reached run with nothing chosen next. Green header, the title in the finish's face, the choice under the map. */
.route-arrived .route-header { background: var(--green-tint); }
.route-arrived-title { color: var(--green-deep); }
.route-choice-other { text-align: center; font-weight: 700; }
.route-map { width: 100%; height: auto; display: block; }
.route-map .tip { cursor: pointer; outline: none; }
.route-map .tip:focus-visible { outline: 2px solid var(--signal); }
.route-tip { position: absolute; width: 210px; display: flex; flex-direction: column; gap: var(--space-0-5); box-shadow: 0 6px 20px rgb(17 20 24 / .15); z-index: 1; }
/* Ready: the whole route as a framed picture, fitted to the height it has, so the finish is never cut off. It unrolls
   from the start down to the finish, then the pin drops onto the start. */
.ready-map { display: flex; justify-content: center; padding: max(var(--space-4), env(safe-area-inset-top)) var(--gutter) 0; }
.ready-map .route-map { width: auto; max-width: 100%; height: clamp(220px, 40dvh, 420px); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(17 20 24 / .14); }
.ready-body { padding-top: var(--space-4); }
.ready-pill { align-self: flex-start; }
/* "backwards", not "both": once unrolled the clip goes away, so the picture's shadow shows. */
@media (prefers-reduced-motion: no-preference) {
  .ready-map .route-map { animation: route-unroll 1.3s cubic-bezier(.2, .7, .2, 1) backwards; }
  .ready-map .route-map .pin { animation: pin-drop .55s cubic-bezier(.3, 1.5, .5, 1) 1.15s backwards; }
  .route-pin-lands .route-map .pin { animation: pin-drop .6s cubic-bezier(.3, 1.5, .5, 1) .3s backwards; }
}
/* Reduced motion: no unrolling or dropping, the picture and the pin fade in instead. */
@media (prefers-reduced-motion: reduce) {
  .ready-map .route-map { animation: fade-in .3s ease-out backwards; }
  .ready-map .route-map .pin, .route-pin-lands .route-map .pin { animation: fade-in .3s ease-out .2s backwards; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes route-unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pin-drop { from { translate: 0 -44px; opacity: 0; } to { translate: 0 0; opacity: 1; } }

/* The plan's route, bleeding to the card's edges at the top of the summary */
.plan-summary { overflow: hidden; }
.plan-map { margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 0; }
.plan-map svg { width: 100%; height: auto; max-height: 40dvh; display: block; margin: 0 auto; }

/* Plan timeline: dots placed by date on a track inset by half a dot each side */
.timeline-track { position: relative; height: 16px; margin: 0 8px; }
.timeline-line { position: absolute; left: 0; right: 0; top: 6px; height: 3px; background: var(--line); }
.timeline-dot { position: absolute; top: 0; width: 16px; height: 16px; margin-left: -8px; }
.timeline-start { background: var(--ink); border-radius: 50%; }
.timeline-stop { background: var(--signal); border-radius: 3px; }
.timeline-finish { background: var(--paper); border: 4px solid var(--signal); border-radius: 50%; }
.timeline-labels { display: flex; justify-content: space-between; gap: var(--space-1-5); margin-top: var(--space-2); }
.plan-summary { padding: var(--card-pad); }
.pace-line { align-items: center; }
.pace-line .shape { margin-top: var(--space-0-5); }

/* Stops and goal */
.run-timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-5); position: relative; display: flex; flex-direction: column; gap: var(--space-4); }
.run-timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 3px; background: var(--line); }
.tl { position: relative; display: flex; flex-direction: column; gap: var(--space-0-5); font-size: 17px; }
.tl-sub { font-size: 15px; color: var(--muted); }
.tl::before { content: ""; position: absolute; left: calc(-1 * var(--space-5)); top: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--line); }
.tl-you::before { background: var(--signal); }
.tl-stop::before { background: var(--signal); border-radius: 3px; }
.tl-finish::before { background: var(--paper); border: 4px solid var(--signal); box-sizing: border-box; }
.tl-add::before { background: transparent; border: 2px dashed var(--line); box-sizing: border-box; }
.edit-finish > summary, .add-stop > summary { list-style: none; cursor: pointer; }
.edit-finish > summary::-webkit-details-marker, .add-stop > summary::-webkit-details-marker { display: none; }
.add-stop[open] > summary { display: none; }

/* Start on <date>? */
.start-route { padding: var(--space-4) var(--space-3) var(--space-3); }
.start-route svg { display: block; width: 100%; height: auto; font-family: var(--font-text); }
.start-route line { stroke-linecap: round; }
.start-route-before { stroke: var(--signal); stroke-width: 4; stroke-dasharray: 1 9; }
.start-route-done { stroke: var(--signal); stroke-width: 7; }
.start-route-ahead { stroke: var(--line-soft); stroke-width: 7; }
.start-route-day { fill: var(--surface); stroke: var(--signal); stroke-width: 3; }
.start-route-pole { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.start-route-flag { fill: var(--signal); }
.start-route-you { fill: var(--ink); stroke: var(--surface); stroke-width: 3; }
.start-route-finish { fill: var(--ink); }
.start-route-finish-cloth { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.start-route text { text-anchor: middle; }
.start-route-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; fill: var(--ink); }
.start-route-date { font-size: 12px; fill: var(--muted); }
.start-route-kg { font-size: 14px; font-weight: 700; fill: var(--ink); }
.start-route-gap { fill: none; stroke: var(--signal-text); stroke-width: 1.5; }
.start-route-gap-text { font-size: 12px; font-weight: 700; fill: var(--signal-text); }

/* Import: a file or days typed in, and the preview of what was read before it is saved. */
.import-example { margin: 0; font-size: 13px; background: var(--paper); padding: var(--space-3); border-radius: 8px; }
.or-divider { display: flex; align-items: center; gap: var(--space-3); margin: 0; color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.paste-form textarea { min-height: 150px; font-size: 17px; line-height: 1.4; resize: vertical; }
.paste-form textarea::placeholder { color: var(--muted); opacity: 0.8; }
.paste-preview { width: 100%; border-collapse: collapse; font-size: 15px; }
.paste-preview th { text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 var(--space-3) var(--space-1-5) 0; border-bottom: 1px solid var(--line); }
.paste-preview td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; line-height: 1.3; }
.paste-preview td:first-child { white-space: nowrap; }
.paste-preview .num { text-align: right; white-space: nowrap; padding-right: var(--space-4); }
.paste-preview .num b { font-variant-numeric: tabular-nums; }
.paste-replaces { display: block; margin-top: var(--space-0-5); font-size: 13px; font-weight: 700; color: var(--signal-text); }
.paste-same { color: var(--muted); }
.paste-note { overflow-wrap: anywhere; }
.paste-skipped q { overflow-wrap: anywhere; font-weight: 700; }
.paste-reason { display: block; }
/* The preview is a plain scrolling page: Import and the editor sit in the flow, nothing sticks to the bottom. */
.paste-screen > .push-bottom { position: static; background: none; padding: 0; }
.csv-format > summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: var(--space-1-5) 0; min-height: var(--tap); display: flex; align-items: center; }
.csv-format[open] > summary { color: var(--ink); }

/* Progress */
.weeks { width: 100%; border-collapse: collapse; font-size: 16px; }
.progress-side { display: flex; flex-direction: column; gap: var(--space-4); }
/* On a list surface, so the text starts where the cards' text does. */
.weeks th { text-align: left; font-size: 13px; color: var(--muted); padding: var(--space-3) var(--space-2) var(--space-2); border-bottom: 1px solid var(--line); }
.weeks td { padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line-soft); }
.weeks :is(th, td):first-child { padding-left: var(--card-pad); }
.weeks :is(th, td):last-child { padding-right: var(--card-pad); }
.weeks tbody tr:last-child td { border-bottom: 0; }
.weeks th:nth-child(n+2), .weeks td:nth-child(n+2) { text-align: right; }
.chart-head { display: flex; flex-direction: column; gap: var(--space-2); }
.chart-range a { font-size: 15px; }
@media (min-width: 900px) {
  .chart-head { flex-direction: row; justify-content: space-between; align-items: center; gap: var(--space-3); }
  .chart-range { width: 280px; flex: none; }
}
.weeks-more { padding: var(--space-3) var(--card-pad); border-top: 1px solid var(--line-soft); font-weight: 700; }

/* Finish */
.finish-screen { background: var(--green-tint); min-height: 100dvh; }
.finish-title { font-size: 46px; color: var(--green-deep); }
.run-card { text-decoration: none; color: inherit; }
.run-card:hover { color: inherit; }

/* Crew (section 7b) */
.crew h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.crew-map { display: block; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1; color: #111418; background: #DCE7F7;
}
.avatar-1 { background: #DCF0E3; } .avatar-2 { background: #F7E6D0; } .avatar-3 { background: #EDE0F5; } .avatar-4 { background: #F5DCDC; }
.avatar-me { background: var(--ink); color: var(--paper); }
.avatar-sm { width: 24px; height: 24px; font-size: 9px; }
.avatar-sm + .avatar-sm { margin-left: -8px; }
.crew-week, .crew-season { display: flex; flex-direction: column; gap: var(--space-1); }
/* The season ends on a row: it runs to the card's bottom edge, so a highlighted last row leaves no sliver under it. */
.crew-season { padding-bottom: 0; overflow: hidden; }
.crew-season .crew-row:last-child { padding-bottom: var(--space-3); }
.crew-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--card-pad); margin: 0 calc(-1 * var(--card-pad)); }
.crew-row-me { background: var(--signal-tint); }
.crew-row-paused { opacity: 0.5; }
.crew-rank { width: 16px; font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; }
.crew-row:first-of-type .crew-rank, .crew-season .crew-row:nth-of-type(1) .crew-rank { color: var(--signal); }
.crew-points { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1; min-width: 2ch; text-align: right; }
.week-dots { display: inline-flex; gap: var(--space-0-5); }
.week-dots span { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); }
.week-dots span.on { background: var(--ink); }
.form-bar { width: clamp(48px, 14vw, 80px); height: 8px; border-radius: var(--pill); background: var(--line-soft); overflow: hidden; flex: none; }
.form-bar span { display: block; height: 100%; background: var(--ink); }
.crew-row-me .form-bar span { background: var(--signal); }
.crew-feed { border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.crew-event { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--card-pad); border-bottom: 1px solid var(--line-soft); }
.crew-event:last-child { border-bottom: 0; }
.crew-event:not(.crew-event-mine) { background: var(--green-tint); }
.chip-five { border-color: var(--green); color: var(--green); background: var(--surface); white-space: nowrap; }
.chip-ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button.chip-ink { color: var(--paper); }
.invite-link { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.invite-link b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.crew-shared { margin: 0; padding-left: var(--space-5); list-style: disc; display: flex; flex-direction: column; gap: var(--space-1); }

/* Finish reached: green to the edges and all the way down; the timeline of the way here. */
body:has(.finish-screen) { background: var(--green-tint); }
.finish-screen > .push-bottom { position: static; background: none; padding-bottom: 0; }
.finish-timeline::before { background: var(--green); }
.finish-timeline .tl::before { background: var(--green); }
.finish-timeline .tl-circle::before { background: var(--green); }
.finish-timeline .tl-square::before { background: var(--blue); border-radius: 3px; }
.finish-timeline .tl-diamond::before { background: var(--ink); border-radius: 2px; transform: rotate(45deg) scale(0.85); }
.finish-timeline .tl-stop::before { background: var(--signal); border-radius: 3px; }
.finish-timeline .tl:first-child::before { background: var(--ink); }
.finish-timeline .tl-finish::before { background: var(--green-tint); border: 4px solid var(--signal); }

/* Arriving from the weigh-in that got there, once: the badge lands and its ring turns, the words rise, the stats
   card follows with its numbers, then the way down is drawn from the start, each mark as the line reaches it, the
   goal popping in last; the choice of what's next comes after. --steps is the number of marks after the start, --i a mark's place; the
   whole way takes at most 1.4s however long the run was, so the choice is in by about 3.3s. */
.finish-arriving { --finish-ease: cubic-bezier(.32, .72, 0, 1); --finish-way-at: 1.25s; --finish-step: min(140ms, 1.4s / var(--steps)); }
@media (prefers-reduced-motion: no-preference) {
  .finish-arriving .finish-badge { animation: finish-land .7s cubic-bezier(.3, 1.4, .5, 1) backwards; }
  .finish-arriving .finish-ring { transform-box: fill-box; transform-origin: center; animation: finish-turn 1.4s cubic-bezier(.2, .7, .2, 1) backwards; }
  .finish-arriving .finish-words > * { animation: finish-rise .5s var(--finish-ease) backwards; }
  .finish-arriving .finish-words > :nth-child(1) { animation-delay: .35s; }
  .finish-arriving .finish-words > :nth-child(2) { animation-delay: .5s; }
  .finish-arriving .finish-words > :nth-child(3) { animation-delay: .65s; }
  .finish-arriving .tiles { animation: finish-rise .5s var(--finish-ease) .8s backwards; }
  .finish-arriving .tile > * { animation: finish-rise .4s var(--finish-ease) backwards; }
  .finish-arriving .tile:nth-child(1) > * { animation-delay: .95s; }
  .finish-arriving .tile:nth-child(2) > * { animation-delay: 1.05s; }
  .finish-arriving .tile:nth-child(3) > * { animation-delay: 1.15s; }
  .finish-arriving .finish-timeline::before {
    transform-origin: top; animation: finish-draw calc(var(--steps) * var(--finish-step)) linear var(--finish-way-at) backwards;
  }
  .finish-arriving .finish-timeline .tl { animation: finish-mark .35s var(--finish-ease) calc(var(--finish-way-at) + var(--i) * var(--finish-step)) backwards; }
  .finish-arriving .finish-timeline .tl-finish::before { animation: finish-goal .6s cubic-bezier(.3, 1.6, .5, 1) calc(var(--finish-way-at) + var(--i) * var(--finish-step)) backwards; }
  .finish-arriving > .push-bottom { animation: finish-rise .5s var(--finish-ease) calc(var(--finish-way-at) + (var(--steps) + 2) * var(--finish-step)) backwards; }
}
/* Reduced motion: nothing moves; the words, then the rest, fade in. */
@media (prefers-reduced-motion: reduce) {
  .finish-arriving > * { animation: fade-in .3s ease-out backwards; }
  .finish-arriving > .finish-timeline, .finish-arriving > .push-bottom { animation-delay: .2s; }
}
@keyframes finish-land { from { opacity: 0; scale: .6; } }
@keyframes finish-turn { from { rotate: -120deg; } }
@keyframes finish-rise { from { opacity: 0; translate: 0 12px; } }
@keyframes finish-draw { from { scale: 1 0; } }
@keyframes finish-mark { from { opacity: 0; translate: -8px 0; } }
@keyframes finish-goal { from { scale: .3; } }

/* The crew card on Today */
.crew-today { display: flex; flex-direction: column; gap: var(--space-1-5); padding: var(--card-pad); border-color: var(--ink); overflow: hidden; }
.crew-today a { text-decoration: none; color: inherit; }
.crew-today-head { display: flex; align-items: center; gap: var(--space-3); }
.crew-today .avatars { display: inline-flex; }
.crew-today .avatars .avatar-sm { box-shadow: 0 0 0 2px var(--surface); }
.crew-today-place { display: flex; flex-direction: column; gap: var(--space-0-5); }
.crew-today-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.05; }
.crew-today-event { margin: var(--space-1-5) calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)); border-top: 1px solid var(--line-soft); border-bottom: 0; background: var(--green-tint); }
.crew-today .avatars .avatar-sm + .avatar-sm { margin-left: -3px; }
.points-help > summary { cursor: pointer; position: relative; }
.points-help > summary::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--tap); transform: translateY(-50%); }
.points-help[open] > summary { margin-bottom: var(--space-3); }
.points-rules { margin: 0; padding-left: var(--space-5); list-style: disc; display: flex; flex-direction: column; gap: var(--space-1-5); }

/* On/off switches in Me */
.toggle { -webkit-appearance: none; appearance: none; flex: none; width: 46px; height: 28px; margin: 0; border-radius: var(--pill); background: var(--line); position: relative; cursor: pointer; transition: background 0.15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform 0.15s; }
.toggle:checked { background: var(--green); }
.toggle:checked::after { transform: translateX(18px); }
.toggle:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.switch-form label { cursor: pointer; }
.switch-form label > span:first-child { min-width: 0; }
/* One line at most, so a failed save never pushes the row taller than a line. */
.switch-error:not([hidden]) { display: block; margin-top: var(--space-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pick your scenery */
.scenery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.scenery-card { display: flex; flex-direction: column; border: var(--border) solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); cursor: pointer; }
.scenery-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.scenery-card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.scenery-card:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.scenery-art svg { display: block; width: 100%; height: auto; max-height: 26dvh; object-fit: cover; }
.scenery-name { display: flex; flex-direction: column; padding: var(--space-2) var(--space-3); border-top: 1px solid var(--line-soft); }
.scenery-name b { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1; }

/* Dark mode for drawings: charts take the text colours; route illustrations get a dimmed sky (brief section 4). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) svg.chart [fill="#111418"] { fill: var(--ink); }
  :root:not([data-theme="light"]) svg.chart [stroke="#111418"] { stroke: var(--ink); }
  :root:not([data-theme="light"]) svg.chart [fill="#4A545C"] { fill: var(--muted); }
  :root:not([data-theme="light"]) svg.chart [stroke="#E2E6EA"] { stroke: var(--line); }
  :root:not([data-theme="light"]) svg.chart [fill="#DCEFE3"] { fill: var(--green-tint); }
  :root:not([data-theme="light"]) svg.chart [fill="#1E8A4C"] { fill: var(--green); }
  :root:not([data-theme="light"]) svg.chart [stroke="#4A545C"] { stroke: var(--muted); }
  :root:not([data-theme="light"]) svg.chart [stroke="#2563C9"] { stroke: var(--blue); }
  :root:not([data-theme="light"]) svg.chart [fill="#FFFFFF"] { fill: var(--surface); }
  :root:not([data-theme="light"]) svg.crew-map text.ink { fill: var(--ink); }
  :root:not([data-theme="light"]) svg.crew-map text.muted { fill: var(--muted); }
  :root:not([data-theme="light"]) svg.crew-map path[stroke="#E2E6EA"] { stroke: var(--line); }
  :root:not([data-theme="light"]) svg.crew-map path[stroke="#111418"] { stroke: var(--muted); }
  :root:not([data-theme="light"]) svg.route-map, :root:not([data-theme="light"]) .scenery-art svg, :root:not([data-theme="light"]) .welcome-art img { filter: brightness(0.82) saturate(0.9); }
}
:root[data-theme="dark"] svg.chart [fill="#111418"] { fill: var(--ink); }
:root[data-theme="dark"] svg.chart [stroke="#111418"] { stroke: var(--ink); }
:root[data-theme="dark"] svg.chart [fill="#4A545C"] { fill: var(--muted); }
:root[data-theme="dark"] svg.chart [stroke="#E2E6EA"] { stroke: var(--line); }
:root[data-theme="dark"] svg.chart [fill="#DCEFE3"] { fill: var(--green-tint); }
:root[data-theme="dark"] svg.chart [fill="#1E8A4C"] { fill: var(--green); }
:root[data-theme="dark"] svg.chart [stroke="#4A545C"] { stroke: var(--muted); }
:root[data-theme="dark"] svg.chart [stroke="#2563C9"] { stroke: var(--blue); }
:root[data-theme="dark"] svg.chart [fill="#FFFFFF"] { fill: var(--surface); }
:root[data-theme="dark"] svg.crew-map text.ink { fill: var(--ink); }
:root[data-theme="dark"] svg.crew-map text.muted { fill: var(--muted); }
:root[data-theme="dark"] svg.crew-map path[stroke="#E2E6EA"] { stroke: var(--line); }
:root[data-theme="dark"] svg.crew-map path[stroke="#111418"] { stroke: var(--muted); }
:root[data-theme="dark"] svg.route-map, :root[data-theme="dark"] .scenery-art svg, :root[data-theme="dark"] .welcome-art img { filter: brightness(0.82) saturate(0.9); }
/* Bands that are dark by design stay dark. */
.site-dark { --ink: #F6F7F3; background: #111418; color: #F6F7F3; }

a.chip-ink, a.chip-ink:hover { color: var(--paper); }

/* History as weeks of dots */
.history-switch { width: 200px; }
.week-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.week-month-group { display: flex; flex-direction: column; gap: var(--space-1-5); }
.week-row { display: grid; grid-template-columns: 34px repeat(7, 1fr) 64px; align-items: center; justify-items: center; gap: var(--space-1); }
.week-head span { font-size: 12px; font-weight: 700; color: var(--muted); }
.week-month { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.week-label { justify-self: start; font-size: 13px; color: var(--muted); }
.week-change { justify-self: end; display: inline-flex; align-items: center; gap: var(--space-1); font-size: 14px; font-weight: 700; }
.day-dot { position: relative; display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--line-soft); }
@media (hover: hover) and (pointer: fine) { a.day-dot:hover { transform: scale(1.12); } }
/* A 32px target around the 26px dot; the grid's cells are wider than that, so neighbours never overlap. */
a.day-dot::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; }
.day-dot.below-1 { background: #A7D9B8; } .day-dot.below-2 { background: #4CAF77; } .day-dot.below-3 { background: var(--green); }
.day-dot.above-1 { background: #F4C3AC; } .day-dot.above-2 { background: #E2804F; } .day-dot.above-3 { background: var(--warn); }
.day-dot.day-missed { background: transparent; border: 2px dashed var(--line); }
.day-dot.day-none { background: transparent; }
.day-dot.today { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--signal); }
.day-dot.noted::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); border: 2px solid var(--paper); }
.week-key { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.week-key span { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.week-key .day-dot { width: 14px; height: 14px; }
.week-key .day-dot.noted::after { width: 6px; height: 6px; right: -3px; bottom: -3px; border-width: 1px; }
.legend .legend-point { width: 8px; height: 8px; border: 1.5px solid var(--ink); background: var(--surface); transform: rotate(45deg); }
.run-link { text-decoration: none; color: inherit; }
@media (hover: hover) and (pointer: fine) { .run-link:hover { color: var(--signal); text-decoration: underline; } }

/* How Trendot works: three frames, each a small drawing beside one line. */
.intro-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.intro-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: var(--space-5); }
.intro-marker { display: flex; flex-direction: column; align-items: center; }
.intro-marker::after { content: ""; flex: 1; border-left: 3px dotted var(--signal); margin: var(--space-1-5) 0; }
.intro-number { width: 34px; height: 34px; flex: none; border-radius: var(--pill); background: var(--signal); color: var(--on-signal); display: flex; align-items: center; justify-content: center; font: 800 20px/1 var(--font-display); }
/* The pole stands on the dotted line (the pole is 3px in, the line is the column's centre). */
.intro-flag { order: 2; width: 26px; height: 30px; flex: none; align-self: flex-start; margin-left: 14px; }
.intro-body { display: flex; flex-direction: column; gap: var(--space-3); padding-bottom: var(--space-6); }
.intro-step-last .intro-body { padding-bottom: var(--space-7); }
.intro-body h2 { font-size: 30px; text-wrap: balance; }
.intro-body p { line-height: 1.45; }
.intro-art { display: block; width: 100%; height: auto; border-radius: 16px; }
.intro-glow { opacity: 0.35; }
.intro-scale { stroke: var(--ink); stroke-width: 3; }
.intro-readout { fill: var(--paper); font: 800 22px var(--font-display); text-anchor: middle; }
.intro-trend, .intro-route { stroke-width: 5; }
.intro-you { stroke-width: 3; }
.intro-key { fill: var(--muted); font: 700 12px var(--font-text); }
.intro-key-trend { fill: var(--signal-text); }
/* From 1100px the steps sit side by side and the dotted line runs across, to the flag on the right. One grid
   holds all three, so the drawings, titles and texts line up row by row however many lines a title takes. */
@media (min-width: 1100px) {
  .screen:has(.intro-steps) { --screen: 1100px; }
  .intro-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto auto; column-gap: var(--space-6); }
  .intro-step { grid-row: span 4; grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; row-gap: var(--space-2); }
  .intro-body { display: contents; }
  /* The text sits close under its title; the drawing and the title keep more air above them. */
  .intro-body > :is(.intro-art, h2) { margin-top: var(--space-2); }
  .intro-marker { flex-direction: row; height: 34px; }
  .intro-step:not(.intro-step-last) .intro-marker::after { margin-right: calc(-1 * var(--space-5)); }
  .intro-marker::after { border-left: 0; border-top: 3px dotted var(--signal); align-self: center; margin: 0 0 0 var(--space-2); }
  .intro-flag { margin: 0 0 0 var(--space-2); align-self: center; }
  .screen:has(.intro-steps) .push-bottom { width: 300px; align-self: center; margin-top: var(--space-4); }
}

/* Passes: the trial-ended screen from the canvas, also reached during the trial and when a renewal fails. Sky behind,
   a big line about the way so far, the passes as cards at the foot. */
.passes-screen { background: var(--sky); min-height: 100dvh; }
body:has(.passes-screen) { background: var(--sky); }
.passes-screen > .push-bottom { position: static; background: none; padding-bottom: 0; }
.passes-back { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; text-decoration: none; }
/* The map fills what's left between the title and the ticket. Absolutely placed, because Safari doesn't resolve a
   percentage height inside a flex item and drew it at zero; its own proportion keeps it whole. */
.founder-map { flex: 1 1 0; min-height: 180px; position: relative; }
.founder-map .route-map { position: absolute; top: 0; bottom: 0; left: 50%; translate: -50% 0; height: 100%; width: auto; max-width: 100%; aspect-ratio: 360 / 460; border-radius: var(--radius); box-shadow: 0 10px 30px rgb(17 20 24 / .14); }
.founder-map .loop-map { aspect-ratio: 360 / 400; }
.passes-eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.passes-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 46px; line-height: 1; text-wrap: balance; }
.passes-founder { display: block; width: 100%; min-height: var(--tap); text-align: center; font-size: 15px; }
.passes-later { display: inline-flex; align-items: center; min-height: var(--tap); font-size: 14px; }
.ticket { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ticket-primary { box-shadow: 0 12px 32px rgb(17 20 24 / .12); }
.ticket-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--card-pad); background: var(--ink); color: var(--paper);
  font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
.ticket-head small { font-size: 14px; color: var(--signal); }
.ticket-head-signal, .ticket-head-signal small { background: var(--signal); color: var(--on-signal); }
.ticket-body { padding: var(--card-pad); }
.ticket-price { font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1; }
.ticket-price small { font-size: 22px; }
.ticket-body .btn { width: 100%; margin-top: var(--space-1); }

/* Me's pass card when it leads to the passes: the whole card is the tap, the action reads as one, nothing underlined. */
.pass-card-offer { text-decoration: none; color: inherit; }
.pass-card-action { font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .pass-card-offer:hover { border-color: var(--ink); } }
.pass-card-form { margin: 0; }
button.pass-card { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
