:root {
  --bg: #08111f;
  --glass: rgba(10, 19, 34, 0.86);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e7edf5;
  --muted: #8d9bb0;
  --accent: #e8b64c;
  --past: #b3a6f7; /* back in time: the time bar and the chip over the map */
  --radius: 12px;
  --panel-w: 376px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 Heebo, system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
/* A pinch zooms the map, never the page (as the viewport's maximum-scale, in index.html, tells the browsers that heed
   it): a finger on a panel, a button or a boat's mark zoomed the whole page, and on a phone the panels at the bottom
   went off the screen (a pinch going on as the dive to a boat began, and the card opened under the fingers).
   Scrolling stays. */
html { touch-action: pan-x pan-y; }

button, select, input { font: inherit; color: inherit; }
/* .isolate: a flag and a name kept together in the text's direction (a flag reads left to right, and would pull in
   what comes after it) */
bdi, .isolate { unicode-bidi: isolate; }

/* Thin, dim scrollbars on the dark panels, rather than the system's light ones (the ::-webkit- rules for browsers
   without scrollbar-color) */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.28) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 3px; background: rgba(255, 255, 255, 0.28); }

#map {
  position: fixed;
  inset: 0;
  direction: ltr; /* the map's own layout, its markers' and buttons', is left to right */
  background: radial-gradient(circle at 50% 45%, #0d1c33 0%, #050a14 75%); /* space round the globe */
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ---------- side panel ---------- */

/* The panel sits at the start of the reading direction (right in Hebrew, left otherwise), the map tools at the end */
#panel {
  position: fixed;
  top: 12px;
  inset-inline-start: 12px;
  bottom: 84px;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

#panel header { padding: 14px 16px 8px; display: flex; align-items: center; gap: 6px; }
#panel header .titles { flex: 1; min-width: 0; }
/* The day of the race, today: the one number of the header, as large as the title */
/* The language by a globe, the select laid over it unseen to open the browser's own list (in the header; on a phone
   among the map's buttons, above the gear) */
.language-pick { position: relative; flex: none; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.language-pick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.language-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
#language-head { width: 30px; height: 30px; justify-content: center; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
#language-head:hover, #language-head:focus-within { border-color: var(--accent); color: var(--accent); }
#settings .language-name { display: inline-flex; align-items: center; gap: 5px; }
#settings .language-name svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#race-day { flex: none; padding: 4px 11px; border: 1.5px solid var(--accent); border-radius: 10px; color: var(--accent);
  font-size: 13px; font-weight: 600; line-height: 1.15; white-space: nowrap; background: rgba(232, 182, 76, 0.1); }
#race-day b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#panel h1 { margin: 0; font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: 0.2px; text-align: start; }
#panel .sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
#panel .sub a { color: var(--accent); text-decoration: none; white-space: nowrap; }
#panel .sub a:hover { text-decoration: underline; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.segmented { display: flex; flex: 1 0 auto; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
.segmented button {
  flex: 1;
  height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
/* The buttons of the race's views, and the language at the far end */
.controls-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#open-briefing, #open-gap-chart, #open-race-log, #open-designs, #open-story {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
#open-briefing:hover, #open-gap-chart:hover, #open-race-log:hover, #open-designs:hover, #open-story:hover, body.briefing #open-briefing { border-color: var(--accent); color: var(--accent); }
#language {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  cursor: pointer;
}
#language option { color: #111; }
.segmented button[aria-checked="true"] { background: rgba(232, 182, 76, 0.2); color: var(--accent); font-weight: 500; }

.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }

#sheet-toggle { display: none; }

.list-head, .boat-row {
  display: grid;
  grid-template-columns: 22px 1fr 36px 50px 40px; /* place, skipper, wind, to finish / sailed, VMG / 24 h */
  align-items: center;
  gap: 7px;
  padding-inline: 14px 12px; /* the colour marker sits at the start */
}
.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 8px;
  padding-bottom: 6px;
  background: rgba(10, 19, 34, 0.96);
  color: var(--muted);
  font-size: 11px;
}
.list-head span:nth-child(3) { text-align: center; }
.list-head > span:nth-child(n+4) { text-align: end; }
.list-head small { display: block; font-size: 10px; opacity: 0.8; }

.fleet { list-style: none; margin: 0; padding: 0; }

.boat-row {
  position: relative;
  padding-top: 7px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.boat-row::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--c);
}
.boat-row:hover { background: rgba(255, 255, 255, 0.04); }
.boat-row.selected { background: rgba(232, 182, 76, 0.12); }
.boat-row.stale { opacity: 0.55; }

.rank { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.25; }
/* Places gained or lost in 24 hours, under the place */
.rank .change { font-size: 10px; letter-spacing: -0.3px; }
.rank .change.up { color: #3cc27a; }
.rank .change.down { color: #ff8f6b; }
/* Gap to the leader · boat · status: the boat's name is the part that gives way */
.who .meta { display: flex; }
.who .meta > * { flex: none; }
.who .meta .model { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.who .meta .sep { margin-inline: 4px; }
.who .meta .gap { color: var(--text); }
.who { min-width: 0; }
.name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flag { margin-inline-end: 5px; }
.meta { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { color: #ff8f6b; }

.wind { display: flex; align-items: center; justify-content: center; gap: 3px; font-variant-numeric: tabular-nums; direction: ltr; }
.wind-arrow { width: 14px; height: 14px; flex: none; vertical-align: -2px; }

.dist { text-align: end; font-variant-numeric: tabular-nums; }
.dtf { font-weight: 500; }

#ghost-section h2 {
  margin: 14px 14px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
#ghost-section .boat-row::before { background: repeating-linear-gradient(var(--c) 0 3px, transparent 3px 6px); }

#panel footer {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
}
#panel footer p { margin: 0; }
#panel footer .credit { margin-top: 3px; }
#panel footer a { color: var(--text); text-decoration: none; }
#panel footer a:hover { text-decoration: underline; }

/* ---------- selected boat ---------- */

/* Taller than the room the panel has (a short window), the card scrolls within it, the fleet under it giving way first */
#details {
  position: relative;
  flex: 0 1 auto;
  min-height: 0;
  margin: 10px 12px 4px;
  padding: 10px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-inline-start: 3px solid var(--c);
}
#details[hidden] { display: none; }
#details .boat-head { margin-bottom: 8px; padding-inline-end: 28px; }
#details .boat-head img { width: 48px; height: 48px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 18px; margin-top: 8px; }
.card-actions { align-items: center; gap: 6px 8px; }
.card-actions :is(.to-sea, .share) { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.05);
  color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; }
.card-actions :is(.to-sea, .share):hover { border-color: var(--accent); }
/* Her speed by wind angle (js/app.js, polarSvg) */
#details .today .lateral { color: var(--muted); }
#details .polar { margin-top: 8px; }
#details .polar-toggle { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; }
#details .polar-chart { display: block; width: 180px; margin: 6px auto 0; overflow: visible; }
#details .polar-chart .grid path { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 0.6; }
#details .polar-chart text { fill: var(--muted); font-size: 7.5px; font-variant-numeric: tabular-nums; }
#details .polar-chart .dots circle { fill: var(--c, var(--accent)); opacity: 0.45; }
#details .polar-chart .fleet { fill: none; stroke: var(--text); stroke-width: 1.2; opacity: 0.85; }
#details .polar-chart .now { fill: none; stroke: #fff; stroke-width: 1.8; }
#details .polar-chart .wind { font-size: 11px; }
#details .polar .caption { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
/* The latest news item over the map (js/app.js, showHeadline) */
#headline { position: fixed; top: 12px; inset-inline-start: calc(var(--panel-w) + 24px); max-width: min(460px, calc(100vw - var(--panel-w) - 96px));
  display: flex; align-items: stretch; z-index: 900; border-radius: 999px; font-size: 13px; }
#headline[hidden], body:is(.briefing, .story-mode, .at-sea) #headline { display: none; }
#headline button { border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
#headline .open { display: flex; align-items: baseline; gap: 6px; min-width: 0; padding: 7px 4px 7px 12px; padding-inline: 12px 4px; text-align: start; }
#headline .lead { flex: none; color: var(--accent); font-weight: 500; }
#headline .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
#headline .open:hover .text { text-decoration: underline; }
#headline .close { flex: none; padding-inline: 6px 12px; color: var(--muted); }
#headline .close:hover { color: var(--text); }
@media (max-width: 760px) {
  #headline { position: static; max-width: none; margin: 0 12px 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-size: 12.5px; }
  #headline .open { flex: 1; padding-block: 6px; }
  .sheet-open #headline { display: none; }
}
/* What's new with her (js/app.js, todayHtml) */
#details .today { margin: 0 0 8px; padding: 6px 9px; list-style: none; display: flex; flex-direction: column; gap: 3px;
  border-inline-start: 2px solid var(--c, var(--accent)); border-radius: 4px; background: rgba(255, 255, 255, 0.05); font-size: 12.5px; line-height: 1.35; }
#details .today .good { color: #3cc27a; }
#details .today .bad { color: #ff8f6b; }
#details .today .visit { font-weight: 500; }
#details .today .rival { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; unicode-bidi: isolate; }
#details .today .rival:hover { text-decoration: underline; }
#details .today .rival .flag { margin-inline-end: 3px; }
.card-links { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 8px; }
.card-links a, .card-links button { color: var(--accent); font-size: 12px; text-decoration: none; }
.card-links button { padding: 0; border: 0; background: none; cursor: pointer; }
.card-links a:hover, .card-links button:hover { text-decoration: underline; }

/* Wind forecast at the selected boat (renderForecast) */
#details .forecast { position: relative; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
#details .forecast[hidden] { display: none; }
.forecast-title { margin-bottom: 2px; color: var(--muted); font-size: 11.5px; }
.forecast > svg { display: block; width: 100%; height: auto; direction: ltr; touch-action: pan-y; } /* the chart, not the tip's arrow */
.forecast .grid, .forecast .day-line { stroke: rgba(255, 255, 255, 0.09); stroke-width: 1; vector-effect: non-scaling-stroke; }
.forecast .tick, .forecast .day { fill: var(--muted); font-size: 8px; }
.forecast .peak { fill: var(--text); font-size: 8px; font-weight: 500; }
.forecast .bar { fill: #7aa7d6; }
.forecast .bar.on { fill: #b6d0ee; }
.forecast .arrow { fill: var(--muted); }
.forecast .hit { fill: transparent; cursor: crosshair; }
.forecast-tip {
  position: absolute;
  top: 18px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 17, 31, 0.95);
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
}
.forecast-tip[hidden] { display: none; }

/* ---------- boat header (selected card and hover card) ---------- */

.boat-head { display: flex; align-items: center; gap: 10px; }
.boat-head img {
  width: 56px;
  height: 56px;
  flex: none;
  border: 2px solid var(--c);
  border-radius: 50%;
  object-fit: cover;
  background: #1b2638;
}
.boat-head img { cursor: zoom-in; }
.boat-head img:hover { filter: brightness(1.12); }
.boat-head > div { min-width: 0; }

/* ---------- gap chart ---------- */

/* Windows over the map: the gap chart and the race events */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr); /* the screen's size, not the content's, so a long list scrolls */
  place-items: center;
  padding: 16px;
  background: rgba(2, 5, 10, 0.8); /* dark enough that the map and its wind don't read through round the window */
}
.dialog[hidden] { display: none; }
/* Opaque, with a lighter edge and a deeper shadow: the window stands clear of the map behind it */
.dialog .box {
  display: flex; flex-direction: column; width: min(960px, 100%); max-height: 100%; padding: 12px 14px 10px;
  background: #0d1a2e;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}
.dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dialog h2 { margin: 0; font-size: 15px; font-weight: 500; }
.dialog .close {
  width: 30px;
  height: 30px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.dialog .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* ---------- the boats' designs ---------- */

/* A card for each design, its picture (js/showcase.js) over its name and boats; a design's page, its picture beside its
   figures and its boats under them */
#designs .box { width: min(1100px, 100%); height: min(880px, 100%); }
#designs header h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#designs .back {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
#designs .back:hover { border-color: var(--accent); color: var(--accent); }
#designs .back[hidden] { display: none; }
#designs .pages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#designs .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 2px 2px 8px;
  list-style: none;
}
#designs .gallery[hidden], #designs .gallery-top[hidden] { display: none; }
#designs .gallery-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 2px 10px; }
#designs .scale-note { flex: 1 1 260px; margin: 0; color: var(--muted); font-size: 12.5px; }
#designs .to-compare {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
#designs .to-compare:hover { border-color: var(--accent); color: var(--accent); }
#designs .about .to-compare { margin-top: 14px; }
#designs .gallery .wait { color: var(--muted); }
#designs .card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  text-align: start;
  cursor: pointer;
}
#designs .card:hover { border-color: var(--accent); }
#designs canvas { display: block; width: 100%; background: #0d1c33; }
#designs .card canvas { aspect-ratio: 5 / 6; } /* as sideplan.js draws it */
#designs .still canvas, #designs .still .hint { display: none; } /* no WebGL 2 */
#designs .card .name { margin: 8px 10px 0; font-size: 15px; font-weight: 700; }
#designs .card .by, #designs .card .figures { margin: 0 10px; color: var(--muted); font-size: 12px; }
#designs .card .figures { margin-top: 2px; color: var(--text); font-variant-numeric: tabular-nums; }
#designs .tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 10px 0; }
#designs .tags .tag {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
#designs .boats { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 10px 0; }
#designs .boats .boat {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 8px 1px 2px;
  border-inline-start: 3px solid var(--c);
  border-radius: 4px 999px 999px 4px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  white-space: nowrap;
}
:root[dir="rtl"] #designs .boats .boat { border-radius: 999px 4px 4px 999px; }
#designs .boats .boat bdi { overflow: hidden; text-overflow: ellipsis; }
#designs .boats .place {
  min-width: 18px;
  margin-inline-end: 5px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#designs .boats .flag { margin-inline-end: 4px; font-size: 11px; }
#designs .boats .ghost { background: none; outline: 1px dashed rgba(255, 255, 255, 0.22); outline-offset: -1px; color: var(--muted); }
#designs .boats .ghost .place { font-weight: 500; }

#designs .design {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-areas: "stage about" "fleet fleet" "crew crew";
  align-items: start;
  gap: 10px 20px;
  padding: 2px 2px 8px;
}
#designs .design[hidden] { display: none; }
#designs .stage { grid-area: stage; }
#designs .stage canvas { aspect-ratio: 16 / 10; border-radius: 10px; cursor: grab; touch-action: pan-y; }
#designs .stage canvas.dragging { cursor: grabbing; }
#designs .stage .hint { margin: 5px 2px 0; color: var(--muted); font-size: 11.5px; }
#designs .about { grid-area: about; }
#designs .about dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 4px 0 0; font-size: 13.5px; }
#designs .about dt { color: var(--muted); }
#designs .about dd { margin: 0; }
#designs .about .ft { margin-inline-start: 5px; color: var(--muted); font-size: 12px; }
#designs .design h3 { grid-area: fleet; margin: 8px 0 0; color: var(--muted); font-size: 13px; font-weight: 500; }
#designs .crew { grid-area: crew; margin: 0; padding: 0; list-style: none; }
#designs .crew li {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
#designs .crew li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 2px;
  background: var(--c);
}
#designs .crew li:hover { background: rgba(255, 255, 255, 0.04); }
#designs .crew li.on { background: rgba(232, 182, 76, 0.12); cursor: default; }
#designs .crew .place { font-size: 18px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
#designs .crew .ghost .place { color: var(--muted); font-size: 12.5px; font-weight: 500; }
#designs .crew .meta { display: flex; flex-wrap: wrap; font-size: 12.5px; white-space: normal; }
#designs .crew .meta .boat { color: var(--text); }
#designs .crew .go { display: flex; gap: 6px; }
#designs .crew .go button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 15px;
  cursor: pointer;
}
#designs .crew .go button:hover { border-color: var(--accent); }
/* Two designs compared: which two, one drawn over the other, their figures */
#designs .compare {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "pick pick" "overlay figures" "overlay note";
  grid-template-rows: auto auto 1fr;
  align-items: start;
  gap: 10px 20px;
  padding: 2px 2px 8px;
}
#designs .compare[hidden] { display: none; }
/* (the two lists, each in its design's colour with a patch of it, stay in sight as the page scrolls: they say whose
   colour is whose) */
#designs .pick {
  grid-area: pick;
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 8px;
  background: #0d1a2e; /* the window's */
  box-shadow: 0 -4px 0 #0d1a2e; /* (and a little over it, where a phone's rounding lets a line of the page show) */
}
#designs .pick .who {
  flex: 0 1 330px; /* (a skipper's name and her design's) */
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding-inline-start: 9px;
  border: 1.5px solid var(--c);
  border-radius: 7px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
}
#designs .pick .swatch, #designs .overlay .whose span::before {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--c);
}
#designs .pick select {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--c);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
/* (the list's focus ring round its whole frame and in its own colour, not the page's amber, which is one of the two) */
#designs .pick select:focus, #designs .pick select:focus-visible { outline: none; }
#designs .pick .who:focus-within { outline: 2px solid var(--c); outline-offset: 2px; }
#designs .pick option { color: #111; font-weight: 400; }
#designs .pick .swap {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
#designs .pick .swap:hover { border-color: var(--accent); color: var(--accent); }
#designs .overlay { grid-area: overlay; position: relative; }
#designs .overlay .whose {
  position: absolute;
  inset: 9px 11px auto;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
#designs .overlay .whose span { display: inline-flex; align-items: center; gap: 6px; color: var(--c); }
#designs .overlay .whose span::before { content: ""; width: 11px; height: 11px; }
#designs .overlay canvas { aspect-ratio: 5 / 6; border-radius: 10px; cursor: grab; touch-action: pan-y; }
#designs .overlay canvas.dragging { cursor: grabbing; }
/* (where the two are seen from: from the side, from above, from ahead; a drag turns them besides) */
#designs .overlay .views { display: flex; gap: 6px; margin-top: 7px; }
#designs .overlay .views button {
  flex: 1;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  cursor: pointer;
}
#designs .overlay .views button:hover { border-color: var(--accent); color: var(--accent); }
#designs .overlay .views button.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#designs .overlay .hint { margin: 5px 2px 0; color: var(--muted); font-size: 11.5px; }
#designs .compare .figures { grid-area: figures; display: grid; gap: 9px; font-size: 13px; }
#designs .compare .row { display: grid; gap: 3px; }
#designs .compare .label { color: var(--muted); font-size: 12px; }
#designs .compare .val { display: grid; grid-template-columns: minmax(0, 1fr) 5.6em 3.2em; align-items: center; gap: 8px; }
#designs .compare .bar { height: 9px; border-radius: 3px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
#designs .compare .bar::before { content: ""; display: block; width: var(--w); height: 100%; border-radius: 3px; background: var(--c); }
#designs .compare .v { font-variant-numeric: tabular-nums; white-space: nowrap; }
#designs .compare .more { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
#designs .compare .kind { display: block; padding-inline-start: 8px; border-inline-start: 3px solid var(--c); }
#designs .compare .note { grid-area: note; margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- race events ---------- */

#race-log .box { width: min(620px, 100%); height: min(640px, 100%); }
#race-log .events { flex: 1; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
#race-log li {
  position: relative;
  display: grid;
  grid-template-columns: 92px 22px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  cursor: pointer;
}
#race-log li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(var(--c) 50%, var(--c2) 50%); /* an encounter's two boats */
}
#race-log li:hover { background: rgba(255, 255, 255, 0.04); }
#race-log li.selected { background: rgba(232, 182, 76, 0.12); }
#race-log li { content-visibility: auto; contain-intrinsic-size: auto 64px; } /* (those out of sight not laid out: hundreds) */
#race-log li.focus { background: rgba(232, 182, 76, 0.2); box-shadow: inset 0 0 0 1px rgba(232, 182, 76, 0.55); } /* (the item a news tip opened it at) */
#race-log .more-count { cursor: pointer; }
#race-log li.empty { display: block; color: var(--muted); cursor: default; }
#race-log li.empty::before { display: none; }
#race-log li.log-end { display: block; height: 1px; padding: 0; border: 0; content-visibility: visible; cursor: default; } /* (where more rows are drawn as it nears) */
#race-log li.log-end::before { display: none; }
#race-log .when { display: flex; flex-direction: column; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
#race-log .when b { color: var(--text); font-weight: 500; }
#race-log .icon { font-size: 16px; text-align: center; }
#race-log .what { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
#race-log .who { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#race-log li.race .who { color: var(--accent); } /* the race's news, under its name */
#race-log .pair .who { white-space: normal; } /* two names: the second goes under the first if need be */
#race-log .who > span { white-space: nowrap; }
#race-log .what > span:last-child { color: var(--muted); font-size: 12.5px; }
/* The news from the race among the events: the text cut to two lines; the switch for them by the title */
#race-log .news-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
#race-log li.open .news-text { display: block; -webkit-line-clamp: unset; line-clamp: none; }
/* The arrow showing a long item whole, at the row's end */
#race-log li.news { grid-template-columns: 92px 22px 1fr 24px; }
#race-log .expand {
  align-self: end;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--accent);
  opacity: 0.8;
  cursor: pointer;
}
#race-log .expand svg { display: block; width: 18px; height: 18px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#race-log .expand:hover { background: rgba(255, 255, 255, 0.08); opacity: 1; }
#race-log .expand[hidden] { display: block; visibility: hidden; } /* (its column kept, so the rows' texts line up) */
#race-log li.open .expand { transform: rotate(180deg); }
/* Above the list: a skipper to show alone, and the kinds of event, each switched on or off */
#race-log .log-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
#log-boat {
  height: 28px;
  max-width: 100%;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  cursor: pointer;
}
#log-boat option { color: #111; }
#race-log .log-kinds { display: flex; flex-wrap: wrap; gap: 4px; }
#race-log .log-kinds button {
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
#race-log .log-kinds button[aria-pressed="true"] { border-color: rgba(232, 182, 76, 0.55); background: rgba(232, 182, 76, 0.16); color: var(--text); }
#race-log .log-kinds button[aria-pressed="false"] span[aria-hidden] { filter: grayscale(1); opacity: 0.5; }
#race-log .log-kinds button:hover { border-color: var(--accent); }
#open-race-log .badge {
  display: inline-block;
  min-width: 17px;
  margin-inline-start: 2px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #111;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
#gap-view { flex: none; } /* the chart's views: the gaps or the depth under the boats */
/* Zoom in time, toward the latest report: fewer days, more days, and how many are shown */
#gap-zoom { display: flex; flex: none; align-items: center; margin-inline-start: auto; padding: 2px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
#gap-zoom button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
#gap-zoom button:hover:not(:disabled) { background: rgba(232, 182, 76, 0.2); color: var(--accent); }
#gap-zoom button:disabled { opacity: 0.3; cursor: default; }
#gap-zoom .span { min-width: 64px; color: var(--muted); font-size: 12px; text-align: center; white-space: nowrap; }
#gap-chart .chart { position: relative; height: min(520px, 64vh); direction: ltr; } /* time runs left to right */
#gap-chart svg { display: block; touch-action: pan-y; } /* a pinch zooms the chart (js) */
#gap-chart .grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
#gap-chart .tick { fill: var(--muted); font-size: 10.5px; }
#gap-chart .line { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
#gap-chart .line.dim { opacity: 0.35; }
#gap-chart .line.on { stroke-width: 3; }
#gap-chart .name { font-size: 11px; cursor: pointer; }
#gap-chart .tie { fill: none; stroke-width: 1; opacity: 0.7; } /* from a line's end to its name, when the name had to move */
#gap-chart .tie.dim { opacity: 0.3; }
#gap-chart .name.dim { opacity: 0.5; }
#gap-chart .name.on { font-weight: 700; }
#gap-chart .now { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 3; }
#gap-chart .cursor { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1; visibility: hidden; }
#gap-chart .cursor.on { visibility: visible; }
#gap-chart .hit { fill: transparent; cursor: crosshair; }
#gap-chart .tip {
  position: absolute;
  top: 8px;
  min-width: 190px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.95);
  font-size: 12px;
  pointer-events: none; /* the chart under it keeps the pointer */
}
#gap-chart .tip[hidden] { display: none; }
#gap-chart .tip .when { margin-bottom: 3px; color: var(--muted); white-space: nowrap; }
#gap-chart .tip .when b { color: var(--text); font-weight: 500; }
#gap-chart .tip ol { margin: 0; padding: 0; list-style: none; }
#gap-chart .tip li { display: flex; align-items: baseline; gap: 6px; line-height: 17px; white-space: nowrap; }
#gap-chart .tip .place { min-width: 14px; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }
#gap-chart .tip .place::after { content: ""; display: inline-block; width: 3px; height: 9px; margin-inline-start: 5px; border-radius: 1px; background: var(--c); }
#gap-chart .tip .flag { margin: 0; font-size: 11px; line-height: 1; } /* emoji flags would make the rows taller */
#gap-chart .tip .who { flex: 1; }
#gap-chart .tip .gap { margin-inline-start: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
#gap-chart .tip .hint { margin-top: 4px; color: var(--muted); font-size: 11px; }
#gap-chart .tip .to-map {
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  color: var(--accent);
  font-size: 12px;
  pointer-events: auto;
  cursor: pointer;
}
/* The tip reads in the page's direction, inside the chart's left-to-right box */
:root[dir="rtl"] #gap-chart .tip { direction: rtl; }

/* ---------- photo viewer ---------- */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 8, 16, 0.86);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: zoom-out;
}
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; text-align: center; cursor: default; }
/* A sized track, so the photo's max-height: 100% applies; in an auto-sized row a tall photo overflows onto the caption */
#lightbox .stage { --w: min(92vw, 1000px); --h: min(66vh, 720px); display: grid; grid-template: 100% / 100%; place-items: center; width: var(--w); height: var(--h); cursor: zoom-out; }
/* The photo as large as the stage holds, by its shape (--ratio, its width to its height: js/app.js showPhoto) and not
   its own size: the small one shown first is as large as the full one that takes its place, which so doesn't jump */
#lightbox .stage img {
  display: block;
  width: min(var(--w), var(--h) * var(--ratio, 1.5));
  aspect-ratio: var(--ratio, 1.5);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  background: #1b2638;
  cursor: default;
}
/* A photo that can't be loaded (its site down): said so in its place */
#lightbox .stage .missing { display: none; max-width: 420px; margin: 0; padding: 18px 22px; border-radius: 14px; background: #1b2638; color: var(--muted); font-size: 15px; cursor: default; }
#lightbox .stage.failed img { display: none; }
#lightbox .stage.failed .missing { display: block; }
#lightbox figcaption { margin-top: 12px; font-size: 16px; font-weight: 500; }
/* On its own line: inline, a Hebrew label sits next to the (Latin) boat name and reads as if it named it */
#lightbox .which { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; font-weight: 400; }
#lightbox .thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
#lightbox .thumbs button {
  width: 64px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #1b2638;
  opacity: 0.55;
  cursor: pointer;
}
#lightbox .thumbs button:hover { opacity: 0.85; }
#lightbox .thumbs button.on { border-color: var(--accent); opacity: 1; }
#lightbox .thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; }
#lightbox .thumbs button.failed img { display: none; }
#lightbox .thumbs button.failed::after { content: '\1F4F7'; opacity: 0.5; }
#lightbox .nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
#lightbox .nav:hover { border-color: var(--accent); color: var(--accent); }
/* "Previous" is at the start of the reading direction. Right-to-left text shows ‹ and › mirrored, so in Hebrew
   too each arrow points outward. */
#lightbox .prev { inset-inline-start: 12px; }
#lightbox .next { inset-inline-end: 12px; }
#lightbox.single .nav { display: none; }
#lightbox .close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  inset-inline-end: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  font-size: 16px;
  cursor: pointer;
}
.boat-head .title { font-size: 15px; font-weight: 700; }
.boat-head .sub { color: var(--muted); font-size: 12px; }
.boat-head .sub.boat { color: var(--text); }
:is(#panel, body) .boat-head .sub.status { color: #ff8f6b; font-weight: 600; }
.boat-head .head-buttons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.boat-photos, .boat-design {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  cursor: pointer;
}
.boat-photos:hover, .boat-design:hover { border-color: var(--accent); color: var(--accent); }

#boat-card {
  position: fixed;
  z-index: 1100;
  width: 300px;
  padding: 12px 14px;
  border-top: 3px solid var(--c);
}
/* Its ✕, embedded and on a touch screen (a pointer leaving it closes it otherwise): in the corner over her photo, her
   place's tab keeping the other */
#boat-card > .close { display: none; position: absolute; top: 2px; inset-inline-start: 2px; width: 24px; height: 24px;
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
#boat-card > .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.embed #boat-card > .close { display: block; }
@media (hover: none) { #boat-card > .close { display: block; } }
#boat-card[hidden] { display: none; }
/* Her place, hanging from the card's top edge at the corner away from the photo (in the boat card, beside its close
   button), framed in her colour; the header's top two lines kept clear of it (--tab, its width, set where it's drawn) */
.place-tab {
  position: absolute;
  top: -3px;
  inset-inline-end: 12px;
  min-width: 44px;
  padding: 3px 8px 4px;
  border: 3px solid var(--c);
  border-radius: 0 0 10px 10px;
  background: var(--bg);
  text-align: center;
  line-height: 1;
}
#details .place-tab { top: 0; inset-inline-end: 36px; border-top: 0; padding-top: 6px; }
.place-tab[hidden] { display: none; }
.place-tab small { display: block; color: var(--muted); font-size: 10px; }
.place-tab b { display: block; margin-top: 2px; font-size: 22px; font-variant-numeric: tabular-nums; }
:is(.place-tab:not([hidden]) + .boat-head, #boat-card:has(> .place-tab:not([hidden])) .boat-head) > div > :nth-child(-n + 2) { margin-inline-end: calc(var(--tab) + 4px); }
/* Where the whole card can't go beside the boat (renderBoatCard): no bio, two lines of the quote */
#boat-card.short .bio { display: none; }
#boat-card.short .quote, #boat-card.short .latest { -webkit-line-clamp: 2; line-clamp: 2; }
#boat-card .specs { margin-top: 8px; color: var(--muted); font-size: 11.5px; }
#boat-card .stats { margin-top: 4px; white-space: pre-line; font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* The whole bio, about 8 lines at a time with its own scrollbar */
/* The skipper's latest words, from the messages the race passes on */
#boat-card .quote { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
  margin: 8px 0 0; color: var(--text); font-size: 12.5px; font-style: italic; line-height: 1.4; }
/* (over them the latest news, where it's newer) */
#boat-card .latest { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  margin: 8px 0 0; color: var(--text); font-size: 12.5px; line-height: 1.4; }
#boat-card .quote .text, #boat-card .latest .text { unicode-bidi: isolate; }
/* (cut short, whole on a click: renderBoatCard) */
#boat-card .cut { cursor: pointer; }
#boat-card .quote.open, #boat-card .latest.open { display: block; }
/* (its day under it, in sight however long the words) */
#boat-card .quote-when { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
#boat-card .bio {
  max-height: 140px;
  margin: 8px 0 0;
  padding-inline-end: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #c9d3e0;
  font-size: 12px;
  line-height: 1.45;
  text-align: start;
}
#details dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 12.5px; }
#details .more { display: none; } /* a phone's: the card in full or short */
#details dt { color: var(--muted); }
#details dd { margin: 0; font-variant-numeric: tabular-nums; }
/* News of the skipper from the race's Facebook page: each item cut to three lines till clicked */
#details .news { margin-top: 10px; }
#details .news-head { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
#details .news ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
#details .news li { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  font-size: 12px; line-height: 1.4; cursor: pointer; }
#details .news li.open { display: block; }
#details .news .when { color: var(--muted); margin-inline-end: 4px; font-variant-numeric: tabular-nums; }
#details .news .text { unicode-bidi: isolate; }
#details .news a { color: var(--accent); text-decoration: none; }
/* The day's other items, under its first once it's open, each set apart by a line */
#details .news .parts, #race-log .parts { display: none; }
#details .news li.open .parts, #race-log li.open .parts { display: block; }
#details .news .part, #race-log .part { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
#details .news .more-count, #race-log .more-count { color: var(--accent); font-size: 11.5px; white-space: nowrap; }
#details .news .part-when, #race-log .part-when { color: var(--muted); margin-inline-end: 4px; font-variant-numeric: tabular-nums; }
#race-log .part a { color: var(--accent); text-decoration: none; }
#race-log li.open .more-count { display: none; }
/* The picture of an item's post once it's shown whole (a photo's still, a video's mini clip of a few frames, with a
   play mark), linked to the post, the post's lines about it under it; while it's cut short, a small mark by its link */
#details .news .news-media, #race-log .news-media { display: none; }
#details .news li.open .news-media, #race-log li.open .news-media { display: block; margin-top: 6px; }
.news-media a { position: relative; display: inline-block; max-width: 100%; line-height: 0; border-radius: 6px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); }
.news-media img { display: block; max-width: 100%; height: auto; background: rgba(255, 255, 255, 0.06); }
.news-media .more-photos { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; max-width: 100%; margin-top: 3px; }
.news-media .more-photos a { display: block; }
.news-media .more-photos img { width: 100%; height: 64px; object-fit: cover; }
.news-media .play { position: absolute; inset-inline-start: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); }
.news-media .play::after { content: ''; position: absolute; left: 8px; top: 6px; border-left: 8px solid #fff;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.news-caption { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; line-height: 1.35; unicode-bidi: isolate; }
.media-hint { position: relative; display: inline-block; width: 12px; height: 9px; margin-inline: 2px; vertical-align: -1px;
  border: 1.5px solid var(--accent); border-radius: 2px; opacity: 0.85; cursor: pointer; }
.media-hint.photo::after { content: ''; position: absolute; left: 3px; top: 1.5px; width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.media-hint.video::after { content: ''; position: absolute; left: 3.5px; top: 1px; border-left: 5px solid var(--accent);
  border-top: 2.5px solid transparent; border-bottom: 2.5px solid transparent; }
#details .news li.open .media-hint, #race-log li.open .media-hint { display: none; }
/* One of the site's own videos: its poster a button that plays it in a window over the map, its length on it; in the
   card it's in sight with the item not opened (the item whole, not cut to three lines) */
.news-media button { position: relative; display: inline-block; max-width: 100%; padding: 0; border: 0; line-height: 0; border-radius: 6px;
  overflow: hidden; background: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); }
.news-media button:hover { box-shadow: 0 0 0 1.5px var(--accent); }
.news-media.ours .play { inset: 0; margin: auto; width: 44px; height: 44px; }
.news-media.ours .play::after { left: 17px; top: 12px; border-left-width: 15px; border-top-width: 10px; border-bottom-width: 10px; }
.news-media .len { position: absolute; inset-inline-end: 6px; bottom: 6px; padding: 2px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.6);
  color: #fff; font-size: 11px; line-height: 1.2; font-variant-numeric: tabular-nums; }
#details .news li.has-video { display: block; }
#details .news li.has-video .news-media { display: block; margin-top: 6px; }
#details .news li.has-video .media-hint { display: none; }
#video-player { z-index: 2600; } /* (over the events window it may be opened from) */
#video-player .box { width: auto; max-width: 100%; }
/* (as wide as the screen or its height lets a 4:5 picture be, never with bars round it) */
#video-player video { display: block; width: min(720px, 100vw - 62px, (100dvh - 110px) * 0.8); height: auto; aspect-ratio: 4 / 5; border-radius: 6px; background: #000; }
#video-player .post { align-self: flex-start; margin-top: 8px; color: var(--accent); font-size: 12.5px; text-decoration: none; }
#details .close {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
#details .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* ---------- time bar ---------- */

#timebar {
  position: fixed;
  inset-inline-start: calc(var(--panel-w) + 24px);
  inset-inline-end: 12px;
  bottom: 12px;
  height: 60px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
}
#timebar button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}
#play { width: 40px; flex: none; font-size: 13px; }
#time-zoom { padding: 0 10px; flex: none; font-size: 12.5px; white-space: nowrap; }
#time-zoom.zoomed { border-color: var(--accent); color: var(--accent); }
/* The slider with an hour back and on at its ends, left to right as its track is; the slider's own text as the page's */
.scrub { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; direction: ltr; }
:root[dir="rtl"] .scrub .slider { direction: rtl; }
#timebar .step { width: 26px; flex: none; padding: 0; font-size: 19px; line-height: 1; color: var(--muted); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#timebar .step:not(:disabled):hover { color: var(--text); }
#timebar .step:disabled { opacity: 0.35; cursor: default; }
/* Its two names, now and the way back to it, in one cell with the one not in use hidden, so it keeps the longer one's
   width: a drag on the slider near its end, crossing in and out of now, doesn't narrow the slider under the pointer
   (the time jumped and the map flickered). The dot before "now" keeps its room too; on a phone the way back is "now"
   again, without the dot's room so it's centred (.short). Each centred in the button. */
#live { display: inline-grid; place-content: center; justify-items: center; padding: 0 12px; flex: none; }
#live > span { grid-area: 1 / 1; visibility: hidden; }
#timebar:not(.past) #live .now, #timebar.past #live .long { visibility: visible; }
#live.on { background: rgba(232, 182, 76, 0.18); border-color: var(--accent); color: var(--accent); }
#live .now::before { content: "\25CF  "; font-size: 10px; visibility: hidden; }
#live.on .now::before { visibility: visible; }
#timebar.past { border-color: var(--past); }
#timebar.past #time { --thumb: var(--past); }
#timebar.past #live, #past-chip .back { border-color: var(--accent); background: var(--accent); color: #0b1424; }
#past-chip .back, #live .long { font-weight: 600; } /* (the button's own weight unchanged, so is its width) */
#time-label .ago { color: var(--past); font-weight: 600; }

/* Over the map, in the middle of it, clear of the panel and of the map's tools down the other side */
#past-chip {
  position: fixed;
  top: 12px;
  inset-inline-start: calc(var(--panel-w) + 24px);
  inset-inline-end: 64px;
  width: max-content;
  max-width: calc(100% - var(--panel-w) - 88px);
  margin-inline: auto;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 5px;
  padding-inline: 14px 5px;
  border-color: var(--past);
  font-size: 13px;
  white-space: nowrap;
}
#past-chip[hidden] { display: none; }
#past-chip .when { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
#past-chip .when b { color: var(--text); font-weight: 500; }
#past-chip .back { height: 30px; padding: 0 12px; border: 1px solid; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
:is(.story-mode, .at-sea, .sheet-open) #past-chip { display: none; }

.slider { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Range inputs: race slider in gold, wind-forecast slider in blue */
input[type="range"] {
  --fill: rgba(232, 182, 76, 0.6);
  --thumb: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  direction: ltr;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--fill); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 2px solid #0b1424;
  border-radius: 50%;
  background: var(--thumb);
}
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid #0b1424; border-radius: 50%; background: var(--thumb); }
#forecast { --fill: rgba(121, 174, 245, 0.4); --thumb: #79aef5; }
/* The race's days (renderTimeDays), hanging from the slider's track: left to right as it is, and between where the
   middle of its thumb stops at either end. Under the thumb, and not in the way of a click or a drag. */
#time { position: relative; z-index: 1; }
#time-days { position: relative; height: 15px; margin: -9px 8px 0; direction: ltr; color: var(--muted); font-size: 10px; line-height: 1; pointer-events: none; }
#time-days i { position: absolute; top: 0; width: 1px; height: 3px; background: currentColor; opacity: 0.5; }
#time-days i.numbered { height: 5px; opacity: 0.9; }
#time-days span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
#time-days span.first { transform: none; }
#time-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#time-label b { color: var(--text); font-weight: 500; }

/* ---------- the fleet's next 3 days (js/app.js renderOutlookBox) ---------- */

#outlook-box {
  position: fixed;
  inset-inline-start: calc(var(--panel-w) + 24px);
  bottom: 84px;
  z-index: 1000;
  width: 300px;
  max-height: calc(100dvh - 180px);
  display: flex;
  flex-direction: column;
  padding: 9px 12px 8px;
  font-size: 12.5px;
}
#outlook-box[hidden] { display: none; }
#outlook-box .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#outlook-box .head b { font-size: 13.5px; }
#outlook-box .close { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
#outlook-box .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
#outlook-box .slide { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
#outlook-box .slide input { flex: 1; min-width: 0; accent-color: var(--accent); }
#outlook-box .play { width: 30px; height: 30px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--text); cursor: pointer; font-size: 11px; }
#outlook-box .play:hover { border-color: var(--accent); color: var(--accent); }
#outlook-box .when { margin: 2px 0 6px; color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
#outlook-box .standings { overflow-y: auto; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
#outlook-box li { display: grid; grid-template-columns: 18px 26px 1fr auto 44px; align-items: center; gap: 4px; padding: 3px 4px;
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
#outlook-box li:not(.head):hover { background: rgba(255, 255, 255, 0.06); }
#outlook-box li.selected { background: rgba(255, 255, 255, 0.09); font-weight: 600; }
#outlook-box li.head { color: var(--muted); font-size: 11px; cursor: default; }
#outlook-box li .place { color: var(--muted); text-align: center; }
#outlook-box li .move { font-size: 10.5px; }
#outlook-box li .who { overflow: hidden; text-overflow: ellipsis; }
#outlook-box li .dot { display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 50%; background: var(--c); }
#outlook-box li .gap, #outlook-box li .error { text-align: end; }
#outlook-box li .error { color: var(--muted); }
#outlook-box .up { color: #7fd48a; }
#outlook-box .down { color: #f08a7a; }
#outlook-box .accuracy { margin: 6px 0 2px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
#outlook-box .how-outlook { align-self: flex-start; }
.story-mode #outlook-box { display: none; }

/* ---------- wind box ---------- */

/* (put away while the weather's menu is open over it, on a short screen: js/app.js fitWeatherMenu) */
#wind-box.under-menu { visibility: hidden; }

#wind-box {
  position: fixed;
  inset-inline-end: 12px;
  bottom: 84px;
  z-index: 1000;
  width: 250px;
  padding: 9px 12px;
  font-size: 12px;
}
#wind-box.off { display: none; }
#wind-box.wind-off .row, #wind-box.wind-off #wind-legend, #wind-box.wind-off #wind-filled { display: none; } /* pressure or waves only */
#wind-box .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
#wind-box .row b { color: var(--text); }
#wind-source {
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  cursor: pointer;
}
#wind-source option { color: #111; }
#wind-when { margin-top: 2px; color: var(--muted); }
#wind-box.forecasting #wind-when { color: #79aef5; }
#forecast-lead { font-weight: 500; }
#wind-filled { margin-top: 2px; color: var(--muted); font-size: 0.92em; }

.forecast-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.forecast-row input { flex: 1; min-width: 0; }
#forecast-play {
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  cursor: pointer;
}
/* Folds the legends and the storms' line away, leaving the slider and the readout */
#legend-toggle {
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
#wind-box.compact .legend, #wind-box.compact #wave-legend, #wind-box.compact #rain-legend, #wind-box.compact #gust-legend, #wind-box.compact #clouds-legend, #wind-box.compact #sst-legend, #wind-box.compact #currents-legend, #wind-box.compact #storms-status,
#wind-box.squeezed .legend, #wind-box.squeezed #wave-legend, #wind-box.squeezed #rain-legend, #wind-box.squeezed #gust-legend, #wind-box.squeezed #clouds-legend, #wind-box.squeezed #sst-legend, #wind-box.squeezed #currents-legend, #wind-box.squeezed #storms-status { display: none; }
.legend { display: flex; direction: ltr; margin: 7px 0 6px; border-radius: 4px; overflow: hidden; }
.legend span { flex: 1; text-align: center; font-size: 10px; line-height: 15px; color: rgba(0, 0, 0, 0.75); font-weight: 500; }
/* Wave height (0 to 8 m), under the wind's legend while the waves layer is on */
/* Wave height (0 to 8 m) and current (0 to 3 kn) */
#wave-legend, #rain-legend, #gust-legend, #sst-legend, #clouds-legend, #currents-legend { margin: 2px 0 6px; }
#wave-legend[hidden], #rain-legend[hidden], #gust-legend[hidden], #sst-legend[hidden], #clouds-legend[hidden], #currents-legend[hidden], #storms-status[hidden] { display: none; }
#wave-legend .title, #rain-legend .title, #gust-legend .title, #sst-legend .title, #clouds-legend, #currents-legend .title, #storms-status .title { color: var(--muted); font-size: 11px; }
#wave-legend .bar, #rain-legend .bar, #gust-legend .bar, #sst-legend .bar, #currents-legend .bar { height: 9px; margin-top: 3px; border-radius: 4px; }
#wave-legend .ticks, #rain-legend .ticks, #gust-legend .ticks, #sst-legend .ticks, #currents-legend .ticks { display: flex; justify-content: space-between; direction: ltr; color: var(--muted); font-size: 10px; }
/* The waves' heights sit where the log scale puts them */
#wave-legend .ticks, #rain-legend .ticks, #gust-legend .ticks, #sst-legend .ticks { position: relative; display: block; height: 13px; }
#wave-legend .ticks span, #rain-legend .ticks span, #gust-legend .ticks span, #sst-legend .ticks span { position: absolute; transform: translateX(-50%); }
#storms-status { margin: 2px 0 6px; }

/* Pressure: highs and lows, and the values on some isobars */
.pressure-centre, .isobar-label { pointer-events: none; text-shadow: 0 0 3px #08111f, 0 0 2px #08111f; }
.pressure-centre { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.pressure-centre b { font-size: 20px; font-weight: 700; }
.pressure-centre span { color: var(--text); font-size: 10px; }
.pressure-centre.high b { color: #7ab8ff; }
.pressure-centre.low b { color: #ff8a80; }
.isobar-label { color: rgba(231, 237, 245, 0.85); font-size: 10px; text-align: center; white-space: nowrap; }
.wave-label { color: #fff; font-size: 11.5px; font-weight: 600; line-height: 16px; } /* wave heights, over a bright colour map */
/* The selected boat's sight and VHF rings */
.range-label { color: rgba(255, 255, 255, 0.8); font-size: 10.5px; line-height: 14px; text-align: center; white-space: nowrap; text-shadow: 0 0 3px #08111f, 0 0 2px #08111f; pointer-events: none; }
/* The lines of latitude and longitude's degrees: down the map's start and along its top, or on the middle lines */
/* A country's name, centred on its point, under the boats; a little bigger for the big ones. An island's name in italics,
   under its country's or on its own */
.country-label {
  z-index: 0;
  color: #e3eef8;
  font: 500 11px/16px Heebo, system-ui, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-align: center;
  text-shadow: 0 0 3px #08111f, 0 0 2px #08111f;
  pointer-events: none;
  opacity: 0.7;
}
.country-label.big { font-size: 12px; }
.country-label .island { display: block; }
.country-label .island, .island-label { font-size: 10.5px; font-style: italic; }
/* A cape's name, as an island's, to the west of the dot on its point */
.cape-label { font-style: italic; padding-right: 9px; }
.cape-label::after { content: ''; position: absolute; right: 0; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: currentColor; }
/* Cape Leeuwin's and Cape Horn's, beside their marks' rings, with no dot */
.cape-label.at-mark { padding-right: 0; }
.cape-label.at-mark::after { content: none; }
/* A city's name, to the east of the dot on it */
.city-label { font-size: 10.5px; padding-left: 9px; }
.city-label::before { content: ''; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: currentColor; }
/* An ocean's name: on the open sea, wide-spaced capitals in italics, the sea's colour */
.ocean-label { color: #a9cfee; font: italic 500 13px/20px Heebo, system-ui, sans-serif; letter-spacing: 2.6px; opacity: 0.6; }
.grid-label { color: #e3eef8; font: 500 10px/13px system-ui, sans-serif; white-space: nowrap; direction: ltr; text-shadow: 0 0 3px #08111f, 0 0 2px #08111f; pointer-events: none; opacity: 0.85; }
.grid-label[data-kind="lat"] { translate: calc(50% + 2px) -7px; }
.grid-label[data-kind="lon"] { translate: calc(50% + 3px) calc(50% - 4px); }
.grid-label[data-kind~="middle"] { translate: calc(50% + 3px) calc(-50% - 2px); }
.equator-label { color: #9fd3ff; font-size: 10.5px; line-height: 14px; text-align: center; white-space: nowrap; text-shadow: 0 0 3px #08111f, 0 0 2px #08111f; pointer-events: none; }
.equator-label.crowded { visibility: hidden; } /* (the Greenwich meridian's, where a country is named) */
.equator-label.jerusalem-label { color: #ffd27a; } /* (as its line) */
#wind-hover { color: var(--muted); min-height: 18px; }
#wind-hover b { color: var(--text); }
#wind-hover.learned { display: none; } /* a touch screen's hint, once a tap has shown the wind (renderWindHint) */
#wind-hover > span { white-space: nowrap; }

/* ---------- map overlays ---------- */

/* Round the far side of the globe: gone, and not clickable */
.maplibregl-marker-covered, .maplibregl-marker-covered * { pointer-events: none !important; }
/* Labels at the bottom, then the storms, the boats (the leader and the selected one above, js/app.js), the distance
   tool, the map's buttons, so what opens beside them (their names, menus) isn't covered by a boat, and the tooltips over
   all (a route's, a mark's), which the buttons had covered */
.storm-marker, .disturbance { z-index: 1; }
.boat-icon { z-index: 2; }
.measure-dot, .measure-label { z-index: 5; }
.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right { z-index: 6; }
.maplibregl-popup { z-index: 7; }

/* Tropical storms: the symbol where a storm is now, its name beside it, and the details in its place on hover */
.storm-marker, .storm-symbol { width: 28px; height: 28px; }
.storm-symbol svg { width: 100%; height: 100%; animation: storm-spin 6s linear infinite; }
.storm-symbol path, .storm-symbol circle { fill: var(--c); stroke: #08111f; stroke-width: 1; }
.storm-symbol circle { fill: #08111f; stroke: var(--c); stroke-width: 1.6; }
@keyframes storm-spin { to { transform: rotate(-360deg); } } /* anticlockwise, as northern storms turn */
@media (prefers-reduced-motion: reduce) { .storm-symbol svg { animation: none; } }
.disturbance { display: grid; place-items: center; width: 18px; height: 18px; font: 700 15px Heebo, system-ui, sans-serif; text-shadow: 0 0 3px #08111f; }
.storm-label {
  position: absolute;
  top: 50%;
  left: 32px;
  transform: translateY(-50%);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(8, 17, 31, 0.85);
  color: var(--text);
  font: 500 11.5px Heebo, system-ui, sans-serif;
  white-space: nowrap;
}
.storm-marker:hover .storm-label, .storm-label:has(br) {
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: rgba(8, 17, 31, 0.92);
  font: 12px Heebo, system-ui, sans-serif;
}

/* The tooltips of the marks, the zones and the storms' shapes */
.map-tip { pointer-events: none; }
/* (a tip to one side of its point has its tail on that side in a Hebrew page too: MapLibre's [dir=rtl] rule turns the
   frame round, the tail away from the point) */
[dir=rtl] .map-tip { direction: ltr; } /* (its content's own direction: js/app.js showTip) */
[dir=rtl] .map-tip.maplibregl-popup-anchor-left { flex-direction: row; }
[dir=rtl] .map-tip.maplibregl-popup-anchor-right { flex-direction: row-reverse; }
.map-tip .maplibregl-popup-content {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 17, 31, 0.92);
  color: var(--text);
  font: 12px Heebo, system-ui, sans-serif;
  box-shadow: none;
  pointer-events: none;
}
.map-tip .maplibregl-popup-tip { display: none; }
/* A news dot popping up (renderNewsPoints): as the layer's circle, grown from nothing past its size and back */
.news-pop { pointer-events: none; }
.news-pop i { display: block; width: 8px; height: 8px; border: 1.5px solid #fff; border-radius: 50%; animation: news-pop 360ms ease-out both; }
@keyframes news-pop { 0% { transform: scale(0); } 60% { transform: scale(1.45); } 100% { transform: scale(1); } }
.news-tip .maplibregl-popup-content { line-height: 1.4; border-color: rgba(255, 255, 255, 0.3); }
/* A news tip's tail on its dot, as a speech bubble's on its speaker: a square turned 45° and drawn out toward the dot,
   half into the tip, framed like it on its two outer sides (MapLibre's own tail, a triangle of borders, can't be); only
   its outer half drawn, and a sliver over the tip's border (all of it, drawn out, it went into the text) */
.news-tip .maplibregl-popup-tip { display: block; flex-shrink: 0; width: 14px; height: 14px; border: 0; background: rgba(8, 17, 31, 0.92); }
.news-tip.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { margin-top: -7px; border: 0; border-right: 1px solid rgba(255, 255, 255, 0.3); border-bottom: 1px solid rgba(255, 255, 255, 0.3); transform: scaleY(1.6) rotate(45deg); clip-path: polygon(100% -20%, 100% 100%, -20% 100%); }
.news-tip.maplibregl-popup-anchor-top .maplibregl-popup-tip { margin-bottom: -7px; border: 0; border-left: 1px solid rgba(255, 255, 255, 0.3); border-top: 1px solid rgba(255, 255, 255, 0.3); transform: scaleY(1.6) rotate(45deg); clip-path: polygon(0 0, 120% 0, 0 120%); }
.news-tip.maplibregl-popup-anchor-left .maplibregl-popup-tip { margin-right: -7px; border: 0; border-left: 1px solid rgba(255, 255, 255, 0.3); border-bottom: 1px solid rgba(255, 255, 255, 0.3); transform: scaleX(1.6) rotate(45deg); clip-path: polygon(0 -20%, 0 100%, 120% 100%); }
.news-tip.maplibregl-popup-anchor-right .maplibregl-popup-tip { margin-left: -7px; border: 0; border-right: 1px solid rgba(255, 255, 255, 0.3); border-top: 1px solid rgba(255, 255, 255, 0.3); transform: scaleX(1.6) rotate(45deg); clip-path: polygon(-20% 0, 100% 0, 100% 120%); }
.news-tip[class*='maplibregl-popup-anchor-top-'] .maplibregl-popup-tip, .news-tip[class*='maplibregl-popup-anchor-bottom-'] .maplibregl-popup-tip { display: none; }
.news-tip .text { unicode-bidi: isolate; }
.news-tip.linger .maplibregl-popup-content { cursor: pointer; } /* (a click: the race's events, at it) */

/* Distance tool */
.measure-control button { display: grid; place-items: center; }
.measure-control button[aria-pressed="true"] { background: rgba(232, 182, 76, 0.25); color: var(--accent); }
.measuring .maplibregl-canvas-container.maplibregl-interactive, .measuring .boat-icon path { cursor: crosshair; }
.measure-dot { width: 26px; height: 26px; cursor: grab; touch-action: none; }
.measure-dot.dragging { cursor: grabbing; }
.measure-label { pointer-events: none; }
.measure-dot span {
  position: absolute;
  inset: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.measure-label span {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 9px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.92);
  color: #fff;
  font: 500 12.5px Heebo, system-ui, sans-serif;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.measure-hint {
  position: absolute;
  top: 12px;
  left: calc((100% - var(--panel-w) - 24px) / 2);
  z-index: 1000;
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  font: 13px Heebo, system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}
.measure-hint[hidden] { display: none; }
/* Centred over the visible map; the map container itself is always left-to-right, so this can't use logical properties */
html[dir="ltr"] .measure-hint { left: calc(var(--panel-w) + 24px + (100% - var(--panel-w) - 24px) / 2); }

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

/* A dark glass column with a soft edge, 30 px buttons */
.maplibregl-ctrl-group:not(:empty) {
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: var(--glass);
  background-clip: padding-box;
  box-shadow: none;
}
.maplibregl-ctrl-group button { width: 30px; height: 30px; color: var(--text); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.maplibregl-ctrl-group button:not(:disabled):hover { background-color: rgba(255, 255, 255, 0.08); }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(0.92); } /* MapLibre's dark icons, light */
/* The compass only once the map is turned or tilted, to set it straight again */
#map:not(.turned) .maplibregl-ctrl-compass { display: none; }

/* Settings: the gear among the map's buttons, and its window beside it, towards the middle of the map (placed by
   js/app.js, placeSettings), over everything but the windows: the language, the globe or the flat map, the base map,
   and the map's own layers, each a row with a switch */
body > #settings-tool { display: none; } /* (until it's put among the map's buttons; embedded, never) */
#settings-tool button { display: grid; place-items: center; }
#settings-tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#settings-tool.open button { background: rgba(232, 182, 76, 0.25); color: var(--accent); }
#settings {
  position: fixed;
  z-index: 2400;
  display: flex;
  flex-direction: column;
  width: min(300px, calc(100vw - 64px));
  padding: 10px 12px 8px;
  background: #0d1a2e;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  font-size: 13px;
}
#settings[hidden] { display: none; }
#settings header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
#settings h2 { margin: 0; font-size: 15px; font-weight: 500; }
#settings .close { width: 30px; height: 30px; margin: -6px -6px -6px 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
#settings .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
#settings .body { overflow-y: auto; overscroll-behavior: contain; }
#settings .field { display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border-bottom: 1px solid var(--line); }
#settings .field .name, #settings .rows::before { color: var(--muted); font-size: 12px; }
#settings .segmented { flex: none; }
#settings .segmented button { height: 32px; }
#settings #language { width: 100%; height: 32px; font-size: 13px; }
#settings .rows { display: flex; flex-direction: column; padding-top: 4px; }
#settings .row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 4px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}
@media (hover: hover) { #settings .row:hover { background: rgba(255, 255, 255, 0.06); } }
#settings .row:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
#settings .row input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
#settings .row svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
#settings .row span { flex: 1; }
/* An on/off switch at the row's end, lit while it's on */
#settings .switch { position: relative; flex: none; width: 34px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); transition: background 0.15s; }
#settings .switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c9d3e0; transition: inset-inline-start 0.15s; }
#settings .row:has(input:checked) svg { color: var(--accent); }
#settings .row:has(input:checked) .switch { background: rgba(232, 182, 76, 0.55); }
#settings .row:has(input:checked) .switch::after { inset-inline-start: 17px; background: var(--accent); }
@media (pointer: coarse) {
  #settings .segmented button, #settings #language { height: 36px; }
  #settings .row { min-height: 44px; font-size: 14px; }
}

.maplibregl-ctrl.maplibregl-ctrl-attrib { background: rgba(8, 17, 31, 0.7); color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
/* ---------- layers toolbar ---------- */

/* Columns of buttons under the map's own, in their style, hidden until they're put there: a box for each group (the
   boats, the weather and the sea, the map itself). They run down to whatever is under them (fitLayerTools), a group
   that doesn't fit starting another column towards the middle of the map on a short screen. */
#layer-tools { display: none; --tool: 30px; }
#layer-tools.maplibregl-ctrl {
  display: flex;
  flex-flow: column wrap;
  align-content: flex-start;
  gap: 10px;
  max-height: calc(100vh - 260px);
}
#layer-tools .group-title, #layers-open { display: none; } /* (a phone's: below) */
#layer-tools .group {
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: var(--glass);
  background-clip: padding-box;
}
.maplibregl-ctrl-top-left #layer-tools { direction: ltr; }
.maplibregl-ctrl-top-right #layer-tools { direction: rtl; }
html[dir="rtl"] #layer-tools :is(.tip, #track-mode, .layer-menu) { direction: rtl; } /* the names, in the page's direction */
html[dir="ltr"] #layer-tools :is(.tip, #track-mode, .layer-menu) { direction: ltr; }
#layer-tools .tool { position: relative; border-bottom: 1px solid var(--line); }
#layer-tools .tool:last-child { border-bottom: 0; }
#layer-tools :is(.tool:first-child, .group-title + .tool), #layer-tools .group-title + .tool > button { border-radius: 2px 2px 0 0; }
#layer-tools .tool:last-child, #layer-tools .tool:last-child > button { border-radius: 0 0 2px 2px; }
:is(#layer-tools, #layers-sheet) label.tool[hidden] { display: none; } /* (the outlook's, on trial: js/app.js SHOW_OUTLOOK) */
#layer-tools label.tool, #tracks-button, #weather-button {
  display: grid;
  place-items: center;
  width: var(--tool);
  height: var(--tool);
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
#layer-tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#layer-tools input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; } /* the label is the button */
@media (hover: hover) { #layer-tools label.tool:hover, #tracks-button:hover, #weather-button:hover { color: var(--text); } }
/* On: in the accent, as the distance tool's button */
#layer-tools label.tool:has(input:checked), #tracks-tool.on #tracks-button, #weather-tool:has(input:checked) #weather-button { background: rgba(232, 182, 76, 0.25); color: var(--accent); }
#layer-tools :is(.tool, .item):has(> :focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Its name beside it, on the map's side */
#layer-tools .tip {
  position: absolute;
  top: 50%;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(8, 17, 31, 0.92);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.maplibregl-ctrl-top-left #layer-tools :is(.tip, #track-mode, .layer-menu) { left: calc(100% + 8px); }
.maplibregl-ctrl-top-right #layer-tools :is(.tip, #track-mode, .layer-menu) { right: calc(100% + 8px); }
@media (hover: hover) { #layer-tools .tool:hover .tip { opacity: 1; } }
#layer-tools .tool:has(:focus-visible) .tip, #layer-tools .tool.flash .tip { opacity: 1; }
/* The tracks' button opens their three choices in its name's place */
#track-mode { display: none; position: absolute; top: -3px; border: 1px solid var(--line); background: var(--glass); }
#tracks-tool.open #track-mode { display: flex; }
#tracks-tool.open .tip { opacity: 0 !important; }
/* The weather's button opens its layers beside it, each lit while it's on, as the buttons are; a strip over the gap
   keeps the pointer on it on its way across */
#weather-tool .layer-menu {
  display: none;
  position: absolute;
  top: -2px;
  padding: 4px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: var(--glass);
  background-clip: padding-box;
  font: 13px Heebo, system-ui, sans-serif;
}
#weather-tool .layer-menu::before { content: ""; position: absolute; top: 0; bottom: 0; width: 10px; }
.maplibregl-ctrl-top-left #weather-tool .layer-menu::before { right: 100%; }
.maplibregl-ctrl-top-right #weather-tool .layer-menu::before { left: 100%; }
#weather-tool.open .layer-menu { display: block; }
#weather-tool.open .tip { opacity: 0 !important; }
#weather-tool.open #weather-button { color: var(--text); }
.layer-menu .title { padding: 2px 8px 4px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.layer-menu .item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--tool);
  padding: 0 12px 0 8px;
  border-radius: 3px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.layer-menu .item svg { color: var(--muted); }
@media (hover: hover) { .layer-menu .item:hover { background: rgba(255, 255, 255, 0.08); } }
.layer-menu .item:has(input:checked) { background: rgba(232, 182, 76, 0.25); color: var(--accent); }
.layer-menu .item:has(input:checked) svg { color: var(--accent); }
/* At its foot, the way to the window on what the layers show */
.layer-menu .how-link {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 8px 3px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
}
@media (hover: hover) { .layer-menu .how-link:hover { text-decoration: underline; } }

/* On a phone the toolbar is one button, its groups opening in a window, each layer a row with its name: the groups
   are moved into it while it's open (js/app.js) */
@media (max-width: 760px) {
  #layer-tools .group { display: none; }
  #layers-open {
    display: grid;
    place-items: center;
    width: var(--tool);
    height: var(--tool);
    padding: 0;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: var(--glass);
    background-clip: padding-box;
    color: var(--text);
    cursor: pointer;
  }
}
#layers-sheet .box { width: min(420px, 100%); }
#layers-sheet .groups { overflow-y: auto; padding: 0 2px 4px; }
#layers-sheet .group-title { margin: 10px 0 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
#layers-sheet .group:first-child .group-title { margin-top: 0; }
#layers-sheet svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#layers-sheet input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
#layers-sheet label.tool, #layers-sheet .layer-menu .item, #layers-sheet #tracks-tool {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
#layers-sheet :is(label.tool, .layer-menu .item):has(input:checked) { background: rgba(232, 182, 76, 0.25); color: var(--accent); }
#layers-sheet .tool .tip { position: static; padding: 0; background: none; color: inherit; font-size: 14px; opacity: 1; transform: none; }
#layers-sheet #tracks-button { display: contents; color: inherit; }
#layers-sheet #tracks-tool.on { color: var(--accent); }
#layers-sheet #track-mode { display: flex; position: static; width: 100%; margin: 0 0 8px; margin-inline-start: 28px; border: 1px solid var(--line); }
#layers-sheet #weather-button, #layers-sheet #weather-tool > .tip, #layers-sheet .layer-menu .title { display: none; }
#layers-sheet .layer-menu { display: block; position: static; padding: 0; border: 0; background: none; }
#layers-sheet .layer-menu .item { height: auto; }
#layers-sheet .layer-menu .item svg { color: inherit; }
#layers-sheet .layer-menu .how-link { margin-top: 2px; padding: 8px 10px 2px; font-size: 13px; }

/* Clicks go to the arrow's shape, not its square icon box, so a boat close to another can still be picked. Its name
   is beside it. */
.boat-icon { width: 34px; height: 34px; pointer-events: none; }
.boat-icon path { pointer-events: visiblePainted; }
.boat-icon svg { width: 100%; height: 100%; overflow: visible; transition: transform 0.2s; }
.moving .boat-icon svg { transition: none; } /* the arrows turn with the globe at once */
.boat-icon .hit { fill: transparent; stroke: transparent; stroke-width: 4; stroke-linejoin: round; }
.boat-icon .arrow { fill: var(--c); stroke: rgba(0, 0, 0, 0.7); stroke-width: 1.1; stroke-linejoin: round; }
.boat-icon.ghost .arrow { fill: rgba(0, 0, 0, 0.3); stroke: var(--c); stroke-width: 1.4; stroke-dasharray: 2 2; }
.boat-icon.stale { opacity: 0.45; }
.boat-icon.selected .arrow { stroke: #fff; stroke-width: 1.8; }
/* Above the arrow's turning circle, so it never overlaps the hull whichever way the boat points */
.boat-icon .crown {
  display: none;
  position: absolute;
  left: 50%;
  top: -11px;
  width: 16px;
  height: 12px;
  margin-left: -8px;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.8));
}
.boat-icon.leader .crown { display: block; }
.boat-icon .crown path { pointer-events: none; fill: var(--accent); stroke: #5a3d05; stroke-width: 1.2; stroke-linejoin: round; }

.boat-label {
  position: absolute;
  top: 50%;
  left: 31px;
  transform: translateY(-50%);
  display: flex;
  align-items: baseline;
  gap: 4px;
  direction: ltr; /* the place by the arrow, whatever the page's language (the name's a bdi) */
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(8, 17, 31, 0.8);
  color: var(--text);
  font: 11px Heebo, system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}
.boat-icon.selected .boat-label { background: var(--accent); color: #111; font-weight: 700; }
/* Hidden but still laid out, so placeNames() can measure it again as the boats move */
.boat-icon:not(.selected) .boat-label.crowded { visibility: hidden; }
/* The selected boat's or the leader's, where only the left of the arrow is clear (placeNames) */
.boat-label.left { left: auto; right: 31px; flex-direction: row-reverse; }
/* Her place in the race, before the name (render) */
.boat-place { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.boat-place[hidden] { display: none; }
/* Where her name would be in the way, her place alone (placeNames) */
.boat-label.place-only .boat-name { display: none; }
.boat-icon.selected .boat-place { color: #111; }

#loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 16px;
}
#loading[hidden] { display: none; }
/* Turning from the start, before any code has come in to write "Loading data…" beside it (index.html) */
#loading { grid-auto-flow: column; justify-content: center; gap: 10px; }
#loading .spinner { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); border-radius: 50%; animation: loading-spin 0.9s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #loading .spinner { animation-duration: 3s; } }
/* No WebGL2, so no map: what to do (js/app.js, mapFailed) */
#loading .no-map { max-width: 34em; padding: 0 20px; line-height: 1.55; color: var(--text); text-align: start; }
#loading .no-map b { display: block; margin-bottom: 8px; font-size: 18px; }
#loading .no-map p { margin: 0; color: var(--muted); }
#loading .retry { width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 50%; background: none; color: var(--text); font-size: 22px; cursor: pointer; }

/* ---------- scale and altitude ---------- */

#scale-box {
  position: fixed;
  bottom: 84px;
  inset-inline-start: calc(var(--panel-w) + 24px);
  z-index: 900;
  padding: 4px 9px 5px;
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.62);
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
}
#scale-box .scale { display: flex; align-items: flex-end; gap: 6px; }
#scale-box .bar { height: 6px; border: 2px solid currentColor; border-top: 0; margin-bottom: 3px; }
#scale-box .altitude { color: var(--muted); }

/* ---------- the view of a boat at sea (js/sim.js) ---------- */

/* Its canvas lies over the map's, under the markers, and fades in as the map zooms in on the boat */
.sea-view { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
/* The race board (js/raceboard.js): the toy boats drawn over the map, so the arrows, crowns and names go; each arrow,
   still there to point at, is as big as the toy drawn over it */
.race-board { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fleet-3d .boat-icon .arrow, .fleet-3d .boat-icon .crown, .fleet-3d .boat-icon .boat-label { visibility: hidden; }
.fleet-3d .boat-icon svg.hull { scale: var(--fleet-scale, 2); }
/* The story of the last four days: everything else off the screen as it plays (but the credits and a boat's hover card), and its own bar at the
   bottom: the time it has come to over its play button, its timeline with the days on it, and the way back */
.story-mode :is(#panel, #wind-box, #timebar, #scale-box, #sea-hud, #race-log, #gap-chart, #designs,
  .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right) { display: none !important; }
#story {
  position: fixed;
  bottom: calc(30px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(760px, calc(100vw - 24px));
  padding: 10px 14px 12px;
}
#story-north {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  inset-inline-end: 12px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
#story-north svg { width: 36px; height: 36px; transition: transform 0.1s linear; }
#story-north .n { fill: #e5482f; }
#story-north .s { fill: #d8dde6; }
#story-north text { font: 700 5.5px Heebo, Arial, sans-serif; fill: #fff; }
#story-north[hidden] { display: none; }
#story .head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
#story .title { font-size: 12px; color: var(--muted); }
#story .when { font-size: 18px; font-weight: 700; }
#story .row { display: flex; gap: 12px; align-items: center; }
#story button { flex: none; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; cursor: pointer; }
#story :is(.play, .again) { width: 38px; font-size: 15px; }
/* its place kept while it's hidden: coming and going, it changed the timeline's width under the pointer */
#story .again[hidden] { display: inline-block; visibility: hidden; }
#story .back { padding: 0 12px; color: var(--accent); }
#story .timeline { flex: 1; position: relative; padding: 6px 0 16px; cursor: pointer; touch-action: none; }
#story .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
#story .bar span { display: block; height: 100%; width: 0; background: var(--accent); }
#story .days span { position: absolute; top: 15px; font-size: 11px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
#story .days i { position: absolute; top: 3px; width: 1px; height: 12px; background: var(--muted); }
#story .days b { position: absolute; top: -1px; width: 8px; height: 8px; margin-inline-start: -4px; border-radius: 50%; background: #e8b64c; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); pointer-events: none; }
/* where the story is: over the items' marks, which hid the bar's progress where they're close together */
#story .now { position: absolute; top: 3px; width: 12px; height: 12px; margin-inline-start: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); pointer-events: none; }
/* the boats' places at the review's last item, over their flags (renderStoryRanks): ringed in each boat's colour */
#story-ranks { --size: 24px; position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
#story-ranks i { position: absolute; left: 0; top: 0; }
#story-ranks span { position: absolute; left: -0.75px; top: 0; width: 1.5px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 2px rgba(0, 0, 0, 0.6); }
#story-ranks b { position: absolute; left: 0; top: 0; width: var(--size); height: var(--size); box-sizing: border-box; border: 2.5px solid; border-radius: 50%; background: #0d1a2e; color: #fff; font: 700 calc(var(--size) * 0.52) / calc(var(--size) - 5px) Heebo, Arial, sans-serif; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
#story-ranks b.first { background: #e8b64c; color: #0d1a2e; }
#story-caption {
  position: fixed;
  bottom: calc(30px + env(safe-area-inset-bottom) + var(--story-bar, 92px));
  left: 50%;
  transform: translate(-50%, 8px);
  z-index: 1000;
  width: min(760px, calc(100vw - 24px));
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s, transform 0.45s;
}
#story-caption.on { opacity: 1; transform: translate(-50%, 0); }
#story-caption[hidden] { display: none; }
#story-caption .faces { flex: none; display: flex; }
#story-caption .faces img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 3px solid; background: var(--line); }
#story-caption .faces img + img { margin-inline-start: -14px; }
#story-caption .words { min-width: 0; }
#story-caption .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
/* the weather the item speaks of, shown on the board: its layer's name, in its colours */
#story-caption .who .weather { display: inline-block; margin-inline-start: 8px; padding: 0 8px; border-radius: 9px; font-size: 11px; line-height: 17px; color: #fff; font-weight: 600; }
#story-caption .who .weather.gusts { background: linear-gradient(90deg, #f39a2b, #e5482f, #c0359b); }
#story-caption .who .weather.pressure { background: rgba(231, 237, 245, 0.18); border: 1px solid rgba(231, 237, 245, 0.6); line-height: 15px; }
#story-caption .who .weather.rain { background: linear-gradient(90deg, #3d8fd6, #2f6fc0, #7a3fb8); }
#story-caption .headline { font-size: 19px; font-weight: 700; line-height: 1.25; color: #e8b64c; }
#story-caption .text { display: block; margin-top: 4px; font-size: 14.5px; line-height: 1.45; }
[dir="rtl"] #story .days span { transform: translateX(50%); }
@media (max-width: 760px) {
  #story { padding: 8px 10px 10px; }
  #story-caption { padding: 9px 10px; gap: 9px; }
  #story-caption .faces img { width: 38px; height: 38px; }
  #story-caption .headline { font-size: 16px; }
  #story-caption .text { font-size: 13px; }
  #story .when { font-size: 15px; }
  #story .back { padding: 0 8px; }
}
/* Close in, where a drag turns the view round the boat, the map's own drag is off, and MapLibre then leaves one-finger
   drags to the browser (touch-action: pan-x pan-y): the browser takes the fingers, and neither the turn nor a pinch
   gets them. The map keeps every touch. */
#map .maplibregl-canvas-container, #map .maplibregl-canvas { touch-action: none; }
#map .maplibregl-canvas-container.turning { cursor: grabbing; } /* a Cmd- or Shift-drag turning the map (app.js) */
/* The boats' arrows and names give way to the sea, the selected boat's to the boat drawn in it, a little later */
.boat-icon > * { opacity: calc(1 - var(--sea, 0)); }
.boat-icon.selected > * { opacity: var(--sea-icon, 1); }
.at-sea .maplibregl-marker:not(.boat-icon) { visibility: hidden; }
/* The map's own tools (the settings, the distance tool, the layers' toolbar) have nothing to do at sea, on
   any screen; the zoom buttons stay, with the compass, as a way in and out */
.at-sea :is(#settings-tool, #settings, .measure-control, #layer-tools) { display: none; }

#sea-hud {
  position: fixed;
  top: 12px;
  inset-inline-start: calc(var(--panel-w) + 24px);
  z-index: 1000;
  max-width: 360px;
  padding: 10px 14px 12px;
  font-size: 12.5px;
  /* Her name with the fold button beside it, the rest under them; folded, only her name, the way back and the button,
     in a row */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
}
#sea-hud[hidden] { display: none; }
#sea-hud > * { grid-column: 1 / -1; }
#sea-hud .who { grid-column: 1; grid-row: 1; font-weight: 700; font-size: 14px; border-inline-start: 4px solid var(--c); padding-inline-start: 8px; }
#sea-hud .fold {
  grid-column: -2; grid-row: 1; width: 26px; height: 26px; margin-block: -4px; margin-inline-end: -6px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
@media (hover: hover) { #sea-hud .fold:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); } }
#sea-hud .fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
#sea-hud.folded { grid-template-columns: minmax(0, 1fr) auto auto; padding-bottom: 10px; }
#sea-hud.folded :is(.facts, .note, .page, .credit) { display: none; }
#sea-hud.folded .back { grid-column: 2; grid-row: 1; }
#sea-hud.folded .fold svg { transform: rotate(180deg); }
#sea-hud .who .boat { color: var(--muted); font-weight: 500; }
#sea-hud .facts { display: grid; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
#sea-hud .facts svg { width: 13px; height: 13px; vertical-align: -2px; }
#sea-hud .note { margin: 8px 0 10px; color: var(--muted); font-size: 11px; }
#sea-hud .page { margin: -2px 0 10px; color: var(--muted); font-size: 11.5px; }
#sea-hud .page a { color: var(--accent); font-weight: 500; text-decoration: none; white-space: nowrap; }
#sea-hud .page a:hover { text-decoration: underline; }
#sea-hud .credit { margin: -6px 0 10px; font-size: 10px; }
#sea-hud .credit a { color: var(--muted); text-decoration: none; }
#sea-hud .back { justify-self: start; padding: 5px 12px; border: 1px solid var(--accent); border-radius: 8px; background: none; color: var(--accent); cursor: pointer; }
#sea-hud .back:hover { background: rgba(232, 182, 76, 0.12); }
/* (the way back and the sound's button share the last row, one at each end) */
#sea-hud .back, #sea-hud .sound { grid-column: 1 / -1; grid-row: 9; }
#sea-hud .sound { justify-self: end; padding: 5px 12px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
#sea-hud .sound[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
#sea-hud .sound[hidden], #sea-hud.folded .sound { display: none; }
/* In a window too narrow for the panel, the facts over the view and the boat side by side, the panel goes at sea, as on
   a phone (the facts give her wind and speed, and their button the way back to the map); the time bar, the scale and
   the facts move into its place */
@media (min-width: 761px) and (max-width: 1279px) {
  .at-sea #panel { display: none; }
  .at-sea :is(#timebar, #scale-box, #sea-hud) { inset-inline-start: 12px; }
}

/* ---------- phones: map first, fleet in a bottom sheet ---------- */

@media (max-width: 760px) {
  .maplibregl-ctrl-zoom-in, .maplibregl-ctrl-zoom-out { display: none; } /* pinch to zoom */
  #map:not(.turned) .maplibregl-ctrl-group:has(.maplibregl-ctrl-compass) { display: none; }
  .maplibregl-ctrl-group button { width: 34px; height: 34px; }
  #language-head { display: none; }
  .measure-hint { top: auto; bottom: calc(var(--sheet-h, 64px) + 70px); left: 50%; }
  .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right { top: env(safe-area-inset-top); }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-h, 64px) + 66px); }
  .sheet-open :is(.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right) { bottom: calc(var(--sheet-h, 64px) + 6px); } /* (no time bar between) */

  #panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 72dvh;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #panel:not(.open) header, #panel h1, #panel:not(.open) footer { display: none; }
  #panel header { padding: 0 16px 6px; }
  #panel:not(.open) .controls, #panel:not(.open) .scroll { display: none; }

  #sheet-toggle {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    padding: 8px 16px 12px;
    border: 0;
    background: none;
    text-align: start;
    cursor: pointer;
    touch-action: none;
  }
  .grip { align-self: center; width: 46px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.4); }
  #summary { display: flex; align-items: baseline; gap: 5px; min-width: 0; font-size: 13.5px; white-space: nowrap; }
  #summary .lead { color: var(--muted); font-size: 12px; }
  #summary .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
  #summary .more { margin-inline-start: auto; padding-inline-start: 8px; color: var(--accent); font-size: 12.5px; }
  #panel.open #summary .when-closed, #panel:not(.open) #summary .when-open { display: none; }

  .controls { padding: 2px 16px 10px; font-size: 14px; }
  .segmented button { height: 34px; font-size: 12.5px; }
  #layer-tools { --tool: 34px; }
  .boat-row { padding-top: 9px; padding-bottom: 9px; }

  /* The card scrolls within the sheet when it's taller than there's room for; with the fleet open, it leaves room for it */
  #details { margin: 0 12px 12px; padding: 9px 12px; }
  #panel.open #details { max-height: 38dvh; }
  #details .title { font-size: 15px; }
  #details dl { font-size: 12px; gap: 2px 12px; }
  #details .more { display: block; margin-top: 6px; padding: 4px 0; border: 0; background: none; color: var(--accent);
    font: inherit; font-size: 12.5px; cursor: pointer; }
  #details:not(.full) :is(.extra, .card-links, .forecast, .head-buttons, .boat-head .sub:not(.boat, .status)) { display: none; }
  #details:not(.full) .boat-head { margin-bottom: 6px; }
  #details:not(.full) .boat-head img { width: 40px; height: 40px; }
  #details .close { width: 36px; height: 36px; top: 2px; inset-inline-end: 2px; font-size: 15px; }
  #details .place-tab { inset-inline-end: 42px; }

  /* A newly selected boat's card at its shortest (.mini, js/app.js): her photo, name and place, a line of her speed,
     course and gap (and what's changed since the visitor's last visit, if told), the way to her at sea and to the
     rest of the card; a tap anywhere on it opens the short card */
  #details.mini { flex-shrink: 0; padding-block: 7px; cursor: pointer; touch-action: none; } /* (whole over the open fleet; dragged as the grip is) */
  #details.mini :is(dl, .polar, .news, .card-actions, .boat-head .sub:not(.status)) { display: none; }
  #details.mini .boat-head { align-items: center; margin-bottom: 6px; }
  #details.mini .boat-head img { width: 36px; height: 36px; }
  #details.mini .place-tab small { font-size: 9px; }
  #details.mini .place-tab b { font-size: 17px; }
  #details.mini .today { margin-bottom: 6px; padding: 3px 8px; }
  #details.mini .today li:not(.visit), #details.mini .today:not(:has(.visit)) { display: none; }
  .mini-line { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
  .mini-line .facts { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .mini-line button { flex: none; height: 30px; min-width: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px;
    background: rgba(255, 255, 255, 0.05); color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; }

  /* With a boat's card up (.card-up) the map is given what room there is: the sheet's line of the leader and its
     headline wait under the card (back once it's closed, or with the fleet opened), and the weather box folds to a
     line of what's shown and for when, a tap opening it till the card is closed (.untucked) */
  .card-up #panel:not(.open) :is(#summary > :not(.more), #headline) { display: none; }
  /* (the way to the whole fleet stays, beside the grip) */
  .card-up #panel:not(.open) #sheet-toggle { position: relative; padding-block: 12px; }
  .card-up #panel:not(.open) #summary { position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%); }
  .card-up #wind-box:not(.untucked, .off) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; width: auto;
    max-width: calc(100vw - 72px); padding: 5px 10px; cursor: pointer; }
  .card-up #wind-box:not(.untucked) > :not(.row, #wind-when, #wind-hover), .card-up #wind-box:not(.untucked) #wind-source,
  .card-up #wind-box:not(.untucked) #wind-hover.hint { display: none; }
  .card-up #wind-box:not(.untucked) #wind-when { margin: 0; white-space: nowrap; }
  .card-up #wind-box:not(.untucked) #wind-when::after { content: ' ▾'; font-size: 10px; }
  .card-up #wind-box:not(.untucked) #wind-hover { flex: 1 1 100%; min-height: 0; }
  /* (opened, its legends' button folds the whole box back, and so does a tap on its title or the time) */
  .card-up #wind-box.untucked #legend-toggle { font-size: 0; }
  .card-up #wind-box.untucked #legend-toggle::before { content: '▴'; font-size: 11px; }
  .card-up #wind-box.untucked #wind-when::after { content: ' ▴'; font-size: 10px; }
  .card-up #wind-box.untucked :is(.row b, #wind-when) { cursor: pointer; }

  #timebar {
    inset-inline: 8px;
    bottom: calc(var(--sheet-h, 64px) + 8px);
    height: 52px;
    gap: 8px;
    padding: 0 8px;
  }
  .sheet-open #timebar { display: none; }
  /* At the top in the wind box's place (its slider is the outlook's own then), down to the time bar over the sheet */
  #outlook-box {
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
    inset-inline: 8px 56px; /* clear of the map's tools down that side */
    width: auto;
    max-height: calc(100dvh - var(--sheet-h, 64px) - 84px - env(safe-area-inset-top));
    padding: 7px 10px 6px;
  }
  .outlook-open #wind-box, .sheet-open #outlook-box { display: none; }
  #outlook-box { overflow-y: auto; } /* as a whole, so the fleet gets what room there is */
  #outlook-box .standings { flex: none; overflow: visible; }
  #outlook-box .accuracy { font-size: 11px; }
  #play { width: 38px; height: 38px; }
  #time-zoom, #live { height: 38px; padding: 0 9px; font-size: 12px; }
  #timebar .step { width: 24px; height: 38px; }
  .scrub { gap: 2px; }
  #time-label .tz, #time-label .utc { display: none; }
  /* How long ago is in the chip over the map (always there with the time bar on a phone), so the time itself fits */
  #time-label .ago-part { display: none; }
  #live .long { display: none; }
  #timebar.past #live .short { visibility: visible; }
  #past-chip {
    top: auto;
    bottom: calc(var(--sheet-h, 64px) + 168px); /* over the scale and the credits: set by renderTime */
    inset-inline: 8px 56px; /* clear of the map's tools down that side */
    max-width: calc(100% - 64px);
    font-size: 12.5px;
  }
  #past-chip .what { display: none; } /* the time and how long ago say it */

  #wind-box {
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
    inset-inline-end: auto;
    inset-inline-start: 8px;
    width: min(236px, calc(100vw - 72px));
    padding: 7px 10px;
    font-size: 11.5px;
  }
  #wind-source { max-width: 160px; font-size: 11px; }
  .dialog { padding: 8px; }
  .dialog .box { padding: 10px 8px 8px; }
  #race-log li { grid-template-columns: 78px 20px 1fr; gap: 6px; }
  #race-log li.news { grid-template-columns: 78px 20px 1fr 24px; }
  #gap-chart .chart { height: 58dvh; }
  #gap-chart header { flex-wrap: wrap; row-gap: 6px; }
  #gap-chart header h2 { flex: 1 1 calc(100% - 50px); } /* the title and ✕ on a row, the zoom and views below */
  #gap-zoom, #gap-view { order: 1; }
  #gap-zoom { margin-inline-start: 0; }
  #gap-zoom button { width: 34px; height: 34px; }
  #gap-view { margin-inline-start: auto; }
  #designs .box { height: 100%; }
  #designs .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  #designs .card .name { font-size: 14px; }
  #designs .design { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "about" "fleet" "crew"; gap: 8px; }
  #designs .compare { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pick" "overlay" "figures" "note"; gap: 8px; }
  /* (a phone's width holds one such list a row, a skipper's name and her design's: the second under the first and
     the swap button) */
  #designs .pick { flex-wrap: wrap; }
  #designs .pick .who { flex: 1 1 calc(100% - 40px); }
  #designs .about dl { font-size: 13px; gap: 5px 14px; }
  #designs .crew li { gap: 8px; padding-inline-end: 4px; }
  #gap-chart .tip { font-size: 11.5px; }
  .legend { margin: 5px 0 4px; }

  #sea-hud {
    top: calc(8px + env(safe-area-inset-top));
    inset-inline-start: 8px;
    max-width: min(300px, calc(100vw - 72px));
    padding: 8px 10px 10px;
    font-size: 11.5px;
  }
  #sea-hud .note { margin: 6px 0 8px; }
  #sea-hud .credit { margin: -4px 0 8px; }
  /* A finger on the facts over the view, the scale or the credits reaches the map all the same, so a pinch or a turn
     can start anywhere over it (the credits' links still take a tap) */
  #sea-hud, #scale-box, .maplibregl-ctrl-attrib { pointer-events: none; }
  #sea-hud :is(.back, .sound, .fold, .credit a, .page a), .maplibregl-ctrl-attrib a { pointer-events: auto; }
  .at-sea #wind-box { display: none; }
  /* At sea the view has the screen to itself: the sheet with the boat's card (the facts over the view give her wind
     and speed), the time bar and the scale go, and the credits too once the base map is hidden (.sea-only, app.js:
     nothing of the map's is on show then) */
  .at-sea :is(#panel, #timebar, #scale-box) { display: none; }
  .sea-only .maplibregl-ctrl-attrib { display: none; }
  /* The zoom buttons, hidden on a phone's map, are there at sea, with the compass, as a way in and out that needs no
     pinch (the map's other tools are hidden at sea on any screen) */
  .at-sea #map .maplibregl-ctrl-group:has(.maplibregl-ctrl-compass) { display: block; }
  .at-sea #map .maplibregl-ctrl-group button:is(.maplibregl-ctrl-zoom-in, .maplibregl-ctrl-zoom-out) { display: block; }
  .at-sea .maplibregl-ctrl-bottom-left, .at-sea .maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-h, 64px) + 8px); }
  #scale-box { inset-inline-start: 8px; }
  .sheet-open #scale-box { display: none; }
}

/* ---------- embedded in another site (?embed=1, js/app.js) ---------- */

/* The map alone, in a window a few hundred pixels high: no panel, weather box, time bar or scale, and no view at sea.
   The page it's in scrolls on past it (the scroll isn't held at the map's edges), its zoom buttons stay on a phone
   too, the credits keep to a line (whole on pointing at them, or a tap), and the bar with when the positions are from
   and the link to the full map sits in the corner the buttons leave free. */
html.embed, html.embed body { overscroll-behavior: auto; }
.embed :is(#panel, #wind-box, #timebar, #scale-box, #sea-hud, #layer-tools) { display: none; }
.embed #wind-box { display: none !important; } /* (a phone's tucked line under a card, .card-up, would show it) */
/* One finger scrolls the page, two move the map (MapLibre's own, for its cooperative gestures; the view at sea's
   touch-action: none, above, is for a view the embedded map hasn't got) */
.embed #map :is(.maplibregl-canvas-container, .maplibregl-canvas) { touch-action: pan-x pan-y; }
.embed #map .maplibregl-ctrl-group:has(.maplibregl-ctrl-compass) { display: block; }
.embed #map .maplibregl-ctrl-group button:is(.maplibregl-ctrl-zoom-in, .maplibregl-ctrl-zoom-out) { display: block; }
.embed :is(.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right) { bottom: 0; max-width: 100%; }
/* Esri's terms let the providers' names be cut short on a small screen if a tap or a click shows them all (js/app.js
   toggles .open); the pointer cursor is what makes iOS send a tap on plain text as a click */
.embed .maplibregl-ctrl.maplibregl-ctrl-attrib { max-width: calc(100vw - 8px); pointer-events: auto; cursor: pointer; }
.embed .maplibregl-ctrl-attrib-inner { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.embed .maplibregl-ctrl-attrib:is(.open, :focus-within) .maplibregl-ctrl-attrib-inner { white-space: normal; }
@media (hover: hover) { .embed .maplibregl-ctrl-attrib:hover .maplibregl-ctrl-attrib-inner { white-space: normal; } }
html[dir="rtl"] .maplibregl-cooperative-gesture-screen { direction: rtl; }

#embed-bar {
  position: fixed;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 64px);
  padding-block: 5px;
  padding-inline: 10px 5px;
  font-size: 12px;
}
#embed-bar[hidden] { display: none; }
/* A boat's card in a window a few hundred pixels high: her bio in three lines at a time, and none on a phone, where
   the card would cover most of the map */
.embed #boat-card { width: min(300px, calc(100vw - 16px)); }
/* no taller than the frame's room (js/app.js sets its max-height), what's under her place scrolling in it */
.embed #boat-card:not([hidden]) { display: flex; flex-direction: column; }
.embed #boat-card .card-body { min-height: 0; overflow-y: auto; }
.embed #boat-card .bio { max-height: calc(3 * 1.45em); }
@media (max-width: 480px) { .embed #boat-card .bio { display: none; } }
#embed-bar .when { min-width: 0; overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
#embed-bar .when b { color: var(--text); font-weight: 500; }
#embed-bar .full {
  flex: none;
  padding: 3px 10px;
  border: 1px solid rgba(232, 182, 76, 0.55);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
#embed-bar .full:hover, #embed-bar .full:focus-visible { background: rgba(232, 182, 76, 0.16); }
@media (max-width: 480px) { #embed-bar .ago { display: none; } }
/* The route in hindsight's boat (renderHindsight): a ghost's outline, gold; its tooltip's note smaller */
.boat-icon.hindsight .arrow { fill: rgba(255, 213, 74, 0.25); }
.boat-icon.hindsight .boat-label { color: #ffd54a; }
.hindsight-tip .note { display: block; margin-top: 4px; font-size: 11px; opacity: 0.8; }
/* Where the selected boat was at the window's end, when the time shown is after it: a ring on her track in her colour,
   and her name with that time, as on the ghost's label */
.hindsight-then { position: relative; width: 14px; height: 14px; pointer-events: none; z-index: 1; }
.hindsight-then .ring { position: absolute; inset: 0; border: 2.5px solid var(--c); border-radius: 50%; background: rgba(8, 17, 31, 0.55); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.hindsight-then .boat-label { left: 20px; color: var(--c); }

/* The fleet's next 3 days on the forecast (renderOutlook): its tip; the card's row, where she's expected and when; the
   window's key to the map (js/outlook-how.js) */
.outlook-tip .note { display: block; margin-top: 4px; font-size: 11px; opacity: 0.8; }
/* With the slider past now, each boat's ghost where she's expected (outlookGhost), the boats themselves faint, their names
   (the selected boat's too) gone with the ghosts */
.outlook-ahead .boat-icon:not(.outlook-ghost) { opacity: 0.35; }
.outlook-ahead .boat-icon:not(.outlook-ghost) .boat-label { visibility: hidden; }
.boat-icon.outlook-ghost .arrow { fill: color-mix(in srgb, var(--c) 35%, rgba(0, 0, 0, 0.4)); stroke-width: 1.6; }
.outlook-tip .how-outlook { margin-top: 6px; }
.outlook-way { display: block; }
.outlook-way.when { color: var(--muted); font-size: 11.5px; }
#outlook-how .key { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 10px; color: var(--muted); font-size: 13px; }
#outlook-how .key svg { width: 40px; height: 14px; vertical-align: middle; margin-inline-end: 6px; }

/* ---------- how the route in hindsight is worked out ---------- */

/* The link that opens the window (js/hindsight-how.js), under the card's routing figures and in the route's tip (a
   click on the route or its boat opens it too); the window: text and a moving picture a part */
:is(.how-hindsight, .how-outlook) {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: #ffd54a;
  font: inherit;
  font-size: 12px;
  text-align: start;
  cursor: pointer;
}
/* (written as escapes: read in another encoding than the page's, the stylesheet showed the sign as "â€º", 12 Nov) */
:is(.how-hindsight, .how-outlook)::after { content: ' \203A'; }
:is(.how-hindsight, .how-outlook):hover { text-decoration: underline; }
.how-outlook { color: var(--accent); }
.map-tip.linger, .map-tip.linger .maplibregl-popup-content { pointer-events: auto; } /* (js/app.js lingerTip) */
.hindsight-tip .how-hindsight { margin-top: 6px; }
:is(#hindsight-how, #layers-how, #outlook-how) .box { width: min(760px, 100%); }
:is(#hindsight-how, #layers-how, #outlook-how) .how { overflow-y: auto; padding: 0 4px 6px; line-height: 1.55; }
:is(#hindsight-how, #layers-how, #outlook-how) .how .lead { font-size: 15px; }
:is(#hindsight-how, #layers-how, #outlook-how) .how .wait { color: var(--muted); }
:is(#hindsight-how, #layers-how, #outlook-how) h3 { margin: 22px 0 6px; color: var(--accent); font-size: 15px; font-weight: 600; }
:is(#hindsight-how, #layers-how, #outlook-how) p { margin: 0 0 8px; }
:is(#hindsight-how, #layers-how, #outlook-how) ul { margin: 0; padding-inline-start: 20px; }
:is(#hindsight-how, #layers-how, #outlook-how) li { margin-bottom: 4px; }
:is(#hindsight-how, #layers-how, #outlook-how) figure { margin: 10px 0 0; }
:is(#hindsight-how, #layers-how, #outlook-how) canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050c17;
}
#hindsight-how figure[data-picture="polar"] canvas { aspect-ratio: 16 / 9; }
#layers-how canvas { aspect-ratio: 16 / 7; } /* (js/layers-how.js's ASPECT) */
/* Which rain when: set apart, after the two rains */
#layers-how .which { margin-top: 18px; padding: 2px 14px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
#layers-how .which h3 { margin-top: 10px; }
#layers-how .which b { color: var(--text); font-weight: 600; }
:is(#hindsight-how, #layers-how, #outlook-how) figcaption { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 5px; color: var(--muted); font-size: 12px; }
:is(#hindsight-how, #layers-how, #outlook-how) .again {
  flex: none;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
:is(#hindsight-how, #layers-how, #outlook-how) .again:hover { border-color: var(--accent); color: var(--accent); }
:is(#hindsight-how, #layers-how, #outlook-how) .sources { margin-top: 18px; color: var(--muted); font-size: 12px; }
@media (pointer: coarse) {
  :is(.how-hindsight, .how-outlook) { padding: 4px 0; font-size: 13px; }
}
@media (max-width: 520px) {
  #hindsight-how figure[data-picture="polar"] canvas { aspect-ratio: 1; }
}

/* On a phone the credits keep to a line, as embedded (a tap shows them whole, js/app.js), and the layers' toolbar ends
   above them, starting another column where it would run into them (its top, under the three buttons, at 154 px) */
@media (max-width: 760px) {
  .maplibregl-ctrl.maplibregl-ctrl-attrib { max-width: calc(100vw - 8px); pointer-events: auto; cursor: pointer; }
  .maplibregl-ctrl-attrib-inner { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .maplibregl-ctrl-attrib:is(.open, :focus-within) .maplibregl-ctrl-attrib-inner { white-space: normal; }
  #layer-tools.maplibregl-ctrl { max-height: calc(100dvh - var(--sheet-h, 64px) - 66px - 26px - 154px - env(safe-area-inset-top)); }
}

/* The race now (js/app.js, startBrief): over the time bar, in the middle of the map's room (its bottom set by the
   script, over the time bar wherever that is) */
#briefing {
  position: fixed;
  top: 12px;
  inset-inline-start: calc(var(--panel-w) + 24px);
  inset-inline-end: 64px;
  margin-inline: auto;
  width: min(560px, calc(100vw - var(--panel-w) - 88px));
  z-index: 1001;
  padding: 10px 14px 10px;
}
#briefing[hidden] { display: none; }
#briefing .top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
#briefing .top .title { color: var(--accent); font-weight: 600; }
#briefing .top .count { margin-inline-start: auto; }
#briefing .close { border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 0 2px; }
#briefing .close:hover { color: var(--text); }
#briefing .body { display: flex; gap: 12px; align-items: flex-start; margin-top: 8px; min-height: 52px; }
#briefing .faces { flex: none; display: flex; }
#briefing .faces img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 3px solid; background: var(--line); }
#briefing .faces img + img { margin-inline-start: -16px; }
#briefing .words { min-width: 0; }
#briefing .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
#briefing .who .name { border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
#briefing .who .name:hover { color: var(--accent); text-decoration: underline; }
#briefing .headline { font-size: 18px; font-weight: 700; line-height: 1.25; color: var(--accent); }
#briefing .text { display: block; margin-top: 4px; font-size: 14px; line-height: 1.45; }
#briefing .nav { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
#briefing .nav button {
  height: 30px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px;
  background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
#briefing .nav .next { margin-inline-start: auto; background: rgba(232, 182, 76, 0.2); border-color: rgba(232, 182, 76, 0.6); color: var(--accent); font-weight: 600; }
#briefing .nav button:disabled { opacity: 0.35; cursor: default; }
#briefing .dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; flex: 1; }
#briefing .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); }
#briefing .dots i.on { background: var(--accent); }
/* the boats the item isn't about, dimmed (MapLibre sets the marker's own opacity, behind the globe: its parts here) */
.brief-dim > * { opacity: 0.35; }
body.briefing #past-chip { display: none; }
@media (max-width: 760px) {
  #briefing { top: auto; bottom: 84px; inset-inline: 8px; width: auto; padding: 8px 10px; }
  /* On a phone the briefing has the map to itself: the sheet, the time bar, the weather's box, the scale and the map's
     tools go till it's over (it sets the time and the weather it tells of itself), and the credits sit on its box
     (--brief-h, its height, set where it's drawn) */
  body.briefing :is(#panel, #timebar, #wind-box, #scale-box, #layer-tools, #settings, .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right) { display: none; }
  body.briefing :is(.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right) { bottom: calc(var(--brief-h, 150px) + 14px + env(safe-area-inset-bottom)); }
  #briefing .faces img { width: 40px; height: 40px; }
  #briefing .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #briefing .headline { font-size: 16px; }
  #briefing .text { font-size: 13.5px; }
}
