
/* Layout: light sidebar + scrolling work area; clean white cards on soft grey, one blue for actions, orange only for 'where you can gain'. */
:root {
  /* v499 design tokens: type scale and corner radii (tools/css-tokens.py); colours above, sailing modes in modes.css */
  --fs-xxs: 11px; --fs-xs: 11px; --fs-s: 12px; --fs-sm: 13px; --fs-m: 14px; --fs-ml: 15px; --fs-l: 16px; --fs-xl: 18px; --fs-xxl: 20px;
  --r-xs: 4px; --r-s: 8px; --r-m: 12px; --r-l: 14px; --r-xl: 22px; --r-pill: 999px;
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f2f2f4;
  --line: #e5e5ea;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --accent: #13263d;
  --accent-ink: #ffffff;
  --water: #e9eef2;
  --good: #2e7d4f;
  --good-bar: #4caf6e;
  --warn: #c2410c;
  --gain: #e4572e;
  --bad: #c62828;
  --port: #e4572e;
  --stbd: #2e7d4f;
  --b: #2f5d8c;
  --grey-patch: #c9c9ce;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
/* v1010: one page column on a desktop (top bar, Tune, side menu + page): up to 1440 px wide, centred, with one side padding;
   the scroll bar's room is always kept so a page with and without one is the same width */
:root { --page-max: 1440px; --page-pad: 24px; }
@media (min-width: 761px) {
  html { scrollbar-gutter: stable; }
  .app { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--page-pad); box-sizing: border-box; }
  .work > main { padding-right: 0; }   /* the page's right edge (the map) ends under the profile button */
}
body { margin: 0; background: var(--bg); color: var(--fg); }
/* v1055: slim page scroll bar: no track or arrows, a faint thumb that firms up while the pointer is over the page */
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 14%, transparent) transparent; }
html:hover { scrollbar-color: color-mix(in srgb, var(--fg) 32%, transparent) transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td.n, .tab { font-variant-numeric: tabular-nums; }
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.side {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  height: 100vh;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; padding: 0 6px; }
.brand small { display: block; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  all: unset;
  cursor: pointer;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav button svg { width: 18px; height: 18px; flex: none; }
.nav button:hover { color: var(--fg); }
.nav button:focus-visible { outline: 2px solid var(--accent); }
.side .foot { margin-top: auto; font-size: var(--fs-m); color: var(--faint); padding: 0 6px; }
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  margin-right: 6px;
  vertical-align: 1px;
}
.status-dot.on { background: var(--good); }
main { min-width: 0; padding-block: 24px 64px; padding-inline: clamp(16px, 3vw, 36px); }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}
h1 { margin: 0; text-wrap: balance; }
h2 { margin: 0 0 12px; }
h3 { font: 600 15px/1.3 var(--body); margin: 0 0 6px; }
.sub { color: var(--muted); margin: 6px 0 0; max-width: 70ch; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.section { padding: 18px; min-width: 0; }
.section + .section, .stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* instrument tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; overflow: hidden; margin-bottom: 16px; }
.tile { padding: 12px 14px 14px; min-width: 0; }
.tile .k { color: var(--muted); }
.tile .v { font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .v small { font-size: var(--fs-l); color: var(--muted); font-weight: 500; margin-left: 3px; }
.tile .d { font-size: var(--fs-ml); color: var(--muted); margin-top: 2px; }

/* controls */
.btn { cursor: pointer; font-size: var(--fs-m); }
.btn:hover { border-color: var(--muted); }
.btn.primary { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 9px; font-size: var(--fs-ml); }
select, input[type=text], input[type=number], input[type=date], input[type=search], textarea { padding: 7px 10px; min-width: 0; }
textarea { width: 100%; font: 15px/1.5 var(--mono); }
select { max-width: 100%; }
.page-head > * { min-width: 0; max-width: 100%; }
.page-head label.f select { width: 100%; }
label.f {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-ml);
  color: var(--muted);
  min-width: 0;
}
label.f > span { font-weight: 600; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { cursor: pointer; font-size: var(--fs-ml); }
.chip[aria-pressed="true"] { border-color: var(--fg); }
.pill { display: inline-block; font-size: var(--fs-m); border-radius: var(--r-pill); white-space: nowrap; }
.pill.rounding { color: var(--muted); }
.pill.sample { border-style: dashed; }
.pill.reach { color: var(--muted); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-m); }
th { text-align: left; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--fg); }
th.sorted::after { content: " ▾"; }
td { padding: 7px 10px; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }
tr.sel td { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* map + charts */
.map-wrap { position: relative; overflow: hidden; background: var(--water); aspect-ratio: 4 / 3; max-width: 100%; }
.map-wrap canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-wrap .tools { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; }
.scrub { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.scrub input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.scrub .clock { font: 600 20px/1 var(--display); font-variant-numeric: tabular-nums; min-width: 70px; }
.live { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.live div { padding: 6px 10px; }
.live b { display: block; font-variant-numeric: tabular-nums; }
.live span { color: var(--muted); }
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font: 13px var(--body); }
.chart .grid line { stroke: var(--line); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: stretch; }

/* grid children line up: no stacked-section margin, equal heights, same padding */
.grid > .section, .grid > .card, .analysis-grid > .section, .cards > .card { margin-top: 0; }
.analysis-grid > .section, .grid > .section { padding: 14px; }
@media (max-width: 1100px) {
  .analysis-grid { grid-template-columns: minmax(0, 1fr); }
}

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.card { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--muted); }
.card canvas { width: 100%; height: 140px; border-radius: var(--r-s); background: var(--water); }
.card .meta { font-size: var(--fs-ml); color: var(--muted); }

/* knowledge */
.tip { padding: 16px; min-width: 0; }
.tip header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.tip p { margin: 6px 0 10px; max-width: 75ch; }
.score { flex: none; text-align: center; width: 58px; }
.score b { display: block; font: 700 26px/1 var(--display); }
.score span { font-size: var(--fs-sm); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sources {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: var(--fs-l);
}
.sources li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.sources .type { font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding-top: 2px; }
.sources .note { color: var(--muted); }
.views { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin-top: 8px; }
.views > div { border: 1px dashed var(--line); border-radius: var(--r-s); padding: 12px; }
.tag { font-size: var(--fs-m); color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); font-size: var(--fs-ml); }
.answer {
  white-space: pre-wrap;
  background: var(--panel-2);
  border-radius: var(--r-s);
  padding: 12px 14px;
  margin-top: 10px;
  max-width: 80ch;
}

/* tuning guide */
table.guide td.agree { vertical-align: top; padding-top: 10px; }
.dissent { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--bad); color: var(--muted); font-size: var(--fs-l); }
.gnote { margin-top: 4px; color: var(--faint); font-size: var(--fs-ml); }
.src-chip {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  font-size: var(--fs-ml);
  text-decoration: none;
  color: var(--fg);
  border-radius: var(--r-pill);
  padding: 2px 10px;
}
.src-chip:hover { border-color: var(--accent); }
.src-chip b { font-weight: 600; }
table.tune { border-collapse: separate; border-spacing: 0; font-size: var(--fs-ml); }
table.tune th, table.tune td { border-bottom: 1px solid var(--line); vertical-align: top; }
table.tune th.tc {
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: normal;
  min-width: 140px;
  max-width: 160px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg);
  font-size: var(--fs-ml);
}
table.tune th.tw { text-align: center; color: var(--fg); letter-spacing: .02em; border-left: 1px solid var(--line); }
table.tune th.tw span { font: 500 14px var(--body); color: var(--muted); }
table.tune th.ts { text-align: left; border-left: 1px solid var(--line); }
table.tune td.tt {
  white-space: normal;
  min-width: 190px;
  max-width: 230px;
  padding: 8px 10px;
  cursor: pointer;
  border-left: 1px solid var(--line);
  line-height: 1.4;
}
table.tune td.tt:hover { background: var(--panel-2); }
table.tune .sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.linkbtn { font-weight: 700; }
.linkbtn:focus-visible { outline: 2px solid var(--accent); }
.adot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--faint);
  vertical-align: 1px;
}
.adot.bad { background: var(--bad); }
table.fleet td.best { color: var(--good); font-weight: 700; }
table.fleet td.worst { color: var(--bad); }
table.fleet tr.sec th { padding-top: 16px; color: var(--fg); }
ul.plain { margin: 4px 0 8px; padding-left: 18px; }

/* guide v2 */
.bands { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.band { padding: 14px 16px; min-width: 0; }
.band.on { border-color: var(--accent); }
.band .focus { margin: 6px 0 8px; color: var(--fg); }
.band ol { margin: 0; padding-left: 20px; font-size: var(--fs-m); display: grid; gap: 4px; }
table.tune td.tt .do { color: var(--fg); font: 600 15px/1.3 var(--body); letter-spacing: -0.01em; }
table.tune td.tt .gnote { color: var(--muted); font-size: var(--fs-ml); line-height: 1.4; margin-top: 3px; }
table.tune tr.grp th { padding-top: 14px; border-bottom: 1px solid var(--line); background: transparent; }
table.tune .tag { font-size: var(--fs-sm); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
table.tune th.tw.sel, table.tune td.sel { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.srcs { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.src-mini { font-size: var(--fs-m); color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--faint); }
.src-mini:hover { color: var(--fg); border-color: var(--accent); }
.src-mini b { font-weight: 600; }
.qlegend { gap: 12px; }
.faint { color: var(--faint); }
.dockgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
table.dock th {
  white-space: normal;
  width: 34%;
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-m);
  vertical-align: top;
  padding-top: 9px;
}
table.dock td { white-space: normal; }

/* class picker */
.clswrap { position: relative; }
.clsbtn {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  padding: 8px 12px;
}
.clsbtn .eyebrow { grid-column: 1 / -1; }
.clsbtn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clsbtn:hover, .clsbtn[aria-expanded="true"] { border-color: var(--accent); }
.clsbtn:focus-visible { outline: 2px solid var(--accent); }
.clspop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 280px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  padding: 8px;
}
.clspop input { width: 100%; margin-bottom: 6px; }
#clsList { max-height: 320px; overflow-y: auto; display: grid; }
.clsitem {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-s);
}
.clsitem:hover, .clsitem:focus-visible { background: var(--panel-2); }
.clsh { font-size: var(--fs-sm); color: var(--faint); padding: 8px 9px 3px; }
@media (max-width: 760px) {
  .clswrap { flex: none; }
  .clsbtn { width: auto; padding: 5px 10px; }
  .clsbtn .eyebrow { display: none; }
  .clsbtn b { font-size: var(--fs-ml); max-width: 120px; }
  .clspop { position: fixed; left: 16px; top: 64px; }
}

/* analysis window: two range inputs stacked over a speed strip */
.winstrip { position: relative; height: 46px; margin-top: 10px; }
.winstrip svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.winstrip input[type=range] {
  position: absolute;
  left: -8px;
  right: -8px;
  width: calc(100% + 16px);
  top: 0;
  height: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.winstrip input[type=range]::-webkit-slider-runnable-track { background: none; height: 100%; }
.winstrip input[type=range]::-moz-range-track { background: none; }
.winstrip input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; height: 46px; cursor: ew-resize; }
.winstrip input[type=range]::-moz-range-thumb { pointer-events: auto; height: 44px; cursor: ew-resize; }
.winstrip input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--fg); }

/* upload */
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 36px 20px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); color: var(--fg); }
.drop b { color: var(--fg); }
.notice { padding: 10px 14px; font-size: var(--fs-m); max-width: 90ch; }
.notice.bad { border-color: var(--bad); }
.notice.good { border-color: var(--good); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding: 10px 16px;
  font-weight: 600;
  z-index: 9;
}
.muted { color: var(--muted); }
.small { font-size: var(--fs-ml); }
.heat td.hc { color: #0b1420; font-weight: 600; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 5;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand small, .side .foot { display: none; }
  .nav { flex-direction: row; }
  .nav button { padding: 7px 9px; font-size: var(--fs-m); }
  .nav button span { display: none; }
  .nav button[aria-current="page"] span { display: inline; }
  .nav button[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .tile .v { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== clean light theme overrides ===== */
body { font: 15px/1.47 var(--body); -webkit-font-smoothing: antialiased; }
h1 { font: 700 clamp(30px, 4vw, 44px)/1.08 var(--display); }
h2 { font: 600 21px/1.25 var(--display); }
.eyebrow { font: 600 15px/1.2 var(--body); letter-spacing: 0; text-transform: none; }
.side { background: rgba(255,255,255,.72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--line); }
.brand small { text-transform: none; font-size: var(--fs-m); }
.nav button { border-radius: var(--r-m); font-weight: 500; color: var(--fg); }
.nav button:hover { background: rgba(0,0,0,.04); }
.nav button[aria-current="page"] { box-shadow: none; font-weight: 600; }
.section, .card, .tip, .band { background: var(--panel); border: 0; border-radius: var(--r); box-shadow: var(--shadow); }
.tiles { background: var(--panel); border: 0; border-radius: var(--r); box-shadow: var(--shadow); }
.tile { box-shadow: 1px 0 0 var(--line); background: transparent; }
.tile .k { letter-spacing: 0; text-transform: none; font-size: var(--fs-ml); font-weight: 500; }
.tile .v { font: 600 32px/1.1 var(--display); letter-spacing: -0.02em; }
.btn { border-radius: var(--r-pill); border: 0; background: var(--panel-2); font-weight: 500; padding: 7px 14px; }
.btn:hover { background: #e8e8ed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: none; background: #0d1a2d; }
.btn.ghost { background: transparent; }
.chip {
  border-radius: var(--r-pill);
  border: 0;
  background: var(--panel-2);
  color: var(--fg);
  font-weight: 500;
  padding: 5px 12px;
}
.chip[aria-pressed="true"] { background: var(--fg); color: #fff; }
select, input[type=text], input[type=number], input[type=date], input[type=search], textarea { background: var(--panel); border: 1px solid #d2d2d7; border-radius: var(--r-m); }
th { letter-spacing: 0; text-transform: none; font-size: var(--fs-ml); font-weight: 600; }
td { border-bottom: 1px solid var(--panel-2); }
.pill {
  font-weight: 600;
  letter-spacing: 0;
  border: 0;
  padding: 3px 10px;
  background: var(--panel-2);
  color: var(--fg);
}
.pill.good { background: rgba(52,199,89,.14); color: var(--good); }
.pill.warn { background: rgba(228,87,46,.15); color: var(--warn); }
.pill.bad { background: rgba(255,59,48,.12); color: var(--bad); }
.pill.tack { background: rgba(21,38,63,.10); color: var(--accent); }
.pill.gybe { background: rgba(228,87,46,.15); color: var(--warn); }
.pill.up { background: rgba(21,38,63,.10); color: var(--accent); }
.pill.down { background: rgba(228,87,46,.15); color: var(--warn); }
.pill.sample { background: transparent; border: 1px dashed var(--faint); color: var(--muted); }
.notice { background: rgba(21,38,63,.06); border-left: 0; border-radius: var(--r-m); }
.notice.bad { background: rgba(255,59,48,.08); }
.map-wrap { border: 0; border-radius: var(--r-l); }
.live div { background: var(--panel-2); border-radius: var(--r-m); }
.live b { font: 600 22px/1.1 var(--display); letter-spacing: -0.02em; }
.live span { letter-spacing: 0; text-transform: none; font-size: var(--fs-ml); }
.clsbtn { background: var(--panel); border-radius: var(--r-m); border: 1px solid var(--line); }
.clsbtn b { font: 600 17px/1.2 var(--display); }
.clsbtn .eyebrow { font-size: var(--fs-m); }
.clspop { border-radius: var(--r-l); box-shadow: 0 12px 40px rgba(0,0,0,.14); border: 0; }
.clsh { letter-spacing: 0; text-transform: none; font-weight: 600; }
.clsitem.on { box-shadow: none; background: rgba(21,38,63,.08); color: var(--accent); }
.winstrip { background: var(--panel-2); border: 0; border-radius: var(--r-m); }
.winstrip input[type=range]::-webkit-slider-thumb { background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.06); border-radius: var(--r-s); width: 14px; }
.winstrip input[type=range]::-moz-range-thumb { background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25); border-radius: var(--r-s); width: 12px; }
.src-mini b { color: var(--gain); }
.src-chip { background: var(--panel-2); border: 0; }
.src-chip b { color: var(--warn); }
.band.on { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.band ol { color: var(--fg); }
table.tune th.tc { background: var(--panel); }
table.tune tr.grp th { color: var(--muted); letter-spacing: 0; text-transform: none; font: 600 15px/1.2 var(--body); }
table.tune th.tw { font: 600 16px/1.2 var(--display); }
table.fleet tr.sec th { font: 600 15px/1.2 var(--display); letter-spacing: -0.01em; }
table.fleet .you { background: rgba(21,38,63,.06); }
table.fleet th.you { color: var(--accent); }
.adot.good { background: var(--good-bar); }
.adot.warn { background: var(--gain); }
.toast { background: var(--fg); color: #fff; border-radius: var(--r-m); }
.empty h2 { color: var(--fg); }
table.dock th { color: var(--fg); }
.dissent { border-left-color: var(--gain); }
.tile .d { min-height: 2.9em; }
.map-wrap .tools .btn { background: rgba(255,255,255,.9); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.nav button.more { font-size: var(--fs-m); color: var(--muted); padding: 7px 10px; }
.nav button.more svg { color: var(--faint); }

/* ===== Prepare for next race: conditions card, data line, settings for the day ===== */
main .well { margin-top: 18px; }

/* ===== four routes: Tune my boat, Review my race, Prepare for next race, Upload tracks ===== */
.work { min-width: 0; display: flex; flex-direction: column; }
.subnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px clamp(16px, 3vw, 36px) 0; }
.subnav[hidden] { display: none; }
.subnav:not([hidden]) + main { padding-top: 4px; }

/* v304: the top menu stays put; the page scrolls under it (under the app bar on a phone). shell.js sets --side-h and --subnav-h */
.subnav { position: sticky; top: var(--side-h, 0px); z-index: 2; background: var(--bg); padding-bottom: 12px; }
.subnav.stuck { box-shadow: 0 8px 12px -12px rgba(19,38,61,.4); }
.work > main { position: relative; z-index: 0; }
html { scroll-padding-top: calc(var(--side-h, 0px) + var(--subnav-h, 0px) + 8px); }
.subtabs { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.subtabs button { all: unset; cursor: pointer; white-space: nowrap; border-radius: var(--r-pill); transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.subtabs button:hover { color: var(--fg); }
.subtabs button[aria-selected="true"] { font-weight: 600; }
.subtabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav button[hidden] { display: none; }   /* v855: the Account button, when there is no sign-in */
.nav button span { white-space: nowrap; }
@media (max-width: 1100px) and (min-width: 761px) {
  .subnav { padding-inline: 20px; }
}
@media (max-width: 760px) {
  .subnav { padding: 12px 12px 12px; }   /* v501: keep a grey gap under the tabs on a phone too (was 0, so pages scrolled flush against the tabs) */
  .subnav { flex-wrap: wrap; gap: 8px; }
  .side .nav button span[data-short] { font-size: 0 !important; }
  .side .nav button span[data-short]::after { content: attr(data-short); }
}

/* key metric cards: identical structure so every row lines up across cards */
.km { background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.km header h3 { font: 600 17px/1.2 var(--display); letter-spacing: -0.01em; margin: 0; }

/* brand */
.brand svg { flex: none; }
.brand b { font: 800 15px/1 var(--display); letter-spacing: .24em; text-transform: uppercase; color: var(--fg); }
.brand small { margin-top: 5px; letter-spacing: .02em; }
.nav button svg { color: var(--gain); }
.nav button[aria-current="page"] { background: rgba(21,38,63,.07); color: var(--fg); }
.chip.mark { background: rgba(47,93,140,.12); color: var(--b); }
.chip.mark[aria-pressed="true"] { background: var(--b); color: #fff; }
a { color: var(--b); }
.btn.ghost { color: var(--b); }

/* Where to gain: opportunities are green (good news: speed to find); strengths are navy */
.km.top { box-shadow: 0 0 0 2px var(--good-bar), var(--shadow); }

/* BowDown wordmark: Inter Display Bold, "Down" in orange */
.brand { align-items: center; gap: 10px; }
.brand b.wordmark {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--fg);
}
.brand b.wordmark span { color: var(--gain); }

/* Analyse: race timeline of big, clearly clickable blocks (width = time on that part) */
.winhead { margin-bottom: 10px; }
.segbar { display: flex; gap: 8px; align-items: stretch; }
.segs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.seg,
.segall {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 9px 10px;
  border-radius: var(--r-m);
  min-height: 58px;
}
.seg { flex-basis: 0; min-width: 78px; }
.seg.mark { min-width: 76px; }
.segall { flex: none; min-width: 104px; background: var(--panel-2); color: var(--fg); }
.seg b, .segall b { font: 600 14px/1.2 var(--display); white-space: nowrap; }
.seg span, .segall span { font-size: var(--fs-m); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg.up { background: rgba(47,93,140,.12); color: #23476c; }
.seg.down { background: rgba(228,87,46,.12); color: #8a2f12; }
.seg.reach { background: var(--panel-2); color: var(--fg); }
.seg.mark { background: rgba(19,38,61,.06); color: var(--fg); border: 1px dashed rgba(19,38,61,.25); }
.seg:hover, .segall:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(19,38,61,.12); }
.seg:focus-visible, .segall:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.seg[aria-pressed="true"], .segall[aria-pressed="true"] { background: var(--fg); color: var(--accent-ink); border-color: var(--fg); box-shadow: 0 3px 10px rgba(19,38,61,.25); }
.seg[aria-pressed="true"] span, .segall[aria-pressed="true"] span { opacity: .85; }
@media (max-width: 760px) {
  .segbar { flex-wrap: wrap; }
  .segs { order: 3; flex-basis: 100%; }
  .segall { flex: 1; }
  .seg { min-width: 104px; }
}

/* tacks and gybes section */
/* fit any screen: cap line length on very wide monitors, keep the map within the viewport */
main { width: 100%; justify-self: center; }
.map-wrap { max-height: 72vh; }
@media (min-width: 1700px) {
  body { font-size: var(--fs-l); }
}
@media (max-width: 1280px) {
  main { padding-inline: 20px; }
}

/* Race detail: compact so header, analyse bar, map and charts fit one screen */
main:has(#winStrip) .page-head { margin-bottom: 4px; align-items: center; }
main:has(#winStrip) h1 { font-size: clamp(22px, 2.2vw, 30px); }
main:has(#winStrip) .sub { margin-top: 2px; font-size: var(--fs-l); }
main:has(#winStrip) .tiles { margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
main:has(#winStrip) .tiles .tile { padding: 8px 12px; }
main:has(#winStrip) .tiles .tile .k { font-size: var(--fs-m); }
main:has(#winStrip) .tiles .tile .v { font-size: 24px; margin-top: 1px; }
main:has(#winStrip) .tiles .tile .v small { font-size: var(--fs-ml); }
main:has(#winStrip) .tiles .tile .d { min-height: 0; font-size: var(--fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrub.dock .segbar { margin-top: 6px; }
.scrub.dock .seg, .scrub.dock .segall { min-height: 40px; padding: 5px 9px; }
.scrub.dock .seg b, .scrub.dock .segall b { font-size: var(--fs-ml); }
.scrub.dock .seg span, .scrub.dock .segall span { font-size: var(--fs-sm); }
.scrub.dock .winstrip { height: 30px; margin-top: 8px; }
.scrub.dock .winstrip input[type=range]::-webkit-slider-thumb { height: 30px; }
.scrub.dock .winstrip input[type=range]::-moz-range-thumb { height: 28px; }
.analysis-grid { margin-bottom: 12px; gap: 12px; }
.analysis-grid > .section { padding: 10px 12px; }
.analysis-grid .scrub { margin: 8px 0 0; gap: 8px; }
.analysis-grid .scrub .clock { font-size: var(--fs-l); min-width: 60px; }
.analysis-grid .live { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 6px; min-height: 42px; }
.analysis-grid .live div { padding: 3px 8px; border-radius: var(--r-s); }
.analysis-grid .live b { font-size: var(--fs-l); }
.analysis-grid .live span { font-size: var(--fs-sm); }
.analysis-grid details { margin-top: 6px !important; font-size: var(--fs-ml); }
@media (max-width: 760px) {
  .analysis-grid .live { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ===== polish: one typeface everywhere (Inter, SF on Apple devices), calmer spacing, subtle motion ===== */
:root { --display: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif; --body: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; --ease: cubic-bezier(.2, .7, .2, 1); --t-fast: .15s; --t: .2s; --t-slow: .3s; --shadow: 0 1px 1px rgba(19,38,61,.04), 0 8px 28px rgba(19,38,61,.07); --shadow-hi: 0 2px 4px rgba(19,38,61,.06), 0 16px 40px rgba(19,38,61,.12); }
body { font-family: var(--body); font-optical-sizing: auto; font-feature-settings: "cv11", "ss01"; letter-spacing: -0.011em; text-rendering: optimizeLegibility; }
h1 { font-weight: 700; letter-spacing: -0.035em; }
h2 { font-weight: 650; letter-spacing: -0.02em; }
h3 { letter-spacing: -0.012em; }
.eyebrow { font-weight: 550; color: var(--muted); }
.tile .v, .km-big, .live b, .scrub .clock { font-feature-settings: "tnum", "cv11"; }
.km { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.km:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); }
.section, .tiles, .card { transition: box-shadow var(--t) var(--ease); }
.card.click:hover { box-shadow: var(--shadow-hi); }
.nav button { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.btn, .chip, select { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:active, .chip:active, .seg:active, .segall:active { transform: scale(.97); }
.seg, .segall { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }

/* page entrance: v1174: one quick rise, no stagger, on the page's top-level blocks only, so animations inside a page keep their own timing */
@keyframes bd-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main.enter > * { animation: bd-rise .18s var(--ease) backwards; }

/* phone: Apple-style bottom tab bar (main pages + All races); top bar keeps logo and class picker */
@media (max-width: 760px) {
  .side { overflow: visible; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--panel); }
  .side .nav {
    position: fixed;
    z-index: 20;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    border-top: 1px solid var(--line);
  }
  .side .nav button {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    font-size: var(--fs-sm);
    background: none !important;
    box-shadow: none !important;
  }
  .side .nav button span { display: block !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .side .nav button svg { color: currentColor; }
}

/* v266 phone: the bottom tab bar floats as a solid white pill with a strong shadow (like Facebook's), so the main menu is obvious over any page or map */
@media (max-width: 760px) {
  .side .nav {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 6px;
    gap: 4px;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(19,38,61,.10);
    border-radius: var(--r-xl);
    box-shadow: 0 2px 6px rgba(19,38,61,.10), 0 10px 30px rgba(19,38,61,.22);
  }
  .side .nav button { padding: 6px 2px 5px; border-radius: var(--r-xl); color: #3a4553; font-weight: 600; }
  .side .nav button svg { width: 24px; height: 24px; stroke-width: 2; }
  .side .nav button span[data-short]::after { font-size: var(--fs-sm); }
  .side .nav button[aria-current="page"] { color: var(--gain); background: rgba(228,87,46,.12) !important; }
  main, main:has(#replayBox) { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
}

/* Where to gain: compact cards; all seven in one row on wide screens so the scorecard starts on the first screen */
.km { padding: 14px 14px 12px; border-radius: 18px; }
.km header h3 { font-size: var(--fs-ml); }
@media (max-width: 1280px) {
  .km { padding: 12px 12px 10px; }
}

/* boats left out of a race comparison */
table.fleet .out { color: var(--faint); }
table.fleet th.out { font-style: italic; }

/* Race detail (simplified): tiles, map + leg table, settings tucked away */
.analysis-grid.rd { margin-bottom: 16px; }
.rd .live { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.rd .live div { padding: 4px 10px; border-radius: var(--r-m); }
.rd .live b { font-size: var(--fs-xl); }
.rd .scrub { margin: 10px 0 0; }
.rd .scrub .clock { font-size: var(--fs-xl); }
@media (max-width: 760px) {
  .rd .live { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* wind phase in the live readout */
.live .ph.in { color: var(--good); }
.live .ph.out { color: var(--warn); }

/* Race detail: the leg or mark in focus; the rest of the table fades back */
/* How it works */
.about h2 { font-size: var(--fs-xl); margin-bottom: 8px; }
.about p, .about li { font-size: var(--fs-ml); line-height: 1.55; color: var(--fg); max-width: 72ch; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0 0 8px; padding-left: 18px; }
.about li + li { margin-top: 4px; }

/* upload: near-miss race or class name */
.namewarn { display: grid; gap: 8px; }
.namewarn .btn { margin-left: 4px; }

/* switching tacks / gybes / hoists / drops and focusing a leg: content eases in */

/* Race detail: which boats are on the map */

/* detail page: one part of the race, you vs every boat */
/* Where to gain: each card's breakdown sits below the cards */
/* detail chart with the key takeaway beside it */
/* Race detail: every boat on the map in its own colour, and the order at the current time */
.fleetorder i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 0;
}
.fleetorder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 8px;
  font-size: var(--fs-ml);
  font-variant-numeric: tabular-nums;
}
.fleetorder .fo { white-space: nowrap; font-weight: 500; }
.fleetorder .fo.you { font-weight: 700; }
.fleetorder .fo.off { color: var(--faint); }
.fleetorder .fo.off i { opacity: .4; }

/* tacks and gybes: where each turn loses, going in / the turn / coming out */
/* ===== Next race, try this: three plain instructions, what went well, the part of the race ===== */
.todo { list-style: none; margin: 0; padding: 0; display: grid; counter-reset: none; }
.well { background: rgba(47,93,140,.07); }
.well p { display: flex; gap: 8px; }
.well .ok { color: var(--b); font-weight: 700; }

/* Race replay: presets, a searchable boat list and a running order that copes with a fleet of 100 */
.pickwrap { position: relative; display: inline-block; }
.pickpop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border-radius: var(--r-l);
  box-shadow: 0 12px 40px rgba(0,0,0,.16);
  padding: 8px;
}
.pickpop input[type=search] { width: 100%; }
.picklist { max-height: 300px; overflow-y: auto; margin-top: 6px; display: grid; }
.pickrow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--r-s);
  cursor: pointer;
  font-size: var(--fs-m);
}
.pickrow:hover { background: var(--panel-2); }
.pickrow span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickfoot { margin-top: 6px; }
.fleetorder button.fo {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.fleetorder .fo.lit { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.fleetorder .fo.gap { color: var(--faint); }

/* Next race: compact cards, side by side on wide screens */
.todo { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; align-items: stretch; }
.well { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-l); font-size: var(--fs-m); }
.well p { margin: 3px 0 0; }

/* ===== Next race: total seconds to find, then the hot tips ===== */
.chip:disabled { opacity: .45; cursor: default; }

/* Next race: place at each mark, place minute by minute, clear air */
/* Race replay: race then boat pickers, follow chips, full screen */
/* Race replay: race and boat pickers as a slim bar at the top (the big title repeated the picker) */
main:has(.racebar) { padding-top: 10px; }
.racebar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.racebar select {
  padding: 3px 26px 3px 8px;
  font-size: var(--fs-ml);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background-color: var(--panel);
  max-width: min(46vw, 320px);
}
@media (max-width: 760px) {
  main:has(.racebar) { padding-top: 8px; }
}
.scrub .follow { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.scrub .follow .chip { padding: 3px 10px; font-size: var(--fs-ml); }
.replaybox.fsmode {
  background: var(--panel);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: auto;
  border-radius: 0;
  box-shadow: none;
}
.replaybox.fs { position: fixed; inset: 0; z-index: 1000; margin: 0; }

/* pinned full screen: the top menu (Replay / Where to gain) and the sidebar hide, so only the map shows */
body.mapfs .subnav, body.mapfs .side, body.mapfs .topme, body.mapfs .topbar { display: none !important; }
.replaybox:fullscreen { width: 100vw; height: 100vh; }
.replaybox.fsmode .map-wrap { flex: 1 1 auto; aspect-ratio: auto; max-height: none; min-height: 240px; }
.replaybox.fsmode .live { flex: none; }
body.noscroll { overflow: hidden; }

/* phone full screen: the map runs edge to edge; race window strip and leg buttons hidden, slim play bar underneath */
@media (max-width: 760px) {
  .replaybox.fs { height: 100vh; height: 100dvh; }
  .replaybox.fsmode { padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); overflow: hidden; }
  .replaybox.fsmode > .notice { display: none; }
  .replaybox.fsmode .mapfeed { min-height: 0; gap: 0; }
  .replaybox.fsmode .map-wrap { border-radius: 0; min-height: 0; }
  .replaybox.fsmode .scrub { flex: none; margin: 0; padding: 6px 10px; gap: 6px 8px; }
  .replaybox.fsmode .scrub input[type=range] { min-width: 120px; }
  .replaybox.fsmode .fleetorder { flex: none; max-height: 30vh; overflow: auto; padding: 0 10px; }
}

/* BowDown colours: orange disc, cream play mark, cream ring with a navy edge */
.mapplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 3;
  display: grid;
  place-items: center;
  background: var(--gain);
  color: #ffffff;
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 6px #13263d, 0 8px 26px rgba(19,38,61,.45);
  transition: transform .2s var(--ease, ease), background-color .2s, opacity .2s;
}
.mapplay svg { width: 36px; height: 36px; display: block; }
/* v1261 (Al): with a mouse, the big play button shows only while the pointer is over the map */
@media (hover: hover) and (pointer: fine) { .map-wrap:not(:hover):not(:focus-within) > .mapplay { opacity: 0; pointer-events: none; } }
.mapplay:hover { background: #cf4720; transform: translate(-50%, -50%) scale(1.06); }
.mapplay:active { transform: translate(-50%, -50%) scale(.96); }
.mapplay:focus-visible { outline: 3px solid #13263d; outline-offset: 8px; }
.mapplay[hidden] { display: none !important; }
@media (max-width: 760px) {
  .mapplay { width: 68px; height: 68px; }
  .mapplay svg { width: 28px; height: 28px; }
}
.maprail {
  position: absolute;
  right: 10px;
  top: 54px;
  max-height: calc(100% - 120px);
  display: flex;
  flex-flow: column wrap-reverse;
  align-content: flex-start;
  gap: 7px;
  z-index: 2;
}
.rbtn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(255,255,255,.92);
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,.14), 0 4px 12px rgba(19,38,61,.10);
  backdrop-filter: blur(6px);
  transition: background-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease);
}
.rbtn svg { width: 20px; height: 20px; }
.rbtn:hover, .rbtn:focus-visible { background: #fff; z-index: 3; }
.rbtn[aria-pressed="true"]:hover { background: #1f3a5c; }
.rbtn[aria-pressed="true"] { background: var(--fg); color: #fff; }
.rbtn:disabled { opacity: .55; cursor: default; }
.rbtn:active { transform: scale(.93); }
.rbtn:focus-visible { outline: 2px solid var(--gain); outline-offset: 2px; }
.rbtn[data-tip]:hover::after,
.rbtn[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--fg);
  color: #fff;
  font: 500 14.5px/1.2 var(--body);
  padding: 6px 9px;
  border-radius: var(--r-s);
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.rbadge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-s);
  background: var(--gain);
  color: #fff;
  font: 700 12.5px/17px var(--body);
  text-align: center;
}
.maprail .pickwrap { display: block; }
.maprail .pickpop { z-index: 1100; }
@media (max-width: 560px) {
  .rbtn { width: 34px; height: 34px; }
  .rbtn svg { width: 18px; height: 18px; }
  .maprail { gap: 5px; right: 8px; top: 48px; }
  .rbtn[data-tip]:hover::after { display: none; }
}
.fleetorder .badair { color: var(--bad); font-weight: 600; font-size: var(--fs-m); }
.scrub .spd { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.scrub .spd select { padding: 3px 8px; font-size: var(--fs-ml); border-radius: var(--r-pill); }
.replaybox.fsmode .winhead #zfull { margin-left: 4px; }
.replaybox.fsmode #zfull.fsexit { position: fixed; z-index: 1001; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* full screen exit: one round X, easy to find but not shouting */
#zfull.fsx {
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font: 600 19px/1 var(--body);
  flex: none;
}
#zfull.fsx:focus-visible { outline: 3px solid var(--gain); outline-offset: 3px; }
@media (max-width: 760px) {
  #zfull.fsx { font-size: var(--fs-xxl); }
  .replaybox.fsmode .maprail { top: 58px; }
}

/* Race replay: one card. Race window and leg buttons sit inside it, above the map; settings at the foot */
.analysis-grid.rd { grid-template-columns: minmax(0, 1fr); }

/* text for screen readers only */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Full width: cards span the whole window. Race replay: the map fills the card's width and the height the window leaves
   above the play bar (set as --maph by fitMapH in app-pages.js); full screen still uses the flex layout */
main { max-width: none; }
.replaybox .map-wrap { aspect-ratio: auto; max-height: none; height: var(--maph, clamp(320px, calc(100vh - 360px), 1600px)); }
.replaybox.fsmode .map-wrap { height: auto; }
main:has(#replayBox) { padding-bottom: 0; }
main .analysis-grid.rd { margin-bottom: 8px; }

/* no page scroll below the replay card */
@media (max-width: 760px) {
  main:has(#replayBox) { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
}

/* Next race: watch a tack / gybe / mark next to the best boat; Race replay quick-replay bar */

/* Where to gain: three groups (boat speed, manoeuvres, where you sailed) */
/* v361 the three groups share one grid so all seven cards fit on one screen; subgrid lines up headings and cards.
   1100-1499 px: two rows of four (Boat speed + Where you sailed, then Manoeuvres); 1500 px and up: all seven in one row */
/* Where to gain: "Every boat" and "Every leg / tack / race" tables start closed */
/* Next race: what the gurus recommend */
.gurus { margin-top: 18px; }
.gurus h2 { margin: 4px 0 8px; }

/* race commentary beside the replay map (below it on narrow screens) */
.mapfeed.on { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: stretch; }
@media (max-width: 1100px) {
  .mapfeed.on { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
.replaybox.fsmode .mapfeed { flex: 1 1 auto; min-height: 240px; display: grid; grid-template-rows: minmax(0, 1fr); }
.replaybox.fsmode .mapfeed:not(.on) { grid-template-columns: minmax(0, 1fr); }
.replaybox.fsmode .mapfeed .map-wrap { height: 100%; min-height: 0; }
@media (max-width: 1100px) {
  .replaybox.fsmode .mapfeed.on { grid-template-rows: minmax(0, 1fr) auto; }
}

/* Next race scorecard (v2 layout): headline top-left, your column first and set apart, full row labels,
   quieter "best" cells, a short colour key with the long explanation folded away */
/* upload: the races found in a file, each joined to the fleet's race or named as a new one */
.racerows { display: grid; gap: 6px; }
.racerow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  padding: 8px 10px;
  border-radius: var(--r-m);
  background: var(--panel-2);
}
.racerow.on { box-shadow: inset 0 0 0 2px var(--fg); }
.racerow .chk input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--fg); }
.racerow .chk input { margin-top: 0; }
.rr-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.rr-line .spacer { flex: 1; }
.rr-n { font-weight: 700; }
.rr-t { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rr-link { background: none; border: 0; padding: 0; font: inherit; font-size: var(--fs-sm); color: var(--muted); text-decoration: underline; cursor: pointer; }
@media (max-width: 440px) { .rr-n { flex: 1 0 60%; } .rr-line .rr-t { order: 3; flex-basis: 100%; } .rr-line .spacer { display: none; } .rr-n { order: 1; } .rr-line .pill, .rr-line .rr-link { order: 2; } }
.racerow .rr-what .btn.ghost { padding-inline: 6px; }
.racerow label.f input { max-width: 260px; }

/* training session (one boat): tack and gybe drills, steadiness */
.trk { display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: 0; }
.trk.tack { border-radius: 50%; background: #2a64b0; }
.trk.gybe { border-radius: 2px; background: var(--gain); }

/* Race replay: the training report card under the map (one boat) */
.debrief { margin-top: 18px; }

/* Race replay: instrument strip like a B&G display: black, white digits, one thin row under the map */
.replaybox .live.inst {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 6px 0 0;
  min-height: 0;
  background: #0b0d10;
  border-radius: var(--r-m);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #23272e;
}
.replaybox .live.inst div {
  background: none;
  border-radius: 0;
  padding: 3px 10px 4px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  box-shadow: -1px 0 0 #2a2f37;
}
.replaybox .live.inst div:first-child { box-shadow: none; }
.replaybox .live.inst span { font: 600 11.5px/1.2 var(--body); letter-spacing: .09em; color: #8b95a3; text-transform: uppercase; }
.replaybox .live.inst b {
  display: block;
  text-align: right;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  font: 600 24px/1.05 var(--display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.replaybox .live.inst b small { font: 600 12px/1 var(--body); letter-spacing: .06em; color: #8b95a3; margin-left: 3px; text-transform: uppercase; }
.replaybox .live.inst b em { font-style: normal; font-size: .62em; margin-right: 3px; vertical-align: .18em; }
.replaybox .live.inst em.stb { color: #3ddc84; }
.replaybox .live.inst em.prt { color: #ff5a4e; }
.replaybox .live.inst .ph { font: inherit; }
.replaybox .live.inst .ph.in { color: #3ddc84; }
.replaybox .live.inst .ph.out { color: #ffa53d; }
.replaybox .live.inst .ph.st { font-size: .62em; color: #c9d1db; }
.replaybox .scrub { margin-top: 6px; }
@media (max-width: 760px) {
  .replaybox .live.inst div { padding: 2px 6px 3px; }
  .replaybox .live.inst b { font-size: var(--fs-xl); }
  .replaybox .live.inst b small { display: none; }
  .replaybox .live.inst span { font-size: var(--fs-xs); letter-spacing: .05em; }
}

/* Race replay: the instruments are a mast-mounted stack (B&G style) standing in the bottom-left of the map */
.replaybox .map-wrap .live.inst.mast {
  position: absolute;
  left: -14px;
  z-index: 3;
  width: 158px;
  margin: 0;
  padding: 50px 30px 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  grid-template-columns: none;
  overflow: visible;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(222,236,250,.30) 0%, rgba(222,236,250,.23) 50%, rgba(222,236,250,.09) 78%, rgba(222,236,250,0) 100%);
  border-radius: 0;
  box-shadow: none;
}

/* the mast: carbon tube (2x2 twill weave under a clear-coat sheen) rising from the foot of the map, capped above the top display */
.replaybox .map-wrap .live.inst.mast::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 28px;
  bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  z-index: -1;
  background: linear-gradient(90deg, rgba(0,0,0,.7) 0%, rgba(0,0,0,.15) 22%, rgba(255,255,255,.22) 40%, rgba(255,255,255,.42) 47%, rgba(255,255,255,.06) 56%, rgba(0,0,0,.35) 78%, rgba(0,0,0,.75) 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 2px, rgba(0,0,0,.18) 2px 4px),
    conic-gradient(var(--fg) 25%, #33373d 0 50%, var(--fg) 0 75%, #33373d 0);
  background-size: 100% 100%, 100% 100%, 6px 6px;
  box-shadow: 2px 0 6px rgba(0,0,0,.45);
}

/* luff track down the back of the mast */
.replaybox .map-wrap .live.inst.mast::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 36px;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  z-index: -1;
  background: rgba(0,0,0,.6);
  box-shadow: 1px 0 0 rgba(255,255,255,.08);
  border-radius: 2px;
}
.replaybox .map-wrap .live.inst.mast div {
  position: relative;
  padding: 3px 7px 4px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--fg) 0%, #0b0d10 46%, #050608 100%);
  border-radius: var(--r-s);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px #2d333b, 0 0 0 3px #0a0c0f, 0 0 0 4px #3a4049, 0 6px 14px rgba(0,0,0,.5);
}

/* bracket clamps where each display bolts to the mast */
.replaybox .map-wrap .live.inst.mast div::before,
.replaybox .map-wrap .live.inst.mast div::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 24px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, #5a6068, #16181b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(0,0,0,.5);
}
.replaybox .map-wrap .live.inst.mast div::before { top: -5px; }
.replaybox .map-wrap .live.inst.mast div::after { bottom: -5px; }
.replaybox .map-wrap .live.inst.mast div:first-child { box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px #2d333b, 0 0 0 3px #0a0c0f, 0 0 0 4px #3a4049, 0 6px 14px rgba(0,0,0,.5); }
.replaybox .map-wrap .live.inst.mast span { font: 600 11px/1.2 var(--body); letter-spacing: .1em; color: #8b95a3; text-transform: uppercase; }
.replaybox .map-wrap .live.inst.mast b { font-size: 25px; line-height: 1.02; text-shadow: 0 0 10px rgba(255,255,255,.12); }
.replaybox .map-wrap .live.inst.mast b small { font-size: var(--fs-xs); margin-left: 2px; }
.replaybox .map-wrap .live.inst.mast b em { margin-right: 2px; }

/* speed legend moves to the bottom right so the mast has the corner */
.replaybox.fsmode .map-wrap .live.inst.mast { flex: none; }
@media (max-width: 760px) {
  .replaybox .map-wrap .live.inst.mast { left: -12px; width: 118px; gap: 6px; padding: 36px 22px 12px; }
  .replaybox .map-wrap .live.inst.mast::before { width: 14px; top: 20px; }
  .replaybox .map-wrap .live.inst.mast::after { top: 26px; }
  .replaybox .map-wrap .live.inst.mast div { padding: 2px 5px 3px; }
  .replaybox .map-wrap .live.inst.mast b small { display: none; }
  .replaybox .map-wrap .live.inst.mast div::before, .replaybox .map-wrap .live.inst.mast div::after { width: 18px; height: 3px; }
  .replaybox .map-wrap .live.inst.mast b { font-size: var(--fs-xl); }
  .replaybox .map-wrap .live.inst.mast span { font-size: 7.5px; letter-spacing: .06em; }
}

/* shift display: lifted lights the whole display green, headed amber, so it reads at a glance */
.replaybox .map-wrap .live.inst.mast div.lift { background: linear-gradient(180deg, #0f5a2e 0%, #0a3f20 55%, #062a15 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px #2fbf66, 0 0 0 3px #0a0c0f, 0 0 0 4px #3a4049, 0 0 18px rgba(61,220,132,.55), 0 6px 14px rgba(0,0,0,.5); }
.replaybox .map-wrap .live.inst.mast div.head { background: linear-gradient(180deg, #7a3d06 0%, #5a2c04 55%, #3d1d02 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px #ff9f2e, 0 0 0 3px #0a0c0f, 0 0 0 4px #3a4049, 0 0 18px rgba(255,165,61,.6), 0 6px 14px rgba(0,0,0,.5); }
.replaybox .map-wrap .live.inst.mast div.lift > span,
.replaybox .map-wrap .live.inst.mast div.head > span {
  color: #fff;
  font-weight: 800;
}

/* the shift value is a span inside the number: give it the number's size, not the label's */
.replaybox .map-wrap .live.inst.mast b .ph { font: inherit; letter-spacing: inherit; text-transform: none; color: inherit; }
.replaybox .map-wrap .live.inst.mast b .ph.in { color: #3ddc84; }
.replaybox .map-wrap .live.inst.mast b .ph.out { color: #ffa53d; }
.replaybox .map-wrap .live.inst.mast b .ph.st { color: #6f7a87; }

/* webcam minimise: a small button on the lens; minimised it is a pill with a wind arrow, speed and direction (tap to open) */
.replaybox .map-wrap .live.inst.mast div.lift b .ph.in,
.replaybox .map-wrap .live.inst.mast div.head b .ph.out {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* the guide's sources links land the References heading clear of the phone's top bar (v252) */
#guideRefs { scroll-margin-top: 12px; }
@media (max-width: 760px) {
  #guideRefs { scroll-margin-top: 76px; }
}

/* v255 Race replay, desktop: map as big as the window allows. Race and boat pickers sit in the Race window header,
   leg and mark buttons are one line, the card is tighter and Settings sits just below the fold (⚙ on the play bar) */
@media (min-width: 761px) {
  .replaybox:not(.fsmode) { padding: 12px 14px; }
  .replaybox .winhead { margin-bottom: 6px; gap: 6px 10px; align-items: center; flex-wrap: nowrap; min-width: 0; }
  .replaybox .winhead .racebar { margin: 0; flex-wrap: nowrap; flex: none; }
  .replaybox .winhead #winLbl, .replaybox .winhead #winHint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .replaybox .winhead #winHint { flex: 0 1 auto; }
  .replaybox .winstrip { margin-top: 0; height: 28px; }
  .replaybox .winstrip input[type=range]::-webkit-slider-thumb { height: 28px; }
  .replaybox .winstrip input[type=range]::-moz-range-thumb { height: 26px; }
  .replaybox .scrub.dock .segbar { margin-top: 6px; gap: 6px; }
  .replaybox .scrub.dock .seg,
  .replaybox .scrub.dock .segall {
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    min-height: 30px;
    padding: 4px 9px;
    border-radius: var(--r-s);
    overflow: hidden;
  }
  .replaybox .scrub.dock .seg span, .replaybox .scrub.dock .segall span { min-width: 0; }
  .replaybox .scrub.dock .segall { min-width: 0; }
  .replaybox .scrub.dock .seg { min-width: 64px; }
  .replaybox .scrub.dock .seg.mark { min-width: 64px; }
  .replaybox .scrub { margin-top: 6px; }
  .replaybox.fsmode .winhead .racebar { display: none; }
}
@media (min-width: 761px) {
  /* one-line leg buttons: the second word (upwind · 8:44, hoist) only shows when the button is wide enough for it */
  .replaybox .scrub.dock .seg { container-type: inline-size; display: block; white-space: nowrap; line-height: 22px; }
  .replaybox .scrub.dock .seg span { margin-left: 6px; }
}
@container (max-width: 118px) { .replaybox .scrub.dock .seg span { display: none; } }
@media (min-width: 761px) {
  .replaybox .scrub.dock .seg { padding: 4px 7px; text-overflow: ellipsis; text-align: center; }
}

/* v267: exit-full-screen ✕ stands out on dark satellite: brand orange, white ring, bigger. Same on hover so a sticky touch-hover can't turn it navy */
#zfull.fsx, #zfull.fsx:hover, #zfull.fsx:active { font-weight: 700; background: var(--gain) !important; color: #fff !important; }

/* Top sub-menus (v269): clear pills like the bottom tab bar and the guide tabs */
.subtabs { gap: 8px; padding: 0; background: transparent; border-radius: 0; }
.subtabs button { padding: 10px 16px; min-height: 24px; font-size: var(--fs-l); font-weight: 600; color: var(--fg); }
.subtabs button:hover { background: var(--panel-2); }
.subtabs button[aria-selected="true"] { background: #fbe6df; color: var(--gain); box-shadow: none; }

/* v270: class logo sits on the right of each guide card, name leads on the left (all widths) */
/* v272 Race replay: Google Maps style. The map fills the card; pickers float at the top, the play bar floats at the foot,
   Follow you / Follow the fleet are round buttons above it. Everything sits on white frosted pills with soft shadows. */
.replaybox .map-wrap { --ov: rgba(255,255,255,.94); --ovsh: 0 1px 3px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.22); }
.replaybox .map-wrap > .racebar.onmap {
  position: absolute;
  z-index: 6;
  left: 10px;
  top: 10px;
  margin: 0;
  gap: 6px;
  flex-wrap: nowrap;
  pointer-events: none;
}
.replaybox .map-wrap > .racebar.onmap select {
  pointer-events: auto;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 260px;
  height: 38px;
  padding: 0 30px 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background-color: var(--ov);
  box-shadow: var(--ovsh);
  font: 600 14.5px/38px var(--body);
  color: var(--fg);
  text-overflow: ellipsis;
}
.replaybox .map-wrap .tools { z-index: 6; }
.replaybox .map-wrap .tools .btn:not(.fsx) {
  height: 38px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--ov);
  box-shadow: var(--ovsh);
  font-weight: 600;
}
.replaybox .map-wrap > .scrub.onmap {
  position: absolute;
  z-index: 6;
  left: 124px;
  right: 10px;
  bottom: 10px;
  margin: 0;
  padding: 6px 10px 6px 6px;
  gap: 6px 10px;
  flex-wrap: wrap;
  border-radius: var(--r-xl);
  background: var(--ov);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--ovsh);
}
.replaybox .map-wrap > .scrub.onmap #play {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  flex: none;
}
.replaybox .map-wrap > .scrub.onmap input[type=range] { min-width: 120px; }
.replaybox .map-wrap .followrail { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.replaybox .map-wrap .frbtn { all: unset; box-sizing: border-box; cursor: pointer; transition: background-color .15s, color .15s; }
.replaybox .map-wrap .frbtn:focus-visible { outline: 3px solid var(--gain); outline-offset: 2px; }
@media (max-width: 760px) {
  .replaybox { padding: 0 !important; background: none !important; box-shadow: none !important; }
  .replaybox .map-wrap { border-radius: var(--r-l); }
  .replaybox .map-wrap > .racebar.onmap select { font-size: var(--fs-m); padding: 0 26px 0 12px; }
  .replaybox .map-wrap > .scrub.onmap { left: 96px; right: 8px; bottom: 8px; padding: 5px 8px 5px 5px; }
  .replaybox .map-wrap > .scrub.onmap .spd #effSpd { display: none; }
}
@media (max-width: 760px) {
  .replaybox .map-wrap > .racebar.onmap select { flex: 1 1 0; max-width: none; }
  .replaybox .map-wrap .tools #zfull:not(.fsx) { padding: 0; justify-content: center; }
  .replaybox .map-wrap .tools #zfull .fst { display: none; }
  .replaybox .map-wrap > .scrub.onmap .spd { font-size: 0; gap: 0; }
  .replaybox .map-wrap > .scrub.onmap .spd select { font-size: var(--fs-m); }
}

/* v273: declutter the replay map. Wind pill hidden for now; every round map button is the same size on one right-hand line */
.replaybox .map-wrap .rbtn,
.replaybox .map-wrap .frbtn,
.replaybox .map-wrap .tools #zfull:not(.fsx) {
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.22);
}
.replaybox .map-wrap .tools #zfull .fst { display: none; }
.replaybox .map-wrap > .racebar.onmap { right: 64px; }
.replaybox .map-wrap .rbtn[data-tip]:hover::after { display: none; }
.replaybox .map-wrap .maptoast {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 64px;
  transform: translate(-50%, -6px);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(19,38,61,.92);
  color: #fff;
  font: 600 14px/1.2 var(--body);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t), transform var(--t);
}
.replaybox .map-wrap .maptoast.on { opacity: 1; transform: translate(-50%, 0); transition: opacity .15s, transform .15s; }

/* v331: the demo welcome sits large in the middle of the map, over the big play button, then fades to leave it.
   v333: a clean white card with navy and orange words; the play button stays hidden (.welcoming) until it dissolves.
   v340: in with the map, already showing; out as a plain dissolve (no shrink) */
.replaybox .map-wrap .mapwelcome {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 50%;
  width: min(460px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  padding: 26px 28px 22px;
  border-radius: var(--r-xl);
  background: #ffffff;
  color: #13263d;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s cubic-bezier(.45, 0, .25, 1);
  will-change: opacity;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 18px 50px rgba(19,38,61,.35), 0 2px 6px rgba(19,38,61,.15);
}
.replaybox .map-wrap .mapwelcome.on { opacity: 1; }
.replaybox .map-wrap .mapwelcome .mw-logo { flex: none; display: block; margin-bottom: 4px; }
.replaybox .map-wrap .mapwelcome .kick { font: 700 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--warn); }
.replaybox .map-wrap .mapwelcome b { font: 700 clamp(24px, 5vw, 34px)/1.15 var(--display); letter-spacing: -0.02em; color: #13263d; }
.replaybox .map-wrap .mapwelcome .wind { font: 700 clamp(16px, 3.4vw, 20px)/1.3 var(--body); color: var(--warn); }
.replaybox .map-wrap .mapwelcome .sea { font: 500 clamp(14px, 3vw, 17px)/1.3 var(--body); color: #13263d; }
.replaybox .map-wrap .mapplay { transition: transform .2s var(--ease, ease), background-color .2s, opacity 1s ease; }

/* v346: the map comes in from a blur under the welcome card: .mapblur for 1.4 s, then .mapsharp eases it clear over 1.2 s.
   Filter only (no opacity), so the children keep their own show/hide */
.replaybox .map-wrap.mapblur > :not(.mapwelcome):not(.maptoast) { filter: blur(14px) saturate(.7); will-change: filter; }
.replaybox .map-wrap.mapsharp > :not(.mapwelcome):not(.maptoast) { transition: filter 1.6s cubic-bezier(.45, 0, .25, 1); will-change: filter; }

/* v349: card and map both on their own layers with one gentle in-out curve over 1.6 s, so the fade does not step while the blur clears */
/* v348: under the demo welcome the page does not rise in (the map slid up 12 px behind the card) */
main.enter:has(.map-wrap.norise) > * { animation: none; }

/* norise stays on: dropping it would restart the rise */
.replaybox .map-wrap.welcoming .mapplay { opacity: 0; pointer-events: none; transition: none; }

/* v446: the demo fly-in from Australia: only the imagery shows; the pickers, buttons, gauges and play bar fade in once it lands */
.replaybox .map-wrap.flying > :not(canvas):not(.mapwelcome):not(.maptoast) { opacity: 0; pointer-events: none; }
.replaybox .map-wrap.landed > :not(canvas):not(.mapwelcome):not(.maptoast) { transition: opacity .7s ease; }

/* v352: Replay opens on an empty map at the size it will have (.rdskel) while the race is analysed; the map box carries on
   that fade, then the tracks and the buttons on it fade in (.mapin), and the welcome card grows in gently instead of popping */
@keyframes rd-skel { from { opacity: 0; } }
.rdskel .map-wrap, .replaybox .map-wrap.mapin { animation: rd-skel var(--t-slow) ease backwards; }
.rdskel .map-wrap { display: grid; place-items: center; }
.rdskelmsg { font: 600 15px/1.3 var(--body); color: var(--muted); animation: rd-skel var(--t-slow) ease .6s backwards; }

/* only if the wait is long */
.replaybox .map-wrap.mapin > :not(.mapwelcome):not(.maptoast):not(.mapplay) { animation: rd-skel var(--t-slow) cubic-bezier(.45, 0, .25, 1) backwards; }
@keyframes mw-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.96); } }
.replaybox .map-wrap .mapwelcome.on { animation: mw-in var(--t-slow) var(--ease) backwards; }
@media (prefers-reduced-motion: reduce) {
  .rdskel .map-wrap,
  .replaybox .map-wrap.mapin,
  .replaybox .map-wrap.mapin > *,
  .replaybox .map-wrap .mapwelcome.on {
    animation: none;
  }
}
@media (max-width: 760px) {
  .replaybox .map-wrap .rbtn svg, .replaybox .map-wrap .frbtn svg { width: 20px; height: 20px; }
  .replaybox .map-wrap .maprail { top: 60px; gap: 8px; }
  .replaybox .map-wrap > .racebar.onmap { right: 60px; }
  .replaybox .map-wrap > .racebar.onmap select { height: 40px; line-height: 40px; }
}

/* v274: boat picker. 16 px text so iOS never zooms on the search box; the big play button hides while the picker is open */
.pickpop input[type=search], .replaybox .map-wrap select { font-size: var(--fs-l) !important; }
.pickpop { z-index: 1200 !important; }
.replaybox:has(.pickpop:not([hidden])) .mapplay { display: none; }

/* v280: map buttons. Picked = brand orange with a white ring, so it stands out on dark water and light charts alike */
.replaybox .map-wrap .rbtn[aria-pressed="true"],
.replaybox .map-wrap .frbtn[aria-pressed="true"],
.replaybox .map-wrap .rbtn[aria-pressed="true"]:hover {
  background: var(--gain);
  color: #fff;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(228,87,46,.45), 0 4px 14px rgba(0,0,0,.25);
}

/* v280: on desktop each map button names itself on hover (a label to its left); the centre toast is for touch only */
@media (hover: hover) and (pointer: fine) {
  .replaybox .map-wrap [data-tip]:not([data-tip=""]) { position: relative; }
  .replaybox .map-wrap .rbtn[data-tip]:hover::after,
  .replaybox .map-wrap [data-tip]:not([data-tip=""]):hover::after,
  .replaybox .map-wrap [data-tip]:not([data-tip=""]):focus-visible::after {
    display: block;
    content: attr(data-tip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--fg);
    color: #fff;
    font: 500 14px/1.2 var(--body);
    padding: 6px 10px;
    border-radius: var(--r-s);
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    z-index: 20;
  }
}

/* v289: one drawn chevron on every pull-down (the native arrow looked squashed in the pill selects) */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  padding-right: 30px;
  cursor: pointer;
}
select::-ms-expand { display: none; }

/* v290: rounded, frosted pull-down lists where the browser allows styling them (Chrome/Edge 135+; Safari and Firefox keep their native list) */
select > button.selbtn { display: none; }

/* only used by the styled pull-down below */
@supports (appearance: base-select) {
  select:not([multiple]):not([size]), select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
  /* the chevron becomes the picker icon, so long text stops (with …) before it instead of running under it */
  select:not([multiple]):not([size]) {
    background-image: none;
    padding-right: 11px !important;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  select:not([multiple]):not([size])::picker-icon {
    content: "";
    flex: none;
    width: 12px;
    height: 8px;
    margin-left: auto;
    align-self: center;
    line-height: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%236e6e73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px;
    transition: transform .2s var(--ease);
  }
  select:not([multiple]):not([size]):open::picker-icon { transform: rotate(180deg); }
  /* long race / boat names end in … before the chevron (replay.js puts a <selectedcontent> button in those two) */
  select > button.selbtn {
    all: unset;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  select > button.selbtn selectedcontent { display: inline; }
  /* v902: on a phone the closed race picker shows just the date ("Oct 5"); replay.js raceOpt keeps the name when two races share a day */
  @media (max-width: 760px) { select > button.selbtn selectedcontent :is(.rn, .yr) { display: none; } }
  select:not([multiple]):not([size])::picker(select) {
    margin-top: 6px;
    padding: 5px;
    min-width: anchor-size(width);
    max-height: min(72vh, 560px);
    border: 1px solid rgba(19,38,61,.10);
    border-radius: var(--r-l);
    background: rgba(255,255,255,.82);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    backdrop-filter: blur(16px) saturate(1.6);
    box-shadow: 0 12px 32px rgba(19,38,61,.18), 0 2px 6px rgba(19,38,61,.08);
    font: 500 14.5px/1.3 var(--body);
    color: var(--fg);
    scrollbar-width: none;
    overscroll-behavior: contain;
  }
  select:not([multiple]):not([size]) option { padding: 8px 12px; border-radius: var(--r-s); gap: 8px; cursor: pointer; white-space: nowrap; }   /* v501: one line each */
  select:not([multiple]):not([size])::picker(select) { width: max-content; max-width: calc(100vw - 24px); }
  select:not([multiple]):not([size]) option::checkmark { color: var(--gain); }
  /* the gate start rabbit (replay.js): a green rabbit in the tick column, shown whether or not it's the picked boat */
  select:not([multiple]):not([size]) option.rabbit::checkmark { content: "" / "rabbit"; visibility: visible; width: 1em; height: 1em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232e9e5b'%3E%3Cpath d='M8.6 1.2c1.3-.3 2.2 2.4 2.3 5.6.4-.1.8-.1 1.2 0 .6-3.1 2-5.6 3.2-5.2 1.3.4.9 3.4-.6 6.4 1.6 1 2.6 2.7 2.6 4.6v.3c2.5.6 4.2 2.6 4.2 5 0 1.5-.7 2.9-1.8 3.8H20c.6 0 1 .4 1 1s-.4 1-1 1H8.5c-.6 0-1-.4-1-1 0-.4.2-.7.5-.9-1.8-1.1-2.9-3.1-2.9-5.3 0-1.3.4-2.6 1.1-3.6-.3-.6-.5-1.3-.5-2 0-1.4.7-2.6 1.8-3.3-.6-3.1-.3-6 1.1-6.4z'/%3E%3C/svg%3E") no-repeat center / contain; }
  select:not([multiple]):not([size]) option:hover,
  select:not([multiple]):not([size]) option:focus-visible {
    background: rgba(19,38,61,.07);
    outline: none;
  }
  select:not([multiple]):not([size]) option:checked { background: #fbe6df; color: var(--gain); font-weight: 600; }
  select:not([multiple]):not([size]) optgroup { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); padding: 6px 4px 2px; }
  select:not([multiple]):not([size]) optgroup option { color: var(--fg); font-size: var(--fs-ml); }
}

/* v292: one timeline across the foot of the map. Leg and mark buttons on top; under them play, the race-window strip
   (speed trace, legs, start/finish handles) with the play slider over the race part, the clock, speed and Settings.
   The mast instruments move up to the middle of the left edge. */
.replaybox .map-wrap > .scrub.onmap.dock {
  left: 10px;
  right: 10px;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  padding: 7px 10px 7px 7px;
  border-radius: 18px;
}
.scrub.dock .docktop { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scrub.dock .docktop .segbar { flex: 1 1 auto; min-width: 0; margin: 0; gap: 6px; flex-wrap: nowrap; }
.scrub.dock .docktop .segs { order: 0; flex-basis: auto; scrollbar-width: none; }
.scrub.dock .docktop .segs::-webkit-scrollbar { display: none; }
.replaybox .scrub.dock .seg, .replaybox .scrub.dock .segall { min-height: 28px; padding: 3px 8px; border-radius: var(--r-s); line-height: 22px; }
.replaybox .scrub.dock .segall { flex: none; min-width: 0; flex-direction: row; align-items: baseline; gap: 6px; }
.replaybox .scrub.dock .seg b, .replaybox .scrub.dock .segall b { font-size: var(--fs-m); }
.replaybox .scrub.dock .seg span, .replaybox .scrub.dock .segall span { font-size: var(--fs-sm); }
.scrub.dock #winHint { display: none; }
.scrub.dock .dockrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.replaybox .scrub.dock .winstrip {
  flex: 1 1 auto;
  min-width: 100px;
  height: 30px;
  margin: 0;
  border-radius: var(--r-s);
  overflow: visible;
}
.replaybox .map-wrap > .scrub.onmap .winstrip input[type=range] { min-width: 0; flex: none; }
.replaybox .scrub.dock .winstrip input[type=range]::-webkit-slider-thumb { height: 30px; width: 10px; border-radius: var(--r-xs); }
.replaybox .scrub.dock .winstrip input[type=range]::-moz-range-thumb { height: 28px; width: 8px; border-radius: var(--r-xs); }

/* the play slider: clicking or dragging anywhere on the race part of the strip moves through the race */
#winStrip #scrub { pointer-events: auto; cursor: pointer; z-index: 1; right: auto; accent-color: auto; }
#winStrip #scrub::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fg);
  border: 0;
  box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgba(0,0,0,.35);
  cursor: grab;
}
#winStrip #scrub::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  border: 0;
  box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgba(0,0,0,.35);
  cursor: grab;
}
#winStrip #scrub:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
#winStrip #winA, #winStrip #winB { z-index: 2; }
.replaybox .map-wrap .live.inst.mast { padding-bottom: 12px; }
.replaybox .map-wrap .live.inst.mast::before { border-radius: var(--r-s); }
@media (max-width: 760px) {
  .replaybox .map-wrap > .scrub.onmap.dock { left: 8px; right: 8px; padding: 6px 8px 6px 6px; gap: 5px; }
  .scrub.dock .dockrow { gap: 8px; }
  .replaybox .scrub.dock .winstrip { height: 28px; }
  .replaybox .scrub.dock .seg { min-width: 0; flex: none !important; }
  .replaybox .scrub.dock .seg span { display: none; }
  .scrub.dock .docktop { flex-wrap: wrap; row-gap: 5px; }
}

/* v300: the right-hand map buttons sit further in from the edge, and the bottom one (Back to you) clears the scale bar and imagery credit */
.replaybox .map-wrap .maprail, .replaybox .map-wrap .followrail, .replaybox .map-wrap .tools { right: 18px; }
.replaybox .map-wrap .tools { top: 12px; }
@media (max-width: 760px) {
  .replaybox .map-wrap .maprail, .replaybox .map-wrap .followrail, .replaybox .map-wrap .tools { right: 14px; }
}

/* v356 Race replay: Settings pops up over the map from the ⚙ on the play bar (no fold-out under the card) */
.rdset {
  position: absolute;
  z-index: 30;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dockh, 90px) + 22px);
  max-height: calc(100% - var(--dockh, 90px) - 80px);
  overflow: auto;
  border-radius: var(--r-l);
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 10px 34px rgba(0,0,0,.28);
}
.rdset[hidden] { display: none; }
.rdask { max-width: 560px; }
.rdask p { margin: 0 0 12px; font-size: var(--fs-ml); line-height: 1.45; }
.rdask .row { display: flex; gap: 8px; flex-wrap: wrap; }
.rdset .form { margin-top: 10px !important; }
.rdsethead { display: flex; align-items: center; gap: 10px; font-size: var(--fs-m); }
.rdsethead b { flex: 1; font-weight: 600; }
.rdsetx {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.rdsetx:hover { background: var(--line); color: var(--fg); }
.rdsetx.xbtn { background: var(--panel-2); color: var(--fg); }
.rdsetgo.on { background: var(--fg); color: var(--panel); }
.rdsetgo svg { vertical-align: -2px; }   /* v536: Share */
.askfleet { margin: 0 0 12px; }   /* v536: the only boat in the race so far */
/* v501: the ⚙ stays on the play bar in full screen too, in the same place (Al, 19 Oct) */
.replaybox.fsmode .rdset { max-height: calc(100% - var(--dockh, 90px) - 64px); }
@media (max-width: 760px) {
  .rdset { left: 8px; right: 8px; bottom: calc(var(--dockh, 90px) + 12px); max-height: calc(100% - var(--dockh, 90px) - 64px); }
  .rdsetgo { flex: none; padding-inline: 9px; }
  .rdsetgo .rdsett { display: none; }
}

/* your boat: picked once in the menu, under the class logo; every page uses it */
.mebox { display: grid; gap: 5px; padding: 0 2px; margin-top: -8px; }
.mebox[hidden] { display: none; }
.mebox .eyebrow { font-size: var(--fs-m); padding-left: 4px; }
.mebox select { width: 100%; font-weight: 600; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .mebox {
    order: 3;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    display: flex;
    justify-content: flex-end;
  }
  .mebox .eyebrow { display: none; }
  .mebox select { width: auto; max-width: 100%; padding: 5px 26px 5px 8px; font-size: var(--fs-ml); }
  body.hasme .side .brand .wordmark { display: none; }
  /* room for the boat beside the class logo. v482: by hasme (you have a boat), not the picker showing, so Tune (no picker) keeps the same header */
  body.hasme .side .fleetbadge { margin-left: 0; flex: none; }
}

/* v392 Analytics: small cards; clicking one opens its numbers, tip and breakdown underneath, filling the screen */
/* v400 Analytics: the open card's whole breakdown on one screen on a laptop or desktop. The heading and its one line share a
   row; with a What to change panel the numbers are in its table (the card box would repeat them), with who and why under it */
/* v402: signed out, a strip over the page offering sign-in (shell.js #signBan) */
.signban[hidden] { display: none; }
.signban {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 16px 0;
  max-width: none;
}
.signban > span { flex: 1 1 220px; }
.signban-x {
  all: unset;
  cursor: pointer;
  padding: 2px 8px;
  font-size: var(--fs-xl);
  line-height: 1;
  color: var(--muted, #6e6e73);
}
.linkbtn { all: unset; cursor: pointer; color: var(--b); text-decoration: underline; }

/* v415 Analytics is one race at a time: the race picker sits in the sentence at the top */
/* v417 (i) buttons: how a number is worked out opens in a small dialog instead of text on the page */
.km header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* v501: one close button for every popup: round, grey, a drawn cross; a focus ring only when tabbed to */
.xbtn { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--fg); cursor: pointer; transition: background-color .15s var(--ease); }
.xbtn:hover { background: var(--line); }
.xbtn:focus { outline: none; }
.xbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the start card joins the grid: 1100-1499 px Start + Boat speed + Where you sailed, then Manoeuvres; 1500 px+ one row of eight */
/* phone and tablet: Start and Where you sailed (one card each) share the first row, then Boat speed, then Manoeuvres;
   subgrid keeps the two cards level when one heading wraps */
/* v444: on opening a replay the full screen button pulses and shows its label for 3 s */
@keyframes fs-pulse { 0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 0 rgba(228,87,46,.6); } 50% { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 9px rgba(228,87,46,0); transform: scale(1.08); } }
.replaybox .map-wrap .tools #zfull.fshint:not(.fsx) { position: relative; animation: fs-pulse 1s ease-in-out 3; }
.replaybox .map-wrap .tools #zfull.fshint:not(.fsx)::after {
  display: block;
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--fg);
  color: #fff;
  font: 500 14px/1.2 var(--body);
  padding: 6px 10px;
  border-radius: var(--r-s);
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  z-index: 20;
  animation: fs-tipin .25s ease-out;
}
@keyframes fs-tipin { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .replaybox .map-wrap .tools #zfull.fshint:not(.fsx) { animation: none; }
}

/* v480/v484: a demo's tour flashes the full screen and instruments buttons solid orange three times, naming each to its left */
@keyframes tour-flash { 0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 0 rgba(228,87,46,.7); }
  45%, 60% { background: var(--gain); color: #fff; border-color: var(--gain); transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 12px rgba(228,87,46,0); } }
.replaybox .map-wrap #zfull.tourflash:not(.fsx), .replaybox .map-wrap #instBtn.tourflash { position: relative; animation: tour-flash 1.1s ease-in-out 3; }
.replaybox .map-wrap #zfull.tourflash:not(.fsx)::after,
.replaybox .map-wrap #instBtn.tourflash::after {
  display: block;
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  background: var(--gain);
  color: #fff;
  font: 600 14px/1.2 var(--body);
  padding: 6px 10px;
  border-radius: var(--r-s);
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  z-index: 20;
  animation: fs-tipin .25s ease-out;
}
.replaybox .map-wrap #instBtn.tourflash::after { content: 'Instruments'; }
@media (prefers-reduced-motion: reduce) {
  .replaybox .map-wrap #zfull.tourflash:not(.fsx), .replaybox .map-wrap #instBtn.tourflash { animation: none; background: var(--gain); color: #fff; }
}

/* v445/v450: the boat picker leaves the map, as "Your boat" (side bar on desktop, header on a phone) does the same;
   it stays in full screen, where neither shows */
body.hasme .replaybox:not(.fsmode) .map-wrap > .racebar.onmap #trackSel { display: none; }

/* v452: with the boat picker gone the race picker takes more of the map's top (was 260 px on desktop) */
body.hasme .replaybox:not(.fsmode) .map-wrap > .racebar.onmap #raceSel2 { max-width: 440px; }
@media (max-width: 760px) {
  body.hasme .replaybox:not(.fsmode) .map-wrap > .racebar.onmap #raceSel2 { flex: 0 1 auto; max-width: 100%; }
  /* v456: as wide as the race's name, not the whole map */
  /* v452: phone header: tighter gaps and padding round the logo and class, so the boat's name has room */
  body.hasme .side { gap: 8px; }
  body.hasme .side .fleetbadge:not(.nologo) { padding: 6px; }
  body.hasme .side .clsbtn { padding: 5px 8px; column-gap: 4px; }
  .mebox select { padding-right: 24px; }
}

/* v457: phone full screen is just the map: race and boat pickers hide (v465: the B&G mast full size again) */
@media (max-width: 760px) {
  .replaybox.fsmode .map-wrap > .racebar.onmap { display: none; }
  /* v459/v460: a slim play bar: play/pause, the plain race slider (below) and the playback speed; no settings */
  .replaybox.fsmode .map-wrap > .scrub.onmap.dock { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding: 5px 6px 5px 5px; }
  .replaybox.fsmode .scrub.dock .dockrow > :not(#play):not(.winstrip):not(.spd):not(.rdsetgo) { display: none; }   /* v501: the ⚙ stays */
}

/* v465: the play bar is plain: play/pause, a thin race slider with its dot centred on the line, speed and Settings.
   v468: always (the legs are hidden; the start and finish handles are in Race settings) */
.replaybox .scrub.dock .docktop { display: none; }
.replaybox .scrub.dock #winStrip { margin: 0 8px; background: linear-gradient(rgba(19,38,61,.2), rgba(19,38,61,.2)) center / 100% 4px no-repeat; border-radius: 0; }
.replaybox #winStrip #scrub { left: -8px !important; width: calc(100% + 16px) !important; top: 50%; height: 16px; transform: translateY(-50%); }

/* v458: cleaner replay map, no clock on the play bar. v461: the round map buttons are one column at the bottom right,
   just above the play bar (Back to you to its left); the instruments button slides the B&G mast off the left edge and back */
.replaybox .map-wrap .maprail { top: auto; max-height: none; flex-flow: column nowrap; }
.replaybox .scrub.dock #clock { display: none; }
.replaybox .map-wrap .live.inst.mast { transition: transform .3s var(--ease, ease), opacity .3s; }
.replaybox .map-wrap .live.inst.mast.instoff { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .replaybox .map-wrap .live.inst.mast { transition: none; }
}

/* v464: the column sits clear of the imagery credit (drawn just above the play bar) and the buttons are bigger */
.replaybox .map-wrap .maprail, .replaybox .map-wrap .followrail { bottom: calc(var(--dockh, 52px) + 44px); }
.replaybox .map-wrap .maprail { gap: 10px; }
.replaybox .map-wrap .rbtn, .replaybox .map-wrap .frbtn { width: 50px; height: 50px; }
.replaybox .map-wrap .rbtn svg, .replaybox .map-wrap .frbtn svg { width: 24px; height: 24px; }
.replaybox .map-wrap .followrail { right: 78px; }
@media (max-width: 760px) {
  .replaybox .map-wrap .maprail, .replaybox .map-wrap .followrail { bottom: calc(var(--dockh, 52px) + 40px); }
  .replaybox .map-wrap .rbtn, .replaybox .map-wrap .frbtn { width: 48px; height: 48px; }
  .replaybox .map-wrap .followrail { right: 72px; }
}
.replaybox .map-wrap .maprail:has(.pickpop:not([hidden])) { z-index: 20; }

/* the open boat list over the mast and play bar */
/* the instruments button stays white when on (orange is for which boats show); the mast itself shows it's on */
.replaybox .map-wrap #instBtn[aria-pressed="true"],
.replaybox .map-wrap #instBtn[aria-pressed="true"]:hover {
  background: #fff;
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.22);
}

/* v458: desktop: the race picker is in the side bar above Your boat */
.racebox { margin: 0 0 4px; }
.racebox select { width: 100%; font-weight: 600; }
/* v1210: a date menu, then that day's races as buttons (common.js raceBox); the closed menu shows the date only */
#raceDay selectedcontent .rn { display: none; }
.racebox { grid-template-columns: minmax(0, 1fr); }   /* a long race name can't widen the side bar */
.racebox .daybtns { display: flex; flex-wrap: wrap; gap: 4px; }
.racebox .daybtns button { min-width: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: inherit; font: inherit; font-size: var(--fs-m); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.racebox .daybtns button:hover { background: var(--panel-2); }
.racebox .daybtns button[aria-pressed="true"] { background: #fbe6df; border-color: transparent; color: var(--gain); }
/* v1216: a training session's button (T1) is teal, not the orange of the race on screen; chosen, it fills with a teal tint and a solid edge */
.racebox .daybtns button[data-kind="training"] { border-color: #9ccfd2; color: #1f6f74; }
.racebox .daybtns button[data-kind="training"]:hover { background: #eaf6f6; }
.racebox .daybtns button[data-kind="training"][aria-pressed="true"] { background: #d7eeef; border-color: #1f7a80; color: #14595e; }
/* v1225: Replay's map on a day of several races: a slider at the top, T1 | Race 1 | Race 2 (common.js raceStep), level with full screen */
/* v1235: in full screen the slider sits in the pickers' row, beside the boat (Al) */
.replaybox .map-wrap > .racebar .racestep { position: relative; flex: none; display: flex; align-items: center; padding: 4px; border-radius: 99px; background: rgba(255,255,255,.94); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.22); font-weight: 600; font-size: var(--fs-ml); pointer-events: auto; touch-action: none; user-select: none; }
.replaybox .map-wrap > .racebar .racestep button { height: 32px; }
/* v1233: the slider sits in the side bar under the date (Al: was on the map) */
.racebox .racestep { position: relative; display: flex; overflow-x: auto; scrollbar-width: none; margin-top: 6px; padding: 4px; border-radius: 99px; background: var(--panel-2); font-weight: 600; font-size: var(--fs-m); touch-action: none; user-select: none; }
.racebox .racestep button { flex: 1 0 auto; height: 32px; padding: 0 10px; }
.replaybox:not(.fsmode) .racestep.fsonly { display: none; }   /* v1234: on the map only in full screen */
/* v1234: in full screen on a wide screen the turns panel floats over the map's right side, left of the map buttons */
.map-wrap > .rd-turns.onmap { position: absolute; z-index: 5; top: 64px; right: 72px; bottom: 96px; width: min(400px, 40%); max-height: none; padding: 12px; border-radius: var(--r-l, 16px); background: rgba(255,255,255,.95); box-shadow: 0 4px 18px rgba(0,0,0,.25); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.map-wrap > .rd-turns.onmap .spd-grid { grid-template-columns: minmax(0, 1fr); }
.map-wrap > .rd-turns.onmap .spd-card { margin: 0; padding: 0; box-shadow: none; background: none; }
.map-wrap > .rd-turns.onmap .spd-bar { display: none; }
.racestep .rs-thumb { position: absolute; left: 4px; top: 4px; bottom: 4px; width: 0; border-radius: 99px; background: var(--gain); box-shadow: 0 2px 6px rgba(228,87,46,.4); }
.racestep.ready .rs-thumb { transition: transform .18s var(--ease), width .18s var(--ease), background-color .18s; }
.racestep .rs-thumb.tr { background: #1f7a80; box-shadow: 0 2px 6px rgba(31,122,128,.4); }
.racestep button { position: relative; flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 99px; background: none; color: inherit; font: inherit; white-space: nowrap; cursor: pointer; transition: color .18s; }
.racestep button[data-kind="training"] { color: #1f6f74; }
.racestep button.on { color: #fff; }
.racestep button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* v467 Analytics: the finishing gap and the five parts that add up to it (gain.js). Time to find is green and
   time ahead is blue, as on the old cards; lost goes right of the line, gained left */
.an { background: var(--panel); border-radius: var(--r); max-width: 760px; }

/* v463: phone header: just the class logo (no BowDown logo once a class is picked), then the race and boat pickers side by side */
@media (max-width: 760px) {
  body.hasfleet .side .brand { display: none; }
  .side .racebox { order: 3; flex: 1 1 0; min-width: 0; margin: 0; display: flex; }
  .side .racebox .eyebrow { display: none; }
  .side .racebox select, .side .racebox + .mebox select { width: 100%; min-width: 0; padding: 5px 22px 5px 8px; font-size: var(--fs-ml); }
  /* v482: 14.5 px as the boat picker on the other pages, so the header is the same height */
  .side .racebox + .mebox { flex: 1 1 0; }
  .side .racebox + .mebox[hidden] { display: none; }
  .side:has(.racebox) { gap: 6px; overflow-x: visible; }
  /* v1210: the day's race buttons get their own row under the date and boat menus */
  .side:has(.daybtns) { flex-wrap: wrap; row-gap: 6px; }
  .side .racebox:has(.daybtns) { display: contents; }
  .side .racebox:has(.daybtns) > select { order: 3; flex: 1 1 0; min-width: 0; }
  .side .racebox .daybtns { order: 9; flex: 1 0 100%; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}

/* v466: the full screen button lines up with the map buttons under it: same size, same distance from the right */
.replaybox .map-wrap .tools #zfull:not(.fsx) { width: 50px; height: 50px; }
.replaybox .map-wrap .tools #zfull .fsi { font-size: var(--fs-xxl); }
#zfull.fsx, #zfull.fsx:hover, #zfull.fsx:active { width: 50px; height: 50px; }
.replaybox.fsmode #zfull.fsexit { top: 24px; right: 34px; }

/* desktop full screen: the map's top right corner (box padding 12 / 16 + 12 / 18) */
/* v466: phone: the map runs down under the floating tab bar to the foot of the screen; the play bar sits just above the tab bar */
@media (max-width: 760px) {
  .replaybox .map-wrap .tools #zfull:not(.fsx), #zfull.fsx, #zfull.fsx:hover, #zfull.fsx:active { width: 48px; height: 48px; }
  .replaybox:not(.fsmode) .map-wrap { border-radius: 0; }
  .replaybox:not(.fsmode) .map-wrap > .scrub.onmap { bottom: calc(var(--navsp, 84px) + 8px); }
  main:has(#replayBox) { padding-bottom: 0; }
}

/* v468: Race settings: a panel of sections (start and finish, wind, venue) over the map */
.rdset { max-width: 560px; margin-inline: auto 0; padding: 14px 18px 16px; }
.rdsethead b { font: 700 17px/1.2 var(--display, var(--body)); }
.rdsec { padding: 14px 0 2px; border-top: 1px solid var(--line); margin-top: 12px; }
.rdsec h4 { margin: 0 0 6px; font: 650 14px/1.2 var(--body); color: var(--fg); }
.rdsec .form { margin-top: 8px !important; }
.rdsecnote { margin: 0 0 10px; font-size: var(--fs-m); line-height: 1.4; color: var(--muted); }
.rdsecrow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rdsecrow .spacer { flex: 1; }
/* v1213: the wind in one line with Change at its right; the fields open under it (Al) */
.rdset .rdwline { margin-top: 0; flex-wrap: nowrap; align-items: baseline; }
.rdset .rdwline > span:first-child { min-width: 0; }
.rdvenue .form { grid-template-columns: minmax(0, 1fr); }
.rdset .rdwline b { font-weight: 650; }
#windEd .form { margin-top: 10px !important; }
.winstrip.winedit { height: 56px; margin: 0 8px; border-radius: var(--r-m); overflow: visible; }
.winstrip.winedit input[type=range]::-webkit-slider-thumb { height: 56px; width: 14px; }
.winstrip.winedit input[type=range]::-moz-range-thumb { height: 54px; width: 12px; }
.winstrip.winedit input[type=range] { z-index: 2; }
@media (max-width: 760px) {
  .rdset { margin-inline: 0; }
}

/* v470: Race settings, compact: wind's three fields on one row, venue and its save button on one row, slimmer strip */
.rdset .rdwind { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.rdset .f > span { font-size: var(--fs-sm); }
.rdset .f input, .rdset .f select { min-width: 0; width: 100%; }
.rdvenue .form { margin-top: 0 !important; }
.rdvenue { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; }
.rdvenue h4 { grid-column: 1 / -1; }
.rdvenue .rdsecrow { margin-top: 0; }
.rdvenue .rdsecrow .spacer { display: none; }
/* v1222: SIs: the saved copies as buttons that wrap, the course, a paste or course row (the panel scrolls, as .rdset does) */
.rdsititle { display: block; margin: 12px 0 6px; font-weight: 650; }
.rdsifiles, .rdsirow { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.rdsirow input { flex: 1 1 200px; min-width: 0; height: 38px; padding: 4px 10px; background: var(--panel); border: 1px solid #d2d2d7; border-radius: var(--r-m); }
.rdsicourse { margin: 0 0 4px; font-size: var(--fs-ml); }
.rdsiold { margin-top: 10px; }
.rdsiold1 { margin-top: 6px; }
.rdsiold1 .rdsecnote { margin-bottom: 0; }
.rdsibad, .rdsimsg { margin: 8px 0 0; }
.rdsibad { font-size: var(--fs-ml); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .rdset { padding: 10px 12px 12px; }
  .rdsethead b { font-size: var(--fs-l); }
  .rdsec { padding-top: 10px; margin-top: 8px; }
  .rdsec h4 { margin-bottom: 4px; font-size: var(--fs-m); }
  .rdsecnote { margin-bottom: 6px; font-size: var(--fs-sm); }
  .rdsecrow { margin-top: 6px; }
  .rdset .form { gap: 6px; margin-top: 4px !important; }
  .rdset .f { gap: 2px; }
  .rdset .f input, .rdset .f select { height: 38px; padding-block: 4px; }
  .rdset .rdwind select { padding-inline: 8px 22px; }
  .winstrip.winedit { height: 42px; }
  .winstrip.winedit input[type=range]::-webkit-slider-thumb { height: 42px; }
  .winstrip.winedit input[type=range]::-moz-range-thumb { height: 40px; }
}

/* v471: the full screen ✕ is the ⛶ button's twin: same size, same place (no white ring, which made it look bigger);
   only its colour says it closes */
#zfull.fsx, #zfull.fsx:hover, #zfull.fsx:active { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.22) !important; font-size: var(--fs-xxl); }
@media (max-width: 760px) {
  .replaybox.fsmode .map-wrap .tools { top: 12px; right: 14px; }
}

/* v471: the B&G mast stands at the bottom left of the map, just above the play bar (was half way up) */
.replaybox .map-wrap .live.inst.mast { top: auto; transform: none; }
.replaybox .map-wrap .live.inst.mast.instoff { transform: translateX(-110%); }

/* v472: the speed legend (a race with only your boat) at the map's top left, clear of the buttons and instruments
   (below the boat picker when that is on the map) */

/* v474: the B&G mast's bottom display lines up with the bottom map button on the right */
.replaybox .map-wrap .live.inst.mast { bottom: calc(var(--dockh, 52px) + 32px); }
@media (max-width: 760px) {
  .replaybox .map-wrap .live.inst.mast { bottom: calc(var(--dockh, 52px) + 28px); }
}

/* v476: phone, Race replay (body.rdmap): the map runs to the top of the screen too; the header (class logo,
   race, boat) and the Replay / Analytics tabs float over it as white bars with the tab bar's look */
@media (max-width: 760px) {
  body.rdmap .side { position: fixed; background: #fff; overflow: visible; }
  body.rdmap .subnav {
    position: fixed;
    z-index: 4;
    width: max-content;
    padding: 4px;
    gap: 4px;
    background: #fff;
    border: 1px solid rgba(19,38,61,.10);
    border-radius: var(--r-pill);
    box-shadow: 0 2px 6px rgba(19,38,61,.10), 0 10px 30px rgba(19,38,61,.22);
  }
  body.rdmap .subnav + main, body.rdmap main { padding-top: 0; }
  body.rdmap .replaybox:not(.fsmode) .map-wrap .tools { top: calc(var(--toph, 0px) + 10px); }
  /* v501: the full screen button is in the top right, level with the Replay / Analytics tabs (it had dropped below them) */
  body.rdmap .replaybox:not(.fsmode) .map-wrap .tools { top: max(8px, calc(var(--tabmid, 34px) - 24px)); }
  body.rdmap .replaybox .map-wrap .maptoast { top: calc(var(--toph, 0px) + 10px); }
  body.rdmap .replaybox:not(.fsmode) .rdset { max-height: calc(100% - var(--dockh, 90px) - var(--toph, 0px) - 24px); }
}

/* v478: phone header on Tune (no boat picker): the class logo stays at the left, where it is on the other pages */
@media (max-width: 760px) {
  body.hasfleet .side .fleetbadge { margin-left: 0; }
}

/* v479: phone Replay: the top bar is solid edge to edge again (as on the other pages); only the Replay / Analytics tabs float over the map */
@media (max-width: 760px) {
  body.rdmap .side {
    top: 0;
    left: 0;
    right: 0;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(19,38,61,.10);
  }
}

/* v482: the header and the side menu stay put as you move between pages: phone Replay's floating tabs sit where the
   tabs are on the other pages (left, 12 px in, 12 px under the header), and on desktop Tune keeps the boat picker's room */
@media (max-width: 760px) {
  body.rdmap .side { gap: 8px; }
  /* v485: Replay's header had v476's 6 px gaps, so its pickers sat 4 px left of Analytics' */
  body.rdmap .subnav { top: calc(var(--rdside-h, 64px) + 7px); left: 7px; right: auto; margin-inline: 0; }
}
.mebox.offpage { visibility: hidden; }
/* v688: desktop: Tune / Debrief / Rules sit right under the fleet badge and the Race and boat pickers (only on some pages) go below them, so the menu never moves */
@media (min-width: 761px) {
  .side > .mebox, .side > .clswrap { order: 1; }
  .side > .foot { order: 2; }
  .side > .mebox { margin-top: 0; }
}
@media (max-width: 760px) {
  .mebox.offpage { display: none; }
}

/* v483: Upload's Choose file button is orange, like the Upload tab */
.btn.primary.upchoose { background: var(--gain); border-color: var(--gain); color: #fff; }
.btn.primary.upchoose:hover { background: #cf4a23; border-color: #cf4a23; }
/* v707: the upload box leads with a big headline and the reason to upload */
.drop.uphero { padding: 44px 20px 32px; }
.drop.uphero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.15; color: var(--fg); }
.drop.uphero .uplead { margin: 0 auto 22px; max-width: 30em; font-size: 18px; line-height: 1.4; color: var(--fg); }
.drop.uphero .upchoose { font-size: 18px; padding: 14px 28px; }
.drop.uphero .small { margin-top: 16px; }

/* Upload: Race or Training */
.kindpick { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--panel-2); }
.kindpick button { all: unset; cursor: pointer; padding: 8px 18px; border-radius: var(--r-pill); font-weight: 600; color: var(--muted); }
.kindpick button[aria-pressed="true"] { background: var(--gain); color: #fff; box-shadow: 0 1px 3px rgba(19,38,61,.15); }
.kindpick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* v1059: Upload's fleet buttons (Optimist) and the race name BowDown sets */
.fleetpick { display: flex; flex-wrap: wrap; border-radius: var(--r-md, 12px); }
.fleetpick button { padding: 6px 14px; }
.autoname { display: grid; gap: 2px; padding: 8px 10px; margin-bottom: 6px; border-radius: 10px; background: var(--panel-2); }
.kindnote { margin: 6px 0 0; }
/* Replay settings: the runs on the strip, and the run chips */
.runchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.runchips button { all: unset; cursor: pointer; padding: 5px 12px; border-radius: var(--r-pill); background: var(--panel-2); font-size: var(--fs-sm); font-weight: 600; }
.runchips button[aria-pressed="true"] { background: var(--fg); color: var(--panel); }
.runchips button.runadd { background: none; border: 1px dashed var(--faint); color: var(--muted); }
.runchips button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* v503: the debrief (Analytics, your top 25%): compare switch, intro, ranked areas and one card per area */
.section.db { display: flex; flex-direction: column; gap: 12px; background: transparent; box-shadow: none; padding: 0; border: 0; }
.linkbtn { border: 0; background: none; font: inherit; color: var(--muted); min-height: 32px; cursor: pointer; }

/* v505: the debrief as a dashboard: bars are buttons, the picked one shows beside the chart; wide screens show one area */
@media (min-width: 1000px) {
  .section.db { display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-areas: "intro intro" "menu card" "next next"; gap: 16px; align-items: stretch; }
}

/* v509: Analytics starts at the same height as Replay's map */
main:has(.section.db) { padding-top: 10px; }
@media (max-width: 760px) { main:has(.section.db) { padding-top: 8px; } }
.db-key i { margin: 0 4px 0 12px; } .db-key i:first-child { margin-left: 0; }

/* the graph and the map share one spot everywhere, with the Graph | Map toggle */
@media (min-width: 1000px) {
  .section.db { grid-template-areas: "menu card"; }
}
/* phone: one area at a time, picked from a row of areas that scrolls sideways */
@media (min-width: 1000px) { .section.db { align-items: start; } .db-cards .db-card.on { height: auto; } }

/* v541 demo pre-start: countdown to the gun, top left of the map */
.startclock { position: absolute; left: 10px; top: 58px; z-index: 5; padding: 6px 12px; border-radius: 10px; background: rgba(19,38,61,.88); color: #fff; font: 700 26px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .5px; box-shadow: 0 2px 6px rgba(0,0,0,.2); pointer-events: none; }
.startclock[hidden] { display: none; }
@media (max-width: 760px) { .startclock { top: 136px; font-size: 22px; } .replaybox.fs .startclock { top: 12px; } }   /* below the Replay | Analytics switch; full screen: the corner */

/* v666: Rules page (pages/rules.js): rule chips, then the animation beside (desktop) or above (phone) the words */
.rules { max-width: 1320px; }
.rule-q { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--panel); color: var(--fg); font: inherit; font-size: 16px; }   /* v667: 16px stops iPhone zooming in on focus */
.rule-q:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rule-none { margin: 0 0 10px; }
.rule-pick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.rule-pick::-webkit-scrollbar { display: none; }
.rule-pick button { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--panel); color: var(--fg); font: inherit; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; }
.rule-pick button b { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.rule-pick button b .rule-ico { display: block; margin-left: auto; }   /* v770: Words, Start and Finish show an icon */
.rule-pick button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rule-pick button[aria-selected="true"] b { color: rgba(255,255,255,.7); }
.rule-vars { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin: -4px 0 12px; padding-bottom: 2px; scrollbar-width: none; }   /* v671: a rule's what-if variations */
.rule-vars::-webkit-scrollbar { display: none; }
.rule-vars .eyebrow { flex: none; margin: 0 2px 0 0; }
.rule-vars button { flex: none; padding: 6px 11px; border-radius: var(--r-pill); border: 1px dashed var(--line); background: none; color: var(--fg); font: inherit; font-size: var(--fs-s); font-weight: 600; cursor: pointer; }
.rule-vars button[aria-selected="true"] { border: 1px solid var(--gain); background: rgba(228,87,46,.1); color: var(--gain); }
.rule-vars button.tac { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--port); background: var(--port); color: #fff; }   /* v773: Use the rules: tactic chips, orange with a ⚡ */
.rule-vars button.tac[aria-selected="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--port); }
.rule-cite { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); background: var(--panel-2); font-size: var(--fs-xs); font-weight: 700; }
.rule-text blockquote { margin: 6px 0 12px; padding: 2px 0 2px 14px; border-left: 3px solid var(--gain); font-size: var(--fs-ml); line-height: 1.55; color: var(--fg); }   /* v679: the app's type, not Georgia */
.rule-text blockquote p { margin: 0 0 8px; }
.rule-text blockquote p:last-child { margin-bottom: 0; }
.rule-text blockquote b { font-weight: 700; color: var(--accent); }
.rule-text .eyebrow { color: var(--fg); font-weight: 700; }
.rule-pen { margin: 10px 0 14px; padding: 10px 12px; border-radius: var(--r-s); background: rgba(198,40,40,.07); border-left: 3px solid var(--bad); }
.rule-pen p { margin: 4px 0 0; }
.rule-say.bad { background: var(--bad); }
.rule-card { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }   /* v683: three cards: the scene, the words, the rule book's words */
.rule-words, .rule-text { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.rule-text > .small:last-child { margin-bottom: 0; }
.rule-anim { position: relative; border-radius: var(--r-m); overflow: hidden; align-self: start; }
.rule-anim > svg { display: block; width: 100%; height: auto; }
.rule-anim > canvas { position: absolute; top: 0; left: 0; width: 100%; height: auto; }   /* v678: the still sea (pages/rules.js ruleSea) under the boats */
.rule-anim > svg { position: relative; }
.rule-anim.sea { --water: transparent; --muted: rgba(255,255,255,.8); --faint: rgba(255,255,255,.6); --b: #5b9be0; background: #123358; }
.rule-anim.sea > svg { --fg: #fff; }
.rule-say { position: relative; display: block; padding: 12px; background: var(--accent); color: #fff; font-size: var(--fs-xl); font-weight: 600; line-height: 1.35; text-align: center; }   /* v708: larger and wraps, for older eyes */
.rule-end { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 8px; padding: 18px; background: rgba(12,34,60,.94); overflow-y: auto; color: #fff; opacity: 0; transition: opacity var(--t-slow); }   /* v690: what happens, faded in over the animation */
.rule-end.on { opacity: 1; }
.rule-end .eyebrow { color: rgba(255,255,255,.85); margin: 0; font-size: var(--fs-l); }
.rule-end b { font-size: 26px; line-height: 1.2; }   /* v708: the outcome, big enough to read at a glance */
.rule-end p { margin: 0; font-size: var(--fs-xl); line-height: 1.4; }
.rule-end.long { gap: 6px; padding: 14px 18px; }   /* v708: the longest answers a step smaller so they fit the square */
.rule-end.long b { font-size: var(--fs-xxl); }
.rule-end.long p { font-size: var(--fs-l); line-height: 1.35; }
.rule-end .rule-cite { margin-bottom: 8px; font-size: var(--fs-m); padding: 4px 11px; background: rgba(255,255,255,.18); color: #fff; }
.rule-end[hidden] { display: none; }
.rule-end.bare { background: transparent; justify-content: flex-end; }   /* v702: all clear with no answer: only the buttons, over the boats */
.rule-end .rule-play { background: #fff; color: #123358; }
.rule-ans { display: none; margin: 12px 0 14px; padding: 12px 14px; border-radius: var(--r-s); background: rgba(46,125,79,.08); border-left: 3px solid var(--stbd); opacity: 0; transition: opacity var(--t-slow); }   /* v697: PC: what happens in the card beside the animation */
.rule-ans.on { opacity: 1; }
.rule-ans b { display: block; font-size: var(--fs-l); margin: 2px 0 6px; }
.rule-ans p { margin: 0 0 8px; }
/* v1014: on a phone too the answer is in the card under the animation, so the boats stay in view (was over them) */
.rule-ans { display: block; }
.rule-end { background: transparent; }
.rule-end > :not(.rule-nav) { display: none; }
.rule-nav { align-self: stretch; display: flex; align-items: center; justify-content: center; gap: 14px; }   /* v700: previous, Play again, next */
.rule-step, .rule-nav-gap { flex: none; width: 44px; height: 44px; }
.rule-step { display: flex; align-items: center; justify-content: center; padding: 0; border: 1.5px solid rgba(255,255,255,.7); border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }
.rule-play { align-self: center; display: flex; align-items: center; gap: 6px; padding: 10px 16px; border: 0; border-radius: var(--r-pill); background: var(--accent); color: #fff; font: inherit; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.2); cursor: pointer; }
.rule-words h2 { margin: 4px 0 8px; font-size: var(--fs-xxl); line-height: 1.25; }
.rule-words p { line-height: 1.5; }
.rule-words ul { margin: 10px 0 14px; padding-left: 18px; line-height: 1.5; }
.rule-words li + li { margin-top: 6px; }
.rule-key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rule-key .rk { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rule-key .rk.give { background: var(--port); } .rule-key .rk.right { background: var(--stbd); margin-left: 8px; }
.rule-foot { margin-top: 12px; }
.rrs-view { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--bg); }   /* v686: the rulebook in the same window */
.rrs-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.rrs-bar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrs-pages { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 40px; }
.rrs-pg { position: relative; max-width: 900px; margin: 0 auto 12px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.rrs-pg canvas { display: block; width: 100%; height: 100%; }
.rrs-msg { text-align: center; margin-top: 40px; }
.rrs-hl { position: absolute; z-index: 1; background: rgba(255, 214, 0, .45); mix-blend-mode: multiply; border-radius: 2px; pointer-events: none; }   /* v699: the quoted words */
/* v746: the scene's column (words, rule book) and the full-screen button */
.rule-col { display: contents; }
.rule-col > .rule-foot { grid-column: 1 / -1; }
/* v774: one column at every width: the rule list across the top, What if, the card (animation left, words right), Use it in a race, the rule book */
.rule-side .rule-q { max-width: 320px; margin-bottom: 10px; }
.rule-use { margin-top: 14px; }   /* v1011: the Tactics tips sit in the right-hand box, under the answer */
.rule-use ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.5; }
.rule-use li + li { margin-top: 6px; }
/* v775: the link between the Rules and Tactics tabs */
.rule-link { margin: 12px 0 0; }
.rule-link a { color: var(--gain); font-weight: 600; text-decoration: none; }
.rule-text { margin-top: 14px; }
.rule-text > summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-text[open] > summary { white-space: normal; }
@media (min-width: 761px) {
  .rule-pick { flex-wrap: wrap; overflow: visible; }
  .rule-card { grid-template-columns: minmax(0, 1fr); }   /* v780: one column until there is room for both (a tablet gave the words card 24 px and the page scrolled sideways) */
  .rule-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .rule-col > .rule-foot { margin: 0; }
}
@media (min-width: 761px) { .rule-anim { max-width: 520px; } }
@media (min-width: 1100px) { .rule-card { grid-template-columns: minmax(300px, 520px) minmax(0, 1fr); } }
@media (max-width: 760px) {
  .rule-card { grid-template-columns: 1fr; gap: 12px; }
  .rule-words, .rule-text { padding: 14px; }
  .rule-anim { max-width: 420px; width: 100%; justify-self: center; }
  .rule-words h2 { font-size: var(--fs-xl); }
}
body.pg-rules #meBox, body.pg-rules .clswrap { display: none !important; }   /* v774: the Rules page needs none of them. v994: the class card shows (Al) */
/* v736: rule of thumb and "what changes" on the Rules page */
.rule-thumb { background: var(--card2, rgba(127,127,127,.12)); border-radius: 8px; padding: 6px 10px; margin: 8px 0; }
.rule-diff { margin: 4px 0 0; }
/* v767: the words page: plain words, the rule book's Definition folded under each */
.rule-words-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; max-width: 760px; }
.rule-words-list h2 { margin: 4px 0 8px; font-size: var(--fs-xxl); line-height: 1.25; }
.rule-words-list p { line-height: 1.5; }
.rule-words-list dt { font-weight: 700; margin-top: 14px; } .rule-words-list dd { margin: 2px 0 0; line-height: 1.5; }
.rule-def > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); margin-top: 4px; }
.rule-def p { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--muted); }
@media (max-width: 760px) { .rule-words-list { padding: 14px; } .rule-words-list h2 { font-size: var(--fs-xl); } }
.rule-text > summary { cursor: pointer; font-weight: 600; }   /* v759: the rule book's words fold away */
.rule-text[open] > summary { margin-bottom: 10px; }
.rule-end.long .rule-cite { margin-bottom: 2px; }

/* v903: desktop: the round person button sits at the top right of every page (as on the splash); the menu's Account item is phone-only */
.topme { display: none; }
@media (min-width: 761px) {
  #navMe { display: none; }
  .topme { all: unset; box-sizing: border-box; cursor: pointer; position: fixed; z-index: 60; top: 14px; right: 18px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--fg); box-shadow: 0 2px 8px rgba(0,0,0,.18); transition: background .2s, border-color .2s; }
  .topme[hidden] { display: none; }
  .topme svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .topme.in { background: var(--gain); border-color: var(--gain); color: #fff; }
  .topme:hover { border-color: var(--gain); }
  .topme.in:hover { border-color: #fff; }
  .topme:focus-visible { outline: 2px solid var(--gain); outline-offset: 2px; }
  .subnav { padding-right: 76px; }
}

/* v964: Upload's device guide: one card per device, its file types as small pills */
.updevs { margin-top: 0; }   /* v994: its own tab now */
.updevs h2 { margin: 0 0 4px; }
.updevs > p { margin: 0 0 14px; }
.updev { padding: 18px; gap: 10px; }
.updev h3 { margin: 0; font-size: var(--fs-l); }
.updev p { margin: 0; color: var(--muted); font-size: var(--fs-m); line-height: 1.5; }
.upfmt { display: flex; flex-wrap: wrap; gap: 6px; }
.upfmt span { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(228,87,46,.10); color: var(--gain); }
/* v974: the boatshed card looks different: a dashed orange edge you can drop a file on */
.shed { margin-top: 16px; padding: 18px 20px; border: 2px dashed var(--gain); border-radius: var(--r-l); background: rgba(228,87,46,.06); display: grid; gap: 10px; }
.shed h3, .shed p { margin: 0; }
.shed .row { gap: 10px; align-items: center; flex-wrap: wrap; }
/* v964: the upload box shows it takes a dropped file: a clearer dashed edge and a "drag and drop" line */
.drop.uphero { border-color: var(--faint); }
.drop.uphero.over { border-color: var(--gain); background: rgba(228,87,46,.05); }
.drop.uphero .updrag { display: inline-flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: var(--fs-l); font-weight: 600; color: var(--fg); }
/* v971: button on its own line, drag hint under it, facts as soft pills */
.drop.uphero .upchoose { display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; }
.drop.uphero .updrag { display: flex; justify-content: center; margin: 14px 0 0; font-size: var(--fs-ml); font-weight: 500; color: var(--muted); }
.drop.uphero .upfacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 26px auto 0; padding: 0; max-width: 40em; }
.drop.uphero .upfacts li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(127,127,127,.09); color: var(--fg); font-size: var(--fs-sm); line-height: 1.3; }
.drop.uphero .upfacts li::before { content: "\2713"; color: var(--gain); font-weight: 700; }
/* v966: Upload's save form is a five-step wizard: numbered steps across the top, one step shown, Back / Next below */
.wz h2 { margin: 0 0 4px; }
.wz [data-wz] > .small.muted { margin: 0 0 12px; }
.wz [data-wz] > .f, .wz .kindpick { margin-bottom: 12px; }
.wzbar { list-style: none; display: flex; gap: 4px; margin: 0 0 20px; padding: 0; }
.wzbar li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: var(--fs-s); color: var(--faint); text-align: center; position: relative; }
.wzbar li::before { content: ""; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.wzbar li:first-child::before { display: none; }
.wzbar li b { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); font-size: var(--fs-sm); }
.wzbar li.done { color: var(--muted); }
.wzbar li.done b { background: var(--good); color: #fff; }
.wzbar li.done::before, .wzbar li.on::before { background: var(--good); }
.wzbar li.on { color: var(--fg); font-weight: 600; }
.wzbar li.on b { background: var(--gain); color: #fff; }
.wzbar li.skip { opacity: .35; }
.wzmsg { min-height: 1.2em; margin-top: 10px; }
.wznav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.wznav [hidden] { display: none; }
.wzgo { display: flex; }
.pillbtn { border-radius: 999px; min-width: 120px; justify-content: center; }
/* v969: a box that must be filled in has an orange star */
.req { color: var(--gain); font-style: normal; font-weight: 700; }
/* v969: the wizard's steps sit in one grid cell; a hidden step keeps its room (invisible), so the box never changes height */
.wzsteps { display: grid; }
.wzsteps > [data-wz] { grid-area: 1 / 1; min-width: 0; }
.wzsteps > .wzoff { visibility: hidden; }
/* the whole file already saved: the form greyed out, nothing to tap (Al) */
.wzsteps.wzdup { opacity: .45; filter: grayscale(1); pointer-events: none; }
/* v969: the wizard's last step: one card for the boat, one for the races and who already uploaded each */

/* v981: Upload page in two columns: Your tracks on the left, the uploader, map and save form on the right (Al) */
/* v983: Your tracks wider, full-size rows with the buttons beside each track (Al) */
/* v984: Your tracks rows wider still: up to 45% of the page, so each track's line fits (Al) */
.uplay { display: grid; grid-template-columns: minmax(380px, min(45%, 760px)) minmax(0, 1fr); gap: 24px; align-items: start; }
/* v1015: Upload and Your tracks on one page (Al). v1016: the page is for managing tracks: a small drop box and a small map
   side by side at the top, then Your tracks full width, the tracks in columns */
.uplay { display: block; }
/* v1089: layout B (Al): the upload box on its own; once you have tracks it is one line. The picked track's row opens with its map,
   and every edit for it (cut, change race, rename, delete) is on that map */
.uptop { display: block; }
.uplay.hastracks .uptop .drop.uphero { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px; padding: 12px 18px; }
.uplay.hastracks .uptop .drop.uphero :is(h1, .uplead) { display: none; }
.uplay.hastracks .uptop .drop.uphero .upchoose { font-size: var(--fs-m); padding: 8px 18px; }
.uplay.hastracks .uptop .drop.uphero .updrag { margin: 0; }
.uptop .drop.uphero { padding: 18px 16px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; }
.uptop .drop.uphero h1 { font-size: 22px; margin-bottom: 4px; }
.uptop .drop.uphero .uplead { font-size: var(--fs-ml); margin-bottom: 12px; }
.uptop .drop.uphero .upchoose { font-size: 16px; padding: 10px 22px; align-self: center; }
.uptop .drop.uphero .updrag { margin-top: 10px; }
.uptop .drop.uphero .upfacts { display: none; }
.mtrow > .mtmap { grid-column: 1 / -1; width: 0; min-width: calc(100% + 18px);   /* width 0: the canvases never widen the list */ margin: 4px -6px 2px -12px; cursor: default; }
.mtmap .map-wrap { position: relative; aspect-ratio: auto; height: 340px; }
.mtmap.mtediting .map-wrap { height: 520px; }
.mtmap #mtCutMap[hidden] { display: none; }
.mtmap #mtCutMap { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; background-size: 100% 100%; background-color: #1c2b33; }
.mttools { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
/* v1176: the top bar's buttons (.tbbtn) on the map: a navy pill, an orange icon circle, orange while open (Al) */
.mttool { pointer-events: auto; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 4px 15px 4px 4px; border-radius: 999px; background: rgba(19,38,61,.9); border: 1px solid rgba(255,255,255,.18); color: #fff; font: inherit; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 10px rgba(0,0,0,.28); transition: background .2s, border-color .2s; }
.mttool .ic { width: 30px; height: 30px; border-radius: 50%; background: var(--gain); display: grid; place-items: center; flex: none; }
.mttool svg { width: 16px; height: 16px; color: #fff; }
.mttool b { font: 600 14px/1 var(--display); }
.mttool .mtcaret { margin-left: -2px; }
.mttool:hover { background: rgba(19,38,61,.97); border-color: rgba(228,87,46,.8); }
.mttool:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mttool.on { background: var(--gain); border-color: var(--gain); }
.mttool.on .ic { background: #fff; }
.mttool.on svg { color: var(--gain); }
.mttool.mtx .ic { background: var(--bad); }
.mttool.mtx:hover { border-color: rgba(198,40,40,.9); }
.mttool.mtx.on { background: var(--bad); border-color: var(--bad); }
.mttool.mtx.on svg { color: var(--bad); }
.mtright { margin-left: auto; display: inline-flex; gap: 6px; }   /* v1180: Delete and Expand, round icons at the right (Al) */
.mttool.mtround { width: 40px; padding: 4px; justify-content: center; }
.mtright .mtmenu { left: auto; right: 0; }
.mtcutpill { background: var(--panel-2); color: var(--muted); }
/* v1176: Expand: 75% of the screen on a computer */
.mtmap.mtbigon { position: fixed; z-index: 61; left: 12.5vw; top: 12.5vh; width: 75vw; min-width: 0; margin: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 100vmax rgba(10,14,20,.6), 0 20px 60px rgba(0,0,0,.45); background: #1c2b33; }
.mtmap.mtbigon .map-wrap, .mtmap.mtbigon.mtediting .map-wrap { height: 75vh; border-radius: 0; }
.mtdd { position: relative; display: inline-flex; }   /* v1095: a small menu drops under its button (Al) */
.mtcaret { font-size: 11px; opacity: .7; }
.mtmenu { pointer-events: auto; position: absolute; top: calc(100% + 4px); left: 0; z-index: 3; min-width: 200px; max-width: 280px; max-height: 260px; overflow-y: auto; display: grid; gap: 6px; padding: 6px; box-sizing: border-box; background: #fff; color: #1c1c1e; border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.mtmenu p { margin: 4px 6px 0; white-space: normal; }
.mtmenu .muted { color: #5b6170; }
.mtmenu .row { gap: 6px; }
.mtmenu input { font: inherit; padding: 6px 8px; border: 1px solid #c8ccd4; border-radius: 7px; }
.mtmenu .mtmsg:empty { display: none; }
.mtmi { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: inherit; font: inherit; font-size: var(--fs-sm); white-space: nowrap; cursor: pointer; }
.mtmi:hover, .mtmi:focus-visible { background: #eef1f6; }
.mtmap .mtedit { position: absolute; left: 14px; bottom: 14px; z-index: 2; width: min(500px, calc(100% - 28px)); max-width: none; box-sizing: border-box; display: grid; gap: 8px; padding: 12px 16px; background: rgba(255,255,255,.95); color: #1c1c1e; border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.mtmap #mtEdBox, .mtmap #mtCutBox { position: static; }
.mtmap .mtcut p, .mtmap .mtedit p { margin: 0; }
.mtmap .mtcut .row, .mtmap .mtedit .row { gap: 8px; align-items: center; }
.mtmap .mtedit .muted, .mtmap .mtcut .muted { color: #5b6170; }

.uplay .mytracks { margin-top: 24px; }
.upmain { min-width: 0; }
.upmain .cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
/* a file is open: the upload box shrinks to one line and the uploader takes the page; Your tracks waits under it */
.upmain:has(#upStep > *) .uphero { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 16px; padding: 12px 18px; }
.upmain:has(#upStep > *) .uphero :is(h1, .uplead, .upfacts) { display: none; }
.upmain:has(#upStep > *) .uphero .updrag { margin: 0; }
.mtrow { cursor: pointer; }
.mtrow.sel { background: var(--panel-2); }
@media (max-width: 760px) {
  /* v1089: on a phone the map is too small to float the edits on: they sit under it */
  .mtmap .map-wrap { height: 240px; }
  .mtmap.mtediting .map-wrap { height: 70vh; }
  .mtmap .mtcut { padding: 10px 12px; gap: 6px; }
  .mtcuttop { gap: 8px 10px; } .mtnudge .btn { padding: 3px 6px; font-size: 12px; } .mtct b { font-size: 15px; }
  .mtcutfoot p { flex-basis: 100%; min-width: 0; }
  .mtcutfoot .btn { flex: 1; }
  .mttool { padding: 4px; } .mttool b, .mttool .mtcaret { display: none; }
  .mttool[data-mted="race"] { padding-right: 12px; } .mttool[data-mted="race"] b { display: inline; font-size: 0; } .mttool[data-mted="race"] b::before { content: 'Move race'; font-size: 13px; }   /* v1180: a short label on a phone */
  .mtmap.mtbigon { left: 0; top: 0; width: 100vw; border-radius: 0; } .mtmap.mtbigon .map-wrap, .mtmap.mtbigon.mtediting .map-wrap { height: 100vh; height: 100dvh; }
  .mtmap .mtedit { position: static; width: auto; padding: 10px 2px 2px; background: none; box-shadow: none; color: inherit; }
  .mtmap .mtedit .muted { color: var(--muted); }
  .mtrow > .mtmap { margin-inline: -6px; }
}
/* v977: Upload page: Your tracks (rename, change race, delete) */
.mytracks { margin-top: 28px; }
.mthead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.mthead h2 { margin: 0; }
.mtday { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 8px; padding: 8px 4px; border: 0; background: none; color: var(--fg); font: inherit; font-size: var(--fs-m); text-align: left; cursor: pointer; border-radius: var(--r-s); }   /* v1045: one heading per race day; tap to open or fold */
.mtday:first-of-type { margin-top: 0; }
.mtday:hover { background: var(--panel-2); }
.mtday .mtchev { flex: none; color: var(--muted); transition: transform .18s; }
.mtday.open .mtchev { transform: rotate(90deg); }
/* v1027: one line per track, a table with a column each (Al); the columns come from COLS in upload.js via --mtcols */
.mtlist { display: grid; grid-template-columns: var(--mtcols) minmax(max-content, 1fr); column-gap: 20px; row-gap: 6px; position: relative; }
/* v1039: each track its own card on one line; the date where the picture was; the orange bar slides to the track picked (Al) */
.mtrow, .mtcols { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; row-gap: 4px; padding: 6px 12px 6px 18px; }
.mtrow { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m, 12px); transition: background .15s, box-shadow .18s, transform .18s; }
.mtcols { border-top: 0; padding-block: 8px 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mtrow:hover { background: var(--panel-2); }
.mtrow:not(.sel):hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.mtrow::before { content: ""; position: absolute; left: 5px; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--gain); opacity: 0; transform: scaleY(.3); transition: opacity .2s, transform .2s; }
.mtrow:not(.sel):hover::before { opacity: .35; transform: none; }
.mtbar { position: absolute; left: 6px; width: 4px; border-radius: 4px; background: var(--gain); z-index: 1; pointer-events: none; }
.mtbar.go { transition: top .35s cubic-bezier(.3, 1.4, .5, 1), height .35s; }
.mtmore { display: flex; gap: 6px; opacity: 0; transform: translateX(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.mtrow.sel .mtmore, .mtrow.on .mtmore { opacity: 1; transform: none; pointer-events: auto; }   /* only the picked track shows its edit icons (Al) */
.mtrow.on { background: var(--panel-2); }
.mtthumb { width: 48px; height: 32px; border-radius: var(--r-s); background: var(--water); display: block; }
.mtc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.mtc-name { font-size: var(--fs-ml); }
.mtc .pill { font-size: var(--fs-xs); }
.mtacts.mtwide { grid-column: 1 / -1; }
.mtrow .mti { width: 32px; height: 32px; border-radius: 8px; border-color: transparent; background: var(--panel-2); transition: background .15s, color .15s, border-color .15s, transform .15s; }
.mtrow .mti:hover { transform: translateY(-1px); }
.mtrow .mti:active { transform: scale(.94); }
.mtrow .mtgo { background: var(--accent); }
.mtrow .mti svg { width: 16px; height: 16px; }
.mtacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mti { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--fg); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.mti:hover, .mti.on { border-color: var(--accent); color: var(--accent); }
.mtgo { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mtgo:hover { filter: brightness(1.25); color: var(--accent-ink); }
.mtx:hover { border-color: var(--bad); }
.mtacts { align-items: center; }
.mtask { font-size: var(--fs-sm); margin-right: 4px; }
.mtdanger svg { width: 15px; height: 15px; vertical-align: -2px; }
.mtx:hover, .mtdanger { color: var(--bad); }
.mtdanger { border-color: var(--bad); }
.mtdanger:hover { background: var(--bad); color: #fff; }
.mtedit { grid-column: 1 / -1; justify-self: start; width: 100%; display: grid; gap: 8px; padding: 10px 0 2px; max-width: 460px; }
.mtedit p { margin: 0; }
.mtedit .row { gap: 8px; align-items: center; }
/* v1052: one line, two handles: green start, dark finish, orange between (Al) */
/* v1176: the cut strip along the foot of the map: start, finish, kept; the speed over time with the cut ends shaded; a bar handle each end (Al) */
.mtmap .mtcut { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; gap: 8px; padding: 12px 16px; background: rgba(255,255,255,.96); color: #1c1c1e; border-top: 1px solid rgba(19,38,61,.1); }
.mtmap .mtcut p { margin: 0; }
.mtcuttop { display: flex; align-items: flex-start; gap: 10px 24px; }
.mtct { display: flex; flex-direction: column; gap: 2px; }
.mtct .mtnudge { margin-top: 4px; }
.mtct > span:first-child { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #5b6170; }
.mtct b { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; }
.mtct.s > span:first-child { color: var(--good); }
.mtct.k { margin-left: auto; text-align: right; }
.mtct.k b { color: #e8613a; }
.mtnudge { display: inline-flex; gap: 4px; }
.mtnudge .btn { padding: 4px 8px; font-weight: 500; white-space: nowrap; }
.mtrange { position: relative; height: 52px; border-radius: 8px; background: #eef0f3; }
.mtrange canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; }
.mtshade { position: absolute; top: 0; bottom: 0; pointer-events: none; background: repeating-linear-gradient(135deg, rgba(110,110,120,.3) 0 4px, transparent 4px 8px); }
#mtCutL { left: 0; border-radius: 8px 0 0 8px; } #mtCutR { right: 0; border-radius: 0 8px 8px 0; }
.mtcutaxis { display: flex; justify-content: space-between; margin-top: -4px; font-family: var(--mono); color: #5b6170; }
.mtcutfoot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mtcutfoot p { flex: 1; min-width: 220px; }
.mtcutfoot .mtmsg:empty { display: none; }
.mtmkl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }   /* v1183: Fix marks */
.mtmkc { display: inline-flex; align-items: center; border: 1px solid rgba(19,38,61,.18); border-radius: 999px; background: #fff; }
.mtmkc button { border: 0; background: none; font: inherit; font-size: 13px; color: #1c1c1e; padding: 4px 4px 4px 10px; cursor: pointer; }
.mtmkc button + button { color: #c0392b; font-size: 16px; line-height: 1; padding: 4px 10px 4px 4px; }
.mtmkc.on { border-color: #e8613a; box-shadow: 0 0 0 2px rgba(232,97,58,.25); }
.mtmkc::before { content: ''; width: 10px; height: 10px; margin-left: 8px; border-radius: 50%; background: #f2a900; }
.mtlink { border: 0; background: none; padding: 0; font: inherit; color: #13263d; font-weight: 600; text-decoration: underline; cursor: pointer; }
/* v1216: Fix marks from the Race replay: the Your tracks editor full screen over the replay; a side panel on a computer, a sheet at the foot on a phone */
.mtmap.mkfix { position: fixed; inset: 0; z-index: 1002; overflow: hidden; background: #1c2b33; overscroll-behavior: contain; }
.mtmap.mkfix .map-wrap { height: 100%; max-height: none; border-radius: 0; }
.mtmap.mkfix .mtcut { max-height: 60vh; overflow-y: auto; }
.mtmap.mkfix .mtcutfoot p { flex-basis: 100%; min-width: 0; }
.mtmap.mkfix .mtcutfoot .btn { flex: 1; white-space: nowrap; }
@media (min-width: 761px) { .mtmap.mkfix .mtcut { top: 0; right: auto; width: 340px; max-height: none; align-content: start; border-top: 0; border-right: 1px solid rgba(19,38,61,.1); } }
/* v1263 (Al): Fix marks: zoom buttons on the map, and a tidier panel (title, marks as a list, the picked mark's choices, Save at the foot) */
.mkzoom { position: absolute; right: 16px; top: 72px; z-index: 3; display: grid; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.mkzoom button { width: 44px; height: 44px; border: 0; background: none; color: #13263d; font: 600 22px/1 var(--body); cursor: pointer; display: grid; place-items: center; }
.mkzoom button + button { border-top: 1px solid rgba(19,38,61,.12); }
.mkzoom button:hover { background: #f1f4f8; }
.mkzoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mtmap.mkfix .mtmk { gap: 14px; padding: 18px 18px 16px; }
.mkhead { display: grid; gap: 2px; }
.mkhead h2 { margin: 0 0 2px; font: 800 20px/1.2 "Archivo", var(--display); color: #13263d; }
.mklist { display: grid; gap: 4px; }
.mkrow { display: flex; align-items: center; border-radius: 10px; background: #f3f5f8; }
.mkrow.on { background: #fdece6; box-shadow: inset 3px 0 0 #e8613a; }
.mkname { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; padding: 10px 12px; font: 600 14px var(--body); color: #13263d; text-align: left; cursor: pointer; }
.mkname i { width: 12px; height: 12px; border-radius: 50%; background: #f2a900; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(19,38,61,.2); flex: none; }
.mkx { border: 0; background: none; color: #8a93a3; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.mkx:hover { color: #c0392b; background: rgba(192,57,43,.08); }
.mkx svg { width: 14px; height: 14px; }
.mkadd { justify-self: start; margin-top: 4px; }
.mkedit { display: grid; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid rgba(19,38,61,.12); }
.mtmap.mkfix .mtcutfoot { position: sticky; bottom: -16px; margin: 0 -18px -16px; padding: 12px 18px 16px; background: rgba(255,255,255,.98); border-top: 1px solid rgba(19,38,61,.1); }
.mtrange input[type=range] { position: absolute; left: -7px; right: -7px; top: -4px; width: calc(100% + 14px); height: 60px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.mtrange input[type=range]::-webkit-slider-runnable-track { background: none; height: 60px; }
.mtrange input[type=range]::-moz-range-track { background: none; }
.mtrange input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 14px; height: 60px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); background: #13263d; cursor: ew-resize; }
.mtrange input[type=range]::-moz-range-thumb { pointer-events: auto; box-sizing: border-box; width: 14px; height: 60px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); background: #13263d; cursor: ew-resize; }
.mtrange #mtCutS::-webkit-slider-thumb { background: #2a9d5c; }
.mtrange #mtCutS::-moz-range-thumb { background: #2a9d5c; }
.mtrange input[type=range]:disabled::-webkit-slider-thumb { opacity: .4; }
.mtmsg { color: var(--warn); }
.mtother { margin-top: 18px; }
.fbothers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0 4px; padding: 0 10px; }   /* v1070: your other classes under the class card; v1083: small cards like Also sail in Settings */
.fbothers .fbo { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 8px 2px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2, #f4f5f7); color: var(--muted, #6b7686); cursor: pointer; font: 500 11px/1.2 var(--body, inherit); }
.fbothers .fbo:hover { border-color: #f5b49d; background: #fdf6f3; color: var(--fg); }
.fbothers .fbo img { height: 24px; width: 30px; object-fit: contain; filter: grayscale(1); opacity: .7; }
.fbothers .fbo:hover img { filter: none; opacity: 1; }
.fbothers .fbo b { font-weight: 500; text-align: center; overflow-wrap: anywhere; }
.fbothers .fbo span { font-size: 10px; color: var(--muted, #888); }
.fbdrop { position: fixed; z-index: 60; overflow-y: auto; overscroll-behavior: contain; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; }   /* v1058: Change class drop-down on Upload */
.fbdi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; border-radius: 8px; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.fbdi > span:nth-child(2) { flex: 1; }
.fbdi:hover { background: var(--panel-2); }
.fbdi.on { font-weight: 700; background: var(--panel-2); }
.fbdl { width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.fbdl img { max-width: 28px; max-height: 28px; }
.mtother h3 { margin: 0 0 2px; font-size: 15px; }
.mtother .row { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@media (max-width: 640px) {
  /* v1027: a phone has no room for the columns: each track wraps its cells under the name */
  .mtlist { display: block; }
  .mtcols { display: none; }
  .mtrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px 10px 18px; margin-bottom: 6px; }
  .mtc { white-space: normal; }
  .mtc-name { flex-basis: calc(100% - 60px); }
  .mtc:not(.mtc-name, .mtc-kind) { color: var(--muted); }
  .mtacts { flex-basis: 100%; justify-content: flex-start; }
  .mtask { flex-basis: 100%; }
  .mtedit { grid-column: 1 / -1; flex-basis: 100%; }
}
/* v979: Upload step 2: boat name and class together in one box, clearly required; the rest folded away as optional */
.wzneed { background: rgba(228,87,46,.06); border: 1px solid rgba(228,87,46,.25); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 12px; }
.wzmore summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.wzmore .form { margin-top: 10px; }
.wzkind { margin: 4px 0 14px; }
.kindrow { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.kindrow > span { font-weight: 600; }

/* v987: one navy top bar on every page (Al): logo, class badge, Tune, Debrief, Tactics, Racing rules, Upload tracks, Account,
   all the same pill (the page you're on filled orange); the side menu lists the page's own tabs. Phone: a slim bar with
   Rules, Upload and Account as round buttons; Tune, Debrief and Tactics stay in the bottom tabs */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 20px; background: #13263d; color: #fff; box-sizing: border-box; }
.topbar .brand { padding: 0; margin-right: 8px; cursor: pointer; }
.topbar .brand b.wordmark { color: #fff; font-size: 24px; }
.topbar .fleetbadge { flex: none; margin: 0; }
.topbar .fleetbadge:not(.nologo) { width: auto; padding: 3px 8px; border-radius: var(--r-m); }
.topbar .fleetbadge:not(.nologo) .fb-logo { width: 52px; height: 34px; }
.tbnav { display: flex; gap: 6px; margin-left: auto; }
.tbbtn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 4px 15px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); color: #fff; white-space: nowrap; transition: background .2s, border-color .2s; }
.tbbtn .ic { width: 30px; height: 30px; border-radius: 50%; background: var(--gain); display: grid; place-items: center; flex: none; }
.tbbtn svg { width: 16px; height: 16px; color: #fff; }
.tbbtn b { font: 600 14px/1 var(--display); }
.tbbtn:hover { background: rgba(255,255,255,.12); border-color: rgba(228,87,46,.8); }
.tbbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tbbtn[aria-current="page"] { background: var(--gain); border-color: var(--gain); }
.tbbtn[aria-current="page"] .ic { background: #fff; }
.tbbtn[aria-current="page"] svg { color: var(--gain); }
.topbar .topme { all: unset; box-sizing: border-box; cursor: pointer; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.25); color: #fff; }
.topbar .topme[hidden] { display: none; }
.topbar .topme svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar .topme.in { background: var(--gain); border-color: var(--gain); }
.topbar .topme:hover { border-color: #fff; }
.topbar .topdemo svg { fill: currentColor; stroke: none; }   /* v1049: the admins' Shifty preview, left of the profile button */
/* v1062: the Shifty button is the BowDown boat rocking on moving waves (Al picked it over a plain play triangle, which read as YouTube) */
.topbar .topdemo { position: relative; overflow: hidden; }
.topbar .topdemo .sboat { width: 28px; height: 28px; stroke: none; animation: sboat 2.4s ease-in-out infinite; }
.topbar .topdemo .swave { position: absolute; left: -40px; bottom: 2px; width: 120px; height: 8px; fill: none; stroke: #5fb4ff; stroke-width: 1.6; animation: swave 2.4s linear infinite; }
@keyframes sboat { 0%, 100% { transform: translateY(1px) rotate(-7deg); } 50% { transform: translateY(-3px) rotate(7deg); } }
@keyframes swave { to { transform: translateX(20px); } }
@media (prefers-reduced-motion: reduce) { .topbar .topdemo .sboat, .topbar .topdemo .swave { animation: none; } }
.topbar .topdemo:not([hidden]) + .topme { margin-left: 8px; }
/* v1053: Shifty slides out from the right at its own phone width. A phone: Shifty covers the page */
.shiftyside { position: fixed; z-index: 2050; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: #13263d; transform: translateX(100%); visibility: hidden; transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s .3s; }
.shiftyside iframe { border: 0; width: 100%; height: 100%; display: block; }
body.shiftyon .shiftyside { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.shiftydim { display: none; }
body { transition: padding-right .3s cubic-bezier(.2,.8,.2,1); }   /* the Replay analytics side (body.anon) */
/* v1246: a computer: Shifty is a floating card over a still page that dims (Al picked A, docs/mockups/shifty-panel-options.html); nothing on the page moves.
   The Shifty button turns into the × in the same spot; a click on the dimmed page closes it too */
@media (min-width: 761px) {
  .shiftyside { top: 74px; right: 12px; bottom: 12px; width: 480px; border-radius: 18px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 24px 60px rgba(0,0,0,.55); transform: translateX(calc(100% + 24px)); opacity: 0; transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .25s, visibility 0s .38s; }
  body.shiftyon .shiftyside { opacity: 1; transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .2s; }
  .shiftydim { display: block; position: fixed; z-index: 2045; inset: 64px 0 0 0; background: rgba(6,14,26,.5); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
  body.shiftyon .shiftydim { opacity: 1; visibility: visible; cursor: pointer; transition: opacity .3s; }
  body.mapfs .shiftyside { top: 12px; } body.mapfs .shiftydim { top: 0; }
}
.topbar .topdemo .sx { position: absolute; inset: 0; display: grid; place-items: center; font: 700 24px/1 var(--body); opacity: 0; transform: rotate(-90deg) scale(.5); transition: opacity .25s, transform .3s cubic-bezier(.2,.8,.2,1); }
.topbar .topdemo .sboat, .topbar .topdemo .swave { transition: opacity .2s; }
body.shiftyon .topbar .topdemo { background: #fff; border-color: #fff; color: #13263d; }
body.shiftyon .topbar .topdemo .sboat, body.shiftyon .topbar .topdemo .swave { opacity: 0; }
body.shiftyon .topbar .topdemo .sx { opacity: 1; transform: none; }
/* v1217: analytics beside the Replay map on a PC (app/mapan.js), where Shifty slides out; tabs A, B and C are three layouts to try (Al) */
body.anon { padding-right: 400px; }
@media (max-width: 999px), (hover: none) { #anBtn, .anside { display: none !important; } body.anon { padding-right: 0; } }
.an-ic.tack { background: var(--b); } .an-ic.gybe { background: var(--gain); } .an-ic.top, .an-ic.bottom { background: #c58a00; }
.an-leg em.g { color: var(--good); } .an-leg em.o { color: var(--warn); }
/* v1066: hover popup on the Shifty button (a computer with a mouse): today's fastest times */
/* v1088: white card with a white glow (Al's mockup) */
.shiftytip { position: fixed; z-index: 2040;   /* v1067: above the splash (2000), under the Shifty panel (2050) */ width: 320px; box-sizing: border-box; padding: 18px 18px 14px; border-radius: 16px; background: #fff; color: #14213d; font: 400 14px/1.3 var(--body); box-shadow: 0 0 0 1px rgba(255,255,255,.6), 0 0 28px 6px rgba(255,255,255,.35), 0 0 70px 14px rgba(120,170,255,.25); opacity: 0; transform: translateY(-6px); transition: opacity .15s, transform .15s; }
.shiftytip.on { opacity: 1; transform: none; }
.shiftytip::before { content: ""; position: absolute; top: -7px; right: var(--ar, 20px); width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border-radius: 2px; }
.shiftytip .tipeb { font-size: 13px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--gain); }
.shiftytip .tiph { font-size: 20px; font-weight: 800; line-height: 1.2; margin: 8px 0 4px; }
.shiftytip .tipfe { display: flex; justify-content: space-between; margin: 14px 0; }
.shiftytip .tipfe > div { width: 70px; text-align: center; }
.shiftytip .tipic { width: 46px; height: 46px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--gain); display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; }
.shiftytip .tipic svg { width: 26px; height: 26px; stroke: var(--gain); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shiftytip .tipfe span { display: block; font-size: 11.5px; font-weight: 600; line-height: 1.25; color: #6b7487; }
.shiftytip ol { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid #e8ebf1; }
.shiftytip li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #e8ebf1; }
.shiftytip li b { width: 18px; font-weight: 700; }
.shiftytip li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shiftytip li i { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.shiftytip li.me { color: var(--gain); font-weight: 700; }
.shiftytip .tipgo { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; text-align: center; padding: 13px; border-radius: 999px; background: var(--gain); color: #fff; font: 700 15px/1 var(--body); }
.shiftytip .tipgo:hover, .shiftytip .tipgo:focus-visible { filter: brightness(1.08); }
.shiftytip .tipin { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-bottom: 8px; padding: 11px; border-radius: 999px; border: 2px solid var(--gain); color: var(--gain); font: 700 14.5px/1 var(--body); }   /* v1204: signed out */
.shiftytip .tipin svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.shiftytip .tipin:hover, .shiftytip .tipin:focus-visible { background: #fdeee8; }
.shiftytip .tiprm { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: 10px; padding: 4px 2px; color: #1a2340; font: 600 14px/1.2 var(--body); }   /* v1094; v1096: a switch */
.shiftytip .tiprm i { flex: none; position: relative; width: 38px; height: 22px; border-radius: 999px; background: #c9ced8; transition: background .15s; }
.shiftytip .tiprm i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.shiftytip .tiprm[aria-checked="true"] i { background: var(--gain); } .shiftytip .tiprm[aria-checked="true"] i::after { transform: translateX(16px); }
.shiftytip .tiprm:focus-visible i { outline: 2px solid var(--gain); outline-offset: 2px; } .shiftytip .tiprm[aria-busy="true"] { cursor: progress; }
.shiftytip .tipft { text-align: center; margin-top: 9px; font-size: 12px; font-weight: 600; color: #6b7487; }
@media (prefers-reduced-motion: reduce) { .shiftytip { transition: none; transform: none; } }
@media (prefers-reduced-motion: reduce) { body, #splash, .shiftyside, body.shiftyon .shiftyside, .shiftydim, .topbar .topdemo .sx, .anside, body.anon .anside { transition: none; } }
.sidehead { display: none; }
@media (min-width: 761px) {
  .side { top: var(--bar-h, 64px); height: calc(100vh - var(--bar-h, 64px)); box-sizing: border-box; }
  .side .nav { display: none; }
  .sidehead { display: block; font-size: var(--fs-sm); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 10px; margin-bottom: -14px; }
  .side .subnav { position: static; display: block; padding: 0; background: none; box-shadow: none; }
  .side .subnav[hidden] { display: none; }
  .side .subtabs { flex-direction: column; gap: 2px; overflow: visible; }
  .side .subtabs button { display: block; padding: 9px 12px; border-radius: var(--r-m); font-size: var(--fs-l); white-space: normal; }
  /* v989: Racing rules: the search and the rule list in the side menu, the list scrolls on its own */
  .sidepage { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .sidepage:empty { display: none; }
  .side .rule-side { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  .side .rule-q { padding: 9px 12px; }
  .side .rule-pick { flex-direction: column; flex-wrap: nowrap; gap: 2px; overflow-y: auto; margin: 0; padding: 0; }
  .side .rule-pick button { border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: var(--r-m); font-size: var(--fs-l); font-weight: 600; }
  .side .rule-pick button:hover { background: var(--panel-2); }
  .side .rule-pick button[aria-selected="true"] { background: #fbe6df; color: var(--gain); }
  .side .rule-pick button[aria-selected="true"] b { color: var(--gain); }
  .side .rule-pick button b { min-width: 30px; }
  .side .rule-pick button b .rule-ico { margin-left: 0; }   /* the Glossary, Start and Finish icons line up with the rule numbers */
  .side #bdAuth { display: none; }   /* Account sits at the top right */
  .subnav { padding-right: 0; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .tbbtn { padding-right: 4px; }
  .tbbtn b { display: none; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 52px; padding: env(safe-area-inset-top, 0px) 12px 0; gap: 8px; }
  .topbar .brand svg { width: 32px; height: 32px; }
  .topbar .brand b.wordmark { font-size: 20px; }
  .topbar .fleetbadge:not(.nologo) { padding: 2px 6px; }
  .topbar .fleetbadge:not(.nologo) .fb-logo { width: 44px; height: 28px; }
  .tbbtn:is([data-route="tune"], [data-route="review"], [data-route="tactics"]) { display: none; }
  .tbbtn { padding: 2px; border: 0; background: none; }
  .tbbtn b { display: none; }
  .tbbtn .ic { width: 34px; height: 34px; }
  .topbar .topme { width: 36px; height: 36px; }
  .side { top: var(--bar-h, 52px); }
  body.rdmap .side { top: var(--bar-h, 52px); padding: 10px 12px; }
  /* nothing to pick on this page (Tune, Upload, Rules): no empty white strip under the bar */
  .side .mebox.offpage { display: none; }
  .side:not(:has(.mebox:not([hidden]):not(.offpage), .racebox)) { padding: 0; border-bottom: 0; }
}

/* v992: the top bar buttons sit in one track and start in line with the page (side menu + page padding); one orange pill
   slides under the page you're on (shell.js slidePill). Desktop: the class card heads the side menu (shell.js placeBadge) */
.tbnav { position: relative; margin-left: 0; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.07); }
.tbbtn, .tbbtn:hover, .tbbtn[aria-current="page"] { position: relative; z-index: 1; background: none; border: 0; }
.tbbtn { padding: 8px 15px 8px 11px; color: #c9d1e3; transition: color var(--t); }
.tbbtn .ic, .tbbtn[aria-current="page"] .ic { width: 18px; height: 18px; background: none; transition: transform var(--t-slow) cubic-bezier(.3,1.8,.5,1); }
.tbbtn svg, .tbbtn[aria-current="page"] svg { color: currentColor; }
.tbbtn:hover, .tbbtn.lit { color: #fff; }
.tbbtn:hover .ic, .tbbtn.lit .ic { transform: translateY(-3px); }   /* .lit: the splash headline is on this button's line (splash.js lightBar) */
.tbbtn[aria-current="page"] { color: #fff; }
.tbpill { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--gain); box-shadow: 0 4px 14px rgba(228,87,46,.45); transform-origin: 0 50%; will-change: transform; }
.tbpill.off { opacity: 0; }
.topbar .topme { margin-left: auto; }
.fleetbadge .fb-txt small { display: none; }
.fleetbadge:not(.nologo):not(.fbcard) .fb-txt { display: none; }
@media (prefers-reduced-motion: reduce) { .tbbtn .ic { transition: none; } }
@media (min-width: 761px) {
  .topbar { padding-left: 20px; gap: 0; }
  /* v1010: the bar's contents sit in the shared page column (logo on its left edge, profile button on its right); the navy runs full width */
  .topbar { padding-inline: calc(max(0px, (100% - var(--page-max)) / 2) + var(--page-pad)); }
  .topbar .brand { width: calc(200px + clamp(16px, 3vw, 36px)); margin: 0; flex: none; }
  .topbar .fleetbadge { margin-right: 12px; }
  .sidehead { display: none; }
  .side .fleetbadge.fbcard { display: flex; align-items: center; gap: 12px; width: auto; margin: -6px 0 -8px; padding: 10px; border-radius: var(--r-l, 12px); justify-content: flex-start; text-align: left; }
  .side .fleetbadge.fbcard .fb-logo { width: 54px; height: 54px; flex: none; border-radius: var(--r-m); background: var(--t); display: grid; place-items: center; }
  .side .fleetbadge.fbcard .fb-logo img { max-width: 82%; max-height: 82%; }
  .side .fleetbadge.fbcard .fb-txt b { font: 800 17px/1.15 var(--display); color: var(--fg); white-space: normal; overflow-wrap: anywhere; max-width: none; }
  .side .fleetbadge.fbcard .fb-txt small { display: block; font-size: var(--fs-sm); color: var(--gain); font-weight: 600; }
}
@media (max-width: 1280px) and (min-width: 761px) { .topbar .brand { width: 220px; } }
@media (max-width: 1100px) and (min-width: 761px) { .tbbtn { padding: 8px 12px; } }
@media (max-width: 760px) {
  .tbnav { margin-left: auto; padding: 0; background: none; }
  .tbpill { display: none; }
  .tbbtn { padding: 2px; color: #fff; }
  .tbbtn .ic, .tbbtn[aria-current="page"] .ic { width: 34px; height: 34px; background: var(--gain); }
  .tbbtn svg { color: #fff; }
  .topbar .topme { margin-left: 0; }
}

/* v1014 phone: the same structure as desktop. The bottom bar has all five pages (Tune, Debrief, Rules, Tactics, Upload); the top bar is
   the logo, class and Account; the page's own tabs are one row of pills right under the top bar on every page (shell.js moves #subnav there) */
@media (max-width: 760px) {
  .tbnav { display: none; }
  .topbar .topme { margin-left: auto; }
  body.pg-rules .side { padding: 0; border-bottom: 0; }
  .subnav, body.rdmap .subnav { position: sticky; top: var(--bar-h, 52px); left: auto; right: auto; z-index: 6; display: block; width: auto; margin: 0; padding: 10px 12px; background: var(--bg); border: 0; border-radius: 0; box-shadow: none; }
  .subnav[hidden], body.rdmap .subnav[hidden] { display: none; }
  .subnav.stuck { box-shadow: 0 8px 12px -12px rgba(19,38,61,.4); }
  .subnav .subtabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; max-width: 100%; }
  .subnav .subtabs button { flex: none; padding: 8px 14px; min-height: 0; font-size: var(--fs-ml); font-weight: 600; background: var(--panel); border: 1px solid var(--line); box-sizing: border-box; }
  .subnav .subtabs button[aria-selected="true"] { background: #fbe6df; border-color: transparent; color: var(--gain); }
  .side, body.rdmap .side { top: calc(var(--bar-h, 52px) + var(--subnav-h, 0px)); }
  body.rdmap .side { left: 0; right: 0; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(19,38,61,.10); }
  body.rdmap .replaybox:not(.fsmode) .map-wrap .tools { top: calc(var(--toph, 0px) + 10px); }
  /* Rules: one picker button in the row; it opens a bottom sheet with the search and the whole list */
  .subnav .subtabs button.rule-pickbtn { background: #fbe6df; border-color: transparent; color: var(--gain); }
  .rules > .rule-side { display: none; }
  .rule-sheet-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--fg); cursor: pointer; padding: 0; }
  body.rulesheet .rules > .rule-side { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; top: 18vh; z-index: 60; box-sizing: border-box; padding: 14px 12px calc(92px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: 0 0 0 100vmax rgba(19,38,61,.45); }
  body.rulesheet .rule-side .rule-q { width: calc(100% - 52px); flex: none; margin-bottom: 8px; }
  body.rulesheet .rule-side .rule-none { flex: none; }
  body.rulesheet .rule-side .rule-pick { flex: 1; min-height: 0; flex-direction: column; flex-wrap: nowrap; gap: 2px; overflow-x: hidden; overflow-y: auto; margin: 0; padding: 0; }
  body.rulesheet .rule-side .rule-pick button { border: 0; background: none; text-align: left; padding: 11px 12px; border-radius: var(--r-m); font-size: var(--fs-l); font-weight: 600; }
  body.rulesheet .rule-side .rule-pick button[aria-selected="true"] { background: #fbe6df; color: var(--gain); }
  body.rulesheet .rule-side .rule-pick button[aria-selected="true"] b { color: var(--gain); }
  body.rulesheet .rule-side .rule-pick button b { min-width: 30px; }
  body.rulesheet .rule-side .rule-pick button b .rule-ico { margin-left: 0; }
}
@media (min-width: 761px) { .rule-sheet-x { display: none; } }
/* v1220: Analytics: speed through every tack, gybe, bear-away and drop (pages/gain.js) */
.spd-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin-bottom: 12px; background: var(--panel-2); border-radius: var(--r-pill); }
.spd-tabs button { all: unset; cursor: pointer; flex: 1 0 auto; text-align: center; white-space: nowrap; padding: 6px 12px; border-radius: var(--r-pill); font-size: var(--fs-m); color: var(--muted); }
.spd-tabs button span { opacity: .7; }
.spd-tabs button:hover { color: var(--fg); }
.spd-tabs button[aria-selected="true"] { background: var(--panel); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(19,38,61,.15); }
.spd-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.spd-card[hidden] { display: none; }
.spd-how { margin: -8px 0 16px; max-width: 80ch; }
.spd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }
.spd-grid > .section + .section { margin-top: 0; }
.spd-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin-bottom: 6px; }
.spd-top h3 { margin: 0; }
.spd-top h3 .muted { font-weight: 400; }
.spd-avg { margin: 0; font-size: var(--fs-m); color: var(--muted); font-variant-numeric: tabular-nums; }
/* v1258 (Al: the analytics should look like the mock-up, a nicer font, on the Debrief page only): Archivo for the turn cards' headings and big number */
.spd-big { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.spd-big > b { font: 800 34px/1 var(--display); color: var(--fg); }
.spd-big > span { font-size: var(--fs-m); color: var(--muted); }
.spd-big .spd-good { color: var(--good); font-weight: 600; }
.rd-turns h3, .rd-turns .spd-big > b, .rd-turns .spd-tabs button { font-family: "Archivo", var(--display); }
.rd-turns h3 { font-weight: 800; font-size: 17px; letter-spacing: .01em; }
.spd-def { margin: 0 0 6px; }
/* v1259 (Al): the tabs are the card's own header; one card under them; a picked turn in orange with a cursor to scrub along */
.spd-box { padding: 0 !important; overflow: hidden; }
.spd-box > .spd-tabs { margin: 0; border-radius: 0; padding: 6px; }
.spd-box .spd-grid { padding: 14px 16px 16px; }
.spd-box .spd-tabs button[aria-selected="true"] { border-radius: 10px; }
.spd-what { flex-basis: 100%; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.spd-svg .spd-pick { stroke: var(--gain); stroke-width: 2.5; pointer-events: none; }
.spd-svg .spd-cur { stroke: var(--fg); stroke-width: 1.5; pointer-events: none; }
.spd-svg .spd-curt { fill: var(--fg); font-weight: 600; pointer-events: none; paint-order: stroke; stroke: var(--panel); stroke-width: 4px; }
.spd-svg .spd-sname { fill: var(--fg); font-weight: 600; }
/* v1266: the Knots / % of speed in switch, a colour swatch on each row, the 90% line */
.spd-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 99px; background: var(--panel-2); }
.spd-seg button { border: 0; background: none; color: var(--muted); font: 600 12px var(--body); padding: 5px 12px; border-radius: 99px; cursor: pointer; }
.spd-seg button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 3px rgba(19,38,61,.15); }
.spd-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.spd-top { position: relative; padding-right: 34px; }
.spd-info { position: absolute; top: -4px; right: -4px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.spd-info:hover, .spd-info[aria-expanded="true"] { color: var(--fg); background: var(--panel-2); }
.spd-info:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.spd-top .spd-def { flex-basis: 100%; order: 2; margin: 4px 36px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); color: var(--fg); }
.spd-ovb { border: 1.5px solid var(--line); background: var(--panel); color: var(--fg); font: 600 12px var(--body); padding: 5px 12px; border-radius: 99px; cursor: pointer; margin-right: 6px; }
.spd-ovb[aria-pressed="true"] { background: var(--fg); color: var(--panel); border-color: var(--fg); }
.spd-ovb:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.spd-sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.spd-svg .spd-90 { stroke: var(--good); stroke-dasharray: 4 3; }
.spd-svg .spd-90t { fill: var(--good); font-weight: 600; }   /* v1264: the strips' names */
.spd-plot { touch-action: pan-y; }
/* v1260 (Al): the picked row stays red */
.spd-card .spd-tbl tbody tr.pick, .spd-card .spd-tbl tbody tr.pick:hover, .spd-card .spd-tbl tbody tr.pick.on { background: color-mix(in srgb, var(--gain) 14%, transparent); }
.spd-tbl tbody tr.pick td { color: var(--fg); font-weight: 600; }
.spd-tbl tbody tr.pick td:first-child { box-shadow: inset 3px 0 0 var(--gain); padding-left: 8px; }
.spd-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spd-avg b { color: var(--fg); font-weight: 600; }
.spd-plot { min-height: 210px; }
/* v1265 (Al): on a computer the turns panel is no taller than the map (replay.js sets its height), scrolling inside; no key line */
@media (min-width: 1000px) {
  .rd-turns .spd-key { display: none; }
  .rd-turns .spd-plot { min-height: 0; }
  .rd-turns .spd-big > b { font-size: 28px; }
}
.spd-svg { width: 100%; height: auto; overflow: visible; }
.spd-svg text { font-size: 12px; }
.spd-svg .spd-gl { stroke: var(--line); }
.spd-svg .spd-zero { stroke: var(--faint); stroke-dasharray: 3 3; }
.spd-svg path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.spd-ln { cursor: pointer; }
.spd-ln .spd-hit { stroke: transparent; stroke-width: 12; }
.spd-ln .spd-one { stroke: var(--b); stroke-width: 1.5; stroke-opacity: .3; transition: stroke-opacity .15s, stroke-width .15s; }
.spd-card.lit .spd-ln .spd-one { stroke-opacity: .12; }
.spd-card.lit .spd-ln.on .spd-one { stroke: var(--gain); stroke-opacity: 1; stroke-width: 2.5; }
.spd-svg .spd-halo { stroke: var(--panel); stroke-width: 6; pointer-events: none; }
.spd-svg .spd-mean { stroke: var(--accent); stroke-width: 3; pointer-events: none; }
.spd-key { display: flex; gap: 16px; margin: 2px 0 10px; }
.spd-key span { display: inline-flex; align-items: center; gap: 6px; }
.spd-key i { display: inline-block; width: 18px; border-top: 1.5px solid color-mix(in srgb, var(--b) 45%, transparent); }
.spd-key i.mean { border-top: 3px solid var(--accent); }
.spd-tbl { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.spd-tbl th, .spd-tbl td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.spd-tbl th:first-child, .spd-tbl td:first-child { text-align: left; padding-left: 0; }
.spd-tbl th { color: var(--muted); font-weight: 500; }
.spd-tbl tbody tr { cursor: pointer; }
.spd-tbl tbody tr:hover, .spd-tbl tbody tr.on { background: var(--panel-2); }
.spd-tbl tbody tr.on td:first-child { box-shadow: inset 3px 0 0 var(--gain); padding-left: 8px; }
.spd-tbl tbody tr.spd-best td.spd-g, .spd-avg b.spd-good { color: var(--good); }   /* v1228: the boat's best turn, the one to match */
.spd-tbl tbody tr.spd-best td.spd-g::before { content: '★ '; }
/* v1240: the owner's × to leave a wrong turn out, its yes/keep, and the line to put it back */
.spd-tbl .spd-xc { width: 1%; padding: 0 0 0 4px; }
.spd-x { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--faint); }
.spd-x:hover, .spd-x:focus-visible { color: var(--fg); background: var(--panel-2); }
.spd-x:focus-visible { outline: 2px solid var(--accent); }
.spd-x svg { width: 11px; height: 11px; }
.spd-tbl td.spd-ask { text-align: left; white-space: normal; padding-left: 0; }
.spd-ask span { display: inline-flex; gap: 6px; margin-left: 6px; }
.spd-out { margin: 8px 0 0; }
.spd-tbl tbody tr:focus-visible { outline: 2px solid var(--b); outline-offset: -2px; }
.spd-bar { display: inline-block; vertical-align: middle; width: 96px; height: 6px; margin-right: 8px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.spd-bar i { display: block; height: 100%; border-radius: 3px; background: var(--b); }
.spd-none p { margin: 0; }
.racebox .daybtns button[data-all] { flex: none; }   /* Both (Analytics) stays whole beside long race names */
@media (max-width: 560px) { .spd-bar { display: none; } }

/* v1223 (Al): Analytics' four cards (tacks, gybes, bear-aways, drops) stand in a column right of the Replay map on a
   computer, scrolling on their own; below 1000 px they follow the map */
@media (min-width: 1000px) {
  .analysis-grid.rd { grid-template-columns: minmax(0, 1fr) 440px; align-items: start; }
  .analysis-grid.rd > .replaybox { min-width: 0; }
  .rd-turns { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .rd-turns .spd-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .rd-turns .spd-bar { display: none; }
}
@media (max-width: 999px) { .analysis-grid.rd > .rd-turns { grid-column: 1 / -1; } }
@media (max-width: 760px) { .rd-turns { padding: 12px 12px calc(var(--navsp, 84px) + 16px); } }

/* v1245: phone Replay tidied (Al, 30 Oct): no class logo in the top bar (the BowDown logo still changes class), no lone "Replay" tab,
   no empty gaps before the pickers; the date and boat share a row and the day's race slider gets a full row under them. The map
   stops above the tab bar with the race cards showing below it, so a swipe there scrolls the page (replay.js rdMapH) */
@media (max-width: 760px) {
  body.rdmap .topbar .fleetbadge { display: none; }
  body.rdmap .subnav:has(.subtabs > button:only-child) { display: none !important; }
  body.rdmap .side > .sidepage:empty, body.rdmap .side > .clswrap:has(.clsbtn[hidden]):has(.clspop[hidden]) { display: none; }
  .side:has(.racebox .racestep) { flex-wrap: wrap; row-gap: 8px; }
  .side .racebox:has(.racestep) { display: contents; }
  .side .racebox:has(.racestep) > select { order: 3; flex: 1 1 0; min-width: 0; }
  .side .racebox .racestep { order: 9; flex: 1 0 100%; margin: 0; }
  .side .racebox .racestep button { flex: 1 1 0; min-width: 0; padding: 0 8px; }
  main:has(#replayBox) { padding-bottom: 100px; }
}
/* v1272: Debrief turns: group averages, target bands, group headings, tags, the top-mark box */
.spd-svg .spd-avg { fill: none; stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.spd-svg .spd-band { fill: var(--good); opacity: .28; }
.spd-svg .spd-bande { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 5 3; }
.spd-svg .spd-bandt { fill: var(--good); font-size: 11px; font-weight: 700; paint-order: stroke; stroke: var(--panel, #fff); stroke-width: 3px; stroke-linejoin: round; }
.spd-tbl tr.spd-gh td { padding: 8px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; }
.spd-tbl th, .spd-tbl td { padding-top: 3px; padding-bottom: 3px; }
.spd-tag { font-style: normal; font-size: 10px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-radius: 99px; padding: 1px 6px; margin-left: 6px; }
.spd-tag.mid { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.spd-sub { display: block; font-size: 10px; color: var(--muted); padding-left: 22px; line-height: 1.3; }
.spd-sub .spd-tag { margin-left: 5px; }
.spd-ov { display: block; font-size: 10px; font-weight: 600; color: #c27c0e; }
.spd-ovbox { margin: 6px 0; padding: 7px 10px; border-radius: 10px; font-size: var(--fs-sm); background: color-mix(in srgb, #f5a623 12%, transparent); border: 1px solid color-mix(in srgb, #f5a623 45%, transparent); display: grid; gap: 2px; }
.spd-ovbox span { color: var(--muted); font-size: 12px; }
/* v1281 (Al, phone layout A): a picked turn sticks the map, shorter, at the top; the chart, its slider and the list scroll under it */
@media (max-width: 999px) {
  body.rdpick .replaybox:not(.fs) { position: sticky; top: var(--rdpicktop, 0px); z-index: 5; }
  body.rdpick .replaybox:not(.fs) .map-wrap { height: 36vh !important; }
  body.rdpick .replaybox:not(.fs) :is(.scrub.dock, .mapplay, .maprail, .followrail, .tools, .live.inst) { display: none !important; }
  body.rdpick .rd-turns .spd-scrub { scroll-margin-top: calc(36vh + var(--rdpicktop, 0px) + 8px); }
  .spd-tbl th:nth-child(3), .spd-tbl td:nth-child(3):not([colspan]) { display: none; }
  .spd-tbl .spd-bar { display: none; }
  .spd-tbl td:first-child { white-space: normal; } .spd-tbl th, .spd-tbl td { padding-left: 4px; padding-right: 4px; }
  .rd-turns.picked .spd-plot { touch-action: pan-y; }
  /* the stuck map lets the page scroll up and down past it; sideways and two fingers still move the map */
  body.rdpick .replaybox:not(.fs) .map-wrap canvas { touch-action: pan-y; }
  body.rdpick .replaybox:not(.fs) .rdpickx { display: flex; }
  .spd-svg text { font-size: 12px; }
}
.spd-scrub { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; }
.spd-scrub[hidden] { display: none; }
.spd-rng { flex: 1; height: 32px; accent-color: var(--accent); }
.spd-nb { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: 15px; cursor: pointer; }
.spd-playb { background: var(--accent); border-color: var(--accent); color: #fff; }
/* v1282: on a phone, the way off a picked turn: a button on the stuck map */
.rdpickx { display: none; position: absolute; top: 10px; right: 10px; z-index: 6; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 99px; background: rgba(13,23,36,.82); color: #fff; font: 600 14px var(--body); box-shadow: 0 2px 10px rgba(0,0,0,.3); cursor: pointer; }

/* v1285: Race settings on a computer: a strip along the foot of the map, full width above the play bar, its sections side by side (Al) */
@media (min-width: 761px) {
  #rdSet { left: 0; right: 0; bottom: calc(var(--dockh, 90px) + 10px); max-width: none; margin: 0; border-radius: var(--r-l) var(--r-l) 0 0; padding: 6px 16px 10px; max-height: min(44%, 250px); }
  #rdSet:not([hidden]) { display: flex; flex-wrap: wrap; column-gap: 20px; align-items: flex-start; align-content: flex-start; }
  #rdSet > .rdsethead { flex: 0 0 100%; }
  #rdSet > .rdsec { flex: 1 1 120px; margin-top: 4px; padding-top: 8px; min-width: 0; }
  #rdSet > .rdsec:has(#winEdit), #rdSet > #runSec { flex: 2.2 1 230px; }
  #rdSet > .rdsec:has(#windEd) { flex: 1.3 1 150px; }
  #rdSet .rdsecnote:not(#winHint) { display: none; }
  #rdSet .rdsecnote { margin-bottom: 4px; font-size: var(--fs-sm); }
  #rdSet .rdsecrow { margin-top: 6px; }
  #rdSet .winstrip.winedit { height: 40px; }
  #rdSet .winstrip.winedit input[type=range]::-webkit-slider-thumb { height: 40px; }
  .replaybox.fsmode #rdSet, body.rdmap .replaybox:not(.fsmode) #rdSet { max-height: min(44%, 250px); }
}
/* v1285: hide / show the turns panel beside the map (Al) */
@media (max-width: 999px) { .rd-turns { position: relative; } }
.rd-turnsx { position: absolute; top: 7px; right: 8px; z-index: 3; height: 28px; min-width: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--fg); font: 700 15px/1 var(--body); cursor: pointer; }
.rd-turns:not(.turnsoff) .spd-tabs { padding-right: 44px; }
.rd-turns.turnsoff > :not(.rd-turnsx) { display: none; }
.rd-turns.turnsoff .rd-turnsx { position: static; font-size: var(--fs-sm); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
@media (min-width: 1000px) {
  .analysis-grid.rd.turnsoff { grid-template-columns: minmax(0, 1fr); position: relative; }
  .analysis-grid.rd.turnsoff > .rd-turns { position: absolute; top: 158px; right: 12px; width: auto; max-height: none; overflow: visible; z-index: 6; }
}
.map-wrap > .rd-turns.onmap.turnsoff { bottom: auto; width: auto; padding: 0; background: none; box-shadow: none; overflow: visible; }

/* v1289: Play Shifty on Debrief (replay.js shiftyCard) */
.shiftycard { margin: 12px 0 0; }
.shiftycard .sc-go { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 6px 12px; padding: 12px 14px; border-radius: 16px; background: linear-gradient(135deg, #0d3b66, #13263d); color: #fff; text-decoration: none; box-shadow: 0 6px 18px #13263d33; }
.shiftycard .sc-ic { width: 40px; height: 40px; border-radius: 50%; background: #e4572e; display: grid; place-items: center; }
.shiftycard b { display: block; font-size: 15px; } .shiftycard small { display: block; opacity: .8; font-size: 12px; margin-top: 2px; }
.shiftycard .sc-btn { grid-column: 1 / -1; text-align: center; background: #e4572e; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; }
.shiftycard .sc-x { display: block; margin: 6px auto 0; border: 0; background: none; color: var(--muted, #6e6e73); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 6px; }
@media (max-width: 760px) { .shiftycard { margin: 12px 12px 0; } }

/* v1291: "Your fleets first" race picker (common.js fleetBtn): a button with the fleet and day; it opens the fleets, the sailor's
   own first with a green "you", then the picked fleet's race days. A computer drops it under the button, a phone shows a sheet */
.fleetbtn { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fleetbtn:hover { background: var(--panel-2); }
.fleetbtn img, .fleetsheet .fl-card img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.fl-nologo { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--panel-2); }
.fleetbtn .fl-t, .fleetsheet .fl-t { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.fleetbtn b, .fleetsheet .fl-card b { font-weight: 600; font-size: var(--fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fleetbtn b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.fleetbtn small, .fleetsheet .fl-card small { color: var(--muted); font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-chev { flex: none; width: 8px; height: 8px; margin: 0 2px 4px 4px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.fleetbtn[aria-expanded="true"] .fl-chev { transform: rotate(-135deg); margin-bottom: -2px; }
.fleetsheet { position: fixed; inset: 0; z-index: 1000; }
.fleetsheet .fl-bg { position: absolute; inset: 0; }
.fleetsheet .fl-pan { position: absolute; max-height: min(70vh, 560px); overflow-y: auto; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px 10px 12px; }
.fleetsheet .fl-top { display: none; }
.fleetsheet .fl-h { margin: 10px 2px 4px; font-size: var(--fs-s); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fleetsheet .fl-card { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fleetsheet .fl-card:hover { background: var(--panel-2); }
.fleetsheet .fl-card.on { border-color: var(--gain); background: #fdf1ec; }
.fleetsheet .fl-d { flex: none; color: var(--muted); font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.fleetsheet .fl-you { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); background: var(--good); color: #fff; font-style: normal; font-size: var(--fs-xs); font-weight: 700; vertical-align: 1px; }
.fleetsheet .fl-days { display: flex; flex-direction: column; gap: 4px; }
.fleetsheet .fl-day { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); color: inherit; font: inherit; font-weight: 600; font-size: var(--fs-m); cursor: pointer; }
.fleetsheet .fl-day span { color: var(--muted); font-weight: 400; }
.fleetsheet .fl-day:hover { background: var(--panel-2); }
.fleetsheet .fl-day[aria-current="true"] { background: #fbe6df; border-color: transparent; color: var(--gain); }
@media (max-width: 760px) {
  .side .racebox > .fleetbtn, .side .racebox:has(.racestep) > .fleetbtn, .side .racebox:has(.daybtns) > .fleetbtn { order: 3; flex: 1 1 0; min-width: 0; padding: 3px 8px; gap: 6px; }
  .side .racebox .fleetbtn img, .side .racebox .fleetbtn .fl-nologo { display: none; }
  .side .racebox .fleetbtn b { font-size: var(--fs-sm); -webkit-line-clamp: 1; }
  .side .racebox .fleetbtn small { font-size: var(--fs-xs); }
  .fleetsheet .fl-bg { background: rgba(0,0,0,.35); }
  .fleetsheet .fl-pan { left: 0; right: 0; bottom: 0; max-height: 80vh; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 0 14px calc(16px + env(safe-area-inset-bottom)); }
  .fleetsheet .fl-top { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; padding: 14px 0 6px; background: var(--panel); font-size: var(--fs-l); }
  .fleetsheet .fl-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--panel-2); color: inherit; display: grid; place-items: center; cursor: pointer; }
}


/* Splash: choose your fleet by its class logo (full screen; the BowDown logo in the menu opens it again) */
.brand[role="button"] { cursor: pointer; border-radius: var(--r-m); }
#splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #13263d;
  color: #ffffff;
  overflow-y: auto;
  animation: sp-fade .3s var(--ease);
}
/* v1055: slim scroll bar on the dark splash: faint, firmer on hover */
#splash { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
#splash:hover { scrollbar-color: rgba(255,255,255,.3) transparent; }
#splash.out { animation: sp-leave .3s var(--ease) forwards; pointer-events: none; }
@keyframes sp-fade { from { opacity: 0; } }
@keyframes sp-leave { to { opacity: 0; transform: scale(1.02); } }
/* v775: gusts on the water (splashGusts in splash.js; were faint wavy lines, .sp-wind): one canvas behind the page,
   fixed to the screen, and one in the sticky band above its navy layer */
.sp-gust { position: absolute; pointer-events: none; }
#splash > .sp-gust { position: fixed; inset: 0; width: 100%; height: 100%; }
.sp-top > .sp-gust { z-index: -1; top: 0; height: 100%; }
.sp-in {
  position: relative;
  box-sizing: border-box;
  max-width: 1360px;
  min-height: 100%;
  margin: 0 auto;
  padding: max(36px, env(safe-area-inset-top, 0px)) clamp(16px, 5vw, 72px) max(32px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.sp-head { display: flex; align-items: center; }
.sp-head svg { flex: none; }
.sp-head .wordmark { font: 700 44px/1 var(--display); letter-spacing: -0.035em; }
.sp-head .wordmark span { color: var(--gain); }
.sp-groups { display: grid; gap: 26px; }
.sp-sec h2 { margin: 0 0 12px; font: 600 15px/1.2 var(--body); letter-spacing: .01em; color: #a9b8ca; }
/* shortcuts to Racing rules and Upload tracks, above the class cards */
.sp-genrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.sp-genbtn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border-radius: var(--r-l); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); color: #fff; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.sp-genbtn:hover, .sp-genbtn:focus-visible { background: rgba(255,255,255,.12); border-color: var(--gain); transform: translateY(-2px); outline: none; }
.sp-genbtn .ic { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--gain); }
.sp-genbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-genbtn b { display: block; font: 700 15px/1.2 var(--display); letter-spacing: -.01em; }
.sp-genbtn small { display: block; margin-top: 3px; font: 500 12.5px/1.3 var(--body); color: #a9b8ca; }
/* v771: on PC the Racing rules / Upload tracks / Play Shifty buttons get a light orange fill and border so they read as buttons before hover (phones unchanged) */
@media (min-width: 561px) {
  .sp-genbtn { background: rgba(228,87,46,.2); border-color: rgba(228,87,46,.6); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
  .sp-genbtn:hover, .sp-genbtn:focus-visible { background: rgba(228,87,46,.32); border-color: var(--gain); }
}
/* v865: the admin-only buttons (Admin page, Speed 500) are purple so they read as admin's own */
@media (max-width: 560px) {
  .sp-genrow { grid-template-columns: 1fr 1fr; gap: 8px; }
  .sp-genbtn { min-height: 56px; padding: 10px 12px; gap: 10px; }
  .sp-genbtn .ic { width: 30px; height: 30px; }
  .sp-genbtn svg { width: 17px; height: 17px; }
  .sp-genbtn small { display: none; }
}
.sp-signin { all: unset; box-sizing: border-box; cursor: pointer; position: absolute; z-index: 2; top: max(18px, env(safe-area-inset-top, 0px)); right: 0; width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); color: #fff; transition: background .2s, border-color .2s; }
.sp-signin[hidden] { display: none; }
.sp-signin svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sp-signin.in { background: var(--gain); border-color: var(--gain); }   /* v880: signed in: filled orange */
.sp-signin:hover { border-color: var(--gain); background: rgba(255,255,255,.12); }
.sp-signin.in:hover { background: var(--gain); border-color: #fff; }
.sp-signin:focus-visible { outline: 2px solid var(--gain); outline-offset: 2px; }
@media (min-width: 561px) { .sp-signin { position: static; margin-left: 10px; } }   /* v880: at the end of the button row, top right */
@media (min-width: 561px) {
  /* every class card the same size: the name strip is always two lines tall, a one-line name sits centred in it */
  .sp-name { box-sizing: border-box; line-height: 1.2; overflow: hidden; }
  @media (max-width: 560px) {
    .sp-name { height: calc(2 * 1.2em + 18px); align-items: center; }
  }
}
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 16px; }
.sp-card {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: #ffffff;
  color: #13263d;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);   /* v1199: not var(--t): each card's --t is its tint colour */
  animation: bd-rise .3s var(--ease) backwards;
}
.sp-card:nth-child(2) { animation-delay: .03s; }
.sp-card:nth-child(3) { animation-delay: .06s; }
.sp-card:nth-child(4) { animation-delay: .09s; }
.sp-card:nth-child(5) { animation-delay: .12s; }
.sp-card:nth-child(6) { animation-delay: .15s; }
.sp-card:nth-child(7) { animation-delay: .18s; }
.sp-card:nth-child(n+8) { animation-delay: .2s; }
.sp-card:hover, .sp-card:focus-visible { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--gain), 0 24px 48px rgba(0,0,0,.42); outline: none; }
.sp-card.on { box-shadow: 0 0 0 3px #ffffff, 0 10px 28px rgba(0,0,0,.28); }
.sp-card.picked { transform: scale(1.04); box-shadow: 0 0 0 3px var(--gain), 0 24px 48px rgba(0,0,0,.42); }
.sp-art { height: 170px; display: grid; place-items: center; background: var(--t); }
.sp-art img { max-width: 80%; max-height: 104px; object-fit: contain; transition: transform var(--t-slow) var(--ease); }
.sp-card:hover .sp-art img, .sp-card:focus-visible .sp-art img { transform: scale(1.06) rotate(-3deg); }
.sp-name {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 1px solid #ece4d6;
  font: 700 17px/1.2 var(--display);
  letter-spacing: -0.02em;
}
.sp-name i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.sp-card.sp-off { cursor: default; opacity: .45; filter: grayscale(1); box-shadow: none; animation-name: sp-rise-off; }
/* v500: a class that isn't live rises in already faded (the shared rise ends at full opacity, so it used to look
   available for a moment and then turn off) */
@keyframes sp-rise-off { from { opacity: 0; transform: translateY(6px); } to { opacity: .45; transform: none; } }
.sp-card.sp-off:hover, .sp-card.sp-off:focus-visible { transform: none; box-shadow: none; }
.sp-card.sp-off:hover .sp-art img { transform: none; }
.sp-soon {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: #13263d;
  color: #fff;
  font: 600 11px/1.4 var(--body);
  letter-spacing: .02em;
}
@media (max-width: 560px) {
  .sp-in { padding-top: max(22px, env(safe-area-inset-top, 0px)); gap: 20px; }
  .sp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .sp-card { border-radius: var(--r-l); }
  .sp-art { height: 84px; }
  .sp-art img { max-width: 72%; }
  .sp-name { gap: 6px; }
  .sp-name i { display: none; }
}

/* class is chosen on the splash only; the list opens centred */
.clspop {
  position: fixed;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: 320px;
  z-index: 2100;
}

/* desktop: every class fits on one screen. Small fixed-size cards; keelboats and catamarans share the first row */
@media (min-width: 561px) {
  .sp-in { gap: 20px !important; padding-top: 26px !important; padding-bottom: 24px !important; }
  .sp-groups { display: flex !important; flex-wrap: wrap; gap: 18px 40px !important; }
  .sp-sec:last-child { flex-basis: 100%; }
  .sp-sec h2 { margin-bottom: 10px; }
  .sp-grid { display: flex !important; gap: 14px !important; }
  .sp-card { border-radius: var(--r-l); }
  .sp-art img { max-width: 80% !important; }
  .sp-card:hover, .sp-card:focus-visible { transform: translateY(-4px); }
}
@media (min-width: 561px) and (max-height: 860px) {
  .sp-in { gap: 14px !important; padding-top: 16px !important; padding-bottom: 12px !important; }
  .sp-groups { gap: 12px 36px !important; }
  .sp-grid { gap: 10px !important; }
  .sp-sec h2 { margin-bottom: 8px; }
}

/* class names always on one line */
.sp-name { white-space: nowrap; }
@media (min-width: 561px) {
  .sp-in { max-width: 1440px !important; }
  .sp-card { width: 152px; }
  .sp-name { font-size: var(--fs-sm) !important; letter-spacing: -0.01em; padding: 0 10px !important; height: 34px !important; gap: 6px !important; }
  .sp-name i { width: 7px; height: 7px; }
}
@media (max-width: 560px) {
  .sp-name { font-size: var(--fs-xs) !important; letter-spacing: -0.01em; padding: 0 7px !important; height: 28px !important; }
}

/* fleet badge: the picked class's logo in the menu, on every page */
.fleetbadge {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--r-l);
  background: var(--t, var(--panel-2));
  transition: box-shadow .2s var(--ease);
  min-width: 0;
}
.fleetbadge[hidden] { display: none; }
.fleetbadge:hover { box-shadow: inset 0 0 0 2px var(--c, var(--fg)); }
.fleetbadge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fleetbadge.nologo { padding-left: 12px; }
.fb-logo {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: var(--r-m);
  background: rgba(255,255,255,.55);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.fb-logo img { max-width: 86%; max-height: 86%; object-fit: contain; }
.fb-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fb-txt .eyebrow { font-size: var(--fs-s); }
.fb-txt b {
  font: 650 15px/1.2 var(--display);
  letter-spacing: -0.01em;
  color: var(--c, var(--fg));
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
@media (max-width: 760px) {
  .fleetbadge { margin-left: auto; flex: 0 1 auto; padding: 3px 10px 3px 3px; border-radius: var(--r-m); gap: 7px; }
  .fb-logo { width: 34px; height: 34px; border-radius: var(--r-s); }
  .fb-txt .eyebrow { display: none; }
  .fb-txt b { display: block; font-size: var(--fs-m); max-width: 34vw; white-space: nowrap; text-overflow: ellipsis; }
}

/* splash: a group's cards wrap inside the screen width (catamarans are the last group, so no row is shared) */
@media (min-width: 561px) {
  .sp-sec { flex: 1 1 100% !important; min-width: 0; max-width: 100%; }
  .sp-grid { flex-wrap: wrap !important; }
}

/* splash: the logo tile holds the play button top left (v447: the track-count pill is gone) */
.sp-art { position: relative; box-sizing: border-box; padding-top: 18px; }
@media (max-width: 560px) {
  .sp-art { padding-top: 15px; }
}

/* phone: Race replay map uses the whole screen. Card runs edge to edge, race and boat pickers share one row,
   the map fills everything between the top bar and the play bar (which sits just above the bottom tabs);
   Race window, running order and Settings move below the play bar */
@media (max-width: 760px) {
  main:has(#replayBox) { padding-inline: 12px; padding-top: 6px; }
  main:has(#replayBox) .racebar, main:has(#debrief) .racebar { flex-wrap: nowrap; margin-bottom: 6px; }
  main:has(#replayBox) .racebar select, main:has(#debrief) .racebar select { flex: 1 1 0; min-width: 0; max-width: none; }
  main .analysis-grid.rd { margin-inline: -12px; gap: 0; }
  .replaybox:not(.fsmode) {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--panel);
  }
  .replaybox:not(.fsmode) > .notice { margin: 8px 12px; }
  .replaybox:not(.fsmode) .mapfeed { order: 0; }
  .replaybox:not(.fsmode) .map-wrap { border-radius: 0; }
  .replaybox:not(.fsmode) > .scrub { order: 1; margin: 0; padding: 6px 12px; gap: 6px 8px; }
  .replaybox:not(.fsmode) > .fleetorder { order: 2; padding: 0 12px; }
}

/* v287: fleet badge is the class logo alone, centred on its tint */
.fleetbadge:not(.nologo) { justify-content: center; padding: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--line, #e5e5ea); }

/* v290: logos sit on white */
.fleetbadge:not(.nologo):hover { box-shadow: inset 0 0 0 2px var(--c, var(--fg)); }
.fleetbadge:not(.nologo) .fb-logo { display: block; width: 100%; height: 64px; background: none; border-radius: 0; }
.fleetbadge:not(.nologo) .fb-logo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}
@media (max-width: 760px) {
  .fleetbadge:not(.nologo) { padding: 4px 10px; }
  .fleetbadge:not(.nologo) .fb-logo { width: 64px; height: 34px; }
}

/* v346: the demo races on a globe, beside the title (under it on a phone) */
.sp-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.sp-intro { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.sp-globe {
  position: relative;
  flex: none;
  width: 230px;
  aspect-ratio: 1;
  margin: -12px 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  animation: sp-fade var(--t-slow) var(--ease);
}

/* v359: on a phone a swipe on the globe only turns the globe (any direction); the page scrolls from the cards */
.sp-globe.drag { cursor: grabbing; }
.sp-globe canvas { display: block; width: 100%; height: 100%; }
.sp-gtip {
  position: absolute;
  z-index: 3;
  transform: translateY(-100%);
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--r-m);
  background: #ffffff;
  color: #13263d;
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  font: 500 13px/1.35 var(--body);
  white-space: nowrap;
  pointer-events: none;
}
.sp-gtip b { font: 700 14px/1.2 var(--display); letter-spacing: -0.01em; }
.sp-gtip span { color: #4a5f78; }
.sp-gtip .go { color: var(--gain); font-weight: 600; }
.sp-gtip.menu { pointer-events: auto; padding: 6px; gap: 2px; }
.sp-gtip.menu button {
  all: unset;
  cursor: pointer;
  display: grid;
  grid-template-columns: 30px auto;
  column-gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  border-radius: var(--r-s);
}
.sp-gtip.menu button:hover, .sp-gtip.menu button:focus-visible { background: var(--panel-2); }
.sp-gtip.menu i {
  width: 30px;
  height: 30px;
  border-radius: var(--r-s);
  grid-row: span 2;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* v442: the class's mini logo on its tile tint */
.sp-gtip.menu i img { max-width: 26px; max-height: 24px; object-fit: contain; }
.sp-gtip.menu span { grid-column: 2; font-size: var(--fs-s); }
@media (min-width: 561px) and (max-height: 860px) {
  .sp-globe { width: 190px; margin: -16px 0; }
  .sp-intro { gap: 12px; }
}
@media (max-width: 560px) {
  .sp-top { flex-direction: column; gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-globe { animation: none; }
}

/* v354: a bigger BowDown logo */
.sp-head { gap: 20px; }
.sp-head svg { width: 92px; height: 92px; border-radius: 50%; box-shadow: 0 0 12px 3px rgba(110,160,255,.35), 0 0 34px 9px rgba(80,130,240,.18); }   /* v1126: soft blue halo so the logo lifts off the page */
.sp-head .wordmark { font-size: 60px; }
@media (min-width: 561px) and (max-height: 860px) {
  .sp-head svg { width: 68px; height: 68px; }
  .sp-head .wordmark { font-size: 46px; }
}

/* v373: the logo and globe stay at the top while the class cards scroll under them; the band's background
   runs edge to edge (box-shadow, clipped top and bottom) so the cards don't show either side of it */
.sp-top { position: sticky; top: 0; z-index: 5; padding-bottom: 12px; background: #13263d; }

/* v378: the edge-to-edge navy is a layer behind the band (was a box-shadow spread, which also spilled 20 px below it
   and hid the cards before they reached the band's edge) */
.sp-top::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -100vmax;
  right: -100vmax;
  background: #13263d;
  pointer-events: none;
}
#splash { overflow-x: hidden; }
.sp-gtip[hidden] { display: none; }

/* the empty tooltip showed as a small white pill under the globe */
/* v374: the page's top padding moves inside the band, so it is stuck from the first pixel (it rose ~20 px before sticking) */
.sp-in { padding-top: 0 !important; }
.sp-top { padding-top: 26px; }
@media (min-width: 561px) and (max-height: 860px) {
  .sp-top { padding-top: 16px; }
}
@media (max-width: 560px) {
  .sp-top { padding-top: max(22px, env(safe-area-inset-top, 0px)); }
}

/* v374: a shadow under the band once the cards start going under it (fades in over the first 30 px of scroll) */
.sp-top::after {
  content: "";
  position: absolute;
  left: -100vmax;
  right: -100vmax;
  bottom: -20px;
  height: 20px;
  background: linear-gradient(rgba(0,0,0,.4), rgba(0,0,0,0));
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .sp-top::after { opacity: 0; animation: sp-shadow linear both; animation-timeline: scroll(nearest); animation-range: 0 30px; }
  @keyframes sp-shadow { to { opacity: 1; } }
}

/* on a phone the globe sits beside the logo (not under it) so the band stays short enough to leave room for the cards */
@media (max-width: 560px) {
  .sp-top { display: grid; }
  .sp-intro { display: contents; }
  .sp-head { grid-area: head; }
  /* the logo sits just over the headline, not half a globe above it */
  .sp-globe { grid-area: globe; }
}

/* v425: on a phone the headline sits beside the globe on one line, its bottom level with the globe's bottom, with the
   logo just above it; the headline is sized to the column left of the globe, and the logo stays bigger than it */

/* v428: on a phone the logo, BowDown and the headline stack on the left, each under the last, and the globe beside them
   is bigger (the headline wraps after "fleet." to leave it room) */
@media (max-width: 560px) {
  .sp-top { row-gap: 10px; }
}

/* v428: a pin's label or race list opens under the pin when there's no room above it (it went off the top of a phone) */
.sp-gtip.below { transform: none; }

/* v431: no headline; on a phone the logo and BowDown sit beside the globe, centred on it */

/* v435: on a phone "Down" sits under "Bow" below the sail mark, and a bigger globe runs off the right edge (about a quarter
   of it) and a little off the top; the bottom of "Down" is level with the bottom of the globe (the sphere is 8 px inside
   its box, so the box hangs 8 px lower) */
@media (max-width: 560px) {
  .sp-top { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "head globe"; grid-template-rows: auto; align-items: end; column-gap: 0; }
  .sp-head { flex-direction: column; align-items: flex-start; gap: 10px; align-self: end; }
  .sp-head svg { width: min(76px, 19.5vw); height: min(76px, 19.5vw); }
  .sp-head .wordmark { font-size: min(56px, 14.4vw); line-height: .86; padding-bottom: 2px; }
  .sp-head .wordmark span { display: block; }
  .sp-globe { justify-self: end; align-self: end; }
}

/* v437: play the class's demo race straight from its card. v439: top left, the track count top right at the same size;
   an invisible 10 px ring round the button takes taps too, so a thumb doesn't miss it and open the guide */
.sp-play {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gain);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s var(--ease);
}
.sp-play::after { content: ''; position: absolute; inset: -9px; }
.sp-play svg { width: 12px; height: 12px; margin-left: 1px; }
.sp-play:hover, .sp-play:focus-visible { transform: scale(1.12); background: #c9441d; outline: none; box-shadow: 0 0 0 3px #ffffff, 0 4px 12px rgba(0,0,0,.25); }
@media (max-width: 560px) {
  .sp-play { left: 5px; top: 5px; width: 26px; height: 26px; }
  .sp-play::after { inset: -9px; }
  .sp-play svg { width: 14px; height: 14px; }
}

/* v439: the logo sits below the bigger play button and count; the tile grows to keep the logo near its old size. v440: desktop badges 28 px (were 34), tiles 8 px shorter. v441: 22 px, tiles 6 px shorter again */
@media (min-width: 561px) {
  .sp-art { height: 86px !important; padding: 31px 0 5px !important; }
  .sp-art img { max-height: 50px !important; }
}
@media (min-width: 561px) and (max-height: 860px) {
  .sp-art { height: 76px !important; padding: 31px 0 3px !important; }
  .sp-art img { max-height: 42px !important; }
}
@media (max-width: 560px) {
  .sp-art { padding: 32px 0 4px !important; }
  .sp-art img { max-height: 46px !important; }
}

/* v483 phone: a slightly bigger globe (332 px, was 300) to say BowDown is global. Its bottom stays level with "Down" and it
   grows upward (the extra height goes over the top), and it sits a little further left, toward the logo, with a gap kept */
@media (max-width: 560px) {
  .sp-globe { width: min(332px, 85.1vw); margin: calc(-1 * min(92px, 23.6vw)) calc(-1 * min(91px, 23.3vw)) -8px 0 !important; }
}

/* v500: a card changed after the splash opened (sign-in status arrived) changes in place, without rising in again */
.sp-card.sp-now { animation: none; }

/* v681: the Racing rules / Upload tracks / Play Shifty buttons sit in the sticky band, under the logo and the globe */
.sp-top { flex-wrap: wrap; }
.sp-top .sp-gen { width: 100%; margin-top: 4px; }
@media (min-width: 561px) { .sp-top .sp-gen { flex: 1 0 100%; } }
@media (max-width: 560px) {
  .sp-top .sp-gen { margin-top: 0; grid-column: 1 / -1; }   /* v696: span the logo and globe columns, full width */
  .sp-genrow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .sp-genbtn { flex-direction: column; justify-content: center; text-align: center; gap: 6px; min-height: 76px; padding: 10px 6px; }
  .sp-genbtn b { font-size: 14px; }
}

/* v684: Play Shifty is a phone game: its button shows on phones and tablets (touch), not on a PC (mouse) */
@media (hover: hover) and (pointer: fine) { .sp-genbtn[data-spgo^="/leg"] { display: none; } }   /* v742: ^= since v691 made it /leg#globe (it had stopped hiding on a PC) */

/* v752: the canvas runs 30 px past the globe's box on every side, so the pins' pulse rings at the rim aren't clipped */
.sp-globe canvas { position: absolute; inset: -30px; width: calc(100% + 60px); height: calc(100% + 60px); }

/* v752 desktop: a bigger globe (was 230 px; v754: 300 px, 460 was too big), on the right beside both the logo and the buttons under it,
   its top level with the top of the logo (the sphere is 8 px inside its box) */
@media (min-width: 561px) {
  .sp-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "intro globe" "gen globe"; grid-template-rows: auto 1fr; align-items: start; column-gap: 24px; row-gap: 24px; }
  .sp-intro { grid-area: intro; }
  .sp-top .sp-gen { grid-area: gen; margin-top: 0; }
  .sp-globe { grid-area: globe; justify-self: end; width: min(300px, 38vh, 30vw); margin-top: -8px; margin-bottom: 0; }
}

/* v756 desktop: a slim top bar (small logo left; Racing rules and an orange Upload tracks on the right, like a website),
   then a headline beside the globe. The headline is desktop only: a phone keeps the logo beside the globe (v435) */
.sp-hero { display: none; }
@media (min-width: 561px) {
  .sp-top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "intro gen" "hero globe"; grid-template-rows: auto auto; align-items: center; column-gap: 0; row-gap: 0; padding-top: 0 !important; }
  .sp-intro, .sp-top .sp-gen { align-self: stretch; display: flex; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sp-intro { flex-direction: row; }
  .sp-head { gap: 12px; }
  .sp-head svg { width: 40px !important; height: 40px !important; }
  .sp-head .wordmark { font-size: 26px !important; }
  .sp-top .sp-gen { justify-content: flex-end; }
  .sp-genrow { display: flex; gap: 6px; }
  /* v790: glass pills, icon in an orange circle, same for every button (Al picked B of three mock-ups) */
  .sp-genbtn { min-height: 0; gap: 9px; padding: 5px 16px 5px 5px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
  .sp-genbtn:hover, .sp-genbtn:focus-visible { background: rgba(255,255,255,.12); border-color: rgba(228,87,46,.8); transform: translateY(-1px); }
  .sp-genbtn .ic { width: 30px; height: 30px; background: var(--gain); }
  .sp-genbtn svg { width: 16px; height: 16px; }
  .sp-genbtn b { font: 600 14px/1 var(--display); letter-spacing: 0; }
  .sp-genbtn small { display: none; }
  .sp-genbtn[data-spgo="upload"] { order: 9; }
  .sp-hero { grid-area: hero; display: block; padding: 18px 24px 8px 0; }
  .sp-hero h1 { margin: 0; font: 800 clamp(36px, 4vw, 54px)/1.02 var(--display); letter-spacing: -0.04em; color: #fff; }
  .sp-hero h1 { display: grid; }
  /* v793: a fade in place, no slide, so every line sits in the same spot. v1175: a soft cross-fade with a light blur, the orange line a beat after the white */
  .sp-hero h1 .sp-line { grid-area: 1 / 1; display: block; color: #fff; opacity: 0; filter: blur(6px); transition: opacity .5s ease-in, filter .5s ease-in; }
  .sp-hero h1 .sp-line > span { display: block; color: var(--gain); opacity: 0; transition: opacity .5s ease-in; }
  .sp-hero h1 .sp-line.on { opacity: 1; filter: none; transition: opacity .7s var(--ease) .35s, filter .7s var(--ease) .35s; }
  .sp-hero h1 .sp-line.on > span { opacity: 1; transition: opacity .7s var(--ease) .55s; }
  @media (prefers-reduced-motion: reduce) { .sp-hero h1 .sp-line, .sp-hero h1 .sp-line.on, .sp-hero h1 .sp-line > span { transition: none; filter: none; } }
  .sp-globe { width: min(250px, 32vh, 26vw); margin-top: 12px; margin-bottom: 4px; }
}
@media (min-width: 561px) and (max-height: 860px) {
  .sp-intro, .sp-top .sp-gen { padding: 10px 0; }
  .sp-hero { padding-top: 10px; }
  .sp-hero h1 { font-size: clamp(30px, 3.2vw, 42px); }
  .sp-globe { width: min(210px, 28vh, 24vw); margin-top: 6px; }
}
/* v772 desktop: the top bar buttons end level with the globe's right edge (the sphere is 8 px inside its box), not the page edge;
   the % padding is worked out after the column is sized by the buttons, so they keep their width and sit further left.
   */
@media (min-width: 561px) {
  .sp-top { --gw: min(250px, 32vh, 26vw); }
  .sp-top .sp-gen { padding-right: 8px; }   /* the splash script widens this to match the globe when the globe sits in from the edge */
  .sp-top .sp-gen .sp-genbtn { flex: none; white-space: nowrap; }
}
@media (min-width: 561px) and (max-height: 860px) { .sp-top { --gw: min(210px, 28vh, 24vw); } }

/* v880: phone: the admin buttons (Admin, Speed 500) drop to a second row so Upload, Rules and Shifty stay on top */

/* v989: desktop: the app's top bar (logo, Tune, Debrief, Tactics, Racing rules, Upload tracks, Account) sits over the
   splash, so the splash drops its own logo and buttons and runs the full width under it */
@media (min-width: 761px) {
  #splash { top: var(--bar-h, 64px); }
  body.spon .topbar { z-index: 2001; }
  /* v1173: splash: no page is picked yet, so no orange pill; the button whose headline line is showing gets an orange icon (text stays white) */
  body.spon .tbpill { opacity: 0; }
  body.spon .tbbtn[aria-current="page"]:not(:hover):not(.lit) { color: #c9d1e3; }
  body.spon .tbbtn .ic { transition: transform var(--t-slow) cubic-bezier(.3,1.8,.5,1), color var(--t); }
  body.spon .tbbtn.lit .ic { color: var(--gain); }
  #splash .sp-intro, #splash .sp-gen { display: none !important; }
  #splash .sp-top { grid-template-areas: "hero globe"; padding-top: 12px !important; }
  .sp-in { max-width: var(--page-max) !important; padding-inline: var(--page-pad) !important; }   /* v1010: the shared page column, under the top bar's logo and profile button */
  /* v1010: the splash is as wide as the page including the scroll bar's room, and keeps its own, so its column lines up with the bar */
  #splash { right: auto; width: 100vw; scrollbar-gutter: stable; }
}
.sp-groups.flash .sp-card { animation: sp-flash .9s var(--ease) 2; }
@keyframes sp-flash { 50% { box-shadow: 0 0 0 3px var(--gain); } }

/* v997: desktop: smaller class cards, and the smaller groups share a row, so every class fits on one screen */
@media (min-width: 561px) {
  .sp-card { width: 119px !important; }   /* v1013: was 122 px with 8 px gaps: 11 across fit the 1392 px page column, so Dinghies and skiffs stay on 2 rows */
  .sp-art { height: 60px !important; padding: 6px 0 4px !important; }
  .sp-art img { max-height: 38px !important; max-width: 74% !important; }
  .sp-play { left: 4px; top: 4px; width: 16px; height: 16px; }
  .sp-play svg { width: 9px; height: 9px; }
  .sp-name { height: 26px !important; font-size: 11px !important; padding: 0 4px !important; gap: 3px !important; }
  .sp-name i { width: 6px; height: 6px; }
  .sp-grid { gap: 6px !important; }
  .sp-groups { gap: 10px 36px !important; }
  .sp-sec h2 { margin-bottom: 6px !important; }
  .sp-sec:not(:first-child) { flex: 0 1 auto !important; }
}
