/* Runtrack, race day. One deliberate dark world: asphalt, chalk, and an effort
   scale (yellow → red) that only ever appears where there is effort.
   Type is one family at the ends of its width axis: Archivo 62% black for the
   numbers (speed), Archivo 125% tracked out for the sponsor-board labels. */
:root {
  --ink: #0A0A09;
  --carbon: #151412;
  --line: #2A2724;
  --chalk: #F2EFE9;
  --ash: #8C867C;
  --dim: #3A3631;
  --heat-1: #FFD23F;
  --heat-2: #FFA31A;
  --heat-3: #FF6B1A;
  --heat-4: #E5271B;
  --heat: linear-gradient(90deg, var(--heat-1), var(--heat-2) 38%, var(--heat-3) 68%, var(--heat-4));

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --font: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --mono: 'Azeret Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--chalk);
  font: 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--heat-1); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------ type */
.cond { font-stretch: 62%; }
.semi { font-stretch: 80%; }
.wide { font-stretch: 125%; }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.label { font-stretch: 125%; font-size: 10px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--ash); }
.note { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ash); }
.muted { color: var(--ash); }

/* ------------------------------------------------ frame */
.app { width: 100%; max-width: 440px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
@media (min-width: 900px) { .app { border-inline: 1px solid var(--line); } }
.pad { padding-inline: 20px; }
.grow { flex: 1; }
.bottom { padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.top { height: 64px; display: flex; align-items: center; justify-content: space-between; padding-inline: 20px; padding-top: env(safe-area-inset-top, 0px); box-sizing: content-box; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark::before { content: ''; width: 20px; height: 5px; background: var(--heat); }
.wordmark span { font-stretch: 125%; font-size: 12px; font-weight: 700; letter-spacing: .34em; }
.top-link { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--ash); }
.top-link:hover { color: var(--chalk); }

.rule { border-block: 1px solid var(--line); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Course hoarding: the sponsor boards along a race route, scrolling. */
.hoarding { overflow: hidden; border-block: 1px solid var(--line); padding-block: 10px; }
.hoarding div { display: flex; width: max-content; animation: hoarding 38s linear infinite; }
.hoarding span { display: flex; align-items: center; font-stretch: 125%; font-size: 10px; font-weight: 600; letter-spacing: .3em; color: var(--ash); padding-inline: 20px; }
.hoarding i { width: 4px; height: 4px; background: var(--heat-3); }
@keyframes hoarding { to { transform: translateX(-50%); } }

/* ------------------------------------------------ controls */
.big-btn {
  display: flex; flex-direction: column; justify-content: space-between; width: 100%; padding: 20px; text-align: left;
  transition: transform 120ms var(--ease-out);
}
.big-btn:active { transform: scale(.985); }
.big-btn .word { display: block; font-stretch: 62%; font-weight: 900; line-height: .78; letter-spacing: -.02em; }
.start { background: var(--heat-1); color: var(--ink); height: 44vh; min-height: 250px; max-height: 420px; }
.start .word { font-size: clamp(96px, 34vw, 150px); }
/* Follow-only: the same slab, but it opens the crew instead of starting a run, so it
   wears the quiet surface and its word has to fit a longer name. */
.start.is-follow { background: var(--carbon); color: var(--chalk); border: 1px solid var(--line);
  height: auto; min-height: 0; max-height: none; flex-direction: row; align-items: center; gap: 16px; padding: 26px 20px; }
.start.is-follow .word { font-size: clamp(44px, 14vw, 72px); }
.start.is-follow svg { width: 30px; height: 30px; margin-left: auto; align-self: center; color: var(--heat-2); }
.start svg { align-self: flex-end; width: 28px; height: 28px; transition: transform .15s; }
.start:hover svg { transform: translateX(4px); }
/* On the home page START is a bar above the feed: one tap still starts the run, but the
   feed is what fills the screen. Wide screens give it back its full slab. */
.start.is-bar { height: auto; min-height: 0; max-height: none; flex-direction: row; align-items: center; justify-content: space-between; padding: 18px 20px; }
.start.is-bar .word { order: -1; font-size: clamp(60px, 19vw, 84px); }
.start.is-bar svg { align-self: center; width: 32px; height: 32px; }
.finish { background: var(--heat-4); color: var(--chalk); height: 26vh; min-height: 170px; justify-content: flex-end; }
.finish .word { font-size: clamp(90px, 30vw, 140px); }

.bar-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; height: 64px; padding-inline: 20px;
  background: var(--chalk); color: var(--ink); font-stretch: 80%; font-size: 17px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.bar-btn:hover { background: #fff; }
/* Feedback belongs on the press, not on the release: the finger gets an answer
   before it lifts. Same hop as .big-btn, scaled down for smaller controls. */
.bar-btn, .ghost-btn, .fr-btn, a.step { transition: transform 140ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out); }
.bar-btn:active, .ghost-btn:active, .fr-btn:active { transform: scale(.985); }
a.step:active { transform: scale(.99); }
.bar-btn svg, .step svg { width: 20px; height: 20px; flex: none; }
.ghost-btn {
  display: flex; align-items: center; width: 100%; height: 56px; padding-inline: 20px; border: 1px solid var(--line);
  font-stretch: 80%; font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.ghost-btn:hover { border-color: var(--ash); }
button:disabled { opacity: .5; cursor: progress; }

.step {
  display: flex; align-items: center; gap: 16px; height: 64px; padding-inline: 20px; text-align: left; width: 100%;
  background: var(--chalk); color: var(--ink);
}
.step:hover { background: #fff; }
.step b { width: 20px; font-stretch: 62%; font-size: 28px; font-weight: 900; }
.step span { flex: 1; font-stretch: 80%; font-size: 17px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.step.is-done { background: none; border: 1px solid var(--line); color: var(--ash); cursor: default; }
.step.is-done b { color: var(--heat-1); }
.step.is-locked { background: var(--carbon); color: var(--ash); cursor: default; }

/* Strava's own button and logo, used unmodified as their brand guidelines require: only
   scaled, never recoloured, and never more prominent than Runtrack's own wordmark. */
.strava-btn { display: block; width: 100%; max-width: 280px; }
.strava-btn img { display: block; width: 100%; height: auto; }
.strava-btn.is-locked { opacity: .4; cursor: default; }
.credit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.credit img { height: 20px; width: auto; }
/* Runtrack's Instagram: the glyph in ash, turning chalk when pressed or hovered. */
.ig-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ash); font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  transition: color 140ms var(--ease-out); }
.ig-link svg { width: 20px; height: 20px; flex: none; }
.ig-link:hover, .ig-link:active { color: var(--chalk); }
/* In the home header, beside the account button: seen on every visit, however long the feed. */
.top-end { display: flex; align-items: center; gap: 14px; }
.top .ig-link { font-size: 10.5px; letter-spacing: .04em; gap: 6px; }
.top .ig-link svg { width: 18px; height: 18px; }
/* the narrowest phones keep the glyph; the handle would push into the wordmark */
@media (max-width: 350px) { .top .ig-link span { display: none; } }
/* "View on Strava" has to read as a link: theirs is the orange, bold. */
.strava-link { display: inline-block; color: #FC5200; font-weight: 700; font-size: 13px; letter-spacing: .02em; }

.alert { margin: 0 20px 12px; padding: 12px 14px; border-left: 3px solid var(--heat-4); background: var(--carbon); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--chalk); color: var(--ink); padding: 12px 16px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 50;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Account menu */
.menu { position: relative; }
.menu summary { list-style: none; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); font-stretch: 62%; font-size: 20px; font-weight: 900; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--ash); }
.menu.is-gear summary { color: var(--ash); }
.menu.is-gear summary svg { width: 20px; height: 20px; }
.menu.is-gear[open] summary { color: var(--chalk); }
.menu-list { position: absolute; right: 0; top: 48px; z-index: 40; width: 220px; background: var(--carbon); border: 1px solid var(--line); padding: 6px; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 11px 12px; font-stretch: 80%; font-weight: 700; font-size: 14px; letter-spacing: .05em; text-transform: uppercase; }
.menu-list a:hover, .menu-list button:hover { background: var(--line); }
.menu-list .quiet { color: var(--ash); }
.menu-list .menu-group { display: flex; align-items: center; justify-content: space-between; }
.menu-group i { font-style: normal; font-size: 18px; line-height: 1; color: var(--ash); }
.menu-list .menu-back { color: var(--ash); font-size: 11px; letter-spacing: .2em; padding-block: 9px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ------------------------------------------------ clock + live */
.clock { font-stretch: 62%; font-weight: 900; line-height: .8; letter-spacing: -.02em; font-variant-numeric: tabular-nums; font-size: clamp(96px, 34vw, 146px); }
.clock-small { font-stretch: 62%; font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.is-dim { color: var(--dim); }
.live { display: flex; align-items: center; gap: 10px; font-stretch: 125%; font-size: 11px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; }
.live::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--heat-4); animation: pulse 1.4s ease-out infinite; }
.live.is-off::before { background: var(--dim); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 39, 27, .7); } 100% { box-shadow: 0 0 0 12px rgba(229, 39, 27, 0); } }
.ready { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--ash); }
.ready::before { content: ''; width: 8px; height: 8px; background: var(--heat-1); }

.sync-track { position: relative; height: 3px; overflow: hidden; background: var(--line); }
.sync-track::after { content: ''; position: absolute; inset-block: 0; width: 40%; background: var(--heat); animation: sync 1.3s cubic-bezier(.5, 0, .5, 1) infinite; }
@keyframes sync { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* START: one heat sweep crosses the screen, like the gun going off. */
.gun { position: fixed; inset: 0; z-index: 60; background: var(--heat); pointer-events: none; animation: gun .7s cubic-bezier(.6, 0, .2, 1) forwards; }
@keyframes gun { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ------------------------------------------------ now playing */
.now { display: flex; align-items: center; gap: 16px; }
.now-text { min-width: 0; flex: 1; }
.now-name { font-stretch: 80%; font-weight: 700; font-size: 20px; line-height: 1.15; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { font-size: 14px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now.is-big { display: grid; gap: 20px; }
.now.is-big .now-name { font-size: 30px; }
.art { position: relative; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--carbon); width: 64px; height: 64px; }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art b { font-stretch: 62%; font-weight: 900; font-size: 40px; line-height: 1; }
.art::after { content: ''; position: absolute; inset: auto 0 0; height: 3px; background: var(--c, transparent); }
.now.is-big .art { width: 132px; height: 132px; }
.now.is-big .art b { font-size: 82px; }

/* ------------------------------------------------ welcome */
.headline { font-stretch: 62%; font-weight: 900; text-transform: uppercase; line-height: .82; letter-spacing: -.01em; font-size: clamp(72px, 24vw, 104px); }
.headline i { font-style: normal; color: var(--heat-4); }
.steps { display: grid; gap: 10px; }

/* ------------------------------------------------ the song strip */
.strip-bar { position: relative; height: var(--h, 56px); background: var(--carbon); }
.strip-seg { position: absolute; top: 0; bottom: 0; border-right: 2px solid var(--ink); }
button.strip-seg { cursor: pointer; }
.strip-sel { position: absolute; top: -4px; bottom: -4px; border: 2px solid var(--chalk); pointer-events: none; }
.strip-km { position: relative; height: 16px; margin-top: 6px; }
.strip-km span { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--ash); }
.legend { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 10px; color: var(--ash); }
.legend i { flex: 1; height: 3px; background: var(--heat); }

/* ------------------------------------------------ bib + course */
.bib { display: block; width: 100%; height: auto; }
.bib .b-wide { font-family: var(--font); font-stretch: 125%; font-weight: 700; }
.bib .b-cond { font-family: var(--font); font-stretch: 62%; font-weight: 900; }
.bib .b-semi { font-family: var(--font); font-stretch: 80%; font-weight: 700; }
.bib .b-mono { font-family: var(--mono); font-weight: 500; }
a.bib-link { display: block; transition: transform 120ms var(--ease-out); }
a.bib-link:active { transform: scale(.99); }
.course { display: block; width: 100%; height: auto; background: var(--carbon); }

/* ------------------------------------------------ home */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats dd { font-stretch: 62%; font-weight: 800; font-size: 36px; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stats-top { border-top: 1px solid var(--line); padding-top: 16px; }
.runs li a { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.runs li:first-child a { border-top: 1px solid var(--line); }
.run-date { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ash); grid-column: 1 / -1; }
.run-name { font-stretch: 80%; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-km { font-stretch: 62%; font-weight: 800; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.run-km small { font-stretch: 125%; font-size: 10px; font-weight: 600; letter-spacing: .2em; color: var(--ash); margin-left: 4px; }
.empty { padding: 24px 20px; background: var(--carbon); }
.empty p + p { margin-top: 8px; }

/* ------------------------------------------------ run page */
.back { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -12px; }
.back svg { width: 20px; height: 20px; transform: rotate(180deg); }
.run-title { font-stretch: 62%; font-weight: 800; font-size: 34px; line-height: 1; text-transform: uppercase; margin-bottom: 16px; overflow-wrap: anywhere; }
/* "Soundtrack" is a long word for a third of a phone: give that row its letters back. */
.seg[aria-label="design"] button { letter-spacing: .12em; }

/* Profile photos. Square like the album art: nothing in Runtrack is round. Without a photo
   the Runtrack mark stands in, on the same carbon it sits on as an icon. */
.avatar { --s: 32px; display: inline-block; flex: none; width: var(--s); height: var(--s); overflow: hidden; background: var(--carbon); vertical-align: middle; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fr-name .avatar, .crew-name .avatar { margin-right: 10px; vertical-align: -6px; }
.menu summary:has(.avatar) { overflow: hidden; }
.photo-pick { display: flex; align-items: center; gap: 20px; }

/* The feed. A post is a run's soundtrack: who, the power song, the effort strip, and a
   quiet footnote with the distance — then cheers and comments underneath. */
.feed { display: grid; gap: 14px; padding-top: 8px; }
.post { background: var(--carbon); border: 1px solid var(--line); padding: 16px; }
.post-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.post-who { display: flex; align-items: center; gap: 10px; min-width: 0; font-stretch: 80%; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.post-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-caption { margin-top: 12px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.post-run { display: block; margin-top: 14px; padding: 14px; background: var(--ink); border: 1px solid var(--line); transition: border-color 140ms var(--ease-out); }
.post-run:active { border-color: var(--ash); }
.post-cheers { margin-top: 14px; }
.post-tally { font-size: 15px; letter-spacing: .04em; }
.cheer-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cheer-btn { display: flex; align-items: center; justify-content: center; gap: 4px; height: 38px; border: 1px solid var(--line); background: var(--ink); font-size: 17px;
  transition: transform 120ms var(--ease-out), border-color 120ms var(--ease-out); }
.cheer-btn:active { transform: scale(.94); }
.cheer-btn.is-on { border-color: var(--heat-2); }
.cheer-btn small { font: 600 10px var(--mono); color: var(--ash); }
.comments { display: grid; gap: 12px; margin-top: 14px; }
.comments:empty { display: none; }
.comment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.comment-body p { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.comment-who { font-weight: 700; margin-right: 4px; }
.comment-del { width: 28px; height: 28px; color: var(--ash); font-size: 12px; }
.comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.comment-form input, .caption-input { width: 100%; height: 42px; padding: 0 12px; background: var(--ink); border: 1px solid var(--line); color: var(--chalk); font-family: inherit; font-size: 15px; }
.comment-form input:focus, .caption-input:focus { outline: none; border-color: var(--ash); }
.caption-input { margin-top: 14px; }
.post-box-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.quiet-link { color: var(--ash); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; }

/* Chats. Square like everything else: your messages on chalk, theirs on carbon. Colour
   stays for effort, so the unread count is the only warm thing in the list. */
.chat-list { display: grid; }
.chat-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.chat-row-text { display: grid; gap: 3px; min-width: 0; }
.chat-row-name { font-stretch: 80%; font-weight: 800; font-size: 16px; text-transform: uppercase; letter-spacing: .05em; }
.chat-row-last { font-size: 14px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-last.is-unread { color: var(--chalk); font-weight: 600; }
.chat-row-meta { display: grid; justify-items: end; gap: 6px; color: var(--ash); }
.chat-row-meta svg { width: 18px; height: 18px; }
.chat-unread { min-width: 20px; height: 20px; padding-inline: 5px; display: grid; place-items: center; background: var(--heat-1); color: var(--ink); font: 700 11px var(--mono); }

.chat-top { position: sticky; top: 0; z-index: 10; background: var(--ink); border-bottom: 1px solid var(--line); }
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; font-stretch: 80%; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.chat-who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 6px; padding-top: 16px; padding-bottom: 16px; }
.msg-day { align-self: center; margin: 14px 0 6px; font-size: 10px; }
.msg-empty { align-self: center; text-align: center; text-transform: none; letter-spacing: .02em; margin: auto 0; max-width: 260px; line-height: 1.6; }
.msg { display: grid; justify-items: start; max-width: 82%; }
.msg.is-mine { align-self: flex-end; justify-items: end; }
.bubble { padding: 10px 13px; background: var(--carbon); border: 1px solid var(--line); cursor: default; }
.bubble p { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.is-mine .bubble { background: var(--chalk); color: var(--ink); border-color: var(--chalk); }
.bubble .msg-card + p { margin-top: 10px; }
.msg-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.msg-meta button { font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ash); padding: 6px 0; }
.msg-meta button:hover { color: var(--chalk); }
.msg-card { display: grid; gap: 10px; min-width: 220px; padding: 12px; background: var(--ink); border: 1px solid var(--line); color: var(--chalk); }
.msg.is-mine .msg-card { border-color: var(--ink); }
.msg-card-song { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
.msg-card-song .art { width: 44px; height: 44px; }
.msg-card-song span:last-child { display: grid; min-width: 0; }
.msg-card-song b { font-stretch: 80%; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-card-song small { font-size: 12px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-compose { position: sticky; bottom: 0; z-index: 10; background: var(--ink); border-top: 1px solid var(--line); padding: 10px 20px max(10px, env(safe-area-inset-bottom)); }
.chat-compose-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.chat-compose textarea { width: 100%; min-height: 44px; max-height: 140px; padding: 11px 12px; resize: none; background: var(--carbon); border: 1px solid var(--line); color: var(--chalk); font: inherit; font-size: 16px; line-height: 1.35; }
.chat-compose textarea:focus { outline: none; border-color: var(--ash); }
.chat-icon, .chat-send { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); font-size: 20px; color: var(--chalk); transition: transform 120ms var(--ease-out); }
.chat-send { background: var(--chalk); color: var(--ink); border-color: var(--chalk); }
.chat-send svg { width: 20px; height: 20px; }
.chat-icon:active, .chat-send:active { transform: scale(.94); }
.chat-icon:disabled, .chat-send:disabled { opacity: .5; }
.attach { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding: 8px 10px; background: var(--carbon); border-left: 2px solid var(--chalk); }
.attach .note { text-transform: none; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach button { width: 28px; height: 28px; color: var(--ash); }

.post-reply { display: inline-block; margin-top: 6px; }
.comment-flag { width: 28px; height: 28px; color: var(--dim); font-size: 12px; }
.comment-flag:hover { color: var(--ash); }
.comment:has(.comment-del):has(.comment-flag) { grid-template-columns: auto minmax(0, 1fr) auto auto; }

.reports { display: grid; gap: 28px; }
.report .post-box-actions > * { height: 48px; margin: 0; }
.report { display: grid; gap: 10px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.report blockquote { margin: 0; padding: 12px 14px; background: var(--carbon); border-left: 2px solid var(--heat-4); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }

/* The one hint above the feed: install on iPhone, turn notifications on, or install. */
.hint-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 10px; align-items: center; margin-top: 12px; padding: 14px 12px 14px 16px; background: var(--carbon); border-left: 2px solid var(--chalk); }
.hint-card p { font-size: 14px; line-height: 1.5; }
.hint-card .fr-btn { grid-column: 1; justify-self: start; }
.hint-close { grid-column: 2; grid-row: 1; align-self: start; width: 28px; height: 28px; color: var(--ash); }
.ios-share { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: #0A84FF; }
#hint:empty { display: none; }

/* The crew panel. Bars carry no identity colour — names do that, and colour means effort. */
.crew-list { display: grid; gap: 28px; }
.crew-row { display: grid; gap: 9px; }
.crew-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.crew-name { font-stretch: 80%; font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .05em; }
.crew-km { font-stretch: 62%; font-weight: 800; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crew-km small { font-stretch: 125%; font-size: 9px; font-weight: 600; letter-spacing: .2em; color: var(--ash); margin-left: 4px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 38px; }
.spark i { flex: 1; min-height: 2px; background: var(--dim); }
.spark i.is-now { background: var(--heat-2); }
.crew-facts { font-stretch: 80%; font-size: 11px; color: var(--ash); text-transform: uppercase; letter-spacing: .08em; }
.crew-song { font-size: 13px; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.crew-song i { color: var(--heat-2); font-style: normal; }
.crew-records { display: grid; gap: 16px; }
.crew-records li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.crew-records .label { grid-column: 1 / -1; }
.crew-records b { font-stretch: 62%; font-weight: 800; font-size: 24px; }
.crew-records a, .crew-records li > span:last-child { text-align: right; font-size: 13px; color: var(--ash); }
.crew-songs { display: grid; gap: 14px; }
.crew-songs li { display: grid; grid-template-columns: auto 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.crew-songs .art { width: 44px; height: 44px; }
.crew-rank { font-stretch: 62%; font-weight: 800; font-size: 17px; color: var(--ash); min-width: 14px; }
.crew-track { display: grid; min-width: 0; }
.crew-track b { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-track span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cheers: a closed set of reactions, so there is never a message to moderate. */
.rx-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 20px; }
.rx-btn { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 13px 6px; background: var(--carbon); border: 1px solid var(--line); color: var(--ash);
  transition: transform 140ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out); }
.rx-btn:active { transform: scale(.96); }
.rx-btn.is-on { border-color: var(--heat-2); background: #1D1A16; color: var(--chalk); }
.rx-emoji { font-size: 22px; line-height: 1; }
.rx-label { font-stretch: 125%; font-size: 9px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; }
.rx-list { display: grid; gap: 10px; }
.rx-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.rx-list .rx-emoji { font-size: 18px; }

/* Last week's result: a closed number, so it gets the weight of a finish line. */
.lw { padding-top: 20px; padding-bottom: 20px; background: var(--carbon); }
.lw-line { font-stretch: 80%; font-weight: 800; font-size: clamp(20px, 5.4vw, 26px); line-height: 1.2; margin-top: 10px; text-wrap: balance; }
.lw-km { font-stretch: 62%; font-weight: 900; font-size: clamp(48px, 15vw, 72px); line-height: .9; margin-top: 8px; font-variant-numeric: tabular-nums; }
.lw-km small { font-stretch: 125%; font-size: 11px; font-weight: 600; letter-spacing: .2em; color: var(--ash); margin-left: 8px; vertical-align: middle; }
/* Why a run holds less music than the runner remembers. */
.song-note { font-size: 13px; line-height: 1.5; margin-top: 18px; max-width: 46ch; }
.block { margin-top: 40px; }
.block > .label:first-child { margin-bottom: 16px; }
.picked { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.picked .art { width: 52px; height: 52px; }
.picked .art b { font-size: 32px; }
.picked-pace { text-align: right; }
.picked-pace b { display: block; font-stretch: 62%; font-weight: 800; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.power { position: relative; background: var(--carbon); padding: 20px; }
.power::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--heat-4); }
.power .label { color: var(--heat-4); }
.power .now { margin-top: 12px; }
.power .now-name { font-size: 22px; margin-top: 0; }
.splits li { display: grid; grid-template-columns: 40px 1fr 52px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.split-km { font-stretch: 62%; font-weight: 800; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.split-km.is-part { font-size: 18px; color: var(--ash); }
.split-bar { display: block; height: 8px; background: var(--line); }
.split-bar i { display: block; height: 100%; }
.split-song { display: block; margin-top: 6px; font-size: 12px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-pace { font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ share */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
/* The period filter is a quieter version of the same control. */
/* Day / Week / Month: as many columns as there are buttons, never a second row. */
.seg.is-small { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: auto; }
.seg.is-small button { height: 30px; padding-inline: 11px; font-size: 9px; letter-spacing: .14em; }
.seg button { height: 44px; font-stretch: 125%; font-size: 10px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--ash); }
.seg button[aria-checked="true"] { background: var(--chalk); color: var(--ink); }
.preview { display: flex; align-items: center; justify-content: center; padding-block: 24px; }
.preview canvas { display: block; max-width: 100%; max-height: 58vh; width: auto; height: auto; outline: 1px solid var(--line); }
.preview.is-sticker canvas { background: repeating-conic-gradient(#1d1b18 0% 25%, #26231f 0% 50%) 0 0 / 22px 22px; }

/* ------------------------------------------------ friend page */
.name-big { font-stretch: 62%; font-weight: 900; text-transform: uppercase; line-height: .8; letter-spacing: -.02em; font-size: clamp(80px, 30vw, 150px); white-space: nowrap; overflow-wrap: anywhere; }
.run-title { overflow-wrap: break-word; }

/* ------------------------------------------------ entrance */
.rise { animation: rise .52s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: .001; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .hoarding div, .live::before, .sync-track::after, .gun, .rise { animation: none !important; }
  .gun { display: none; }
  /* Still answers the press, just without the travel. */
  .bar-btn, .ghost-btn, .fr-btn, a.step { transition: none; }
}

/* ------------------------------------------------ friends: a results board */
.fr-list { display: grid; }
.fr-list > li > a, .fr-req { display: grid; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.fr-list > li:first-child > a, .fr-list > li:first-child.fr-req { border-top: 1px solid var(--line); }
.fr-row { grid-template-columns: 30px 1fr auto; }
.fr-row.is-me .fr-name { color: var(--heat-1); }
.fr-row.is-quiet { opacity: .6; }
.fr-live { grid-template-columns: 48px 1fr auto; }
.fr-live .art { width: 48px; height: 48px; }
.fr-live .art b { font-size: 30px; }
.fr-req { grid-template-columns: 1fr auto; }
.fr-place { font-stretch: 62%; font-weight: 900; font-size: 30px; line-height: 1; color: var(--ash); font-variant-numeric: tabular-nums; }
.fr-list > li:first-child .fr-row:not(.is-quiet) .fr-place { color: var(--heat-4); }
.fr-main { min-width: 0; display: grid; gap: 3px; }
.fr-name { font-stretch: 80%; font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-song, .fr-now { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-song i { font-style: normal; color: var(--heat-2); margin-right: 6px; }
.fr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--heat-4); vertical-align: 2px; margin-left: 4px; }
.fr-km { text-align: right; display: grid; justify-items: end; }
.fr-km b { font-stretch: 62%; font-weight: 800; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.fr-km small { font-stretch: 125%; font-size: 9px; font-weight: 600; letter-spacing: .2em; color: var(--ash); }
.fr-today { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--ash); margin-top: 4px; }
.fr-clock { font-stretch: 62%; font-weight: 800; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.fr-actions { display: flex; gap: 8px; }
.fr-btn { height: 40px; padding-inline: 16px; background: var(--chalk); color: var(--ink); font-stretch: 80%; font-weight: 700; font-size: 14px; letter-spacing: .05em; text-transform: uppercase; }
.fr-btn.is-quiet { background: none; border: 1px solid var(--line); color: var(--ash); padding-inline: 14px; }
.share-ask { background: var(--carbon); padding: 20px; border-left: 4px solid var(--heat-1); }
/* Sharing already on: the box reports a state, so it stops asking for attention. */
.share-ask.is-on { border-left-color: var(--line); }
.share-ask.is-on .label { color: var(--heat-1); }
.share-ask-title { font-stretch: 80%; font-weight: 700; font-size: 22px; text-transform: uppercase; margin: 8px 0 6px; }
.fr-form { display: grid; grid-template-columns: 1fr auto; }
.fr-form input { min-width: 0; height: 48px; padding-inline: 14px; background: var(--carbon); border: 1px solid var(--line); border-right: 0; color: var(--chalk); font: 500 15px var(--mono); }
.fr-form input::placeholder { color: var(--ash); }
.fr-form input:focus { outline: none; border-color: var(--ash); }
.fr-form .fr-btn { height: 48px; }
.fr-mine { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line); display: grid; gap: 10px; }
.fr-link { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

/* friends entry on the dashboard */
.friends-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-block: 1px solid var(--line); }
.friends-row .fr-name { font-size: 17px; }
.friends-row .note { display: flex; align-items: center; gap: 8px; }
.friends-row svg { width: 18px; height: 18px; }

/* friend actions and shared totals on a runner's page */
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.pf-stats dd { font-stretch: 62%; font-weight: 800; font-size: 34px; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ terms box + legal page */
.agree { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0 8px; font-size: 14px; color: var(--ash); cursor: pointer; }
.agree input { appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border: 1.5px solid var(--ash); display: grid; place-items: center; cursor: pointer; }
.agree input:checked { background: var(--heat-1); border-color: var(--heat-1); }
.agree input:checked::after { content: ''; width: 10px; height: 6px; border: solid var(--ink); border-width: 0 0 2.5px 2.5px; transform: translateY(-2px) rotate(-45deg); }
.agree a { color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; }
a.step.is-locked { pointer-events: auto; }

.legal { padding-top: 24px; max-width: 680px; }
.legal-lede { font-size: 18px; line-height: 1.5; margin-top: 8px; }
.legal h2 { font-stretch: 80%; font-weight: 700; font-size: 20px; text-transform: uppercase; letter-spacing: .03em; margin: 36px 0 10px; }
.legal p, .legal li { font-size: 15px; line-height: 1.6; color: #D9D5CC; }
.legal ul { display: grid; gap: 8px; padding-left: 18px; list-style: square; }
.legal li::marker { color: var(--heat-3); }
.legal a { color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; }
.legal b { color: var(--chalk); }

/* ------------------------------------------------ wide screens (iPad and up)
   Phones keep the one-column layout untouched: .desk wrappers vanish below 768px
   (display: contents), so their children lay out exactly as before. From 768px
   the same markup becomes two columns. */
/* The tab bar: fixed to the bottom on a phone, a row under the header on a wide screen. */
.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; max-width: 440px; margin-inline: auto; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--ink); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 58px;
  font: 600 9px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ash); transition: color 120ms var(--ease-out); }
.tabs svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--chalk); }
.tabs a[aria-current="page"]::before { content: ''; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; background: var(--chalk); }
.tabs a:active { color: var(--chalk); }
.tabs .dot { position: absolute; top: 10px; left: calc(50% + 9px); width: 7px; height: 7px; background: var(--heat-1); }
.app:has(> .tabs) { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

.desk { display: contents; }

@media (min-width: 768px) {
  .app { max-width: 1240px; }
  .top, .rule { padding-inline: 40px; }
  .pad { padding-inline: 40px; }
  .alert { margin-inline: 40px; }

  .desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 64px; padding-inline: 40px; align-items: start; }
  .desk .pad, .desk .rule { padding-inline: 0; }
  .desk .alert { margin-inline: 0; }
  .desk-a, .desk-b { min-width: 0; }

  /* the biggest words scale with their column, not the phone */
  .desk .start, .desk .finish, .desk-welcome .desk-a, .desk-run .desk-a { container-type: inline-size; }

  /* welcome: headline left, the two steps right */
  .desk-welcome { flex: 1; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; padding-block: 24px 40px; }
  .desk-welcome .headline { font-size: 25cqi; }
  .desk-welcome .desk-b .alert { margin-bottom: 16px; }

  /* dashboard: START left (stays put), everything else right */
  .desk-home { padding-top: 8px; padding-bottom: 40px; }
  .desk-home .desk-a { position: sticky; top: 16px; }
  .desk-home .start { height: min(62vh, 600px); max-height: none; }
  .desk-home .start .word { font-size: 41cqi; }
  .desk-home .desk-b > :first-child { margin-top: 0 !important; }
  .desk-home .desk-b .bottom { padding-bottom: 0; }
  .desk-home .start.is-bar { flex-direction: column; align-items: stretch; padding: 20px; }
  .desk-home .start.is-bar .word { order: 0; }
  .desk-home .start.is-bar svg { align-self: flex-end; width: 28px; height: 28px; }
  /* follow only: no START, so the feed takes one centred column */
  .desk-home.is-solo { grid-template-columns: minmax(0, 640px); justify-content: center; }

  .tabs { position: static; max-width: none; margin-inline: 40px; display: flex; gap: 32px; border-top: 0; border-bottom: 1px solid var(--line); padding: 0; margin-bottom: 24px; }
  .tabs a { flex-direction: row; gap: 8px; height: 46px; font-size: 10px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs a[aria-current="page"]::before { top: auto; bottom: -1px; left: 0; right: 0; }
  .tabs .dot { position: static; }
  .app:has(> .tabs) { padding-bottom: 0; }

  /* running and finished: the clock left, the big button (or the wait) right */
  .desk-run { flex: 1; align-items: stretch; padding-bottom: 40px; }
  .desk-run .desk-a { padding-block: 40px; }
  .desk-run .clock { font-size: min(40cqi, 260px); }
  .desk-run .desk-b { display: flex; flex-direction: column; justify-content: center; padding-block: 40px; }
  .desk-run .finish { flex: 1; height: auto; max-height: 620px; }
  .desk-run .finish .word { font-size: 41cqi; }

  /* run summary: the bib stays in view on the left while the details scroll */
  .desk-summary { padding-bottom: 40px; }
  .desk-summary .desk-a { position: sticky; top: 16px; }
  .desk-summary .run-title { font-size: 56px; }
  .desk-summary .desk-b > .block:first-child { margin-top: 0; border-top: 0 !important; padding-top: 0 !important; }

  /* share: preview left, format and buttons right */
  .desk-share { grid-template-columns: auto 380px; justify-content: center; grid-template-areas: "preview seg" "preview actions"; grid-template-rows: auto 1fr; padding-bottom: 40px; }
  .desk-share .share-seg { grid-area: seg; }
  .desk-share .preview { grid-area: preview; padding-block: 0; justify-content: flex-start; }
  .desk-share .preview canvas { max-height: 78vh; }
  .desk-share .share-actions { grid-area: actions; align-self: start; margin-top: 16px; }

  /* friends: live and requests left, the week's results right */
  .desk-friends {
    grid-template-areas: "req week" "ask week" "running week" "add week";
    grid-template-rows: auto auto auto 1fr; padding-bottom: 40px;
  }
  .desk-friends > * { align-self: start; }
  .desk-friends .fr-requests { grid-area: req; }
  .desk-friends .fr-ask { grid-area: ask; }
  .desk-friends .fr-running { grid-area: running; }
  .desk-friends .fr-week { grid-area: week; margin-top: 8px; }
  .desk-friends .fr-add { grid-area: add; }

  /* a runner's page: name across the top, song and totals side by side */
  .name-big { font-size: clamp(120px, 17vw, 240px); }
  .desk-profile { padding-inline: 0; align-items: start; margin-top: 40px; }
  .desk-profile .pf-stats { margin-top: 0; }
  .desk-profile .desk-a { margin-top: 0 !important; }
  .pf-action { max-width: 50%; margin-left: auto; }
}

/* ------------------------------------------------ username */
.uname {
  width: 100%; height: 72px; padding: 0 16px; background: var(--carbon); color: var(--chalk);
  border: 0; border-bottom: 2px solid var(--line); border-radius: 0;
  font: 800 40px/1 var(--font); font-stretch: 62%; letter-spacing: .01em;
}
.uname::placeholder { color: var(--dim); }
.uname:focus { outline: none; border-bottom-color: var(--chalk); }
.uname-msg { margin-top: 12px; text-transform: none; letter-spacing: .02em; min-height: 16px; }
.uname-msg[data-tone="ok"] { color: var(--heat-1); }
.uname-msg[data-tone="bad"] { color: var(--heat-4); }
.handle { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--ash); }

/* ------------------------------------------------ head to head */
.cmp-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.cmp-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; padding-top: 8px; }
.cmp-head .is-right { text-align: right; }
.cmp-who { font-stretch: 62%; font-weight: 900; font-size: clamp(34px, 11vw, 56px); line-height: .9; text-transform: uppercase; margin: 8px 0 6px; overflow-wrap: anywhere; }
.cmp-vs { font-stretch: 125%; font-weight: 700; font-size: 12px; letter-spacing: .3em; color: var(--ash); padding-bottom: 28px; }
.cmp-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cmp-row:first-child { border-top: 1px solid var(--line); }
.cmp-label { text-align: center; min-width: 88px; }
.cmp-val { font-stretch: 62%; font-weight: 800; font-size: 30px; line-height: 1; color: var(--ash); }
.cmp-val.is-right { text-align: right; }
.cmp-val small { font-stretch: 125%; font-size: 9px; font-weight: 600; letter-spacing: .2em; margin-left: 4px; color: var(--ash); }
/* The winner is marked by a chalk square as well as by colour, never colour alone. */
.cmp-val.is-win { color: var(--chalk); }
.cmp-val.is-win::after { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--chalk); margin-left: 8px; vertical-align: 3px; }
.cmp-val.is-right.is-win::after { content: none; }
.cmp-val.is-right.is-win::before { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--chalk); margin-right: 8px; vertical-align: 3px; }
/* The friendly war: one line of needle, then the week and the month as a split bar.
   The bar takes the two series colours; the numbers above it say the same thing in
   text, so nothing here is carried by colour alone. */
/* No rule underneath: the duel's own first row draws one right after it. */
.rival { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 0; }
.rival-line { font-stretch: 80%; font-weight: 700; font-size: clamp(17px, 4.6vw, 21px); line-height: 1.3; color: var(--chalk); text-wrap: balance; }
.rival-rows { display: grid; gap: 16px; margin-top: 18px; }
.rival-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 10px; }
.rival-when { text-align: center; min-width: 88px; }
.rival-val { font-stretch: 62%; font-weight: 800; font-size: 22px; line-height: 1; color: var(--ash); }
.rival-val.is-right { text-align: right; }
.rival-val.is-win { color: var(--chalk); }
.rival-bar { grid-column: 1 / -1; display: flex; gap: 2px; height: 6px; margin-top: 8px; background: var(--dim); overflow: hidden; }
.rival-bar i { background: #BF3420; }
.rival-bar b { background: #AB8F00; }
.cmp-powers { display: grid; gap: 12px; }
.cmp-power { background: var(--carbon); padding: 16px; }
.cmp-chart { margin: 0; }
.cmp-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-stretch: 80%; font-weight: 700; font-size: 14px; text-transform: uppercase; margin-bottom: 12px; }
.cmp-plot { position: relative; background: var(--carbon); touch-action: pan-y; }
.cmp-plot:focus-visible { outline: 2px solid var(--heat-1); outline-offset: 2px; }
.cmp-plot svg { display: block; }
.cmp-grid { stroke: var(--line); stroke-width: 1; }
.cmp-tick { fill: var(--ash); font: 500 10px var(--mono); }
.cmp-cross { stroke: var(--ash); stroke-width: 1; }
.cmp-tip { position: absolute; top: 12px; z-index: 5; min-width: 150px; max-width: 240px; background: var(--ink); border: 1px solid var(--line); padding: 10px 12px; pointer-events: none; }
.cmp-tip-row { font-size: 12px; margin-top: 6px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-tip-row b { color: var(--chalk); font-family: var(--mono); font-weight: 600; font-size: 13px; }
.cmp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cmp-table th, .cmp-table td { text-align: left; padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp-table thead th { font-stretch: 80%; font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--ash); }
.cmp-table thead th:first-child { width: 44px; }
.cmp-table tbody th { font-stretch: 62%; font-weight: 800; font-size: 22px; line-height: 1; }
.cmp-table td b { display: block; font-family: var(--mono); font-weight: 500; font-size: 14px; color: var(--ash); }
.cmp-table td span { display: block; margin-top: 3px; font-size: 11px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-table td.is-win b { color: var(--chalk); font-weight: 600; }

@media (min-width: 768px) {
  .desk-compare { padding-bottom: 40px; }
  .desk-compare .desk-a { position: sticky; top: 16px; }
  .desk-compare .desk-b > .block:first-child { margin-top: 8px; }
  .cmp-powers { grid-template-columns: 1fr 1fr; }
}
