/* SwimmingDSL — swimmingdsl.com
   Meet-day look: deep navy bands, a red call to action, condensed upper-case
   headings, a short yellow bar over each heading (from the lane-rope discs),
   and the pool itself: deck tile, the navy lane line, water, ropes.
   Red means action or time: buttons, the sweep hand, the playhead, send-offs. */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("fonts/big-shoulders-display-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --navy: #0B1B3F;          /* bands */
  --navy-2: #13285A;        /* raised surfaces on navy */
  --ink: #13245B;           /* text on light, the lane line */
  --ink-soft: #46557F;
  --tile: #EEF5F4;
  --grout: rgba(19, 36, 91, 0.05);
  --water: #3AA5BC;
  --water-deep: #1B7893;
  --water-pale: #D7ECEF;
  --red: #D7263D;
  --red-dark: #B31C30;
  --yellow: #F2C12E;
  --marker-blue: #1C4FA8;
  --frame: #C3CCD2;
  --white: #FFFFFF;
  --rule: rgba(19, 36, 91, 0.16);

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, monospace;

  --s-1: 0.8rem;
  --s0: 1rem;
  --s1: 1.25rem;
  --s2: 1.5625rem;
  --s3: 1.953rem;

  --wrap: 74rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--s0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.band-light :focus-visible, .band-tile :focus-visible { outline-color: var(--ink); }
code, pre, textarea, .entry-code { font-family: var(--mono); }
code { font-size: 0.92em; }
p { margin: 0 0 1rem; }
figure { margin: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 20; background: var(--yellow); color: var(--navy); padding: 0.5rem 1rem; font-weight: 700; }
.skip:focus { top: 1rem; }
.red { color: var(--red); }

/* ---------- buttons ---------- */

.btn-red {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 11rem;
  font: 700 0.78rem/1 var(--body);
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 1.05rem 1.8rem;
  border: 0; border-radius: 2px;
  background: linear-gradient(90deg, var(--red), #C21F37);
  color: var(--white);
  cursor: pointer;
}
.btn-red:hover { background: var(--red-dark); }
.btn-red:disabled { opacity: 0.55; cursor: default; }

.btn {
  display: inline-flex; align-items: center;
  font: 700 0.74rem/1 var(--body);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0.7rem 1rem;
  border: 2px solid var(--ink); border-radius: 2px;
  background: var(--white); color: var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--water-pale); }
.btn-dark { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.6); }
.btn-dark:hover { background: rgba(255,255,255,0.1); }

.link-btn {
  font: inherit; font-size: var(--s-1);
  background: none; border: 0; padding: 0; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}

/* ---------- headings: condensed, upper case, a rope-yellow bar on top ---------- */

h1, h2 {
  font-family: var(--display);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  margin: 0;
}
/* section titles: sentence case, so the all-caps hero stays the loud one */
h2 {
  font-size: clamp(2.7rem, 6vw, 4.4rem);
  font-weight: 800;
  text-transform: none;
  letter-spacing: -0.01em;
  line-height: 0.92;
  margin-bottom: 2rem;
}

/* ---------- header + hero (navy) ---------- */

.top-band { background: var(--navy); color: var(--white); }
.top {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem; padding-block: 1.1rem;
}
.wordmark {
  font-family: var(--display); font-weight: 850; font-size: var(--s2);
  text-transform: uppercase; letter-spacing: 0.02em;
  text-decoration: none; margin: 0;
}
.top ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.6rem; list-style: none; margin: 0; padding: 0; }
.top nav a { text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.top nav a:hover { text-decoration: underline; }

.hero { background: var(--navy); color: var(--white); padding-bottom: 3rem; }
.race-intro {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem 3rem;
  padding-block: clamp(2rem, 5vw, 3.5rem) 2rem;
}
h1 {
  font-size: clamp(3.2rem, 8.5vw, 7rem);
  line-height: 0.86;
}
.race-intro p { margin: 0; max-width: 22em; font-size: var(--s1); line-height: 1.4; color: #C9D3E8; }

/* ---------- shared pool parts ---------- */

.rope { display: flex; height: 14px; background: var(--water-deep); }
.rope span { height: 100%; background-repeat: repeat-x; background-size: 14px 14px; }
.rope span:nth-child(1), .rope span:nth-child(3) {
  flex: 0 0 20%;
  background-image: radial-gradient(circle at 7px 7px, var(--red) 5.6px, rgba(0,0,0,0.25) 6.3px, transparent 6.7px);
}
.rope span:nth-child(2) {
  flex: 1 1 auto; background-size: 28px 14px;
  background-image:
    radial-gradient(circle at 7px 7px, var(--yellow) 5.6px, rgba(0,0,0,0.2) 6.3px, transparent 6.7px),
    radial-gradient(circle at 21px 7px, var(--white) 5.6px, rgba(0,0,0,0.2) 6.3px, transparent 6.7px);
}

.water-bg {
  background:
    radial-gradient(120% 140% at 30% 0%, rgba(255,255,255,0.22), transparent 55%),
    linear-gradient(180deg, var(--water) 0%, #2F98B1 100%);
}
.caustics::before,
.race-pool::before,
.water::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='180'%3E%3Cfilter id='c' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.022 0.034' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0 0 0 0 0 0 0.9 0 0 0 0 0 0 0'/%3E%3C/feComponentTransfer%3E%3CfeGaussianBlur stdDeviation='0.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 300px 180px;
  mix-blend-mode: screen;
  pointer-events: none;
}

.lane-line {
  position: absolute; left: 8%; right: 8%; top: 50%;
  height: 8px; transform: translateY(-50%);
  background: var(--ink); opacity: 0.85;
}
.lane-line::before, .lane-line::after {
  content: ""; position: absolute; top: 50%;
  width: 8px; height: 60%; min-height: 28px; max-height: 64px;
  transform: translateY(-50%);
  background: var(--ink);
}
.lane-line::before { left: 0; }
.lane-line::after { right: 0; }

.swimmer {
  position: absolute; left: 0; top: 50%;
  width: var(--sw-w, 88px); height: calc(var(--sw-w, 88px) * 0.375);
  margin-left: calc(var(--sw-w, 88px) / -2);
  transform:
    translateX(calc(var(--x, 0.02) * (100cqw - 2 * var(--wall, 14px)) + var(--wall, 14px)))
    translateY(calc(-50% + var(--y, 0px)))
    scaleX(var(--dir, 1));
  will-change: transform;
  z-index: 2;
}
.swimmer::before {
  content: ""; position: absolute; right: 70%; top: 50%;
  width: 110%; height: 55%; transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55));
  border-radius: 50%; filter: blur(2px);
}
.swimmer.resting::before { opacity: 0; }
.swimmer svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.sw-body { fill: #0E2A48; opacity: 0.55; }
.sw-arm { stroke: #0E2A48; stroke-width: 4; stroke-linecap: round; opacity: 0.55; }
.sw-cap { fill: var(--cap, var(--red)); stroke: var(--white); stroke-width: 1.5; }

/* ---------- the race ---------- */

.race-pool {
  position: relative;
  background:
    radial-gradient(120% 140% at 30% 0%, rgba(255,255,255,0.2), transparent 55%),
    linear-gradient(180deg, var(--water) 0%, #2C92AB 100%);
  border-left: 18px solid var(--tile);
  border-right: 18px solid var(--tile);
}
.race-pool::before { z-index: 0; }
.rl {
  --sw-w: 72px; --wall: 44px;
  position: relative;
  height: clamp(54px, 6.4vw, 78px);
  container-type: inline-size;
}
.rl[data-lane="1"] { --cap: var(--red); }
.rl[data-lane="2"] { --cap: var(--yellow); }
.rl[data-lane="3"] { --cap: var(--white); }
.rl[data-lane="4"] { --cap: #1C4FA8; }
.race-pool > .rope { position: relative; z-index: 1; }

.block-no {
  position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: 18px; text-align: center;
  font-family: var(--display); font-weight: 850; font-size: 1rem; color: var(--ink);
  z-index: 3;
}
/* broadcast graphics on the lane: what they're swimming, and where they finished */
.tag {
  position: absolute; left: calc(var(--wall) + var(--sw-w) / 2 + 10px); top: 50%; transform: translateY(-50%);
  z-index: 3;
  padding: 0.2rem 0.6rem;
  background: rgba(11, 27, 63, 0.82);
  color: var(--white);
  font-family: var(--display); font-weight: 750; font-size: 0.95rem; letter-spacing: 0.04em;
  text-transform: uppercase;
  border-left: 4px solid var(--cap);
  transition: opacity 0.3s;
  white-space: nowrap;
}
.racing .tag, .raced .tag { opacity: 0; }
.place {
  position: absolute; right: calc(var(--wall) + var(--sw-w) / 2 + 10px); top: 50%; transform: translateY(-50%) scale(0.6);
  z-index: 3;
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.25rem 0.7rem;
  background: var(--navy); color: var(--white);
  font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.2s, transform 0.25s;
}
.place b { font-weight: 850; font-size: 1.35rem; color: var(--yellow); }
.place.show { opacity: 1; transform: translateY(-50%) scale(1); }
.place.near { right: auto; left: calc(var(--wall) + var(--sw-w) / 2 + 10px); }
.place.first { background: var(--yellow); color: var(--navy); }
.place.first b { color: var(--navy); }
.rl.dq .swimmer { opacity: 0.25; }

.race-clock {
  position: absolute; right: 0; top: -2.9rem; z-index: 4;
  padding: 0.25rem 0.8rem;
  background: var(--white); color: var(--navy);
  font-family: var(--display); font-weight: 850; font-size: 1.7rem; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  border-bottom: 4px solid var(--red);
}

.race-board { padding-top: 1.25rem; }
.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) 9rem;
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.entry-no {
  display: grid; place-items: center;
  height: 2.3rem;
  background: var(--cap, var(--red)); color: var(--navy);
  font-family: var(--display); font-weight: 850; font-size: 1.3rem;
}
.entry[data-lane="1"] { --cap: var(--red); }
.entry[data-lane="2"] { --cap: var(--yellow); }
.entry[data-lane="3"] { --cap: var(--white); }
.entry[data-lane="4"] { --cap: #4D86E8; }
.entry[data-lane="1"] .entry-no { color: var(--white); }
.entry-code {
  width: 100%;
  font-size: 0.95rem;
  color: var(--white);
  background: var(--navy-2);
  border: 1px solid transparent;
  border-bottom: 2px dotted rgba(255,255,255,0.45);
  padding: 0.55rem 0.7rem;
  border-radius: 2px;
}
.entry-code:hover { border-bottom-style: solid; }
.entry-code:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.entry.bad .entry-code { border-color: var(--red); }
.entry-res {
  font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  text-align: right; font-variant-numeric: tabular-nums;
}
.entry-res .dq { color: var(--red); }
.entry-res .nt { color: #9FB0D3; }
.entry-res .pl { color: var(--yellow); margin-right: 0.45rem; }
.entry-msg {
  grid-column: 2 / 4;
  font-size: var(--s-1); color: #FFB3BD;
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
}
.entry-msg:empty { display: none; }
.entry-msg button {
  font: 700 0.72rem/1 var(--body); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.4rem 0.6rem; border-radius: 2px; cursor: pointer;
  background: var(--yellow); color: var(--navy); border: 0;
}

.race-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.5rem; }
.race-status { margin: 0; font-family: var(--display); font-weight: 750; font-size: var(--s2); text-transform: uppercase; letter-spacing: 0.02em; }

/* ---------- bands ---------- */

.band { padding-block: clamp(3.5rem, 8vw, 6rem); }
.band-light { background: var(--white); }
.band-tile {
  background-color: var(--tile);
  background-image:
    linear-gradient(var(--grout) 1px, transparent 1px),
    linear-gradient(90deg, var(--grout) 1px, transparent 1px);
  background-size: 28px 28px;
}
.band-navy { background: var(--navy); color: var(--white); }
.band-sub { color: #C9D3E8; max-width: 36em; margin: -1rem 0 2rem; }

/* ---------- read a set ---------- */

.read-grid { display: grid; gap: 1.5rem; justify-items: start; }
.board-scrawl {
  display: inline-block;
  padding: 0.7rem 1.4rem 0.5rem;
  background: var(--white);
  border: 7px solid var(--frame);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(19,36,91,0.08);
  transform: rotate(-1.4deg);
}
.board-scrawl p {
  margin: 0;
  font-family: var(--display); font-weight: 650;
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1;
  color: var(--marker-blue); white-space: nowrap;
}
.board-scrawl figcaption { font-size: var(--s-1); color: var(--ink-soft); margin-top: 0.4rem; }
.board-scrawl span { border-radius: 4px; transition: background-color 0.15s; }
.board-scrawl span.hl { background: rgba(58, 165, 188, 0.25); }
.arrow { margin: 0 0 0 2.5rem; width: 3px; height: 2rem; background: var(--ink); position: relative; }
.arrow::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  border: 8px solid transparent; border-top: 10px solid var(--ink); border-bottom: 0;
}

.anat-line { display: flex; flex-wrap: wrap; column-gap: clamp(0.9rem, 2.2vw, 1.8rem); row-gap: 1.5rem; margin: 0; }
.g { display: inline-flex; flex-direction: column; border-radius: 6px; }
.g code {
  font-size: clamp(1.6rem, 4.4vw, 3.7rem);
  font-weight: 500; line-height: 1.05;
  letter-spacing: -0.02em; word-spacing: -0.3em;
  white-space: nowrap; padding: 0 0.08em; border-radius: 6px;
  transition: background-color 0.15s;
}
.g .rule { position: relative; margin-top: 0.7rem; padding-top: 0.55rem; font-size: var(--s-1); color: var(--ink-soft); white-space: nowrap; }
.g .rule::before {
  content: ""; position: absolute; left: 0.1em; right: 0.1em; top: -0.35rem; height: 0.55rem;
  border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 3px 3px;
}
.g.hl code { background: rgba(58, 165, 188, 0.2); }
.g.hl .rule { color: var(--ink); }
.g code input, .g code select {
  font: inherit; color: inherit; letter-spacing: inherit;
  background: transparent;
  border: 0; border-bottom: 3px dotted var(--water-deep); border-radius: 0;
  padding: 0; margin: 0;
  -webkit-appearance: none; appearance: none; -moz-appearance: textfield;
  cursor: pointer;
}
.g code input { cursor: text; }
.g code input::-webkit-inner-spin-button, .g code input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.g code input:hover, .g code select:hover { border-bottom-style: solid; }
.g code input:focus-visible, .g code select:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-bottom-color: transparent; }

.trace {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem; margin-top: 3.5rem;
}
.trace figure { position: relative; }
.trace figcaption {
  font-family: var(--display); font-weight: 800; font-size: var(--s1);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.trace figure + figure::before {
  content: ""; position: absolute; left: -2rem; top: 4.4rem;
  width: 1.5rem; height: 5px; background: var(--red);
}
.trace figure + figure::after {
  content: ""; position: absolute; left: -0.6rem; top: calc(4.4rem - 7px);
  width: 5px; height: 19px; background: var(--red);
}
.trace pre { min-height: 8rem; }
.trace-out { margin: 0; border-top: 3px solid var(--ink); }
.trace-out div { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.trace-out dt { font-size: var(--s-1); color: var(--ink-soft); }
.trace-out dd { margin: 0; font-family: var(--display); font-weight: 800; font-size: var(--s1); font-variant-numeric: tabular-nums; }
.under { margin: 2.5rem 0 0; }

pre {
  margin: 0;
  background: var(--white); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 2px;
  padding: 1rem 1.15rem;
  font-size: 0.82rem; line-height: 1.6;
  overflow-x: auto; max-width: 100%;
}
pre code { font-size: inherit; }

/* ---------- build a session ---------- */

.build-head h2 { margin-bottom: 1.5rem; }
.pool { position: relative; }
.water {
  position: relative;
  height: clamp(110px, 14vw, 170px);
  background:
    radial-gradient(120% 140% at 30% 0%, rgba(255,255,255,0.22), transparent 55%),
    linear-gradient(180deg, var(--water) 0%, #2F98B1 100%);
  overflow: hidden;
  container-type: inline-size;
}
.wall { position: absolute; top: 0; bottom: 0; width: 14px; background: var(--tile); z-index: 1; }
.wall-l { left: 0; box-shadow: 2px 0 0 rgba(19,36,91,0.25); }
.wall-r { right: 0; box-shadow: -2px 0 0 rgba(19,36,91,0.25); }
.wall::after { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 34%; transform: translateY(-50%); background: var(--ink); }
.flags { position: absolute; top: 0; bottom: 0; width: 2px; background: repeating-linear-gradient(180deg, rgba(255,255,255,0.85) 0 7px, transparent 7px 12px); opacity: 0.7; }
.flags-l { left: 20%; }
.flags-r { left: 80%; }

.profile-wrap { padding-top: 1.1rem; }
.profile { position: relative; height: 56px; border-bottom: 2px solid var(--ink); }
.profile:focus-within { outline: 3px solid var(--ink); outline-offset: 6px; }
.segs { position: absolute; inset: 0; }
.seg { position: absolute; bottom: 0; background: var(--water); box-shadow: inset -1px 0 0 var(--tile); }
.seg.i-moderate { background: var(--water-deep); }
.seg.i-hard { background: var(--ink); }
.seg.i-none { background: #7FA9B8; }
.seg.k-kick, .seg.k-drill { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.45) 0 2px, transparent 2px 6px); }
.seg.new { animation: pop 0.9s ease-out; }
@keyframes pop { from { filter: brightness(1.8) saturate(1.5); } to { filter: none; } }
.playhead { position: absolute; top: -8px; bottom: -6px; left: 0; width: 3px; margin-left: -1.5px; background: var(--red); pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: -5px; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--white); }
#scrub { position: absolute; left: 0; right: 0; top: -10px; bottom: -8px; width: 100%; height: calc(100% + 18px); margin: 0; opacity: 0; cursor: ew-resize; }
.profile-key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 2rem; margin: 0.5rem 0 0; font-size: var(--s-1); color: var(--ink-soft); }
.k { display: inline-block; width: 0.8rem; height: 0.8rem; margin: 0 0.3rem -0.1rem 0.6rem; vertical-align: baseline; }
.k:first-child { margin-left: 0; }
.k-easy { background: var(--water); }
.k-mod { background: var(--water-deep); }
.k-hard { background: var(--ink); }
.k-kick { background: var(--ink-soft) repeating-linear-gradient(135deg, rgba(255,255,255,0.5) 0 2px, transparent 2px 5px); }

.deck { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 2rem 3rem; padding-top: 2rem; }

/* pill tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.tabs [role="tab"] {
  font: 700 0.82rem/1 var(--body);
  padding: 0.55rem 0.95rem;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--ink); background: rgba(19,36,91,0.06); }
.tabs [role="tab"][aria-selected="true"] { background: var(--red); color: var(--white); }
.tabs-dark [role="tab"] { color: #C9D3E8; font-size: 0.95rem; padding: 0.65rem 1.2rem; }
.tabs-dark [role="tab"]:hover { color: var(--white); background: rgba(255,255,255,0.08); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; }
.chips[hidden] { display: none; }
.chip {
  font: 500 0.86rem/1 var(--mono);
  padding: 0.55rem 0.8rem;
  border: 2px solid var(--ink); border-radius: 2px;
  background: var(--white); color: var(--ink);
  cursor: pointer;
}
.chip::before { content: "+ "; color: var(--red); font-weight: 700; }
.chip:hover { background: var(--ink); color: var(--white); }
.chip:hover::before { color: var(--yellow); }

.editor { position: relative; background: var(--white); border: 2px solid var(--ink); border-radius: 2px; overflow: hidden; }
.editor textarea {
  position: relative; z-index: 1; display: block; width: 100%;
  min-height: 24em; margin: 0; padding: 1rem 1.1rem;
  border: 0; resize: vertical; background: transparent; color: var(--ink);
  font-size: 0.86rem; line-height: 1.6; tab-size: 2; white-space: pre; overflow: auto;
}
.editor textarea:focus-visible { outline: none; }
.editor:focus-within { box-shadow: 0 0 0 3px var(--tile), 0 0 0 6px var(--ink); }
.line-mark { position: absolute; left: 0; right: 0; z-index: 0; background: rgba(58, 165, 188, 0.18); border-left: 4px solid var(--water-deep); opacity: 0; pointer-events: none; }
.line-mark.on { opacity: 1; }
.line-mark.err { background: rgba(215, 38, 61, 0.12); border-left-color: var(--red); }
.editor-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 0.6rem; }
.parse-status { margin: 0; min-height: 1.55em; font-weight: 600; }
.parse-status.err { color: var(--red-dark); }
.fixes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.fixes:empty { display: none; }
.fixes .btn { border-color: var(--red); }

.board { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.25rem 1.5rem; align-content: start; padding-top: 3.2rem; }
.clock { width: 100%; height: auto; }
.clock-face { fill: var(--white); stroke: var(--ink); stroke-width: 4; }
.clock .tick { stroke: var(--ink); stroke-width: 1.2; }
.clock .tick.major { stroke-width: 3; }
.clock .num { font-family: var(--display); font-weight: 800; font-size: 17px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.hand-sec { stroke: var(--red); stroke-width: 4; stroke-linecap: round; }
.hand-min { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.hub { fill: var(--red); stroke: var(--white); stroke-width: 2; }
.now p { margin: 0; }
.now-set { font-family: var(--display); font-weight: 800; font-size: var(--s3); line-height: 1; text-transform: uppercase; min-height: 2em; margin-bottom: 0.35rem !important; }
.now-progress { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; margin-top: 0.9rem; }
.speed { border: 0; margin: 0 0 0 0.25rem; padding: 0; display: flex; gap: 0.9rem; font-size: var(--s-1); }
.speed label { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.speed input { accent-color: var(--ink); margin: 0; }
.totals { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; background: var(--navy); color: var(--white); }
.totals div { padding: 0.75rem 0.9rem 0.85rem; }
.totals div + div { border-left: 1px solid rgba(255,255,255,0.15); }
.totals dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: #C9D3E8; }
.totals dd { margin: 0; font-family: var(--display); font-weight: 850; font-size: clamp(1.45rem, 2.3vw, var(--s3)); line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board.stale .totals, .board.stale .now-progress, .board.stale .clock { opacity: 0.35; }

/* ---------- agents (navy) ---------- */

.agent { padding-top: 1.5rem; }
.agent[hidden] { display: none; }
.agent-line { font-size: var(--s1); line-height: 1.4; max-width: 34em; margin-bottom: 1.75rem; }
.band-navy pre { background: var(--navy-2); color: #E6EEF8; border-color: rgba(255,255,255,0.25); }
.band-navy figcaption { font-size: var(--s-1); color: #9FB0D3; margin-top: 0.5rem; }
.exchange {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem; align-items: start;
}
.who { display: block; font-family: var(--display); font-weight: 800; font-size: var(--s1); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.45rem; }
.ex-user p { margin: 0; font-size: var(--s1); line-height: 1.4; font-style: italic; color: #E6EEF8; }
.ex-err, .ex-ok { margin: 0.5rem 0 0.8rem; font-family: var(--mono); font-size: 0.82rem; font-weight: 600; }
.ex-err { color: #FF8A99; }
.ex-ok { color: #7FD3E4; }
.culprit { background: rgba(215, 38, 61, 0.35); }
.gave-up { outline: 2px solid #FF8A99; outline-offset: 1px; border-radius: 2px; }
.context { max-width: 40rem; }

.plan { max-width: 52rem; }
.plan-controls {
  display: grid; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: 0.2rem 1.75rem; margin-bottom: 1.5rem;
}
.plan-controls label { font-size: var(--s-1); color: #C9D3E8; display: flex; justify-content: space-between; gap: 0.5rem; text-transform: uppercase; letter-spacing: 0.1em; }
.plan-controls output { font-family: var(--display); font-weight: 850; font-size: var(--s2); color: var(--white); line-height: 1; letter-spacing: 0; }
.plan-controls input[type="range"] { width: 100%; accent-color: var(--red); margin: 0.3rem 0 0.6rem; }
.plan-lanes { list-style: none; margin: 0; padding: 0; }
.plan-lanes li {
  display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto 4.6rem;
  align-items: center; gap: 0.75rem; height: 2.1rem; font-variant-numeric: tabular-nums;
}
.plan-lanes li + li { border-top: 2px dotted rgba(255,255,255,0.2); }
.plan-lanes .wk { font-size: var(--s-1); color: #C9D3E8; }
.plan-lanes .m { font-family: var(--display); font-weight: 800; font-size: var(--s1); text-align: right; }
.plan-lanes .bar { position: relative; height: 100%; background: linear-gradient(rgba(58,165,188,0.25), rgba(58,165,188,0.25)) 0 50% / 100% 70% no-repeat; }
.plan-lanes .bar::before { content: ""; position: absolute; left: 0; top: 50%; width: var(--w); height: 6px; transform: translateY(-50%); background: var(--white); transition: width 0.25s; }
.plan-lanes .bar::after { content: ""; position: absolute; top: 50%; left: calc(var(--w) - 6px); width: 6px; height: 18px; transform: translateY(-50%); background: var(--white); transition: left 0.25s; }
.caps { display: flex; gap: 3px; }
.caps i { width: 11px; height: 11px; border-radius: 50%; background: var(--red); border: 2px solid var(--red); }
.caps i.off { background: transparent; border-color: rgba(255,255,255,0.35); }
.plan figcaption { margin-top: 0.9rem; max-width: 40em; }

/* ---------- cite + run ---------- */

.run pre { max-width: 44rem; }
.after-pre { margin-top: 1rem; }

.wall-footer { background: var(--navy); color: var(--white); padding-block: 2.5rem 3rem; border-top: 6px solid var(--red); }
.foot { display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem; align-items: baseline; }
.wall-footer p { margin: 0; }
.wall-footer .wordmark { font-size: var(--s3); margin-right: auto; }

/* ---------- responsive ---------- */

@media (max-width: 60rem) {
  .deck { grid-template-columns: minmax(0, 1fr); }
  .trace { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .trace figure + figure::before, .trace figure + figure::after { display: none; }
  .trace pre { min-height: 0; }
  .board { padding-top: 0; }
  .exchange { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  .race-pool { border-width: 12px; }
  .block-no { left: -12px; width: 12px; font-size: 0.75rem; }
  .rl { --sw-w: 50px; --wall: 28px; }
  .tag { font-size: 0.75rem; }
  .place { font-size: 0.85rem; }
  .place b { font-size: 1.05rem; }
  .race-clock { font-size: 1.25rem; top: -2.3rem; }
  .entry { grid-template-columns: 2rem minmax(0, 1fr) 5.2rem; column-gap: 0.5rem; }
  .entry-code { font-size: 0.8rem; padding: 0.5rem; }
  .entry-res { font-size: 1.1rem; }
  .board { grid-template-columns: 7rem minmax(0, 1fr); }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals div:nth-child(3) { border-left: 0; }
  .totals div:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,0.15); }
  .plan-controls { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr); }
  .plan-lanes li { grid-template-columns: 3.4rem minmax(0, 1fr) auto 4rem; gap: 0.5rem; }
  .board-scrawl p { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .g code, .board-scrawl span, .tag, .place, .plan-lanes .bar::before, .plan-lanes .bar::after { transition: none; }
  .seg.new { animation: none; }
}

/* ---------- the real thing, on a Mac ---------- */

.macs-band { padding-bottom: 4rem; }
.macs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem 4rem; align-items: end; margin-top: 2.5rem;
}
.mac { margin: 0; }
.mac:nth-child(2) { margin-bottom: 2.5rem; }
.mac-screen {
  position: relative;
  aspect-ratio: 16 / 10.6;
  background: #1A1C20;
  border: 1px solid #3A3D44;
  border-radius: 14px 14px 3px 3px;
  padding: 2.4% 2.4% 3%;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mac-screen::before { /* camera */
  content: ""; position: absolute; top: 0.9%; left: 50%; width: 5px; height: 5px;
  border-radius: 50%; background: #3A3D44; transform: translateX(-50%);
}
.mac-screen img { display: block; width: 100%; flex: 1; min-height: 0; object-fit: cover; object-position: top left; background: var(--tile); }
.mac-bar {
  display: flex; align-items: center; gap: 5px;
  height: 7%; min-height: 14px; padding: 0 2%;
  background: #E4E6EA; border-bottom: 1px solid #CDD0D6;
}
.mac-bar i { width: 7px; height: 7px; border-radius: 50%; background: #FF5F57; }
.mac-bar i:nth-child(2) { background: #FEBC2E; }
.mac-bar i:nth-child(3) { background: #28C840; }
.mac-bar span {
  margin: 0 auto; padding: 1px 1.4em; border-radius: 4px; background: #fff;
  font: 500 clamp(0.5rem, 0.8vw, 0.72rem)/1.4 var(--body); color: #5A6070;
}
.mac-base {
  position: relative; height: 16px; margin: 0 -7%;
  background: linear-gradient(#E3E5E9, #B5B9C0 70%, #8F949C);
  border-radius: 2px 2px 14px 14px;
  box-shadow: 0 18px 26px -14px rgba(11, 27, 63, 0.45);
}
.mac-base::before { /* the notch you open it with */
  content: ""; position: absolute; top: 0; left: 50%; width: 16%; height: 6px;
  transform: translateX(-50%); background: #A7ABB2; border-radius: 0 0 8px 8px;
}
.mac figcaption {
  margin-top: 1.4rem;
  font-family: var(--display); font-weight: 800; font-size: var(--s1);
  text-transform: uppercase; letter-spacing: 0.02em; color: var(--ink);
}

.next-up {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.9rem;
  margin: 3.5rem 0 0; font-size: var(--s1); font-weight: 700; color: var(--ink);
}
.badge {
  font: 700 0.7rem/1 var(--body); text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.45rem 0.6rem; background: var(--yellow); color: var(--navy); border-radius: 2px;
}

/* built with: one cap colour per tool, like lane caps */
.stack {
  list-style: none; margin: 2.2rem 0 0; padding: 1.8rem 0 0;
  border-top: 2px solid var(--ink);
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.4rem 1.5rem;
}
.stack li {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--display); font-weight: 800; font-size: var(--s2);
  text-transform: uppercase; line-height: 1; color: var(--ink);
}
.tile {
  flex: none; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--c);
}
.t-water-deep { --c: var(--water-deep); }
.t-red { --c: var(--red); }
.t-blue { --c: var(--marker-blue); }
.t-yellow { --c: var(--yellow); }
.t-water { --c: var(--water); }
.t-navy { --c: var(--navy); }
.tile.t-yellow .mark { background: var(--navy); }
.tile img { width: 32px; height: auto; filter: brightness(0) invert(1); }
.mark {
  width: 28px; height: 28px; background: var(--white);
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.mark-kotlin { --m: url("logos/kotlin.svg"); }
.mark-jetpackcompose { --m: url("logos/jetpackcompose.svg"); }
.mark-openjdk { --m: url("logos/openjdk.svg"); }
.mark-nodedotjs { --m: url("logos/nodedotjs.svg"); }
.mark-googlegemini { --m: url("logos/googlegemini.svg"); }

@media (max-width: 60rem) {
  .stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .macs { grid-template-columns: minmax(0, 1fr); }
  .mac:nth-child(2) { margin-bottom: 0; }
  .mac-base { margin: 0 -4%; }
}
.mac-bar-app { background: #F4F1F6; border-bottom-color: #DCD8E0; }
.mac-bar-app span { background: none; font-weight: 700; color: #33363D; }

.band-water { background: var(--water-pale); }
.band-water :focus-visible { outline-color: var(--ink); }
@media (max-width: 40rem) {
  .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { width: 46px; height: 46px; }
}

/* language switch */
.top nav a.lang { border: 1px solid rgba(255,255,255,0.45); border-radius: 2px; padding: 0.3rem 0.6rem; }
.top nav a.lang:hover { border-color: var(--white); text-decoration: none; }
