/* Swimlog — "piscine de nuit": deep pool water, one soft light from above, and the deck's own
   objects (lifebuoy, lane ropes, flags, glazed tiles) standing in for bars and rings. */

:root {
  color-scheme: dark;

  --bg:            #050d18;
  --surface:       rgba(255, 255, 255, .035);
  --surface-2:     rgba(255, 255, 255, .06);
  --border:        rgba(140, 220, 255, .09);
  --border-strong: rgba(140, 220, 255, .18);

  --text:          #e6f4fb;
  --text-2:        #8fb2c4;
  --text-3:        #6a8ea0;

  --accent:        #5fd8f5;   /* interface identity: links, the line, the lit things */
  --accent-ink:    #04111d;   /* text on the accent */
  --series:        #5fd8f5;   /* heart-rate line */
  --rest:          #ffb27a;   /* rests: an event, warm against the water */
  --flag-red:      #e2483b;
  --flag-white:    #f1ede6;
  --rope:          #b9ad99;
  --closed:        rgba(180, 190, 255, .3);
  --danger:        #ff7b7b;

  /* Calendar glazes: one hue, light meaning little and bright meaning a lot. */
  --tile-0: #0f2232;
  --tile-1: #1a6a8e;
  --tile-2: #2795c0;
  --tile-3: #52c6ea;
  --tile-4: #b4f1ff;

  --radius:    1.2rem;
  --radius-sm: 0.6667rem;
}

* { box-sizing: border-box; }

/* Every size below is in rem off this one base, so the whole interface grows on a large screen
   instead of sitting there phone-sized. */
html { background: var(--bg); font-size: 15px; }
@media (min-width: 62rem) { html { font-size: clamp(15px, .45vw + 9px, 20px); } }
body {
  margin: 0;
  padding: 1.1rem 1rem 6rem;
  min-height: 100vh;
  color: var(--text);
  font: 1rem/1.5 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(110% 40rem at 85% -8rem, rgba(64, 190, 255, .14), transparent 60%),
    radial-gradient(80% 30rem at -10% 30rem, rgba(90, 90, 255, .06), transparent 60%),
    linear-gradient(180deg, #08192a 0, #061220 40rem, var(--bg) 80rem);
  background-repeat: no-repeat;
}

main { max-width: 34rem; margin: 0 auto; }
a { color: var(--accent); }
b { font-weight: 700; }

/* ---------- shared pieces ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9333rem; margin-top: 0.8rem;
}
.card-h {
  display: flex; align-items: baseline; gap: 0.4rem; margin-bottom: 0.8rem;
  color: var(--text-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.card-h em { font-style: normal; opacity: .7; text-transform: none; letter-spacing: 0; font-weight: 500; }
.kicker { color: var(--text-3); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 1rem 0 .3rem; }
.lead { color: var(--text-2); margin: 0 0 .5rem; font-size: .92rem; }
.empty { color: var(--text-2); }
.err { color: var(--danger); font-size: .88rem; }
.fine { color: var(--text-3); font-size: .76rem; margin: 0.6667rem 0 0; }

.linkish {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 600;
}
.linkish:hover { text-decoration: underline; }

.btn, .login button {
  padding: 0.6rem 1.0667rem; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .88rem;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover, .login button:hover { filter: brightness(1.08); }

input[type=text], input[type=password], input[type=number], input[type=date] {
  font: inherit; font-size: .9rem; color: var(--text);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0.6rem 0.7333rem; min-width: 0;
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }

.notice {
  background: rgba(95, 216, 245, .08); border: 1px solid rgba(95, 216, 245, .2);
  border-radius: var(--radius-sm); padding: 0.6667rem 0.9333rem; margin: 0 0 0.2667rem; font-size: .88rem;
}

/* ---------- masthead ---------- */

.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 2.4rem; margin-bottom: 0.2667rem; }
.brand { display: flex; align-items: center; gap: 0.5333rem; font-weight: 800; font-size: 1.12rem; color: #fff; text-decoration: none; }
.logo { width: 1.7333rem; height: 1.7333rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; flex: none; }
.logo circle { fill: var(--accent); stroke: none; }
.back { color: var(--accent); font-weight: 600; text-decoration: none; font-size: .95rem; }
.avatar {
  width: 2.2667rem; height: 2.2667rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .85rem; text-decoration: none;
  background: linear-gradient(135deg, #35c2ef, #6a63e8); color: var(--accent-ink);
}
.pill { padding: 0.4rem 0.9333rem; border-radius: 6.6rem; border: 1px solid var(--border-strong); text-decoration: none; font-weight: 600; font-size: .85rem; }

/* ---------- this week ---------- */

.week { background: linear-gradient(160deg, rgba(53, 180, 240, .13), rgba(255, 255, 255, .03)); padding: 1.0667rem; }
.week-top { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; }
.week-big { font-size: 2.6rem; font-weight: 800; line-height: 1.05; color: #fff; letter-spacing: -.02em; }
.week-big span { font-size: 1rem; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.week-line { margin: 0; color: #b5cfdb; font-size: .86rem; }
.week-line b { color: #fff; }

/* The lifebuoy: red and white bands, the share not yet earned sunk under the water. */
.buoy { position: relative; width: 4.9333rem; height: 4.9333rem; flex: none; }
.buoy svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0.2667rem 0.4rem rgba(0, 0, 0, .45)); }
.buoy circle { fill: none; }
.buoy .band-white { stroke: var(--flag-white); stroke-width: 9; }
.buoy .band-red { stroke: var(--flag-red); stroke-width: 9; stroke-dasharray: 1 1; }
.buoy .sunk { stroke: rgba(6, 30, 52, .8); stroke-width: 9.5; }
.buoy .rim { stroke: rgba(0, 0, 0, .18); stroke-width: .6; }
.buoy .grab { stroke: #d9cfbf; stroke-width: 1.2; stroke-dasharray: 2 1; opacity: .65; }
.buoy span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: .78rem; color: #fff; }

/* The week's days as lanes, lane ropes between them; a lane fills with water once swum. */
.lanes {
  display: grid; grid-template-columns: repeat(7, 1fr); margin: 0.9333rem 0 0.6667rem;
  border-radius: var(--radius-sm); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border);
}
a.lane, a.tile { text-decoration: none; cursor: pointer; }
a.lane:hover i { filter: brightness(1.15); }
a.tile:hover { outline: 1.5px solid #fff; outline-offset: -1.5px; }
.wk-lane .fl:hover::before { outline: 2px solid #fff; outline-offset: 1px; }
.lane { position: relative; text-align: center; font-size: .68rem; font-weight: 700; color: var(--text-3); }
.lane span { display: block; padding: 0.2667rem 0 0.2rem; background: rgba(255, 255, 255, .03); }
.lane i { display: block; height: 2.9333rem; background: linear-gradient(180deg, #0c3550, #0a2a42); }
.lane + .lane::before {
  content: ""; position: absolute; left: -2px; top: 0; bottom: 0; width: 0.2667rem; z-index: 1;
  background: repeating-linear-gradient(180deg, var(--flag-red) 0 0.2667rem, var(--flag-white) 0.2667rem 0.5333rem);
  border-radius: 2px; opacity: .85;
}
.lane.is-past i { background: linear-gradient(180deg, #0a2a40, #08223a); }
.lane.is-swum { color: #cdf3ff; }
.lane.is-swum i {
  background:
    radial-gradient(60% 30% at 30% 30%, rgba(255, 255, 255, .25), transparent 70%),
    radial-gradient(50% 25% at 70% 70%, rgba(255, 255, 255, .18), transparent 70%),
    linear-gradient(180deg, #5fd8f5, #1d8cc4);
}
.lane.is-today { color: #fff; }
.lane.is-today i { outline: 2px dashed rgba(95, 216, 245, .6); outline-offset: -4px; }
.week.is-closed .lane i { background: repeating-linear-gradient(135deg, var(--closed) 0 2px, transparent 2px 0.4rem), #0a2a42; }

/* ---------- closures ---------- */

.hatch {
  display: inline-block; width: 1.7333rem; height: 1.7333rem; border-radius: 0.4rem; flex: none;
  background: repeating-linear-gradient(135deg, var(--closed) 0 2px, transparent 2px 0.3333rem);
  box-shadow: inset 0 0 0 1px rgba(180, 190, 255, .25);
}
.hatch.sm { width: 0.8rem; height: 0.8rem; border-radius: 0.2rem; vertical-align: -2px; }
.closure {
  display: flex; gap: 0.8rem; align-items: center; margin-top: 0.8rem; padding: 0.8rem 0.9333rem;
  border-radius: var(--radius); font-size: .86rem; color: #d7dcff;
  background: rgba(160, 170, 255, .06); border: 1px solid rgba(180, 190, 255, .14);
}
.closure b { color: #fff; }
.closure span { display: block; color: #98a1d8; font-size: .76rem; margin-top: 2px; }

/* ---------- streak and milestone ---------- */

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6667rem; }
.stat b { display: block; font-size: 1.35rem; color: #fff; margin-top: 0.5333rem; line-height: 1.2; }
.stat span { font-size: .74rem; color: var(--text-3); }

/* A lane rope, one float per week. */
.rope-floats { position: relative; display: flex; gap: 0.2rem; height: 0.8rem; align-items: center; }
.rope-floats::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; background: var(--rope); opacity: .5; }
.rope-floats i {
  position: relative; flex: 1; height: 0.6667rem; border-radius: 6.6rem;
  background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .25), transparent 60%), #2b3a4a;
}
.rope-floats i.on { background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .55), transparent 60%), #f06a3c; }
.rope-floats i.now { background: rgba(255, 255, 255, .02); outline: 1.5px dashed rgba(240, 106, 60, .7); outline-offset: -1.5px; }
.rope-floats i.closed { background: repeating-linear-gradient(135deg, var(--closed) 0 2px, transparent 2px 0.2667rem), #1a2636; }

/* Backstroke flags: each pennant one tenth of the way to the next milestone. */
.flags { width: 100%; height: 0.8rem; display: block; overflow: visible; }
.flags line { stroke: var(--rope); stroke-width: .8; vector-effect: non-scaling-stroke; }
.flags path { fill: rgba(255, 255, 255, .1); }
.flags path.won.a { fill: var(--flag-red); }
.flags path.won.b { fill: var(--flag-white); }

/* ---------- calendar: glazed tiles set in grout ---------- */

/* Rendered with a full year; the script trims the oldest weeks to whatever fits. */
.cal-scroll { position: relative; overflow: hidden; }
.cal-grid {
  display: inline-flex; gap: 2px; padding: 0.2rem; border-radius: 0.4rem; background: #03101b;
  box-shadow: inset 0 1px 0.2rem rgba(0, 0, 0, .6);
}
/* Fixed to the tile's width: a month label overflows into the next columns, as on GitHub. */
.cal-col { display: flex; flex-direction: column; gap: 2px; width: 0.8rem; flex: none; }
.cal-col[hidden] { display: none; }
.cal-month { height: 1rem; color: var(--text-3); font-size: .62rem; white-space: nowrap; overflow: visible; }
.cal-days { display: flex; flex-direction: column; gap: 2px; }
.tile {
  display: block; width: 0.8rem; height: 0.8rem; border-radius: 2px; background: var(--tile-0);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .1), inset -1px -1px 0 rgba(0, 0, 0, .35);
}
.tile[data-level="1"] { background: linear-gradient(135deg, #1f789e, var(--tile-1)); }
.tile[data-level="2"] { background: linear-gradient(135deg, #2fa3cf, var(--tile-2)); }
.tile[data-level="3"] { background: linear-gradient(135deg, #6ed2f0, var(--tile-3)); }
.tile[data-level="4"] { background: linear-gradient(135deg, #d6f8ff, var(--tile-4)); }
.tile.is-future { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04); }
.tile.is-today { outline: 1.5px solid #fff; outline-offset: -1.5px; }
.cal-col.is-closed .tile:not([data-level="1"]):not([data-level="2"]):not([data-level="3"]):not([data-level="4"]) {
  background: repeating-linear-gradient(135deg, var(--closed) 0 1.5px, transparent 1.5px 0.2667rem);
}
.goal { display: block; height: 0.2667rem; border-radius: 6.6rem; margin-top: 2px; }
.goal.some { background: rgba(95, 216, 245, .3); }
.goal.met { background: var(--rest); }
.cal-foot { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9333rem; margin-top: 0.8rem; font-size: .7rem; color: var(--text-3); align-items: center; }
.cal-foot .goal { display: inline-block; width: 0.9333rem; margin: 0 0.3333rem 1px 0; vertical-align: middle; }
.cal-foot .hatch { margin-right: 0.3333rem; }
.cal-foot .legend { margin-left: auto; display: flex; align-items: center; gap: 0.2rem; }
.cal-foot .legend .tile { width: 0.6667rem; height: 0.6667rem; }
.cal-tip, .ch-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: #04101c; border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 0.5333rem; padding: 0.2667rem 0.5333rem; font-size: .76rem; white-space: nowrap;
}
.cal-tip { transform: translate(-50%, -130%); }
.cal-tip.cal-tip-below { transform: translate(-50%, 30%); }

/* ---------- the list ---------- */

.month { display: flex; align-items: baseline; gap: 0.6667rem; margin: 1.7333rem 2px 0; }
.month h2 { font-size: 1rem; margin: 0; font-weight: 800; color: #fff; }
.month-total { color: var(--text-3); font-size: .78rem; }
#select-toggle {
  margin-left: auto; background: none; border: 1px solid var(--border-strong); color: var(--text-2);
  border-radius: 6.6rem; padding: 0.2rem 0.7333rem; font: inherit; font-size: .76rem; font-weight: 600; cursor: pointer;
}
#select-toggle.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.list { display: grid; }
.swim-row { display: flex; align-items: center; gap: 0.6667rem; }
.swim-row .row { flex: 1; min-width: 0; }
.row { display: block; padding: 0.8rem 0.9333rem; margin-top: 0.5333rem; text-decoration: none; color: inherit; transition: border-color .12s ease, background .12s ease; }
.row:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, .05); }
.swim-row.is-fresh .row { border-color: rgba(95, 216, 245, .5); }
.row-top { display: flex; align-items: baseline; gap: 0.5333rem; }
.dist { font-weight: 800; font-size: 1.15rem; color: #fff; white-space: nowrap; }
.when { color: var(--text-3); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pace { margin-left: auto; font-weight: 700; color: #cdf3ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pace small { font-weight: 500; color: var(--text-3); font-size: .68rem; margin-left: 2px; }
.meta { font-size: .74rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Each length a float on the lane rope, coloured by its speed within the swim. */
.floats { position: relative; display: flex; gap: 2px; height: 0.8rem; align-items: center; margin: 0.6rem 0 0.4667rem; }
.floats::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; background: var(--rope); opacity: .45; }
.floats i {
  position: relative; flex: 1; height: 0.6667rem; border-radius: 6.6rem; max-width: 1.7333rem;
  background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .45), transparent 60%),
    color-mix(in oklab, #7fe3fa calc((1 - var(--k)) * 100%), #3a3f9e);
}
.floats i.wall { flex: 0 0 0.4rem; max-width: none; background: none; }
.floats i.wall::after { content: ""; position: absolute; left: 2px; top: -1px; bottom: -1px; width: 2px; border-radius: 2px; background: var(--rest); }

/* Out of the way until select mode is on — most visits are read, not merge. */
.pick { display: none; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); cursor: pointer; flex: none; margin-top: 0.5333rem; }
body.is-selecting .pick { display: block; }

.merge-bar {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: .9rem; white-space: nowrap;
  background: #0a1f31; border: 1px solid var(--border-strong);
  border-radius: 66.6rem; padding: .5rem .55rem .5rem 1.1rem;
  box-shadow: 0 .6rem 1.6rem rgba(0, 0, 0, .55); font-size: .86rem;
}
.merge-bar[hidden] { display: none; }
.merge-bar button.go {
  background: var(--accent); color: var(--accent-ink); border: 0; cursor: pointer;
  border-radius: 66.6rem; padding: .45rem 1rem; font: inherit; font-weight: 700;
}

/* ---------- a swim's own page ---------- */

.swim-head { padding: 0.9333rem 2px 2px; }
.swim-big { font-size: 3.4rem; font-weight: 800; color: #fff; line-height: 1.05; letter-spacing: -.03em; margin: 0.2667rem 0 0; }

/* The headline figures as glazed depth-marker tiles from the pool edge. */
.depths { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-top: 0.8rem; }
.depth {
  border-radius: 0.8rem; padding: 0.5333rem 0.6rem;
  background: linear-gradient(160deg, #eef5f8, #d3e2ea);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .8), inset -1px -1px 0 rgba(0, 0, 0, .12), 0 0.2rem 0.5333rem rgba(0, 0, 0, .35);
}
.depth span { display: block; font-size: .62rem; color: #4d6c7e; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.depth b { font-size: 1.02rem; color: #0b2d45; font-variant-numeric: tabular-nums; white-space: nowrap; }
.depth small { font-size: .6rem; font-weight: 600; color: #4d6c7e; margin-left: 2px; }
.details { display: flex; flex-wrap: wrap; gap: 0.2667rem 0.9333rem; margin-top: 0.8rem; font-size: .8rem; color: var(--text-3); }
.details b { color: var(--text-2); font-weight: 600; }

/* The pool, from above: caustics on the water and a lane rope down each side. */
/* The water sits inside a coping of tiles, the pool's own edge — an object on the page rather
   than a highlighted panel — and its blue is kept deep and quiet so it does not glow. */
.pool {
  position: relative; padding: 0.9333rem 0; border-radius: 0.8rem; overflow: hidden;
  border: .45rem solid transparent;
  background:
    radial-gradient(30% 12% at 20% 25%, rgba(255, 255, 255, .04), transparent 70%) padding-box,
    radial-gradient(25% 10% at 75% 55%, rgba(255, 255, 255, .035), transparent 70%) padding-box,
    radial-gradient(35% 12% at 45% 85%, rgba(255, 255, 255, .03), transparent 70%) padding-box,
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(255, 255, 255, .02) calc(10% - 1px) 10%) padding-box,
    linear-gradient(180deg, #0b3149, #08263b) padding-box,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .35) 0 1px, transparent 1px .9rem) border-box,
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .35) 0 1px, transparent 1px .45rem) border-box,
    linear-gradient(160deg, #3a4f5e, #2a3c49) border-box;
  box-shadow: inset 0 .25rem .6rem rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .04);
}
/* The pool from above: lanes with their floor line and a starting block on each wall, lane ropes
   wall to wall, backstroke flags strung across above the water. One grid for the whole pool: the
   two outer columns are as wide as the widest tag on that side, so the flag lines sit just past
   the tags — straight down every rope — and the floats share the middle. */
.pool {
  position: relative; overflow: visible; display: grid; column-gap: .55rem;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  grid-template-rows: repeat(var(--rows), auto);
}
.pool-lane, .rope-row { grid-column: 1 / -1; }

.pool-lane { position: relative; height: 2rem; }
.pool-lane .floor {
  position: absolute; left: 2.4rem; right: 2.4rem; top: 50%; height: .28rem; margin-top: -.14rem;
  background: rgba(2, 14, 26, .5);
}
/* The T at each end of the floor line, centred on it. */
.pool-lane .floor::before, .pool-lane .floor::after {
  content: ""; position: absolute; top: 50%; width: .28rem; height: 1.1rem; margin-top: -.55rem;
  background: rgba(2, 14, 26, .5);
}
.pool-lane .floor::before { left: -.28rem; } .pool-lane .floor::after { right: -.28rem; }
/* Starting blocks: on each wall, half over the deck tiles and half over the water. */
.pool-lane .block {
  position: absolute; left: -.55rem; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 1.3rem; height: .95rem; border-radius: .15rem .25rem .25rem .15rem;
  background: linear-gradient(90deg, #c9d6dd, #e9f0f3); box-shadow: .1rem .15rem .2rem rgba(0, 0, 0, .5);
  opacity: .8;
}
.pool-lane .block.r { left: auto; right: -.55rem; border-radius: .25rem .15rem .15rem .25rem; background: linear-gradient(270deg, #c9d6dd, #e9f0f3); }

.rope-row {
  position: relative; display: grid; grid-template-columns: subgrid; align-items: center; height: 2rem;
}
.rope-row::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
  background: var(--rope); opacity: .5;
}
/* A tag on the rope, outside the flags: the stretch on the left, its time on the right, each
   clear of the starting block on its wall. */
.rope-tag {
  position: relative; padding: 0 .25rem; border-radius: .2rem; white-space: nowrap; line-height: 1.3;
  font-size: .56rem; font-weight: 600; color: rgba(201, 221, 230, .7); font-variant-numeric: tabular-nums;
  background: #0a2a40;   /* the water's own colour, over the rope so the text reads */
}
.rope-tag:first-child { justify-self: end; margin-left: 1rem; }
.rope-tag:last-child { justify-self: start; margin-right: 1rem; }
.rope-row.sizer { height: 0; visibility: hidden; overflow: hidden; }
.set-rope {
  position: relative; display: grid; grid-template-columns: repeat(var(--slots), 1fr); justify-items: center; align-items: center;
  padding: 0 .8rem;   /* clear of the pennants, which point inward from both lines */
}
.set-rope i {
  position: relative; width: min(1.4rem, 92%); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .55), transparent 60%),
    color-mix(in oklab, #9ff0ff calc((1 - var(--k)) * 100%), #4b56c8);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .35);
}
.set-rope i.is-best::after {
  content: "★"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .62rem; color: rgba(4, 17, 29, .7);
}
.set-rope i.is-hover { outline: 2px solid #fff; outline-offset: 1px; }
/* A rest, once rests are shown: a small tick just before the float that came after it. */
.swim.show-rests .set-rope i.after-rest::before {
  content: ""; position: absolute; left: -.4rem; top: .15rem; bottom: .15rem; width: 2px; border-radius: 1px; background: var(--rest);
}

/* Backstroke flags: triangular pennants on a line strung across the pool above the water,
   casting a soft shadow down onto it. */
.flagline {
  width: .55rem; z-index: 2; pointer-events: none; opacity: .85;
  filter: drop-shadow(.45rem .35rem .15rem rgba(0, 8, 16, .5));
  background:
    linear-gradient(var(--rope), var(--rope)) 0 0 / 1px 100% no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='20'%3E%3Cpath d='M0 1 L8 5 L0 9Z' fill='%23e2483b'/%3E%3Cpath d='M0 11 L8 15 L0 19Z' fill='%23f1ede6'/%3E%3C/svg%3E") 1px 0 / .5rem 1.25rem repeat-y;
}
/* Positioned on the middle column's two edges; absolutely placed, so they take no grid cells. */
.flagline { position: absolute; grid-column: 2 / 3; grid-row: 1 / -1; top: -.9rem; bottom: -.9rem; }   /* both lines explicit: an absolute item reads "auto" as the padding edge */
/* The line runs out over the coping to a post on the deck at each end. */
.flagline::before, .flagline::after {
  content: ""; position: absolute; left: -.2rem; width: .45rem; height: .75rem;
  background:
    radial-gradient(circle at 50% .225rem, #f4f7f9 0 .12rem, #9fb0ba .16rem .225rem, transparent .235rem),
    linear-gradient(var(--rope), var(--rope)) .2rem .3rem / 1px 100% no-repeat;
}
.flagline::before { top: -.5rem; }
.flagline::after { bottom: -.5rem; transform: scaleY(-1); }
.flagline.l { left: 0; }
.flagline.r { right: 0; transform: scaleX(-1); }
.rope-row, .pool-lane { z-index: 1; }

.pool-legend { display: flex; align-items: center; gap: 0.5333rem; margin-top: 0.6667rem; font-size: .7rem; color: var(--text-3); }
.pool-legend i { flex: 1; max-width: 7.3333rem; height: 0.3333rem; border-radius: 6.6rem; background: linear-gradient(90deg, #9ff0ff, #4b56c8); }
.pool-legend .best-key { margin-left: auto; color: var(--text-3); }

/* ---------- heart-rate chart ---------- */

.hr-card { padding-bottom: 0.6667rem; }
.chart { margin: 0; }
.chart-title {
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6667rem;
  color: var(--text-2); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
}
.chart-unit { text-transform: none; letter-spacing: 0; color: var(--text-3); font-weight: 500; }
.chart-expand {
  margin-left: auto; width: 1.7rem; height: 1.7rem; flex: none; display: grid; place-items: center;
  background: none; border: 1px solid var(--border-strong); color: var(--text-2);
  border-radius: 0.5333rem; cursor: pointer; font-size: .85rem; line-height: 1;
}
.chart-expand:hover { color: var(--text); }

body.chart-lock { overflow: hidden; }
.chart.is-expanded {
  position: fixed; inset: 0; z-index: 50; margin: 0; background: var(--bg);
  padding: 1rem 1rem 1.5rem; display: flex; flex-direction: column;
}
.chart.is-expanded .chart-body { flex: 1; min-height: 0; }
.chart.is-expanded .ch-plot { height: 100%; }

.chart-body { display: flex; gap: .4rem; }
.ch-gutter { position: relative; width: 1.8rem; flex: none; }
.ch-ylabel { position: absolute; right: 0; transform: translateY(-50%); color: var(--text-3); font-size: .66rem; font-variant-numeric: tabular-nums; }
.ch-plot { position: relative; flex: 1; height: 11.3333rem; outline: none; }
.ch-plot:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 2px; }
.ch-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }

.ch-grid { stroke: rgba(140, 220, 255, .07); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ch-lap { stroke: rgba(140, 220, 255, .08); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ch-band { fill: #ffffff; fill-opacity: .02; }
.ch-fill-top { stop-color: var(--series); stop-opacity: .3; }
.ch-fill-bottom { stop-color: var(--series); stop-opacity: 0; }
.ch-line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* Without rests a break is only a faint mark where it happened; with them, a shaded stripe. */
.ch-rest { stroke: var(--rest); stroke-width: 1; stroke-dasharray: 2 4; opacity: .35; vector-effect: non-scaling-stroke; }
.with-rests .ch-rest { opacity: .7; }
.ch-restband { fill: var(--rest); fill-opacity: .12; }
.ch-lapnum { position: absolute; top: 0.2rem; transform: translateX(-50%); color: var(--text-3); font-size: .6rem; font-weight: 700; pointer-events: none; }
.ch-restlabel { position: absolute; bottom: 0.2rem; transform: translateX(-50%); color: var(--rest); font-size: .62rem; font-weight: 700; white-space: nowrap; pointer-events: none; }

.chart-axis { position: relative; height: 1.1rem; margin: .35rem 0 0 2.2rem; }
.ch-xlabel { position: absolute; transform: translateX(-50%); color: var(--text-3); font-size: .66rem; font-variant-numeric: tabular-nums; }
.ch-xlabel-start { transform: none; }
.ch-xlabel-end { transform: translateX(-100%); }

.ch-lap-highlight { position: absolute; top: 0; bottom: 0; background: var(--accent); opacity: .1; pointer-events: none; }
.ch-crosshair { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(140, 220, 255, .35); pointer-events: none; }
.ch-dot {
  position: absolute; width: 0.6rem; height: 0.6rem; border-radius: 50%; pointer-events: none;
  background: var(--series); box-shadow: 0 0 0 2px #061220; transform: translate(-50%, -50%);
}
.ch-tip { transform: translate(-50%, -150%); }
.ch-tip b { color: #fff; }

/* ---------- lengths table ---------- */

.splits table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.splits td { padding: 0.2rem 0; vertical-align: middle; }
.splits td.idx { color: var(--text-3); width: 1.8rem; font-size: .74rem; }
.splits .pace-row { display: flex; align-items: center; gap: 0.6667rem; }
.splits .track { flex: 1; height: 0.5333rem; border-radius: 6.6rem; background: rgba(255, 255, 255, .06); overflow: hidden; }
.splits .pace-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, rgba(79, 140, 255, .5), #4fdcff); }
.splits .time { width: 4.3rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
/* The best length is noted, not shouted: a small star before its time. */
.splits tr.is-best .time::before { content: "★ "; color: var(--rest); opacity: .7; font-size: .75em; }
.splits td.hr { width: 4.4rem; text-align: right; color: var(--text-2); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.splits td.hr .unit { color: var(--text-3); }
/* A hovered row lights as one band: every cell the same colour, rounded at the two ends. */
.splits tr.is-hover td { background: rgba(255, 255, 255, .05); }
.splits tr.is-hover td:first-child { border-radius: .4rem 0 0 .4rem; }
.splits tr.is-hover td:last-child { border-radius: 0 .4rem .4rem 0; }
.splits td.idx { padding-left: .35rem; }
.splits td:last-child { padding-right: .35rem; }

/* Rests are folded away until the toggle asks for them, which also swaps the chart from swim
   time (rests squeezed to a mark) to the wall clock (rests at their real length). */
.swim:not(.show-rests) tr.rest,
.swim:not(.show-rests) .chart.with-rests,
.swim.show-rests .chart.without-rests { display: none; }

.details .rest-toggle { margin-left: auto; }
/* A button, its count in a pill; lit while the rests are shown. */
.chip-btn {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  font: inherit; font-size: .8rem; font-weight: 600; color: var(--text-2);
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border-strong); border-radius: 99px;
  padding: .3rem .4rem .3rem .8rem;
}
.chip-btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.chip-btn .count {
  min-width: 1.3rem; padding: .05rem .45rem; border-radius: 99px; text-align: center;
  background: rgba(255, 178, 122, .16); color: var(--rest); font-size: .72rem; font-weight: 800;
}
.chip-btn[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chip-btn[aria-expanded="true"] .count { background: rgba(4, 17, 29, .18); color: var(--accent-ink); }
.splits tr.rest td { padding: 1px 0; }
.splits tr.rest .pace-row { justify-content: flex-end; }
.splits tr.rest .time { width: auto; color: var(--rest); font-size: .74rem; font-weight: 700; }

.provenance { color: var(--text-3); font-size: .8rem; margin: 0.9333rem 2px 0; }
.danger-zone { margin-top: 1.2rem; padding-top: 0.9333rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-2); }
.danger-zone p { margin: 0 0 0.8rem; }
.delete-swim {
  color: var(--text-3); background: none; cursor: pointer; font: inherit; font-size: .84rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.4667rem 0.8667rem;
}
.delete-swim:hover { color: var(--danger); border-color: var(--danger); background: rgba(255, 123, 123, .08); }

/* ---------- account and pools ---------- */

.item-row {
  display: flex; align-items: center; gap: 0.6667rem; padding: 0.6667rem 0;
  border-bottom: 1px solid var(--border); font-size: .9rem;
}
.item-row:last-of-type { border-bottom: 0; }
.item-row span { flex: 1; min-width: 0; }
.item-row em, .pool-admin-top em, .name-row em, .link-card em {
  display: block; font-style: normal; color: var(--text-3); font-size: .78rem;
}
.item-row b { color: #fff; }

.goal-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6667rem 0.8rem; }
.goal-picks { display: flex; gap: 0.4rem; }
.goal-picks input { position: absolute; opacity: 0; pointer-events: none; }
.goal-picks span {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; cursor: pointer;
  font-weight: 800; color: var(--text-2); border: 1px solid var(--border-strong);
}
/* The chosen goal becomes a small lifebuoy, its number in the middle. */
.goal-picks input:checked + span {
  color: #fff; border: 0;
  background:
    radial-gradient(circle, #0a2a42 0 0.6667rem, transparent 0.7rem),
    conic-gradient(var(--flag-red) 0 25%, var(--flag-white) 0 50%, var(--flag-red) 0 75%, var(--flag-white) 0);
  box-shadow: 0 0.2rem 0.4rem rgba(0, 0, 0, .4);
}
.goal-picks label { position: relative; }
.goal-picks input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.goal-form .fine { margin: 0; flex: 1 1 10rem; }

.link-card { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: inherit; font-size: .95rem; }
.link-card b { color: #fff; }
.link-card:hover { border-color: var(--border-strong); }

.pool-admin-top { display: flex; align-items: flex-start; gap: 0.6667rem; margin-bottom: 0.9333rem; }
.pool-admin-top span { flex: 1; }
.pool-admin-top b { color: #fff; font-size: 1.05rem; }
.closure-row.is-past { opacity: .55; }
.closure-row .hatch { margin-top: 2px; }
.closure-add { display: flex; gap: 0.5333rem; align-items: flex-end; margin-top: 0.8rem; flex-wrap: wrap; }
.closure-add label {
  flex: 1 1 8rem; display: flex; flex-direction: column; gap: 0.2667rem;
  font-size: .68rem; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5333rem; padding: 0.6667rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.name-row:last-child { border-bottom: 0; }
.name-row span { flex: 1 1 100%; }
.name-row input[type=text] { flex: 1 1 10rem; }
.name-row .radius { display: flex; align-items: center; gap: 0.2667rem; color: var(--text-3); }
.name-row input[type=number] { width: 5.5rem; }

/* ---------- sign-in, sign-up, pairing ---------- */

/* The page is the pool seen from above: lane ropes across the water, a dark lane line down the
   middle of each lane, light playing on the surface. The card floats on it. */
body.is-login {
  display: grid; place-items: center; padding: 1.5rem 1rem;
  background:
    radial-gradient(40rem 18rem at 20% 15%, rgba(255, 255, 255, .05), transparent 70%),
    radial-gradient(30rem 14rem at 80% 70%, rgba(255, 255, 255, .04), transparent 70%),
    linear-gradient(180deg, #0b3b58, #072438 60%, #05182a);
}
body.is-login::before, body.is-login::after { content: ""; position: fixed; inset: 0; pointer-events: none; }
body.is-login::before {
  opacity: .55;
  background: repeating-linear-gradient(90deg, var(--flag-red) 0 .6rem, var(--flag-white) .6rem 1.2rem);
  -webkit-mask: repeating-linear-gradient(180deg, transparent 0 7.1rem, #000 7.1rem 7.4rem);
  mask: repeating-linear-gradient(180deg, transparent 0 7.1rem, #000 7.1rem 7.4rem);
}
body.is-login::after {
  background: repeating-linear-gradient(180deg,
    transparent 0 calc(3.7rem - .2rem), rgba(2, 14, 26, .35) calc(3.7rem - .2rem) 3.7rem, transparent 3.7rem 7.4rem);
}
body.is-login main { position: relative; z-index: 1; width: 100%; max-width: 23rem; }

.login {
  position: relative; overflow: hidden; margin: 0; padding: 2rem 1.6rem 1.6rem;
  background: rgba(6, 22, 38, .72); border: 1px solid var(--border-strong); border-radius: 1.4rem;
  -webkit-backdrop-filter: blur(.6rem); backdrop-filter: blur(.6rem);
  box-shadow: 0 1.4rem 3rem -1rem rgba(0, 0, 0, .6);
}
.login::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: .35rem;
  background: repeating-linear-gradient(90deg, var(--flag-red) 0 .6rem, var(--flag-white) .6rem 1.2rem);
}
.login h1 { margin: 0 0 .4rem; font-size: 1.6rem; font-weight: 800; }
.login-brand { display: flex; align-items: center; gap: .7rem; }
.login-brand .logo { width: 2.6rem; height: 2.6rem; }
.login-lead, .login .empty { color: var(--text-2); font-size: .92rem; margin: 0 0 1.2rem; }
.login label {
  display: block; margin-bottom: .85rem;
  font-size: .72rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .07em;
}
.login label em { font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-3); margin-left: .3rem; }
.login input[type=text], .login input[type=password] {
  display: block; width: 100%; margin-top: .35rem; padding: .75rem .85rem;
  font-size: 1rem; text-transform: none; letter-spacing: 0; background: rgba(255, 255, 255, .06);
}
.login button { width: 100%; margin-top: .4rem; padding: .8rem; font-size: .95rem; border-radius: .8rem; }
.login .err { margin: 0 0 .6rem; }
.login p { word-break: break-word; }

/* ---------- home: the rest of the dashboard ---------- */

.navlink { color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .9rem; padding: 0.4rem 0.6667rem; border-radius: 6.6rem; }
.navlink:hover { color: var(--text); }
.navlink.is-on { color: var(--accent); background: rgba(95, 216, 245, .08); }
.masthead nav { display: flex; align-items: center; gap: 0.6667rem; }

.flag-ends { display: flex; justify-content: space-between; font-size: .62rem; color: var(--text-3); margin-top: 2px; }
.flag-ends + b { margin-top: 2px; }

/* Swims per week: each week a lane seen end-on, one float per swim stacked in it, and the goal
   as a lane rope stretched across at its height. */
.wk-chart { --label: 1.0667rem; position: relative; display: flex; gap: 0.3333rem; align-items: flex-end; }
.wk { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wk-lane {
  height: var(--lane); border-radius: 0.4rem; padding: 0.2rem; container-type: inline-size;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 0.2rem;
  background: linear-gradient(180deg, #0c3550, #0a2a42); box-shadow: inset 0 0 0 1px var(--border);
}
/* Each swim takes one slot of the lane's height (so the goal rope lands at the right count);
   the float drawn in it is a circle as big as the slot or the lane's width allows, whichever is
   smaller — round at any screen size. */
.wk-lane .fl {
  --slot: calc((var(--lane) - 0.4rem) / var(--top) - 0.2rem);
  flex: none; width: 100%; height: var(--slot); display: grid; place-items: center;
}
.wk-lane .fl::before {
  content: ""; width: min(78cqw, var(--slot)); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .5), transparent 60%), #3fb8e0;
}
.wk.is-met .wk-lane .fl::before { background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .55), transparent 60%), #f06a3c; }
.wk.is-closed .wk-lane { background: repeating-linear-gradient(135deg, var(--closed) 0 2px, transparent 2px 0.4rem), #0a2a42; }
.wk.is-now .wk-lane { outline: 1.5px dashed rgba(95, 216, 245, .55); outline-offset: -1.5px; }
.wk span { height: var(--label); font-size: .6rem; color: var(--text-3); white-space: nowrap; overflow: visible; padding-top: 0.2rem; }
.wk-goal {
  position: absolute; left: -4px; right: -4px; height: 0.2667rem; border-radius: 2px; pointer-events: none; opacity: .9;
  bottom: calc(var(--label) + 0.2rem + var(--goal) * ((var(--lane) - 0.4rem) / var(--top)) - 0.2333rem);
  background: repeating-linear-gradient(90deg, var(--flag-red) 0 0.4rem, var(--flag-white) 0.4rem 0.8rem);
  box-shadow: 0 1px 0.2rem rgba(0, 0, 0, .5);
}

.months { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6667rem; }
.month-tile { padding: 0.2667rem 2px; }
.month-tile b { display: block; font-size: 1.6rem; color: #fff; line-height: 1.15; margin: 0.2667rem 0 2px; }
.month-tile b small { font-size: .85rem; color: var(--text-2); font-weight: 600; }
.month-tile > span:last-child { font-size: .74rem; color: var(--text-3); }
.month-tile + .month-tile { border-left: 1px solid var(--border); padding-left: 0.9333rem; }
.month-tile:not(.is-now) b { color: var(--text-2); }
.trend { display: inline-block; margin-left: .4rem; font-size: 1.15rem; font-weight: 800; cursor: help; }
.trend.is-up { color: var(--accent); }
.trend.is-level { color: var(--text-2); }
.trend.is-down { color: var(--rest); }

/* Legend swatches drawn like the things they stand for: a length of lane rope (an odd number
   of stripes, so it starts and ends on red as the rope does), a float. */
.rope-key { display: inline-block; width: 1.5rem; height: .27rem; border-radius: 2px; margin-right: .35rem; vertical-align: middle;
  background: repeating-linear-gradient(90deg, var(--flag-red) 0 .3rem, var(--flag-white) .3rem .6rem); }
.float-key { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: -.1rem;
  background: radial-gradient(70% 60% at 35% 30%, rgba(255, 255, 255, .55), transparent 60%), #f06a3c; }

.last-swim .month { margin-top: 1.2rem; }
.see-all { margin-left: auto; font-size: .82rem; font-weight: 600; text-decoration: none; }
.page-head { display: flex; align-items: center; gap: 0.8rem; }
.page-head #select-toggle { margin-left: auto; }

/* ---------- desktop: use the width ---------- */

@media (min-width: 62rem) {
  body.is-home main, body.is-list main, body.is-swim main, body.is-pools main { max-width: 74rem; }

  /* Home: rows of two, each pair the same height, and the calendar across the bottom with
     room for the whole year. */
  .home {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1.6rem;
    grid-template-areas: "week weeks" "side recent" "cal cal";
  }
  .area-week { grid-area: week; } .area-weeks { grid-area: weeks; }
  .area-side { grid-area: side; } .area-recent { grid-area: recent; }
  .area-cal { grid-area: cal; }
  .home > div { display: flex; flex-direction: column; }
  .area-week > .card, .area-weeks > .card { flex: 1; }
  .area-side .duo { flex: 1; }
  .area-side .duo .card { display: flex; flex-direction: column; justify-content: center; }
  .wk-chart { margin-top: auto; }
  .area-weeks .weeks { display: flex; flex-direction: column; }

  /* The full-width calendar: tiles share the width rather than staying a fixed size. */
  .area-cal .cal-grid { display: flex; width: 100%; }
  .area-cal .cal-col { flex: 1; width: auto; min-width: 0; }
  .area-cal .tile { width: 100%; height: auto; aspect-ratio: 1; }

  /* Séances: the cards in a grid, each month still its own block. */
  body.is-list .list { grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); column-gap: 0.8rem; }

  /* A swim: the pool on the left, the chart and the lengths on the right. */
  body.is-swim .swim {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 1.6rem; align-items: start;
    grid-template-areas: "head head" "pool splits" "hr splits" "edit edit" "foot foot";
    grid-template-rows: auto auto 1fr;
  }
  body.is-swim .swim-head { grid-area: head; }
  body.is-swim .pool-card { grid-area: pool; }
  /* The chart takes whatever height the lengths table leaves, so the columns end together. */
  body.is-swim .hr-card { grid-area: hr; align-self: stretch; display: flex; flex-direction: column; }
  body.is-swim:not(:has(.show-rests)) .hr-card .chart.without-rests,
  body.is-swim .show-rests .hr-card .chart.with-rests,
  body.is-swim .hr-card .chart.hr:not(.with-rests):not(.without-rests) { flex: 1; display: flex; flex-direction: column; }
  body.is-swim .hr-card .chart-body { flex: 1; }
  body.is-swim .hr-card .ch-plot { height: auto; min-height: 170px; }
  /* The lengths table runs the full height of the pool and chart beside it, its rows spread
     evenly, so the two columns end together. */
  body.is-swim .splits { grid-area: splits; align-self: stretch; display: flex; flex-direction: column; }
  body.is-swim .splits table { flex: 1; }
  body.is-swim .danger-zone { grid-area: edit; }
  body.is-swim .swim > .provenance { grid-area: foot; }
  body.is-swim .depths { max-width: 40rem; }

  /* Bassins: named pools on the left, places still to name on the right. */
  body.is-pools .pools-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1.6rem; }
  body.is-pools .pools-layout > * { display: flex; flex-direction: column; }
  body.is-pools .pools-layout > * > .card:last-child { flex: 1; }
}

/* A phone fits ten lanes wide enough for round floats, not sixteen. */
@media (max-width: 34rem) {
  .wk:nth-child(-n+6) { display: none; }
  .weeks .card-h em { display: none; }
}

@media (max-width: 26rem) {
  .swim-big { font-size: 2.8rem; }
  .depths { grid-template-columns: repeat(2, 1fr); }
  .ch-plot { height: 10rem; }
  .week-big { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
