/* App layout. Mobile: full-bleed map, floating header, draggable bottom sheet.
   Desktop (≥900px): header + panel become a 380px left column floating over the map. */
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--f-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
:root { --top-h: 150px; --sheet-vis: 180px; --sheet-max: 70vh; --gutter: 12px; --col: 380px; }

.map { position: fixed; inset: 0; background: var(--bg); }
.map:focus-visible { outline: none; }

/* ---------- header ---------- */
.top { position: fixed; z-index: 20; top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: calc(env(safe-area-inset-left, 0px) + var(--gutter)); right: calc(env(safe-area-inset-right, 0px) + var(--gutter));
  display: grid; gap: 10px; pointer-events: none; }
.top > * { pointer-events: auto; }
.top .chips { margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; }
/* START leads the filter row and stays put while the filters scroll beside it */
.chiprow { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.chiprow .chips { flex: 1; min-width: 0; margin: 0 calc(-1 * var(--gutter)) 0 0; padding: 2px var(--gutter) 6px 2px; }
.brandbar { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 6px 6px 12px; border-radius: 18px; background: var(--chrome); color: var(--chrome-fg); box-shadow: var(--sh-2); }
.brandbar img.evt { height: 44px; width: auto; flex: none; padding-right: 10px; margin-right: 2px; border-right: 1px solid rgba(230, 204, 138, .35); box-sizing: content-box; }
.brandbar .bt { flex: 1; min-width: 0; line-height: 1.15; }
.brandbar .bt b { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font: 600 clamp(12.5px, 3.5vw, 16px)/1.15 var(--f-display); color: #FBF6EA; text-wrap: balance; }
/* min-width 0: the bar must shrink with the screen. Its nowrap eyebrow otherwise sets a minimum width and pushes the language button off the edge. */
.brandbar { min-width: 0; max-width: 100%; }
.brandbar .bt .eb { font-size: 9px; letter-spacing: .14em; color: rgba(244, 241, 232, .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandbar .bt span { display: block; font: 600 10.5px/1.3 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-300); }
.seg button { min-width: 44px; height: 36px; }
.search { position: relative; }
.search input[type="search"]::-webkit-search-cancel-button { display: none; }
.search .icon-btn { width: 40px; height: 40px; }

@media (max-width: 639.98px), (max-width: 899.98px) and (min-height: 520.02px) { .has-detail .top .chiprow { display: none; } }

/* ---------- floating buttons ---------- */
.fabs { position: fixed; z-index: 15; right: calc(env(safe-area-inset-right, 0px) + var(--gutter)); bottom: calc(var(--sheet-vis) + 14px);
  display: grid; gap: 10px; transition: bottom .28s var(--ease); }
.fab .ico { width: 22px; height: 22px; }

/* ---------- panel / bottom sheet ---------- */
.panel { position: fixed; z-index: 18; left: 0; right: 0; bottom: 0; height: var(--sheet-max); display: flex; flex-direction: column;
  transform: translateY(calc(var(--sheet-max) - var(--sheet-vis))); transition: transform .28s var(--ease); will-change: transform; }
.panel.is-dragging, .panel.is-dragging ~ .fabs { transition: none; }
.panel-grab { flex: none; height: 26px; display: grid; place-items: start center; cursor: grab; touch-action: none; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.panel[data-state="peek"] .panel-body { overflow: hidden; }
.sum { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 2px 4px; }
.sum b { font: 600 17px/1.3 var(--f-display); text-wrap: balance; }
.sum span { font-size: 12px; color: var(--fg-3); white-space: nowrap; }
.list .row:last-child { border-bottom: 0; }
.empty { padding: 26px 6px; display: grid; gap: 10px; justify-items: start; color: var(--fg-2); }
.empty b { font: 600 17px/1.3 var(--f-display); color: var(--fg); }
.empty .btn { height: 40px; }

/* ---------- detail ---------- */
.detail-top { display: flex; justify-content: space-between; align-items: center; margin: -6px -6px 2px; }
.detail-head { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 12px; align-items: center; padding: 0 2px 12px; }
.detail-logo { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; background: var(--logo-bg); --pin: 60px;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 4px var(--surface), 0 0 0 6px var(--cat), var(--sh-1); }
.detail-logo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.detail-head h2 { margin: 0; font: 600 20px/1.2 var(--f-display); text-wrap: balance; overflow-wrap: anywhere; }
.detail-head .sub { color: var(--fg-2); font-size: 13.5px; margin-top: 2px; }
.detail-head .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; align-items: center; }
.actions { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 46px; gap: 8px; margin-top: 14px; }
.actions .btn { padding: 0 12px; min-width: 0; }
.actions .btn span { overflow: hidden; text-overflow: ellipsis; }
.actions .btn.sq { padding: 0; }
.actions .btn-wide { grid-column: 1 / -1; }
.facts-list { display: grid; gap: 4px; margin-top: 14px; font-size: 14px; }
.fact { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; color: var(--fg-2); padding: 8px 0; border-top: 1px solid var(--line); }
.fact > .ico { width: 18px; height: 18px; color: var(--fg-3); margin-top: 2px; }
.fact b { color: var(--fg); font-weight: 600; }
.fact a { color: var(--fg); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.fact .icon-btn { margin: -8px -6px -8px 0; width: 40px; height: 40px; }
.fact .icon-btn .ico { width: 18px; height: 18px; }
.also { margin-top: 12px; font-size: 12.5px; color: var(--fg-3); }

/* ---------- staff card ---------- */
.staff { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); }
.staff-card { position: relative; box-sizing: border-box; width: min(100%, 480px); max-height: 100%; overflow-y: auto; background: var(--ticket); border: 1px solid var(--ticket-line); border-radius: var(--r-lg);
  padding: 22px 22px 18px; display: grid; justify-items: center; gap: 10px; text-align: center; box-shadow: var(--sh-2); color: var(--fg); }
.staff-x { position: absolute; top: 8px; right: 8px; }
.staff-hint { font: 500 13px/1.3 var(--f-ui); color: var(--fg-2); }
.staff-card .detail-logo { width: 88px; height: 88px; --pin: 88px; }
.staff-card h2 { margin: 0; font: 600 28px/1.2 var(--f-display); text-wrap: balance; }
.staff-card .sub { color: var(--fg-2); }
.staff-perk { text-wrap: balance; font: 700 34px/1.15 var(--f-display); color: var(--fg); padding: 6px 14px; border-radius: 12px; background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: var(--navy-950); }
/* offer and its translation: a block as wide as its text, centred in the card, lines left-aligned inside it.
   One short line then sits centred like the rest of the card; a list keeps a straight left edge. */
.staff-offer { font: 500 18px/1.6 var(--f-ui); text-align: left; max-width: 100%; text-wrap: pretty; }   /* no single word left alone on the last line */
.staff-card .ln-li { padding-left: 1em; text-indent: -1em; }   /* wrapped list items hang under their text, not under the bullet */
.staff-who { text-wrap: balance; font: 600 15px/1.5 var(--f-ui); color: var(--fg); border-top: 1px dashed var(--ticket-line); padding-top: 10px; width: 100%; }
/* the same promotion in the reader's language: a full second block, so the runner can check what the staff are reading.
   Outlined, not filled: the Thai block above stays the one the staff look at first. */
.staff-mine { display: grid; justify-items: center; gap: 8px; width: 100%; padding-top: 12px; border-top: 1px dashed var(--ticket-line); }
.staff-mine b { font: 700 22px/1.2 var(--f-display); text-wrap: balance; padding: 4px 12px; border: 1.5px solid var(--gold-500); border-radius: 10px; color: var(--fg); }
.staff-mine-offer { font: 500 15px/1.55 var(--f-ui); color: var(--fg); text-align: left; max-width: 100%; text-wrap: pretty; }
.staff-mine-who { font: 400 13px/1.45 var(--f-ui); color: var(--fg-2); text-wrap: balance; }
.staff-mark { display: flex; align-items: center; gap: 10px; font: 500 12px/1 var(--f-ui); color: var(--fg-3); margin-top: 4px; }

.map.z-near { --pin: 54px; }
.chip-open .ico { color: var(--ok); }

/* ---------- map overlays ---------- */
.ghost { width: 10px; height: 10px; border-radius: 50%; background: var(--navy-500); opacity: .5; box-shadow: 0 0 0 2px var(--pin-ring); pointer-events: none; }
.me { width: 18px; height: 18px; border-radius: 50%; background: var(--c-sport); box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(8, 18, 42, .4); position: relative; }
.me::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; background: rgba(47, 98, 198, .22); animation: me 2s ease-out infinite; }
@keyframes me { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.maplibregl-marker { will-change: transform; }
.maplibregl-ctrl-bottom-right { bottom: var(--sheet-vis); transition: bottom .28s var(--ease); }
.maplibregl-ctrl-attrib { font: 11px/1.4 var(--f-ui); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--surface); color: var(--fg-2); }
.maplibregl-ctrl-attrib a { color: var(--fg-2); }

.toast { position: fixed; z-index: 40; left: 50%; top: calc(var(--top-h) + 22px); transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: var(--r-pill); background: var(--navy-800); color: #F4F1E8; font: 500 14px/1.35 var(--f-ui); box-shadow: var(--sh-2); text-align: center; }
.maperr { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--fg-2); z-index: 1; }

/* side-panel layout: desktops, and phones held sideways. Keep in step with deskMQ in app.js. */
@media (min-width: 900px), (min-width: 640px) and (max-height: 520px) {
  :root { --gutter: 16px; }
  .top { left: calc(env(safe-area-inset-left, 0px) + 16px); right: auto; top: 16px; width: var(--col); }
  .top .chips { flex-wrap: wrap; margin: 0; padding: 2px; }
  .chiprow .chips { margin: 0; padding: 2px; }
  .panel { left: calc(env(safe-area-inset-left, 0px) + 16px); right: auto; width: var(--col); top: calc(var(--top-h) + 26px); bottom: 16px; height: auto;
    transform: none; border-radius: var(--r-lg); box-shadow: var(--sh-2); border: 1px solid var(--line); }
  .panel-grab { height: 14px; cursor: default; }
  .panel-grab .sheet-handle { display: none; }
  .panel[data-state="peek"] .panel-body { overflow-y: auto; }
  .fabs { bottom: 34px; right: 16px; }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
  .toast { left: calc(16px + var(--col) / 2); top: 24px; }
}
@media (prefers-reduced-motion: reduce) { .panel, .fabs, .maplibregl-ctrl-bottom-right { transition: none; } .me::after { animation: none; } }

/* ---------- welcome card: the real race bib, re-captioned. Red lives only here because it is the bib's own colour. ---------- */
.welcome { --bib-red: #E8302A; position: fixed; inset: 0; z-index: 60; overflow-y: auto; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(7, 9, 32, .86), rgba(7, 9, 32, .96) 34%); color: #F4F1E8; font-family: var(--f-ui);
  padding: max(16px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }
.w-in { width: min(100%, 400px); margin: auto auto 0; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 900px), (min-width: 640px) and (max-height: 520px) { .w-in { margin: auto; } .welcome { background: rgba(7, 9, 32, .88); } }
.w-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.w-hello { font: 600 12px/1.2 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-300); min-width: 0; }
/* the bib keeps the Futura-style face in every language, like the printed one */
/* ".bib *" because :lang(zh) in ui.css resets the font tokens on every element, not only the root */
.bib, .bib * { --f-display: "Jost", "LINE Seed Sans TH", "Noto Sans SC", sans-serif; --f-ui: "Jost", "LINE Seed Sans TH", "Noto Sans SC", sans-serif; }
.bib { background: #FFFFFF; color: var(--navy-800); border-radius: 5px; position: relative; overflow: hidden; transform: rotate(-2deg); margin: 4px 2px 8px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .75); animation: bib-in .6s var(--ease); }
.bib-hd { background: var(--navy-800); height: 64px; display: grid; place-items: center; }
.bib-hd img { height: 48px; width: auto; display: block; }
.bib > i { position: absolute; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy-950); box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.bib > i:nth-of-type(1) { left: 10px; } .bib > i:nth-of-type(2) { right: 10px; }
.bib-race { font: 700 clamp(12px, 4.1vw, 16px)/1.15 var(--f-display); letter-spacing: .03em; text-transform: uppercase; color: var(--bib-red); text-align: center; padding: 9px 10px 0; text-wrap: balance; }
.bib-b { display: grid; grid-template-columns: 26px minmax(0, 1fr) 58px; gap: 8px; padding: 2px 10px 6px; align-items: start; }
.bib-l { display: flex; flex-direction: column; gap: 3px; align-items: center; padding-top: 10px; }
.bib-l span { width: 22px; height: 22px; border: 1px solid var(--navy-800); border-radius: 2px; display: grid; place-items: center; }
.bib-l .ico { width: 15px; height: 15px; }
.bib-l b { font: 500 11px var(--f-ui); margin-top: 3px; }
.bib-c { text-align: center; min-width: 0; }
.bib-c span { display: block; }
.bib-c .num { font: 700 clamp(84px, 30vw, 112px)/.92 var(--f-display); color: var(--bib-red); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.bib-c .nm { font: 700 25px/1.15 var(--f-display); }
.bib-c .ln { font: 500 13px/1.3 var(--f-ui); letter-spacing: .04em; }
.bib-r { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 10px; }
.bib-r .tag { background: var(--bib-red); color: #FFFFFF; font: 700 9px/1 var(--f-ui); padding: 3px 5px; transform: skewX(-12deg); }
.bib-r .lb { font: 700 12px/1.1 var(--f-ui); margin-top: 6px; letter-spacing: .04em; }
.bib-r .v { font: 700 28px/1 var(--f-display); }
.bib-r .gold { font: 700 9px/1 var(--f-ui); color: var(--navy-900); background: var(--gold-500); padding: 4px 6px; margin-top: 6px; clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%); white-space: nowrap; }
.bib-r .flag { width: 44px; height: 30px; margin-top: 7px; background: linear-gradient(180deg, var(--bib-red) 0 17%, #FFFFFF 17% 33%, var(--navy-800) 33% 67%, #FFFFFF 67% 83%, var(--bib-red) 83%); }
.bib-ft { font: 700 11.5px/1.3 var(--f-ui); text-align: center; padding: 6px 10px 8px; border-top: 1px dashed var(--navy-200); margin: 0 10px; }
.w-who { color: #D9DEEC; font-size: 14px; line-height: 1.4; text-align: center; margin: 0; }
.w-cats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.w-cats button { font: 600 14.5px var(--f-ui); text-align: left; min-height: 44px; padding: 10px 12px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .07); color: #F4F1E8; }
.w-cats button b { margin-left: auto; color: var(--gold-300); font-variant-numeric: tabular-nums; }
.w-cta { font: 700 16px var(--f-ui); min-height: 50px; padding: 14px; border-radius: 14px; border: 0; background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: var(--navy-950); cursor: pointer; }
.w-ghost { font: 600 14px var(--f-ui); min-height: 44px; background: none; border: 0; padding: 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: #D9DEEC; }
.welcome button:focus-visible { outline: 3px solid var(--gold-300); outline-offset: 2px; }
/* no opacity in the keyframes: if the animation never starts the bib must still be readable */
@keyframes bib-in { from { transform: translateY(40px) rotate(-6deg); } to { transform: translateY(0) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .bib { animation: none; } }

/* ---------- race start / finish pins: the event logo in a gold ring, with a flag label ---------- */
.racepin { display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; cursor: pointer; z-index: 4; font-family: "Jost", var(--f-ui); }
.racepin .rp-dot { width: 50px; height: 50px; border-radius: 50%; background: #FFFFFF; border: 3px solid var(--gold-500); overflow: hidden; display: grid; place-items: center; box-shadow: var(--sh-pin); }
.racepin .rp-dot img { width: 44px; height: 44px; display: block; }
.racepin .rp-tail { width: 12px; height: 12px; background: var(--gold-500); transform: rotate(45deg); margin-top: -7px; border-radius: 2px; }
.racepin .rp-lb { font: 700 11px/1 var(--f-ui); letter-spacing: .1em; color: #F4F1E8; background: var(--navy-800); padding: 4px 7px; border-radius: 6px; margin-bottom: 3px; white-space: nowrap; box-shadow: var(--sh-1); }
.racepin .rp-lb i { font-style: normal; }
.racepin-finish .rp-lb { background: #F4F1E8; color: var(--navy-800); }
.racepin-near { display: none; }
.map.z-near .racepin-near { display: flex; }
.map.z-near .racepin-both .rp-lb i { display: none; }
.racepin:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }

/* ---------- language switch in the header ----------
   A globe says "language" in any language; the name beside it is the current one. The list is our own menu so it can
   follow the site's look: each row is the language's own name with an English gloss, the current one ticked. */
.lang { position: relative; flex: none; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 11px 0 10px; border: 0; border-radius: var(--r-pill);
  background: var(--gold-500); color: var(--navy-900); font: 700 13px/1 var(--f-ui); cursor: pointer; }
.lang svg { flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.lang-globe { width: 19px; height: 19px; stroke-width: 1.7; }
.lang-chev { width: 11px; height: 11px; stroke-width: 2; transition: transform .15s var(--ease); }
.lang-btn[aria-expanded="true"] .lang-chev { transform: rotate(180deg); }
.lang-btn:focus-visible { outline: 2px solid #F4F1E8; outline-offset: 2px; }
.lang-menu { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; min-width: 208px; padding: 6px; border-radius: var(--r-md);
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); box-shadow: var(--sh-2); display: grid; gap: 2px; }
.lang-menu button { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: none; color: inherit; font: 500 15px/1.3 var(--f-ui); text-align: left; cursor: pointer; }
.lang-menu button b { font-weight: 600; }
.lang-menu button b, .lang-menu button span { white-space: nowrap; }   /* "Tiếng Việt" broke onto two lines: the menu sizes to its narrowest wrap */
.lang-menu button span { font-size: 13px; color: var(--fg-3); }
.lang-menu .lang-tick { width: 16px; height: 16px; margin-left: auto; align-self: center; stroke-width: 2.2; color: var(--accent-ink); visibility: hidden; }
.lang-menu button[aria-checked="true"] { background: var(--surface-2); }
.lang-menu button[aria-checked="true"] .lang-tick { visibility: visible; }
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .lang-chev { transition: none; } }
/* after the base rules above, or they would win: */
@media (max-width: 340px) { .brandbar .bt .eb { white-space: normal; } }
/* narrow phones: tighten the eyebrow and the language button so the English title still fits on two lines */
@media (max-width: 420px) { .brandbar .bt .eb { letter-spacing: .02em; } .lang-btn { gap: 4px; padding: 0 8px; } .lang-globe { width: 17px; height: 17px; } }
/* the bib keeps Jost, with Japanese glyphs from a Japanese face */
:lang(ja) .bib, :lang(ja) .bib * { --f-display: "Jost", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif; --f-ui: "Jost", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif; }

/* ---------- START button: goes to the race start / finish points ----------
   Navy pill like the pin labels, so the button and the pins read as the same thing. It leads the filter row, where it is always on screen. */
.race { position: relative; flex: none; padding-top: 2px; }
.race-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 11px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--navy-800); color: #F4F1E8; font: 700 12px/1 "Jost", var(--f-ui); letter-spacing: .1em; box-shadow: var(--sh-2); }
.race-btn .ico { width: 18px; height: 18px; color: var(--gold-300); }
.race-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.race-menu { position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: min(300px, calc(100vw - 2 * var(--gutter))); padding: 6px; border-radius: var(--r-md);
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); box-shadow: var(--sh-2); display: grid; gap: 2px; }
.race-h { font: 600 12px/1.3 var(--f-ui); color: var(--fg-3); padding: 6px 10px 4px; }
.race-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 2px; }
.race-row > button { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: inherit;
  font: 600 14px/1.3 var(--f-ui); text-align: left; cursor: pointer; }
.race-row > button:hover, .race-row > a:hover { background: var(--surface-2); }
.race-row > a { width: 44px; height: 44px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--fg-2); }
.race-row > a .ico { width: 20px; height: 20px; }
.race-row > button:focus-visible, .race-row > a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.race-k { flex: none; width: 54px; text-align: center; font: 700 10px/1 "Jost", var(--f-ui); font-style: normal; letter-spacing: .08em; padding: 4px 0; border-radius: 5px; background: var(--navy-800); color: #F4F1E8; }
.race-k-finish { background: #F4F1E8; color: var(--navy-800); box-shadow: inset 0 0 0 1px var(--line-2); }
/* START menu: never wider than the screen; long place names wrap */
.race-menu { box-sizing: border-box; max-width: calc(100vw - 2 * var(--gutter)); }
.race-row > button { min-width: 0; }
.race-row > button span { min-width: 0; overflow-wrap: anywhere; }
/* short screens (a phone held sideways): there is no room below the button, so the menu pins to the top-left and scrolls,
   and the filters stay on one scrolling line so the list keeps some height */
@media (max-height: 520px) {
  .race-menu { position: fixed; left: calc(env(safe-area-inset-left, 0px) + 16px); top: 8px; max-height: calc(100dvh - 16px); overflow-y: auto; }
  .top .chips { flex-wrap: nowrap; }
}
/* very small phones (320 x 568): slightly smaller round buttons so the column clears the filter row */
@media (max-width: 639.98px) and (max-height: 600px) { .fabs { gap: 6px; } .fab { width: 42px; height: 42px; } }
/* welcome card on 320px phones: four language buttons need the whole row, so the greeting above the bib gives way */
.w-langs button { white-space: nowrap; }
@media (max-width: 360px) { .w-hello { display: none; } .w-top { justify-content: flex-end; } }

/* the bib in Korean and Vietnamese */
:lang(ko) .bib, :lang(ko) .bib * { --f-display: "Jost", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; --f-ui: "Jost", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }
:lang(vi) .bib, :lang(vi) .bib * { --f-display: "Be Vietnam Pro", sans-serif; --f-ui: "Be Vietnam Pro", sans-serif; }
/* welcome card with six languages: the greeting takes its own line, the buttons share the row below */
.w-top { flex-direction: column; align-items: stretch; gap: 8px; }
.w-hello { text-align: center; }
.w-langs { display: flex; }
.w-langs button { flex: 1 1 0; min-width: 0; padding: 0 2px; font-size: 12.5px; }
@media (max-width: 360px) { .w-hello { display: block; } }
.bib-c .nm { text-wrap: balance; }   /* "Cửa hàng / đối tác", not "Cửa hàng đối / tác" */
/* the greeting above the title may take two lines (Vietnamese and Korean are longer than the English) rather than end in "…" */
.brandbar .bt .eb { white-space: normal; }
