/* Full-bleed 3D view with the header and HUD floating on top. */

body {
  padding: 0;
  overflow: hidden;
  background: #9fb8c8;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

header {
  position: fixed;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 16px;
  color: #fff;
  text-shadow: 0 1px 3px rgb(0 0 0 / 0.5);
}
header h1 { font-size: 1.25rem; margin: 0 auto 0 0.5rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header a, header button { white-space: nowrap; } /* "Reading Thames" never wraps the bar on a narrow phone */
header a { color: #fff; text-decoration: none; opacity: 0.85; }
header button {
  color: #fff;
  background: rgb(0 0 0 / 0.25);
  border-color: rgb(255 255 255 / 0.35);
  backdrop-filter: blur(6px);
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: #fff;
  font-family: var(--mono);
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.6);
}

.hud-top {
  position: absolute;
  top: 3.75rem;
  left: 50%;
  translate: -50% 0;
  display: flex;
  gap: 1.5rem;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 700;
}

/* The course map, top right: the shape, start (green) and finish (white), a
   dot per boat, and an arrow for you. */
#map {
  position: absolute;
  top: 3.75rem;
  right: 16px;
  width: clamp(130px, 30vmin, 220px);
  max-height: 40vh;
  background: rgb(0 0 0 / 0.25);
  border-radius: 8px;
  overflow: visible;
}
#map.tall { width: auto; height: clamp(110px, 34vh, 220px); }
#map .line { fill: none; stroke: rgb(255 255 255 / 0.75); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
#map .start { fill: #4ade80; }
#map .finish { fill: #fff; stroke: #000; stroke-width: 1; }
#map .rival { fill: #facc15; stroke: rgb(0 0 0 / 0.6); stroke-width: 0.8; }
#map .friend { fill: #38bdf8; stroke: rgb(0 0 0 / 0.6); stroke-width: 0.8; }
#map .you { fill: #f43f5e; stroke: #fff; stroke-width: 1; }

/* The close-up, top left: the water near you, ahead up, you a little below the
   middle so there's more to see in front. */
#near {
  position: absolute;
  top: 3.75rem;
  left: 16px;
  width: clamp(100px, 24vmin, 170px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.35);
  border: 1px solid rgb(255 255 255 / 0.35);
}
#near .water { fill: rgb(120 190 230 / 0.55); }
#near line { stroke-width: 2; }
#near .start { stroke: #4ade80; }
#near .finish { stroke: #fff; }
#near .rival { fill: #facc15; stroke: rgb(0 0 0 / 0.6); stroke-width: 0.8; }
#near .friend { fill: #38bdf8; stroke: rgb(0 0 0 / 0.6); stroke-width: 0.8; }
#near .you { fill: #f43f5e; stroke: #fff; stroke-width: 1; }
#near .route { fill: none; stroke: #fde047; stroke-width: 1.4; stroke-dasharray: 4 3; opacity: 0.9; }
#near .buoy, #map .buoy { fill: #facc15; stroke: #000; stroke-width: 0.6; }
#near .boat rect { fill: #d4d4d8; stroke: rgb(0 0 0 / 0.5); stroke-width: 0.5; }
#near .boat .oars { stroke: #d4d4d8; stroke-width: 0.6; }
#map .boat { fill: #d4d4d8; stroke: rgb(0 0 0 / 0.6); stroke-width: 0.6; }

/* An eight coming up behind: an arrow at the bottom of the screen on its side,
   pointing up the way it's going. */
#behind {
  position: absolute;
  bottom: 9rem; /* above the gauges */
  margin: 0;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: rgb(220 38 38 / 0.85);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.2s;
}
#behind::before { content: "\2191  "; }
#behind.on { opacity: 1; animation: behind 0.8s ease-in-out infinite alternate; }
#behind.left { left: 16px; }
#behind.right { right: 16px; }
@keyframes behind { to { translate: 0 -8px; } }
@media (prefers-reduced-motion: reduce) { #behind.on { animation: none; } }
/* A phone's gauges are lower; smaller, so it stays clear of the hint lane in any font. */
@media (max-height: 500px) { #behind { bottom: 7rem; font-size: 0.8rem; padding: 0.3rem 0.5rem; } }

.hud-bottom {
  position: absolute;
  inset: auto 16px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
}

.readout { display: grid; gap: 0.25rem; font-size: 0.9rem; }
.readout b { font-size: 1.6rem; }

#balance { width: clamp(120px, 22vw, 200px); overflow: visible; }
#balance .arc { fill: none; stroke: rgb(255 255 255 / 0.55); stroke-width: 6; stroke-linecap: round; }
#balance .danger { fill: none; stroke: #ff5a3c; stroke-width: 6; stroke-linecap: round; }
#balance line { stroke: #fff; stroke-width: 5; stroke-linecap: round; }
#balance circle { fill: #fff; }
#needle { transform-origin: 100px 100px; }
/* About to go in: the red ends thicken and the gauge pulses, so the warning isn't colour alone. */
#balance.tipping .danger { stroke-width: 11; }
#balance.tipping line { stroke: #ff5a3c; stroke-width: 7; } /* plain to see over a white bow */
#balance.tipping circle { fill: #ff5a3c; }
#balance.tipping { animation: tipping 0.35s ease-in-out infinite alternate; }
@keyframes tipping { to { scale: 1.12; } }
@media (prefers-reduced-motion: reduce) { #balance.tipping { animation: none; } }

.meters { justify-self: end; display: grid; gap: 0.35rem; font-size: 0.8rem; width: clamp(100px, 20vw, 180px); }
.meters .bar { height: 10px; border-radius: 5px; background: rgb(0 0 0 / 0.35); overflow: hidden; }
#rhythm { height: 100%; width: 100%; background: linear-gradient(90deg, #4aa3ff, #b48cff); transform-origin: left; }
.bar.rhythm.locked { box-shadow: 0 0 10px #b48cff; }
#flow { font-weight: 600; color: #d9c4ff; }
.bar.sprint.spending { box-shadow: 0 0 10px #ffb347; }
#stamina { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a3c, #ffd23f 40%, #6fdc8c); transform-origin: left; }

#hud.solo #pos { display: none; }

/* Under the clock, one slot each so they never overlap: the place's name, then
   the wash, then the turn cue. */
#wash {
  position: absolute;
  top: 8rem;
  left: 50%;
  translate: -50% 0;
  margin: 0;
  padding: 0.2rem 0.7rem;
  border-radius: 1rem;
  background: rgb(0 0 0 / 0.3);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.4s;
}
#wash.on { opacity: 1; }

#place {
  position: absolute;
  top: 6.3rem; /* under the clock */
  left: 50%;
  translate: -50% 0;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.6);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.8s;
}
#place.on { opacity: 1; }

/* Low in the middle, above the gauges and clear of the boats ahead: hints, the
   phone's controls help, a drill's numbers. Stacked, so they never overlap, and
   narrow enough to miss the eight-behind arrow at either side. */
.lane-low {
  position: absolute;
  bottom: 9.5rem;
  left: 50%;
  translate: -50% 0;
  width: min(36rem, max(60vw, 100vw - 340px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font);
  text-align: center;
}
.lane-low p { margin: 0; }
#assisted { font-size: 0.75rem; opacity: 0.8; display: none; }
#hud.assisted:not(.helping) #assisted { display: block; } /* after the controls help */
#hint {
  padding: 0.35rem 0.8rem;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.45);
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s;
}
#hint:empty { display: none; }
#hint.show { opacity: 1; transition: none; }

.rotate-hint { display: none; color: var(--accent); font-weight: 700; }
@media (orientation: portrait) and (pointer: coarse) {
  .rotate-hint { display: block; }
}

/* Fingers need bigger targets than a mouse. */
@media (pointer: coarse) {
  header button, header a { min-height: 44px; display: inline-flex; align-items: center; }
  header button { padding-inline: 1rem; }
}

/* A phone on its side: little height, so tuck everything closer to the edges. */
@media (max-height: 500px) {
  header { padding: 0.35rem 16px; }
  header h1 { font-size: 1rem; }
  header button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
  .hud-top { top: 2.6rem; font-size: 1.1rem; gap: 0.9rem; }
  #map { top: 3.6rem; width: 150px; } /* below Pause and Sound */
  #map.tall { width: auto; height: 28vh; }
  #near { top: 3.6rem; width: 90px; }
  #wash { top: 6rem; }
  .hud-bottom { inset: auto 16px 8px; }
  #balance { width: 110px; }
  .readout b { font-size: 1.2rem; }
  .lane-low { bottom: 5.3rem; gap: 0.25rem; width: max(50vw, 100vw - 320px); }
  #hud.helping .lane-low { width: calc(100vw - 160px); } /* the first seconds: over the decorative tap marks, not the boats */
  #touchhelp { font-size: 0.72rem; padding-block: 0.15rem; }
  #hint { font-size: 0.95rem; padding-block: 0.2rem; }
  .cue { width: 48px; height: 48px; }
}

/* Which half of the screen strokes on which side. */
.cue {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 0.35);
  font-weight: 700;
  opacity: 0.35;
}
.cue.left { left: 16px; }
.cue.right { right: 16px; }
/* They're where to tap: none with a mouse and keyboard. */
@media (hover: hover) and (pointer: fine) { .cue { display: none; } }

.gauges { display: grid; justify-items: center; gap: 4px; }
.rudder { position: relative; width: 90px; height: 6px; border-radius: 3px; background: rgb(0 0 0 / 0.35); }
.rudder span { position: absolute; top: -3px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; }

#touchhelp {
  padding: 0.3rem 0.7rem;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.35);
  font-size: 0.85rem;
  display: none;
}
#hud.helping #touchhelp { display: block; }

#tiltdebug {
  position: fixed;
  top: 2.5rem;
  left: 8px;
  z-index: 1;
  margin: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.65);
  color: #9f9;
  font: 11px/1.35 var(--mono);
  pointer-events: none;
  white-space: pre;
}

#standings { columns: 2; column-gap: 2rem; padding-left: 1.5rem; font-family: var(--mono); font-size: 0.9rem; }
#standings .you { font-weight: 700; color: var(--accent); }

/* Above the horizon, so not over the boats ahead; while it shows, the place,
   wash and turn cue under the clock make way. */
#flash {
  position: absolute;
  top: 30%;
  left: 50%;
  translate: -50% -50%;
  margin: 0;
  font-family: var(--font);
  width: max-content;
  max-width: max(50vw, 100vw - 480px); /* between the maps, whatever the font's width */
  font-size: clamp(1.8rem, 7vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  transition: opacity 0.25s;
}
#flash.show { opacity: 1; transition: none; }
#hud.flashing :is(#place, #wash, #cue) { visibility: hidden; }
@media (max-height: 500px) {
  #flash { font-size: 1.6rem; max-width: max(40vw, 100vw - 348px); } /* between the maps (150 and 90 px, 16 px in, a gap) */
  #flash.big { font-size: 3rem; } /* a count, Go! */
}

body.capsized #view { filter: saturate(0.5) brightness(0.8) hue-rotate(-15deg); }

/* The start menu: three steps, paddler, boat, race. */
#menu { width: min(36rem, calc(100vw - 32px)); }
#menu h3 { margin: 0 0 0.6rem; }
#menu .progress { margin: -0.6rem 0 0.2rem; color: var(--accent); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
#menu .step-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 1rem 0 0; position: sticky; bottom: -1px; padding-block: 0.5rem; background: var(--bg); } /* Next and Done in reach from anywhere in a long step */
#menu .step-buttons button { padding: 0.6rem 1rem; }
#menu .step-buttons .next { background: var(--accent); border-color: var(--accent); color: #fff; }
#menu .step-buttons .back { margin-right: auto; }
#menu .me { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; }
#menu .me p { margin: 0 0 0.4rem; }
#menu .edits { display: flex; flex-wrap: wrap; gap: 0.4rem; }
#menu .edits button { min-height: 44px; padding: 0.35rem 0.75rem; font-size: 0.9rem; }
#paddlePic { width: 100%; height: auto; margin-bottom: 0.6rem; }
#boardlist { display: grid; gap: 0.8rem; }
#boardlist h4 { margin: 0 0 0.2rem; }
#boardlist table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
#boardlist td { padding: 0.2rem 0.4rem; border-top: 1px solid var(--line); }
#boardlist td:first-child { width: 2.5rem; color: var(--dim); }
#boardlist td:nth-child(3) { font-family: var(--mono); }
#boardlist td:last-child { color: var(--dim); }
#boardlist .you td { font-weight: 700; color: var(--ink); }
#boardlist button, #ranked button { min-height: 44px; } /* Try again, a full tap target */
#ranked { margin: 0; } /* in the finish's grid form, where margins don't collapse: the gap spaces it */
#ranked:empty { display: none; }
#menu fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 0.6rem; padding: 0.4rem 0.75rem 0.6rem; }
#menu legend { color: var(--dim); font-size: 0.85rem; padding: 0 0.25rem; }
#menu .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
#menu .row label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; min-height: 44px; }
#menu .swatch input { width: 2.4rem; height: 1.8rem; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.pic { display: block; background: radial-gradient(ellipse at 50% 85%, #7fb3cf 0 45%, #b9d6e4 46%); border-radius: 12px; }
#menu .maker { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 0.9rem; align-items: start; }
#menu .maker > .pic { position: sticky; top: 0; } /* stays in view while you scroll the choices */
#paddlerPic { width: 100%; aspect-ratio: 1; }
#skinTones { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.75rem, 2.75rem)); gap: 0.2rem; } /* each tone 44 px to tap: two rows on a phone */
#skinTones label { padding: 0.2rem; }
#skinTones label { position: relative; cursor: pointer; }
#skinTones input { position: absolute; opacity: 0; }
#skinTones span { display: block; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--line); }
#skinTones input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
#skinTones input:focus-visible + span { outline: 2px dashed var(--ink); outline-offset: 4px; } /* not the chosen tone's ring */
#menu .boat-pics { display: grid; grid-template-columns: 1fr 22%; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; }
#boatPic { width: 100%; height: auto; background: #7fb3cf; }
#sectionPic { width: 100%; height: auto; background: #b9d6e4; }
#menu .note { margin: 0 0 0.3rem; color: var(--dim); font-size: 0.8rem; }
#menu legend small, #menu .row label small { font-size: 0.78rem; }
#menu .colours { margin-bottom: 0.6rem; }
#boatList { display: grid; gap: 0.2rem; max-height: 38vh; overflow-y: auto; }
#boatList label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.1rem 0.6rem; padding: 0.35rem 0.4rem; border-radius: 6px; cursor: pointer; }
#boatList label:has(input:checked) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
#boatList small { grid-column: 2 / -1; }
#boatList .meter { display: flex; gap: 2px; }
#boatList .meter i { width: 6px; height: 12px; border-radius: 2px; background: var(--line); }
#boatList .meter i.on { background: var(--accent); }
#youPic { width: 100%; aspect-ratio: 1; }
@media (max-width: 520px) {
  #menu .maker { grid-template-columns: 1fr; }
  #paddlerPic { width: 55%; margin: 0 auto; }
  #menu .maker > .pic { position: static; } /* one column: above the choices, it would cover them */
}
@media (max-height: 500px) {
  #menu .maker { grid-template-columns: 30% 1fr; }
  #boatList { max-height: none; } /* the dialog scrolls; one scroller is enough */
  #menu .boat-pics { width: 75%; }
}

dialog .lede { color: var(--dim); margin-top: -0.5rem; }
dialog .warning { color: var(--accent); }
details { margin-top: 1rem; color: var(--dim); font-size: 0.9rem; }
details ul { padding-left: 1.2rem; }
summary { cursor: pointer; }

@media (max-width: 520px) {
  .readout b { font-size: 1.2rem; }
  .readout { font-size: 0.75rem; }
}

#menu .credit { font-size: 0.8rem; color: var(--dim); }

#menu .account { font-size: 0.9rem; }
/* A race or a time trial: one choice for every course (practice is on your own). */
#menu .format { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
#menu .format button { flex: 1; min-height: 44px; }
#menu .format button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
#menu .format button[aria-pressed="true"] small { color: inherit; }
#livePlayers .you { font-weight: 700; }
#live select, #live input { font: inherit; padding: 0.3rem 0.4rem; }
#live .choice { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
#live .choice button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
#live #liveMake small, #live #liveJoinBox small { display: block; margin-top: 0.4rem; color: var(--dim); }
#live input { text-transform: uppercase; letter-spacing: 0.15em; }
#livePlayers { padding-left: 1.2rem; }
#livePlayers small { opacity: 0.75; }
#livePlayers .face { width: 1.6rem; height: 1.6rem; margin-right: 0.4rem; vertical-align: middle; border-radius: 50%; background: #b9d6e4; }

/* Coming up to a turn or a split: which way, under the clock. */
#cue {
  position: absolute;
  top: 9.9rem; /* under the wash */
  left: 50%;
  translate: -50% 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(36rem, calc(100vw - 32px));
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.45);
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.05rem;
  opacity: 0;
  transition: opacity 0.4s;
}
#cue.on { opacity: 1; }
#cue b { font-size: 2.2rem; line-height: 1; color: #fde047; }
/* A practice drill's numbers, in the low lane. */
#drill {
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.5);
  font-size: 1.05rem;
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  text-align: left;
}
@media (max-height: 500px) { #drill { font-size: 0.85rem; } }
/* A gate missed: go back. Stays until you have. */
#missed {
  position: absolute;
  top: 45%;
  left: 50%;
  translate: -50% -50%;
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: rgb(220 38 38 / 0.9);
  font-family: var(--font);
  font-weight: 700;
  text-align: center;
  max-width: calc(100vw - 32px);
}
@media (max-height: 500px) {
  #place { top: 4.35rem; } /* under the clock */
  /* Between the two maps, under the wash. */
  #cue { top: 7.75rem; font-size: 0.82rem; padding: 0.3rem 0.7rem; max-width: calc(100vw - 2 * 180px); }
  #cue b { font-size: 1.4rem; }
}

/* The walk to the club (#club): the place's name, and labels over the scene to tap. */
#club { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: system-ui, sans-serif; }
#clubPlace { position: absolute; left: max(16px, env(safe-area-inset-left)); top: calc(max(14px, env(safe-area-inset-top)) + 3rem); margin: 0; color: #fff; font-size: clamp(1.3rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -0.01em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
#clubNav { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); margin: 0; display: flex; gap: 0.5rem; }
#clubNav button { pointer-events: auto; min-height: 44px; padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(10, 18, 18, 0.62); color: #fff; font: 600 0.9rem/1 system-ui, sans-serif; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#clubNav button:hover, #clubNav button:focus-visible { border-color: #f2c230; outline: none; }
#clubDoors .spot { position: absolute; left: 0; top: 0; pointer-events: auto; min-height: 44px; padding: 0.5rem 0.95rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 18, 18, 0.62); color: #fff; font: 600 0.95rem/1.1 system-ui, sans-serif; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer; }
#clubDoors .spot:hover, #clubDoors .spot:focus-visible { background: rgba(10, 18, 18, 0.85); border-color: #f2c230; outline: none; }
#clubDoors .spot.go { background: #d6452b; border-color: #d6452b; font-size: 1.05rem; }
#clubDoors .spot.go:focus-visible { outline: 3px solid #fff; outline-offset: 2px; } /* the red hides the amber border */
#clubDoors .spot.small { min-width: 34px; min-height: 34px; padding: 0.25rem; font-size: 0.85rem; }
#clubDoors .spot.small::after { content: ""; position: absolute; inset: -5px; } /* 44 px to tap, though it looks smaller */
#clubDoors .spot.on { border: 2px solid #f2c230; color: #f2c230; }
/* The bridge: the clubs as cards along the bottom, pins over their buildings. */
#clubCards { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 0.5rem; width: max-content; max-width: calc(100vw - 32px); }
#clubCards .card { pointer-events: auto; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0.6rem; align-items: center; text-align: left; min-height: 44px; padding: 0.4rem 0.8rem 0.4rem 0.4rem;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(10, 18, 18, 0.7); color: #fff; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-family: system-ui, sans-serif; }
#clubCards .card svg { grid-row: span 2; width: 60px; height: 40px; border-radius: 7px; display: block; }
#clubCards .card .name { font-weight: 700; font-size: 0.92rem; display: flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
#clubCards .card small { opacity: 0.8; font-size: 0.74rem; max-width: 9.5rem; line-height: 1.2; }
#clubCards .card.go { background: #d6452b; border-color: #d6452b; grid-template-columns: 1fr; padding: 0.45rem 1rem; }
#clubCards .card:hover, #clubCards .card:focus-visible { border-color: #f2c230; outline: none; }
/* Racing friends, on the bridge and at the canoe club: a row of its own above the cards, in the accent colour. */
#clubCards .friends { flex-basis: 100%; display: flex; justify-content: center; gap: 0.5rem; }
#clubCards .friend { pointer-events: auto; display: grid; text-align: left; min-height: 44px; padding: 0.45rem 1rem; border-radius: 14px; border: 1px solid #f2c230;
  background: #f2c230; color: #1b1a14; font: 0.92rem/1.2 system-ui, sans-serif; cursor: pointer; }
#clubCards .friend .name { font-weight: 700; }
#clubCards .friend small { font-size: 0.74rem; opacity: 0.85; }
#clubCards .friend:hover { border-color: #fff; }
#clubCards .friend:focus-visible { outline: 3px solid #fff; outline-offset: 2px; } /* plain to see on the yellow, for a keyboard or a d-pad */
/* A guest on the bridge: the river cruise on its own, the rest in a box that
   says they need an account, with Sign in (its heading shows at every size: on
   a phone on its side the cards lose their lines). Signed in, no box. */
#clubCards > .card.open { background: #d6452b; border-color: #d6452b; } /* the one thing a guest can play: the game's "start here" red */
#clubCards > .card:last-child { margin-left: auto; } /* the river cruise, on the right even when the cards wrap */
#clubCards .signin-box { pointer-events: auto; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem 0.5rem; border: 2px solid #f2c230; border-radius: 18px; background: rgba(10, 18, 18, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#clubCards .signin-box .card { background: rgba(10, 18, 18, 0.55); }
#clubCards .signin-box .card svg { opacity: 0.7; } /* a little quieter than the open card: they need an account */
#clubCards .signin-box .head { flex-basis: 100%; margin: 0; text-align: center; color: #f2c230; font: 700 0.85rem/1.2 system-ui, sans-serif; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
#clubCards .signin-box .signin { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border-radius: 14px; background: #f2c230; color: #1b1a14; font: 700 0.92rem system-ui, sans-serif; text-decoration: none; }
#clubCards .signin-box .signin:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* A phone held sideways: one row for everything, names only, so the scene (and the canoe club's pin) shows. */
@media (max-height: 500px) {
  #clubCards .friends { flex-basis: auto; }
  #clubCards .card small, #clubCards .card svg { display: none; }
  #clubCards .card.go small { display: block; } /* Race again says which course */
  /* A guest's box in one row (its heading kept for screen readers, Sign in says it), so the scene's club pins show above the cards. */
  #clubCards .signin-box { padding: 0.3rem; }
  #clubCards .card { padding-inline: 0.55rem; } /* the box and the cruise in one row on the SE */
  #clubCards .card .name, #clubCards .signin-box .signin { font-size: 0.85rem; }
  #clubCards .signin-box .signin { padding: 0 0.8rem; }
  #clubCards .signin-box .head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* Four cards in the box since the drone (2026-11-22): they shrink and a long name wraps, so it stays one row. */
  #clubCards .signin-box { flex-wrap: nowrap; }
  #clubCards .signin-box .card { flex: 0 1 auto; min-width: 0; }
  #clubCards .signin-box .card .name { white-space: normal; line-height: 1.1; }
}
/* An upright phone: a guest's cards two by two, so the stack stays low, under the scene's pins. */
@media (orientation: portrait) and (max-width: 600px) {
  /* Two to a row in any font: a long name wraps rather than taking the row. */
  #clubCards .signin-box .card { flex: 1 1 calc(50% - 0.25rem); min-width: 0; }
  #clubCards .signin-box .card .name { white-space: normal; }
  /* Its heading for screen readers only (Sign in says it), as on a phone on its side: four cards since the drone, and the stack stays as low as with three. */
  #clubCards .signin-box .head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* An upright phone with Back showing: the cards sit above Back and Start over. */
@media (orientation: portrait) and (max-width: 600px) {
  #club.backable #clubCards { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px); }
  #club.backable #clubNote { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 116px); } /* and the note above the cards */
}
@media (max-width: 860px) { #clubCards .friend small { display: none; } }
.pin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.pin.canoe { background: #f2c230; }
.pin.rowing { background: #d6261c; }
#clubDoors .pin { position: absolute; left: 0; top: 0; width: 16px; height: 16px; }
@media (max-width: 860px) { #clubCards .card { padding: 0.35rem 0.6rem 0.35rem 0.35rem; column-gap: 0.45rem; } #clubCards .long { display: none; } #clubCards .card small { font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9rem; } #clubCards .card svg { width: 50px; height: 34px; } }
@media (max-width: 640px) { #clubCards .card svg { display: none; } #clubCards .card { grid-template-columns: 1fr; } }
/* Five cards on the bridge (the drone, 2026-11-22): on a laptop, the clubs without "Reading" keep them in one row. */
@media (max-width: 1360px) { #clubCards .long { display: none; } }
@media (max-width: 860px) { #clubCards .card.go small { white-space: normal; max-width: 10rem; } } /* Race again's line in full, on two lines */
#clubNote { position: absolute; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px); transform: translateX(-50%); margin: 0; width: max-content; max-width: min(34rem, calc(100vw - 32px)); padding: 0.6rem 1rem; border-radius: 10px; background: rgba(10, 18, 18, 0.8); color: #fff; text-align: center; }
#clubFade { position: absolute; inset: 0; background: #000; opacity: 0; }
/* In the club the editors and the plan are a sheet at the side, the room still in view. */
/* Opened with show(), not showModal(), so the scene's buttons work beside it: placed by hand, over the walk's overlay. */
#menu.sheet { position: fixed; inset: calc(max(16px, env(safe-area-inset-top)) + 48px) max(16px, env(safe-area-inset-right)) auto auto; margin: 0; z-index: 6; width: min(26rem, calc(100vw - 32px)); max-height: calc(100dvh - 48px - 32px); overflow: auto; }
/* A picker on the walk: the header has ← Games, and in the picker it looked like Back (which is at the bottom left). */
#menu.sheet .dialog-links { display: none; }
/* Nothing to pause on the walk: Pause shows only racing or out on the water. */
body.walking #pause { display: none; }
/* Below the header's Pause and Sound; on a phone held upright, a bottom sheet above Back and Start over, the scene above it. */
@media (orientation: portrait) and (max-width: 600px) {
  #menu.sheet { inset: auto 16px calc(max(16px, env(safe-area-inset-bottom)) + 64px) 16px; width: auto; max-height: 52dvh; }
}
/* The narrowest phone on its side (iPhone SE): a narrower sheet, so the room's
   Change and Start over stay clear of it on the left. */
@media (orientation: landscape) and (max-width: 600px) {
  #menu.sheet { width: calc(100vw - 280px); }
}
/* Finish from anywhere in a long step: its buttons stay at the bottom of the sheet. */
#menu.sheet .step-buttons { position: sticky; bottom: -1px; margin-bottom: 0; padding-block: 0.5rem; background: var(--bg); }
/* The walk's labels and cards wait for the scene. */
#club.waiting #clubDoors, #club.waiting #clubCards, #club.waiting #clubNav, #club.asking #clubCards { visibility: hidden; }
#menu.sheet::backdrop { background: transparent; }
#menu.sheet > h2, #menu.sheet .me, #menu.sheet .rotate-hint { display: none; }
/* In the changing room your paddler stands full size beside the picker, so the picker drops its picture. */
#menu.sheet #paddlerPic { display: none; }
#menu.sheet .maker { grid-template-columns: 1fr; }

/* An outing (outing.js): the maps, the speed and the places; no race clock, gauges or stroke rate. */
#hud.outing .hud-top, #hud.outing .gauges, #hud.outing .meters, #hud.outing .readout span:nth-child(2), #hud.outing .cue, #hud.outing #touchhelp, #hud.outing #wash, #hud.outing #assisted { display: none; }
#outingBar { position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem 0.35rem 1rem; border-radius: 999px;
  background: rgba(10, 18, 18, 0.6); color: #fff; font: 0.9rem/1.2 system-ui, sans-serif; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: auto; }
#outingBar button { min-height: 44px; padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12); color: #fff; font-weight: 600; }
#outingBar span { opacity: 0.85; }
#outingBar[hidden] { display: none; }
/* The drone's thumb sticks (main.js showSticks): a ring where the thumb came down, a knob where it is. */
.stick { position: fixed; width: 100px; height: 100px; margin: -50px 0 0 -50px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.55); background: rgba(0, 0, 0, 0.15); pointer-events: none; display: grid; place-items: center; }
.stick i { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.7); }
.stick[hidden] { display: none; }

/* Rowing (scull.js): the stroke coach's numbers on its screen at your feet, a Look button on phones; no rudder. */
#coach { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: auto auto; gap: 0.1rem 0.6rem; padding: 0.4rem 0.6rem; border-radius: 6px;
  background: #9aa88f; color: #101410; font: 600 0.75rem/1 ui-monospace, Menlo, monospace; box-shadow: 0 0 0 3px #161718; pointer-events: none; }
#coach span { display: flex; align-items: baseline; gap: 0.25rem; }
#coach b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
#coach small { font-size: 0.6rem; opacity: 0.75; }
#hud .look { display: none; }
/* Two Look buttons on a phone, one each side of the balance gauge: hold one to look over that shoulder. */
#hud.rowing .look { display: block; position: absolute; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 96px); min-width: 88px; min-height: 48px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(10, 18, 18, 0.6); color: #fff; font-weight: 600; pointer-events: auto; touch-action: none; }
#hud.rowing #lookLeft { right: calc(50% + 8px); }
#hud.rowing #lookRight { left: calc(50% + 8px); }
/* Held sideways: at the outer edges, just above the speed and the meters (where the thumbs rest)… */
@media (orientation: landscape) {
  #hud.rowing .look { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 72px); }
  #hud.rowing #lookLeft { left: max(16px, env(safe-area-inset-left)); right: auto; }
  #hud.rowing #lookRight { right: max(16px, env(safe-area-inset-right)); left: auto; }
}
/* …and on a wide screen, in the bottom row beside the gauge, where there's room. */
@media (orientation: landscape) and (min-width: 760px) {
  #hud.rowing .look { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 8px); }
  #hud.rowing #lookLeft { right: calc(50% + 112px); left: auto; }
  #hud.rowing #lookRight { left: calc(50% + 112px); right: auto; }
}
@media (hover: hover) and (pointer: fine) { #hud.rowing #lookLeft::after { content: ' (Q)'; font-weight: 400; opacity: 0.7; } #hud.rowing #lookRight::after { content: ' (E)'; font-weight: 400; opacity: 0.7; } }
/* The erg's monitor: its numbers just above the machine's own. */
#ergMon { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: auto auto; gap: 0.15rem 0.7rem; padding: 0.5rem 0.7rem; border-radius: 6px;
  background: #9aa88f; color: #101410; font: 600 0.8rem/1.05 ui-monospace, Menlo, monospace; box-shadow: 0 0 0 4px #161718; pointer-events: none; }
#ergMon b, #ergMon span { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
#ergMon small { font-size: 0.6rem; margin-left: 0.2rem; opacity: 0.75; }
#ergMon .other { grid-column: 1 / -1; font-size: 0.75rem; }
#coach[hidden], #ergMon[hidden] { display: none; }
/* The kayak erg has no screen: its numbers in the game's own dark panel, not
   a monitor's. While you paddle (or row, on the rowing club's erg), Back moves
   up under the room's name (at the bottom it sat under the left thumb), and
   Start over and the door make way.
   On a short screen the note keeps left of the numbers, bottom right. */
#ergMon.kayak { background: rgba(10, 18, 18, 0.8); color: #fff; box-shadow: none; border-radius: 10px; font-family: system-ui, sans-serif; }
#club.midpiece #clubStart { display: none; }
#club.midpiece #clubDoors .door { visibility: hidden; }
#club.midpiece #clubNav { bottom: auto; top: calc(max(14px, env(safe-area-inset-top)) + 3.6rem + clamp(1.3rem, 4vw, 2.2rem) * 1.25); }
@media (max-height: 500px) {
  #club.kerg #clubNote { left: max(16px, env(safe-area-inset-left)); transform: none; max-width: calc(100vw - 290px); }
}
/* The rowing club's changing room: no sleeves or buoyancy aid with an all-in-one. */
#menu.rowing .kayak-only { display: none; }
/* Rowing: messages above the coach. The coach sits where the low lane is, so
   it waits out the controls help's first seconds (it reads 0 then anyway). */
#hud.rowing #flash { top: 20%; }
#hud.rowing.helping #coach { visibility: hidden; }
@media (max-height: 500px) {
  #hud.rowing #flash { top: 30%; } /* below the clock */
}

/* The finish on a phone: the standings in three short columns, and the buttons
   always on screen, in a row, with the leaderboard line above them in the same
   sticky form (Sign in, or a time that didn't save and its Try again). The form
   reaches down over the dialog's padding, so nothing peeks out below it. */
@media (max-height: 500px) {
  #standings { columns: 3; column-gap: 1rem; font-size: 0.8rem; margin: 0.4rem 0; }
  #finished h2 { margin-bottom: 0.5rem; }
  #details { font-size: 0.9rem; margin: 0 0 0.4rem; } /* clear of the sticky buttons on the SE */
  #finished form { position: sticky; bottom: -1.5rem; background: inherit; border-top: 1px solid var(--line); padding-block: 0.4rem 1.9rem; margin-bottom: -1.5rem; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); } /* the buttons side by side; the line says the rest scrolls behind */
  #finished form > button { padding-inline: 0.6em; text-align: center; }
  #ranked { grid-column: 1 / -1; font-size: 0.85rem; }
  #ranked:has(button) { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; } /* Try again beside its line, not below it */
  #ranked button { flex: none; white-space: nowrap; }
}

/* The narrowest phones on their side (iPhone SE, 568 px): the maps smaller,
   and the words between them smaller, so the clock row, the big message, the
   turn cue and the help all fit between the maps. */
@media (max-height: 500px) and (max-width: 600px) {
  .hud-top { font-size: 0.95rem; gap: 0.6rem; }
  #map { width: 112px; }
  #near { width: 72px; }
  #flash { font-size: 1.3rem; max-width: calc(100vw - 2 * 136px); }
  #cue { top: 7.45rem; width: max-content; font-size: 0.75rem; padding-block: 0.15rem; max-width: calc(100vw - 2 * 96px); } /* below the map, between the close-up and the edge */
  #cue b { font-size: 1.1rem; }
  /* Above the gauges, which stand taller once racing; mid-race clear of the
     eight-behind arrows at the sides (hints wrap), and in the first seconds
     between the tap marks, below the close-up (it ends 130 px down). */
  .lane-low { width: calc(100vw - 2 * 152px); bottom: 6.5rem; gap: 0.2rem; }
  #hint { line-height: 1.15; }
  /* The slots under the clock a little closer, to leave the lane its room. */
  #place { font-size: 0.9rem; }
  #wash { top: 5.8rem; padding-block: 0.15rem; }
  #hud.helping .lane-low { width: calc(100vw - 2 * 92px); } /* clear of the close-up and the tap marks */
  #hint { font-size: 0.82rem; }
}
