/* Atlantic Race: the race mode pages (races/*.html, drawn by race.js), 2026-10-23.
   Ocean navy and gold like the home page; --accent is the mode's own colour. */
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(./assets/barlow-latin-600-normal-DILqtrty.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url(./assets/barlow-latin-700-normal-A9pxMQ4z.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 800; font-display: swap; src: url(./assets/barlow-latin-800-normal-s1sAMnoV.woff2) format('woff2'); }

:root {
  --accent: #ffd34d;
  --gold: #ffd34d;
  --gold-deep: #e8a33a;
  --navy: #061a2e;
  --navy-2: #0d3354;
  --ink: #fff4d6;
  --muted: #a9c1d6;
  --panel: rgb(8 30 52 / .72);
  --line: rgb(255 211 77 / .28);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  background: var(--navy);
  color: var(--ink);
  font: 600 16px/1.45 Barlow, system-ui, sans-serif;
  overflow-x: hidden;
}
html:not(.ready) body > :not(.backdrop) { opacity: 0; }
body > * { transition: opacity .35s ease; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
kbd {
  display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .35em;
  border: 1px solid rgb(255 255 255 / .3); border-radius: 5px; background: rgb(0 0 0 / .25);
  color: var(--muted); font: 700 .78rem/1 system-ui, sans-serif; letter-spacing: .04em;
}
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* backdrop: ocean night, the mode's glow, speed lines and a band of sea */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(180deg, var(--navy-2), var(--navy) 70%); }
.backdrop .glow {
  position: absolute; inset: -20% 30% 10% -20%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  filter: blur(20px); opacity: .55;
}
.backdrop .lines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 46px, rgb(255 255 255 / .035) 46px 48px);
  mask-image: linear-gradient(90deg, #000, transparent 75%);
}
.backdrop .sea {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  background: linear-gradient(180deg, rgb(47 155 224 / .0), rgb(47 155 224 / .14) 30%, rgb(24 224 200 / .1));
}

/* top bar */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 3vw, 40px);
}
.back {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--gold); text-decoration: none;
  font-weight: 800; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase;
  backdrop-filter: blur(8px); transition: transform .15s ease, border-color .15s ease;
}
.back > span { font-size: 1.5rem; line-height: 0; }
.back:hover { transform: translateX(-3px); border-color: var(--gold); }
.brand { width: clamp(120px, 14vw, 200px); height: auto; filter: drop-shadow(0 4px 10px rgb(0 0 0 / .5)); }
.counter { justify-self: end; margin: 0; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; font-size: .85rem; }
.counter b { color: var(--accent); font-size: 1.2rem; }

/* main: the mode on the left, the stages on the right */
.arena {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 48px);
  align-items: center; width: min(1320px, 100%); margin: 0 auto; padding: 8px clamp(16px, 3vw, 40px) 20px;
}
.hero { min-width: 0; animation: slide-in .5s ease both; }
.mode-logo { display: block; width: min(100%, 640px); height: auto; filter: drop-shadow(0 10px 24px rgb(0 0 0 / .45)); }
.tag { margin: 6px 0 4px; color: var(--accent); font-weight: 800; font-size: clamp(1.1rem, 1.7vw, 1.45rem); letter-spacing: .08em; text-transform: uppercase; }
.about { margin: 0 0 18px; max-width: 54ch; color: var(--muted); font-size: 1.02rem; }
.stats {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 10px 26px;
  margin: 0 0 22px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  width: fit-content; max-width: 100%;
}
.stat dt { color: var(--muted); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; }
.stat dd { display: flex; gap: 4px; margin: 6px 0 0; }
.stat dd i { width: 16px; height: 10px; border-radius: 2px; background: rgb(255 255 255 / .12); transform: skewX(-18deg); }
.stat dd i.on { background: var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent); }
.stat.racers dd { font-size: 1.4rem; font-weight: 800; color: var(--ink); line-height: 1; margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.race-btn {
  min-width: 240px; padding: 18px 40px; border: 0; cursor: pointer;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  background: linear-gradient(180deg, #ffe48a, var(--gold) 45%, var(--gold-deep));
  color: #2a1a0c; font: 800 1.35rem/1 Barlow, sans-serif; letter-spacing: .2em; text-transform: uppercase;
  box-shadow: inset 0 -4px rgb(0 0 0 / .2); transition: transform .15s ease, filter .15s ease;
}
.race-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.race-btn:focus-visible { outline-offset: 5px; }
.picked { margin: 0; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; font-size: .85rem; }
.picked b { display: block; color: var(--ink); font-size: 1.25rem; letter-spacing: .08em; }

.stages { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); backdrop-filter: blur(10px); animation: slide-in .5s .08s ease both; }
.stages h2 { margin: 0 0 14px; color: var(--gold); font-size: .95rem; letter-spacing: .22em; text-transform: uppercase; }
.stage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stage {
  position: relative; display: grid; align-content: end; gap: 2px; min-height: 128px; padding: 14px; overflow: hidden;
  border: 1px solid rgb(255 255 255 / .12); border-radius: 12px; cursor: pointer; text-align: left;
  background: linear-gradient(160deg, rgb(47 155 224 / .22), rgb(6 26 46 / .9) 70%);
  color: var(--ink); font: inherit; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.stage:hover { transform: translateY(-3px); border-color: rgb(255 255 255 / .35); }
.stage[aria-checked='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 26px color-mix(in srgb, var(--accent) 35%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 35%, transparent), rgb(6 26 46 / .9) 75%);
}
.stage .num { color: var(--accent); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; }
.stage .city { font-weight: 800; font-size: 1.2rem; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.stage .country { color: var(--muted); font-size: .82rem; }
.stage-icon { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; color: rgb(255 255 255 / .16); }
.stage[aria-checked='true'] .stage-icon { color: var(--accent); }
/* locked stages: greyed, a padlock; picking one shows the three ways to open it */
.stage.locked { background: repeating-linear-gradient(135deg, rgb(255 255 255 / .03) 0 10px, transparent 10px 20px), rgb(4 14 26 / .85); border-style: dashed; cursor: help; }
.stage.locked .num { padding-right: 40px; color: var(--muted); }
.stage.locked :is(.city, .country) { opacity: .45; }
.stage.locked .lock { width: 36px; height: 36px; color: var(--gold); opacity: .85; }
.stage.locked:hover { border-color: var(--gold); }
.open-count { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); font-size: .7rem; letter-spacing: .14em; vertical-align: middle; }
.goals { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgb(255 255 255 / .1); }
.goals-title { margin: 0 0 10px; color: var(--ink); font-weight: 800; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; }
.goals-title span { color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: none; }
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.ways li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px; border: 1px solid rgb(255 255 255 / .1); border-radius: 10px; background: rgb(0 0 0 / .2); text-align: left; }
.ways li.ok { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ways .way-icon { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px; background: rgb(255 255 255 / .08); color: var(--gold); font-size: 1rem; }
.ways li.ok .way-icon { background: var(--accent); color: #06192c; }
.ways b { display: block; font-size: .82rem; line-height: 1.2; }
.ways small { display: block; color: var(--muted); font-size: .74rem; }
.tasks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .82rem; text-align: left; }
.tasks li span { margin-right: 6px; color: var(--gold); }
.tasks li.ok { color: var(--ink); }
.tasks li.ok span { color: var(--accent); }
.soon #soon-body:not(:empty) { margin: -4px 0 18px; }
.soon:has(#soon-body:not(:empty)) { width: min(620px, calc(100vw - 32px)); }
@media (max-width: 599px) { .ways { grid-template-columns: minmax(0, 1fr); } }

/* the rail: every mode, the current one lit */
.rail {
  display: flex; align-items: stretch; gap: 10px;
  padding: 12px clamp(16px, 3vw, 40px) 16px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(4 16 30 / .55), rgb(4 16 30 / .9));
}
.rail-track { position: relative; display: flex; flex: 1; gap: 10px; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: safe center; padding: 4px 2px; }
.rail-track::-webkit-scrollbar { display: none; }
.panel {
  flex: 0 0 auto; display: grid; justify-items: center; gap: 6px; width: 132px; padding: 12px 8px 10px;
  border: 1px solid rgb(255 255 255 / .12); border-radius: 12px; background: rgb(255 255 255 / .04);
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; text-align: center;
  transition: transform .15s ease, border-color .15s ease, color .15s ease, background .15s ease;
}
.panel .icon { width: 40px; height: 40px; color: var(--accent); opacity: .75; }
.panel:hover { transform: translateY(-3px); color: var(--ink); border-color: var(--accent); }
.panel[aria-current='page'] {
  color: #06192c; border-color: var(--accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.panel[aria-current='page'] .icon { color: #06192c; opacity: 1; }
.step {
  flex: 0 0 auto; display: grid; place-items: center; align-content: center; gap: 4px; width: 64px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  color: var(--gold); text-decoration: none; font-size: 2rem; line-height: .8; transition: border-color .15s ease, transform .15s ease;
}
.step:hover { border-color: var(--gold); transform: scale(1.04); }

/* coming soon */
.soon {
  width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--accent); border-radius: 16px;
  background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: var(--ink); text-align: center;
}
.soon::backdrop { background: rgb(2 8 16 / .7); }
.soon h2 { margin: 0 0 8px; color: var(--gold); font-size: 1.35rem; }
.soon p { margin: 0 0 18px; color: var(--muted); }
.soon button {
  width: 100%; padding: 12px; border: 2px solid var(--gold); border-radius: 10px; background: transparent; cursor: pointer;
  color: var(--gold); font: 800 1rem Barlow, sans-serif; letter-spacing: .2em; text-transform: uppercase;
}

@keyframes slide-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* (also phones held sideways that are 900-1199 px wide, e.g. a Pixel 7 at 915 x 412, 2026-10-27) */
@media (max-width: 899px), (orientation: landscape) and (max-height: 540px) and (max-width: 1199px) {
  .arena { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, auto); }
  .counter { display: none; }
  .topbar { grid-template-columns: auto 1fr; }
  .brand { justify-self: end; }
  .rail-track { justify-content: flex-start; }
  .panel { width: 108px; }
  .step { width: 48px; }
  .step kbd { display: none; }
}
@media (max-height: 760px) and (min-width: 900px) {
  .mode-logo { width: min(100%, 520px); }
  .stage { min-height: 100px; }
  .about { margin-bottom: 12px; }
  .stats { margin-bottom: 14px; }
}

/* ---- Options and Profile pages (options.html, profile.html), 2026-10-23 ---- */
.page-main { display: grid; align-content: start; gap: 20px; width: min(1180px, 100%); margin: 0 auto; padding: 4px clamp(16px, 3vw, 40px) 32px; }
.page-head { animation: slide-in .45s ease both; }
.page-head h1 {
  margin: 0; color: #fff; font-weight: 800; font-size: clamp(2.4rem, 5vw, 3.8rem); line-height: 1;
  letter-spacing: .04em; text-transform: uppercase; transform: skewX(-10deg); transform-origin: left bottom;
}
.page-head h1::after { content: ''; display: block; width: min(320px, 70%); height: 6px; margin-top: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), transparent); }
.page-head p { margin: 10px 0 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); backdrop-filter: blur(10px); animation: slide-in .45s .06s ease both; }
.card.wide { grid-column: 1 / -1; }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; color: var(--gold); font-size: .95rem; letter-spacing: .22em; text-transform: uppercase; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; padding: 12px 0; border-top: 1px solid rgb(255 255 255 / .07); }
.card h2 + .row { border-top: 0; padding-top: 0; }
.row .label { font-weight: 700; letter-spacing: .04em; }
.row small { display: block; color: var(--muted); font-weight: 600; font-size: .82rem; letter-spacing: 0; }
.row.stack { grid-template-columns: minmax(0, 1fr); }
.slider { display: flex; align-items: center; gap: 12px; }
.slider output { min-width: 3.2em; text-align: right; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
input[type='range'] { width: clamp(140px, 18vw, 220px); height: 24px; accent-color: var(--accent); cursor: pointer; }
.switch {
  position: relative; width: 58px; height: 32px; padding: 0; border: 1px solid rgb(255 255 255 / .25); border-radius: 999px; cursor: pointer;
  background: rgb(255 255 255 / .1); transition: background .15s ease, border-color .15s ease;
}
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #dfe8f0; transition: transform .15s ease; }
.switch[aria-checked='true'] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(26px); background: #06192c; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid rgb(255 255 255 / .15); border-radius: 10px; background: rgb(0 0 0 / .2); }
.segmented button {
  min-width: 74px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  color: var(--muted); font: 800 .82rem Barlow, sans-serif; letter-spacing: .12em; text-transform: uppercase;
}
.segmented button[aria-checked='true'] { background: var(--accent); color: #06192c; }
.logo-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.logo-choice {
  display: grid; gap: 6px; justify-items: center; padding: 8px; border: 1px solid rgb(255 255 255 / .12); border-radius: 12px; cursor: pointer;
  background: rgb(255 255 255 / .04); color: var(--muted); font: 700 .74rem Barlow, sans-serif; letter-spacing: .08em; text-transform: uppercase;
}
.logo-choice img { width: 100%; height: auto; }
.logo-choice[aria-checked='true'] { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; }
.keys div { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.keys dt { display: flex; gap: 4px; min-width: 92px; }
.keys dd { margin: 0; color: var(--ink); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.ghost-btn {
  padding: 12px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer;
  color: var(--gold); font: 800 .9rem Barlow, sans-serif; letter-spacing: .16em; text-transform: uppercase;
}
.ghost-btn:hover { border-color: var(--gold); }
.status { color: var(--muted); font-size: .9rem; }
.status.saved { color: var(--accent); }
.soon .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.soon .two button.danger { border-color: #ff6b6b; color: #ff6b6b; }

/* profile */
.player-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
.avatar-big {
  position: relative; display: grid; place-items: center; width: 150px; aspect-ratio: 1; border-radius: 24px; color: #06192c;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 40%, transparent);
}
.avatar-big svg { width: 62%; height: 62%; }
.avatar-big .race-num {
  position: absolute; right: -12px; bottom: -12px; display: grid; place-items: center; min-width: 54px; height: 54px; padding: 0 8px;
  border: 3px solid var(--navy); border-radius: 14px; background: var(--gold); color: #2a1a0c; font-weight: 800; font-size: 1.5rem;
}
.player-name { margin: 0; font-weight: 800; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.05; letter-spacing: .03em; text-transform: uppercase; overflow-wrap: anywhere; }
.player-sub { margin: 6px 0 0; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; }
.player-sub b { color: var(--accent); }
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label { color: var(--muted); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid rgb(255 255 255 / .18); border-radius: 10px;
  background: rgb(0 0 0 / .25); color: var(--ink); font: 700 1rem Barlow, sans-serif; letter-spacing: .03em;
}
.field select option { background: var(--navy); }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields-2 .field + .field { margin-top: 0; }
.fields-2 + .field, .field + .fields-2 { margin-top: 14px; }
.avatars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avatar {
  display: grid; place-items: center; aspect-ratio: 1; padding: 12px; border: 1px solid rgb(255 255 255 / .14); border-radius: 14px; cursor: pointer;
  background: rgb(255 255 255 / .04); color: var(--a);
}
.avatar svg { width: 100%; height: 100%; }
.avatar[aria-checked='true'] { background: var(--a); color: #06192c; border-color: var(--a); box-shadow: 0 6px 18px color-mix(in srgb, var(--a) 40%, transparent); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 14px; border: 1px solid rgb(255 255 255 / .1); border-radius: 12px; background: rgb(0 0 0 / .2); }
.tile b { display: block; color: var(--ink); font-size: 1.9rem; line-height: 1.1; }
.tile span { color: var(--muted); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; }
.note { margin: 12px 0 0; color: var(--muted); font-size: .88rem; }

@media (max-width: 899px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .logo-choices, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keys, .fields-2 { grid-template-columns: minmax(0, 1fr); }
  .player-card { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .avatar-big { width: 120px; }
}

/* ---- the race select page (modes.html): every mode as a game panel, 2026-10-23 ---- */
/* full width with a 70px border on every side; the grid fills the screen under the title,
   so the page fits without scrolling */
.modes-page { padding: 70px; }
.modes-page .topbar { grid-template-columns: auto 1fr; padding: 0 0 12px; }
.modes-main { display: flex; flex-direction: column; gap: 14px; width: 100%; padding: 0; }
.modes-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.modes-head h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.racer-chip {
  justify-self: end; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 14px 6px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); text-decoration: none;
  backdrop-filter: blur(8px); transition: border-color .15s ease, transform .15s ease;
}
.racer-chip:hover { border-color: var(--accent); transform: translateY(-2px); }
.rc-badge { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #06192c; }
.rc-icon { width: 28px; height: 28px; }
.rc-text { display: grid; min-width: 0; line-height: 1.15; }
.rc-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.rc-text small { color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }

.game-grid {
  flex: 1 1 0; display: grid; gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    'car car motorbike quad'
    'car car boat boat'
    'bicycle foot animal animal';
  min-height: 450px;
}
.game-panel[data-mode='car'] { grid-area: car; }
.game-panel[data-mode='motorbike'] { grid-area: motorbike; }
.game-panel[data-mode='quad'] { grid-area: quad; }
.game-panel[data-mode='boat'] { grid-area: boat; }
.game-panel[data-mode='bicycle'] { grid-area: bicycle; }
.game-panel[data-mode='foot'] { grid-area: foot; }
.game-panel[data-mode='animal'] { grid-area: animal; }

.game-panel {
  position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-width: 0; padding: 18px 20px; overflow: hidden; border-radius: 18px;
  border: 1px solid rgb(255 255 255 / .12); color: var(--ink); text-decoration: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 34%, var(--navy-2)), var(--navy) 72%);
  box-shadow: 0 10px 28px rgb(0 0 0 / .3);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  animation: slide-in .5s ease both;
}
.game-panel:nth-child(2) { animation-delay: .04s; } .game-panel:nth-child(3) { animation-delay: .08s; }
.game-panel:nth-child(4) { animation-delay: .12s; } .game-panel:nth-child(5) { animation-delay: .16s; }
.game-panel:nth-child(6) { animation-delay: .2s; } .game-panel:nth-child(7) { animation-delay: .24s; }
/* a slanted racing stripe and fine speed lines */
.game-panel::before {
  content: ''; position: absolute; z-index: -1; top: -30%; right: 22%; width: 22%; height: 160%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 32%, transparent), transparent 80%); transform: skewX(-20deg);
}
.game-panel::after {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: repeating-linear-gradient(110deg, transparent 0 22px, rgb(255 255 255 / .03) 22px 23px);
}
.gp-glow { position: absolute; z-index: -1; top: -40%; right: -20%; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 40%, transparent), transparent); opacity: .7; }
.gp-art {
  position: absolute; z-index: -1; right: -4%; bottom: -12%; width: min(62%, 300px); height: auto;
  color: var(--accent); opacity: .2; transform: rotate(-6deg); transition: transform .25s ease, opacity .25s ease;
}
.gp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gp-num { color: transparent; -webkit-text-stroke: 1.5px rgb(255 255 255 / .45); font-weight: 800; font-size: 2.2rem; line-height: 1; font-style: italic; }
.gp-racers {
  margin-left: auto; padding: 4px 10px; white-space: nowrap; border: 1px solid rgb(255 255 255 / .18); border-radius: 999px; background: rgb(0 0 0 / .25);
  color: var(--muted); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase;
}
.gp-body { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.gp-badge { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; border-radius: 12px; background: var(--accent); color: #06192c; transform: skewX(-8deg); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.gp-icon { width: 34px; height: 34px; transform: skewX(8deg); }
.gp-name { font-weight: 800; font-size: clamp(1.35rem, 1.9vw, 1.85rem); line-height: 1; letter-spacing: .03em; text-transform: uppercase; transform: skewX(-8deg); transform-origin: left; overflow-wrap: anywhere; }
.gp-tag { color: var(--accent); font-weight: 800; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.gp-about { display: none; max-width: 46ch; color: var(--muted); font-size: .98rem; }
.gp-stats { display: none; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.gp-stats > span { display: grid; gap: 4px; }
.gp-stats b { color: var(--muted); font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; }
.gp-bars { display: flex; gap: 3px; }
.gp-bars i { width: 14px; height: 8px; border-radius: 2px; background: rgb(255 255 255 / .14); transform: skewX(-18deg); }
.gp-bars i.on { background: var(--accent); }
.gp-play {
  flex: none; padding: 5px 12px; border-radius: 8px;
  background: rgb(0 0 0 / .3); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--ink); font-weight: 800; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
  transition: background .18s ease, color .18s ease;
}
.game-panel:is(:hover, :focus-visible) {
  transform: translateY(-5px); border-color: var(--accent);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--accent) 38%, transparent), 0 0 0 1px var(--accent);
}
.game-panel:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.game-panel:is(:hover, :focus-visible) .gp-art { opacity: .34; transform: rotate(-3deg) scale(1.06); }
.game-panel:is(:hover, :focus-visible) .gp-play { background: var(--accent); color: #06192c; }
.game-panel.last .gp-racers::before { content: 'Last played · '; color: var(--accent); }
/* the featured panel and the wide ones say more */
.game-panel[data-mode='car'] { padding: 26px 28px; }
.game-panel[data-mode='car'] .gp-name { font-size: clamp(2.2rem, 4vw, 3.6rem); }
.game-panel[data-mode='car'] .gp-badge { width: 64px; height: 64px; }
.game-panel[data-mode='car'] .gp-icon { width: 46px; height: 46px; }
.game-panel[data-mode='car'] .gp-tag { font-size: .95rem; }
.game-panel[data-mode='car'] :is(.gp-about) { display: block; }
.game-panel:is([data-mode='car'], [data-mode='boat'], [data-mode='animal']) .gp-stats { display: flex; }
.game-panel[data-mode='car'] .gp-art { width: min(78%, 520px); opacity: .24; }
.game-panel:is([data-mode='boat'], [data-mode='animal']) .gp-art { width: min(44%, 280px); }
.hints { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 22px; margin: 0; color: var(--muted); font-size: .85rem; }
.hints span { display: inline-flex; align-items: center; gap: 4px; }
/* touch screens: the keyboard hints mean nothing there (2026-10-27) */
@media (pointer: coarse) { .modes-page .hints { display: none; } }

@media (max-width: 1439px) and (min-width: 1100px) {
  .game-panel:is([data-mode='motorbike'], [data-mode='quad'], [data-mode='bicycle'], [data-mode='foot']) .gp-racers { display: none; }
  .game-panel:is([data-mode='motorbike'], [data-mode='quad'], [data-mode='bicycle'], [data-mode='foot']) .gp-play { margin-left: auto; }
}
@media (max-height: 1000px) and (min-width: 900px) {
  .game-panel:not([data-mode='car']) .gp-badge { display: none; }
}
@media (max-height: 800px) and (min-width: 900px) {
  .modes-head > div > p { display: none; }
  .modes-head h1::after { margin-top: 6px; }
  .game-grid { min-height: 380px; }
  .game-panel { padding: 14px 18px; }
  .game-panel[data-mode='car'] .gp-about { display: none; }
  .game-panel:is([data-mode='boat'], [data-mode='animal']) .gp-stats { display: none; }
  .gp-body { width: 100%; }
  /* (2026-10-28) tighter tracking: at 1280 x 720 three small panels cut their tagline ("Four wheels through the d…") */
  .gp-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .07em; }
  .game-panel[data-mode='car'] .gp-name { font-size: clamp(2rem, 3.4vw, 2.8rem); }
  .game-panel[data-mode='car'] .gp-badge { width: 52px; height: 52px; }
  .game-panel[data-mode='car'] .gp-icon { width: 38px; height: 38px; }
}
@media (max-width: 1099px) {
  .game-grid {
    flex: none; grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none; grid-auto-rows: minmax(180px, auto); min-height: 0;
    grid-template-areas: 'car car' 'motorbike quad' 'boat boat' 'bicycle foot' 'animal animal';
  }
  .game-panel[data-mode='car'] { min-height: 300px; }
}
@media (max-width: 899px), (orientation: landscape) and (max-height: 540px) and (max-width: 1199px) {
  .modes-page { padding: 0; }
  .modes-page .topbar { padding: 14px 16px; }
  .modes-main { padding: 0 16px 24px; }
  .modes-page .brand { display: none; }
  .modes-page .topbar { grid-template-columns: auto 1fr; }
  .hints { display: none; }
}
@media (max-width: 599px) {
  .game-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'car' 'motorbike' 'quad' 'boat' 'bicycle' 'foot' 'animal'; grid-auto-rows: minmax(160px, auto); }
  .game-panel[data-mode='car'] { min-height: 260px; }
  .game-panel[data-mode='car'] .gp-about { display: none; }
  .rc-text small { display: none; }
  /* (2026-10-28) "Last played · 10 racers" pushed the panel's Race button off the card on 360 px phones:
     a shorter label, and the chip gives way before the button does */
  .game-panel.last .gp-racers::before { content: 'Last · '; }
  .gp-racers { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .gp-play { flex: none; }
}

/* Exit Game page */
.exit-card { max-width: 640px; margin-top: 24px; display: grid; gap: 18px; justify-items: start; }
.exit-card p { margin: 0; line-height: 1.55; }

/* mode pages on phones held sideways (2026-10-26): the screen is only 340-430 px high, so the logo,
   the blurb and the stats stacked pushed Start Race below the fold. The hero goes in two columns
   (logo, tag line and blurb on the left; stats and Start Race on the right) so Start shows at once. */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1199px) {
  .arena > .hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 20px; align-items: start; }
  .arena > .hero > :is(.mode-logo, .tag, .about) { grid-column: 1; }
  .arena > .hero .mode-logo { width: min(100%, 340px); }
  .arena > .hero .tag { font-size: 1rem; }
  .arena > .hero .about { font-size: .9rem; margin-bottom: 8px; }
  .arena > .hero > .stats { grid-column: 2; grid-row: 1 / span 2; align-self: start; margin: 4px 0 12px; padding: 10px 14px; gap: 8px 18px; }
  .arena > .hero > .actions { grid-column: 2; grid-row: 3 / span 2; align-self: start; gap: 10px 14px; }
  .arena > .hero .race-btn { min-width: 0; width: 100%; padding: 14px 24px; }
}

/* the race select page on phones held sideways (2026-10-27): the seven panels were stacked in two
   columns with a 300 px Car panel, so a 412 px high screen showed the title and half of one panel.
   Now all seven fit on the screen in the big-screen arrangement, each panel trimmed to its number,
   name, tag line and Race. */
@media (orientation: landscape) and (max-height: 540px) {
  /* (html:is(...) outranks the touch screens' safe-area padding in menu-polish.css) */
  html:is(.ar-touch, :not(.ar-touch)) body.modes-page:not([data-home-page]):not(.drive) { height: 100svh; min-height: 0; padding: 0 max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
  html:is(.ar-touch, :not(.ar-touch)) body.modes-page:not([data-home-page]):not(.drive) .topbar { padding: max(8px, env(safe-area-inset-top)) 0 4px; }
  .modes-page .topbar .back, .modes-page .racer-chip { min-height: 40px; }
  .modes-main { min-height: 0; gap: 8px; padding: 0; }
  .modes-head { flex-wrap: nowrap; align-items: center; }
  .modes-head > div { display: flex; align-items: center; gap: 16px; }
  .modes-head h1 { font-size: 1.6rem; }
  .modes-head h1::after { display: none; }
  .modes-head .learn-link { margin-top: 0; }
  .game-grid {
    flex: 1 1 0; min-height: 0; gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); grid-auto-rows: auto;
    grid-template-areas: 'car car motorbike quad' 'car car boat boat' 'bicycle foot animal animal';
  }
  .game-panel, .game-panel[data-mode='car'] { min-height: 0; padding: 8px 12px; gap: 4px; border-radius: 12px; }
  .game-panel:not([data-mode='car']) .gp-badge, .gp-about, .gp-stats, .game-panel:is([data-mode='boat'], [data-mode='animal']) .gp-stats, .gp-racers { display: none; }
  .game-panel[data-mode='car'] .gp-stats { display: flex; }
  .gp-num { font-size: 1.4rem; }
  .gp-play { margin-left: auto; padding: 4px 10px; }
  .gp-body { width: 100%; gap: 2px; }
  .gp-name { font-size: 1.05rem; overflow-wrap: normal; white-space: nowrap; }
  .game-panel[data-mode='car'] .gp-name { font-size: 1.7rem; }
  .game-panel[data-mode='car'] .gp-badge { width: 40px; height: 40px; }
  .game-panel[data-mode='car'] .gp-icon { width: 28px; height: 28px; }
  .gp-tag, .game-panel[data-mode='car'] .gp-tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .game-panel:is(:hover, :focus-visible) { transform: none; }
}
