/* Lap Board base + component styles. Pages add their own CSS in pages/<id>/ (scoped by .page-<id>). */

/* ============ reset ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; overscroll-behavior-y: none; } /* no rubber-band dragging the sticky header */
html.text-lg { font-size: 112.5%; } /* "Text size: Large" (core/me.js): every rem follows */
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/var(--lh-body) var(--font-ui);
  font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; overflow-x: clip; text-rendering: optimizeLegibility; /* clip: no scroll container, so the sticky header stays put on iOS */
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
[hidden] { display: none !important; }

/* subtle page atmosphere */
body::before { /* absolute, not fixed: a fixed full-screen gradient is repainted on every scroll frame on phones */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 900px; pointer-events: none; z-index: -1;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 82, 54, 0.055), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(90, 169, 255, 0.035), transparent 60%);
}

/* ============ typography helpers ============ */
.mono, .num, .code, code, pre { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }
.kicker {
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3);
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.kicker.accent { color: var(--text-2); } /* one accent per screen: kickers stay neutral */
.display { font-size: var(--fs-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: var(--track-display); }
.h1 { font-size: var(--fs-4xl); font-weight: 600; line-height: 1.06; letter-spacing: var(--track-display); }
.h2 { font-size: var(--fs-3xl); font-weight: 600; line-height: 1.1; letter-spacing: var(--track-head); }
.h3 { font-size: var(--fs-xl); font-weight: 600; line-height: var(--lh-snug); letter-spacing: -0.015em; }
.lead { font-size: var(--fs-lg); color: var(--text-2); line-height: 1.5; max-width: 62ch; }
.muted { color: var(--text-2); } .dim { color: var(--text-3); } .faint { color: var(--text-4); }
.up { color: var(--c-up); } .down { color: var(--c-down); }
.fastest { color: var(--c-fastest); } .personal { color: var(--c-personal); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ layout ============ */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-text { max-width: var(--maxw-text); }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s-4)); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s-3)); min-width: 0; }
.row.wrap-ok { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--gap, var(--s-4)); grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr)); }
.grid > * { min-width: 0; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: 1 / -1; }
.auto-grid { display: grid; gap: var(--gap, var(--s-4)); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 240px)), 1fr)); }
@media (max-width: 1100px) { .span-3, .span-4 { grid-column: span 6; } .span-5, .span-7, .span-8, .span-9 { grid-column: 1 / -1; } .span-6 { grid-column: 1 / -1; } }
@media (max-width: 720px) { .span-3, .span-4, .span-6 { grid-column: 1 / -1; } }
.section { margin-top: var(--s-10); }
.section:first-child { margin-top: 0; }

/* ============ app shell ============ */
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }

.nav {
  position: sticky; top: 0; z-index: var(--z-nav); height: var(--nav-h);
  background: var(--surface-glass); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { height: 100%; display: flex; align-items: center; gap: var(--s-6); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15.5px; letter-spacing: -0.02em; white-space: nowrap; }
.logo-mark { width: 26px; height: 26px; flex: none; }
.logo-bar { display: block; width: 24px; height: 4px; border-radius: 1px; background: var(--accent); flex: none; }
.logo-word { font: 800 22px/1 var(--font-display); letter-spacing: 0.01em; }
.logo small { font: 500 var(--fs-micro)/1 var(--font-mono); color: var(--text-3); letter-spacing: 0.08em; border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; margin-left: 2px; }
.nav-links { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.nav-links a {
  position: relative; padding: 8px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav-links a:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.04); }
.nav-links a[aria-current="page"] { color: var(--text); background: rgba(var(--ink-rgb), 0.07); }
.nav-links a .dot-live { position: absolute; top: 7px; right: 5px; }
.nav-right { display: flex; align-items: center; gap: var(--s-3); }
.nav-status {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; transition: border-color var(--t-fast);
  min-height: 44px; height: 44px; padding: 0 14px 0 12px;
}
.nav-status:hover { border-color: var(--line-3); color: var(--text); }
.nav-status b { color: var(--text); font-weight: 600; }
.nav-status .mono { font-size: var(--fs-xs); color: var(--text); }
.nav-status .dim { color: var(--text-3); }
.menu-btn { display: none; width: 38px; height: 38px; border-radius: var(--r-md); align-items: center; justify-content: center; margin-right: -8px; }
.menu-btn:hover { background: rgba(var(--ink-rgb), 0.05); }
.menu-btn svg { width: 20px; height: 20px; }

.mobile-menu {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: var(--z-menu); background: var(--menu-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: var(--s-6) var(--gutter) var(--s-9); overflow-y: auto;
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.mobile-menu.open { opacity: 1; transform: none; pointer-events: auto; }
.mobile-menu a { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 26px; font-weight: 600; letter-spacing: -0.025em; }
.mobile-menu a[aria-current="page"] { color: var(--accent-text); }
.mobile-menu a span { font: 500 11px var(--font-mono); color: var(--text-3); letter-spacing: 0.06em; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
  .nav-right { margin-left: auto; }
}
@media (max-width: 520px) { .logo small { display: none; } }
@media (max-width: 560px) { .hide-sm { display: none !important; } }

main#app { min-height: calc(100vh - var(--nav-h) - 160px); min-height: calc(100dvh - var(--nav-h) - 160px); padding: var(--s-8) 0 var(--s-10); }
.view { animation: view-in var(--t-slow) var(--ease) both; }
.view.leaving { animation: view-out var(--t-fast) var(--ease-in-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes view-out { to { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .view, .view.leaving { animation: none; } }

.route-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 100; opacity: 0; transition: width 600ms var(--ease), opacity 200ms; }
.route-progress.on { opacity: 1; width: 70%; }
.route-progress.done { width: 100%; opacity: 0; transition: width 200ms var(--ease), opacity 300ms 150ms; }

.footer { border-top: 1px solid var(--line); padding: var(--s-8) 0 var(--s-9); color: var(--text-3); font-size: var(--fs-sm); }
.footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s-7); }
.footer h4, .footer .foot-h { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--track-kicker); color: var(--text-2); font-weight: 600; margin-bottom: var(--s-3); }
.footer li { margin: 6px 0; }
.footer a { color: var(--text-2); } .footer a:hover { color: var(--text); }
.footer .legal { max-width: 52ch; line-height: 1.6; }
#footer-links { columns: 2; column-gap: var(--s-6); }
#footer-links li { break-inside: avoid; margin: 0 0 12px; }
.footer .credits-line { line-height: 1.6; margin: 0 0 10px; max-width: 40ch; }
@media (max-width: 760px) { .footer .wrap { grid-template-columns: 1fr; gap: var(--s-6); } }

/* ============ page header ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap; margin-bottom: var(--s-8); }
.page-head .stack { --gap: var(--s-3); max-width: 760px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.section-head .h2, .section-head .h3 { margin-top: 6px; }

/* ============ buttons ============ */
.btn {
  --b-bg: rgba(var(--ink-rgb), 0.06); --b-fg: var(--text); --b-line: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-pill);
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-line); font-size: var(--fs-sm); font-weight: 550; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast), transform var(--t-fast) var(--ease), color var(--t-fast);
}
.btn:hover { --b-bg: rgba(var(--ink-rgb), 0.1); --b-line: var(--line-3); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { --b-bg: var(--text); --b-fg: var(--text-inverse); --b-line: transparent; }
.btn.primary:hover { --b-bg: var(--text-max); }
/* one primary look (BRAND-BOOK §4): primary buttons are white. .accent is kept as an alias so older pages do not break. */
.btn.accent { --b-bg: var(--text); --b-fg: var(--text-inverse); --b-line: transparent; }
.btn.accent:hover { --b-bg: var(--text-max); }
.btn.ghost { --b-bg: transparent; --b-line: transparent; color: var(--text-2); }
.btn.ghost:hover { --b-bg: rgba(var(--ink-rgb), 0.05); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: var(--fs-xs); }
.btn.lg { height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; transition: color var(--t-fast), gap var(--t-fast) var(--ease); }
.link-arrow:hover { color: var(--text); gap: 9px; }
.link-arrow svg { width: 14px; height: 14px; }

/* ============ card ============ */
.card {
  position: relative; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); min-width: 0; display: flex; flex-direction: column;
}
.card-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-5) var(--s-5) 0; min-height: 28px; }
.card-head .titles { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card-title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.card-sub { font-size: var(--fs-sm); color: var(--text-3); }
.card-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.card-body { padding: var(--s-5); flex: 1; min-width: 0; }
.card-body.flush { padding: var(--s-3) 0 0; }
.card-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-xs); display: flex; align-items: center; gap: var(--s-3); }
.card.interactive { transition: border-color var(--t-med) var(--ease), transform var(--t-med) var(--ease), background var(--t-med); }
.card.interactive:hover { border-color: var(--line-3); background: var(--surface-hover); transform: translateY(-2px); }
.card.raised { background: linear-gradient(180deg, var(--surface-raise), var(--surface-1)); box-shadow: var(--shadow-2); }
.card.accent-edge::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, var(--line-3), transparent 40%); /* neutral since rev 8 (one accent per screen) */ -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }

/* ============ stat tile ============ */
.stat { display: flex; flex-direction: column; gap: 6px; padding: var(--s-5); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.stat.bare { background: none; border: 0; padding: 0; }
.stat-label { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3); }
.stat-value { font: 500 clamp(24px, 2.6vw, 32px)/1.05 var(--font-mono); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--text); display: flex; align-items: baseline; gap: 4px; }
.stat-value.ui { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.03em; }
.stat-unit { font: 500 var(--fs-xs) var(--font-mono); color: var(--text-3); letter-spacing: 0; }
.stat-foot { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-3); min-height: 18px; }
.stat-foot .delta { font-family: var(--font-mono); font-weight: 500; }
.stat .spark { margin-top: 4px; }

/* ============ table ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tbl { width: 100%; font-size: var(--fs-sm); }
.tbl th {
  text-align: left; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
  padding: 0 var(--s-3) var(--s-3); white-space: nowrap; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 11px var(--s-3); border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: var(--s-5); }
.tbl th:last-child, .tbl td:last-child { padding-right: var(--s-5); }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl .mono, .tbl .num { font-size: var(--fs-xs); }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: rgba(var(--ink-rgb), 0.025); }
.tbl tr.hl td { background: rgba(var(--ink-rgb), 0.035); }
.tbl tr[data-href] { cursor: pointer; }
.tbl.dense td { padding-top: 7px; padding-bottom: 7px; }
.tbl .pos { font: 500 var(--fs-xs) var(--font-mono); color: var(--text-2); width: 1%; }
.tbl .grow { width: 100%; }

/* ============ tabs + segmented ============ */
.tabs { display: flex; gap: var(--s-5); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 10px 0 12px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); white-space: nowrap; transition: color var(--t-fast); }
.tab:hover { color: var(--text-2); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; }
.tab .count { font: 500 var(--fs-2xs) var(--font-mono); color: var(--text-3); margin-left: 6px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { height: 28px; padding: 0 12px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 550; color: var(--text-2); white-space: nowrap; transition: color var(--t-fast), background var(--t-fast); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line-2), 0 1px 3px rgba(0, 0, 0, 0.4); }
.seg.sm button { height: 28px; padding: 0 10px; font-size: var(--fs-2xs); }

/* ============ form controls ============ */
.input, .select {
  height: 38px; padding: 0 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  font-size: var(--fs-md); outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast); min-width: 0; /* 16 px: no iOS zoom on focus */
}
.input:focus, .select:focus { border-color: var(--line-3); box-shadow: 0 0 0 3px rgba(var(--ink-rgb), 0.06); }
.input:focus-visible, .select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a3a9b3' stroke-width='1.6'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.switch { position: relative; width: 36px; height: 21px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background var(--t-fast); flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--text-2); transition: transform var(--t-med) var(--ease), background var(--t-fast); }
/* "on" is white, never red (BRAND-BOOK §4: toggles are neutral) */
.switch[aria-checked="true"] { background: var(--text); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(15px); background: var(--text-inverse, #060708); }
input[type="range"].range { appearance: none; -webkit-appearance: none; width: 100%; height: 20px; background: transparent; }
.range::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, var(--text) var(--p, 0%), var(--line-3) var(--p, 0%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5.5px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.range::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line-3); }
.range::-moz-range-progress { height: 3px; background: var(--text); }
.range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }

/* ============ badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 2px 7px; border-radius: 6px;
  font: 600 var(--fs-2xs)/1.1 var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: var(--text-2); background: rgba(var(--ink-rgb), 0.06); border: 1px solid var(--line);
}
.badge.live { color: #fff; background: var(--accent); border-color: transparent; }
.badge.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: pulse 1.6s var(--ease-in-out) infinite; }
.badge.accent { color: var(--text); background: rgba(var(--ink-rgb), 0.08); border-color: var(--line-3); } /* neutral since rev 8 */
.badge.pro { color: var(--c-pro); background: rgba(232, 211, 162, 0.08); border-color: rgba(232, 211, 162, 0.28); }
.badge.success { color: var(--c-personal); background: rgba(61, 220, 132, 0.08); border-color: rgba(61, 220, 132, 0.25); }
.badge.warn { color: var(--c-yellow); background: rgba(255, 208, 47, 0.08); border-color: rgba(255, 208, 47, 0.25); }
.badge.purple { color: var(--c-fastest); background: rgba(176, 124, 255, 0.1); border-color: rgba(176, 124, 255, 0.3); }
.badge.info { color: var(--c-info); background: rgba(90, 169, 255, 0.08); border-color: rgba(90, 169, 255, 0.25); }
.badge.solid { color: var(--text-inverse); background: var(--text); border-color: transparent; }
.dot-live { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ring 1.8s var(--ease) infinite; flex: none; }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 82, 54, 0.6); } 80%, 100% { box-shadow: 0 0 0 6px rgba(255, 82, 54, 0); } }

/* ============ driver chip / team ============ */
.chip { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.chip-bar { width: 3px; height: 18px; border-radius: 2px; background: var(--team, var(--text-3)); flex: none; }
.chip-code { font: 600 var(--fs-xs) var(--font-mono); letter-spacing: 0.02em; }
.chip-name { font-weight: 550; letter-spacing: -0.01em; }
.chip-team { font-size: var(--fs-xs); color: var(--text-3); }
.chip-num { font: 500 var(--fs-2xs) var(--font-mono); color: var(--text-3); }
.chip .lines { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.chip.lg .chip-bar { height: 34px; width: 4px; }
.chip.lg .chip-name { font-size: var(--fs-lg); }
.team-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--team, var(--text-3)); flex: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 600 var(--fs-2xs) var(--font-mono); color: var(--on-team, #fff); flex: none;
  background: radial-gradient(circle at 30% 25%, rgba(var(--ink-rgb), 0.22), transparent 55%), var(--team, var(--surface-3)); box-shadow: inset 0 0 0 1px rgba(var(--ink-rgb), 0.12); }

/* ============ tyre ============ */
.tyre { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-2xs) var(--font-mono); color: var(--text-2); }
.tyre svg { width: var(--ts, 18px); height: var(--ts, 18px); flex: none; }

/* ============ position / delta ============ */
.pos-badge { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px; border-radius: 6px; font: 600 var(--fs-2xs) var(--font-mono); background: var(--surface-2); color: var(--text-2); }
.pos-badge.p1 { background: var(--text); color: var(--text-inverse); }
.pos-badge.p2, .pos-badge.p3 { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-3); }
.delta { font: 500 var(--fs-2xs) var(--font-mono); display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--c-up); } .delta.down { color: var(--c-down); } .delta.same { color: var(--text-4); }

/* ============ meter (horizontal bar) ============ */
.meter { height: 4px; border-radius: 4px; background: rgba(var(--ink-rgb), 0.06); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--bar, var(--text)); transform-origin: left; animation: grow 900ms var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .meter > i { animation: none; } }

/* ============ skeleton ============ */
.skel { position: relative; overflow: hidden; background: rgba(var(--ink-rgb), 0.045); border-radius: 6px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(var(--ink-rgb), 0.05), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; } }
.skel-line { height: 12px; margin: 10px 0; }
.skel-block { height: var(--h, 120px); border-radius: var(--r-md); }

/* ============ empty / locked / error / upsell ============ */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-9) var(--s-6); color: var(--text-2); }
.state.compact { padding: var(--s-6) var(--s-4); }
.state-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text-2); }
.state-icon svg { width: 20px; height: 20px; }
.state h3 { font-size: var(--fs-lg); font-weight: 600; color: var(--text); letter-spacing: -0.015em; }
.state p { max-width: 46ch; font-size: var(--fs-sm); color: var(--text-3); line-height: 1.6; }
.state.locked .state-icon { color: var(--c-yellow); border-color: rgba(255, 208, 47, 0.25); background: rgba(255, 208, 47, 0.06); }
.state.error .state-icon { color: var(--c-down); border-color: rgba(255, 93, 93, 0.25); background: rgba(255, 93, 93, 0.06); }
.upsell { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: var(--s-7); border: 1px solid rgba(232, 211, 162, 0.2);
  background: radial-gradient(600px 240px at 100% 0%, rgba(232, 211, 162, 0.10), transparent 60%), var(--surface-1); }
.upsell .h3 { margin: var(--s-2) 0 var(--s-2); }
.upsell p { color: var(--text-2); font-size: var(--fs-sm); max-width: 52ch; margin-bottom: var(--s-5); }
.upsell ul { display: grid; gap: 8px; margin-bottom: var(--s-6); font-size: var(--fs-sm); color: var(--text-2); }
.upsell li { display: flex; gap: 10px; align-items: center; }
.upsell li svg { width: 14px; height: 14px; color: var(--c-pro); flex: none; }

/* ============ tooltip (CSS, via data-tip) ============ */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 6px 9px; border-radius: 8px; background: var(--surface-tip); color: var(--text); box-shadow: var(--shadow-pop);
  font: 500 11.5px/1.35 var(--font-ui); letter-spacing: 0; text-transform: none; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast) var(--ease); z-index: var(--z-tip);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.tip-float { position: fixed; z-index: var(--z-tip); pointer-events: none; padding: 8px 10px; border-radius: 9px; background: var(--surface-tip); box-shadow: var(--shadow-pop); font-size: var(--fs-2xs); color: var(--text); max-width: 260px; opacity: 0; transition: opacity var(--t-fast); }
.tip-float.on { opacity: 1; }

/* ============ countdown ============ */
.countdown { display: flex; gap: clamp(10px, 2.4vw, 28px); }
.countdown .unit { display: flex; flex-direction: column; gap: 6px; }
.countdown b { font: 400 clamp(38px, 6.4vw, 76px)/0.95 var(--font-mono); letter-spacing: -0.06em; font-variant-numeric: tabular-nums; color: var(--text); }
.countdown span { font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--track-kicker); font-weight: 600; }
.countdown .sep { font: 300 clamp(30px, 5vw, 60px)/0.95 var(--font-mono); color: var(--text-4); }
.countdown.sm b { font-size: 1.75rem; } .countdown.sm .sep { font-size: 1.5rem; }

/* ============ toast ============ */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: var(--r-pill); background: var(--surface-tip); box-shadow: var(--shadow-pop); font-size: var(--fs-sm); animation: toast-in var(--t-med) var(--ease) both; }
.toast.out { animation: toast-out var(--t-med) var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ============ misc ============ */
.divider { height: 1px; background: var(--line); border: 0; margin: var(--s-6) 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: var(--fs-xs); }
.icon { width: 16px; height: 16px; flex: none; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.code { font: var(--fs-xs)/1.6 var(--font-mono); background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; color: var(--text-2); overflow-x: auto; white-space: pre; }
.spark path.line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.coming { min-height: 56vh; display: grid; align-content: center; }

/* =====================================================================================================
   v3 casual layer: navigation (5 tabs + More), mode, takeaway, glossary terms, sheets, onboarding,
   partner + support boxes. Everything is free: no Pro styling is used any more.
   ===================================================================================================== */
:root { --tabbar-h: 62px; }

/* ---- desktop top nav: 5 tabs + More ---- */
.nav-links a .nav-ic { display: none; }
.nav-more { position: relative; }
.nav-more > button { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); transition: color var(--t-fast), background var(--t-fast); }
.nav-more > button:hover, .nav-more > button[aria-expanded="true"], .nav-more > button.current { color: var(--text); background: rgba(var(--ink-rgb), 0.06); }
.nav-more > button svg { width: 14px; height: 14px; transition: transform var(--t-fast); }
.nav-more > button[aria-expanded="true"] svg { transform: rotate(180deg); }
.more-menu { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); width: 320px; padding: 8px; border-radius: var(--r-lg);
  background: var(--surface-menu); box-shadow: var(--shadow-pop); z-index: var(--z-menu); display: none; }
.more-menu.open { display: block; animation: pop-in var(--t-med) var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -4px); } }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text); }
.more-list a:hover, .more-list a:focus-visible { background: rgba(var(--ink-rgb), 0.05); }
.more-list a[aria-current="page"] { background: rgba(var(--ink-rgb), 0.07); }
.more-list .more-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); flex: none; }
.more-list .more-ic svg { width: 17px; height: 17px; }
.more-list b { display: block; font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; }
.more-list small { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
.more-mode { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px 6px; margin-top: 6px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.more-mode span small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
.nav-me { display: none; }
.menu-btn svg { width: 20px; height: 20px; }

/* ---- mobile: bottom tab bar ---- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .nav-links, .nav-more { display: none !important; }
  .menu-btn { display: inline-flex; }
  .nav-right { margin-left: auto; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
    background: var(--tabbar-glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-top: 1px solid var(--line-2);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3);
    font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.02em; -webkit-tap-highlight-color: transparent; transition: color var(--t-fast); min-width: 0; }
  .tabbar a svg { width: 22px; height: 22px; stroke-width: 1.7; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px; border-radius: 0 0 2px 2px; background: var(--text); }
  .tabbar a:active svg { transform: scale(0.92); }
  #scroller { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); }
}

/* ---- Simple / Detailed mode ---- */
html.mode-simple [data-detail] { display: none !important; }
html.mode-detailed [data-simple] { display: none !important; }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-pill); font: 600 var(--fs-micro)/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); border: 1px solid var(--line-2); }

/* ---- takeaway: one-sentence conclusion above a chart ---- */
/* neutral box (one accent per screen): only the small icon carries the accent */
.takeaway { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-1); border: 1px solid var(--line-2); margin-bottom: var(--s-4); }
.takeaway-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: rgba(var(--ink-rgb), 0.07); color: var(--text-2); } /* neutral since rev 8 */
.takeaway-ic svg { width: 15px; height: 15px; }
.takeaway p { font-size: var(--fs-md); line-height: 1.5; color: var(--text); font-weight: 500; letter-spacing: -0.005em; margin: 3px 0 0; }
.takeaway-k { display: block; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.takeaway.team { background: linear-gradient(90deg, color-mix(in srgb, var(--team, var(--accent)) 16%, transparent), rgba(var(--ink-rgb), 0.02) 70%); }
.takeaway.team .takeaway-ic { background: color-mix(in srgb, var(--team, var(--accent)) 22%, transparent); color: var(--text); }

/* ---- glossary term ---- */
.term { display: inline; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; text-decoration-thickness: 2px; cursor: help; border-radius: 3px; }
/* a small "i" so phone users (no hover) can see the word explains itself ("?" doubled up in question labels) */
.term::after { content: "i"; content: "i" / ""; font-style: italic; display: inline-grid; place-items: center; width: 1.05em; height: 1.05em; margin-left: 2px; vertical-align: 0.35em; border-radius: 50%; font-size: 0.62em; font-weight: 700; line-height: 1; color: var(--text-2); background: var(--surface-3); }
.term:hover, .term[aria-expanded="true"] { text-decoration-color: var(--text); color: var(--text); }
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.term-pop { position: fixed; z-index: var(--z-tip); width: min(320px, calc(100vw - 24px)); padding: 12px 14px 14px; border-radius: var(--r-md); background: var(--surface-tip); box-shadow: var(--shadow-pop); animation: fade-up var(--t-med) var(--ease) both; }
.term-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.term-pop-head b { font-size: var(--fs-sm); font-weight: 600; }
.term-pop-x { width: 28px; height: 28px; margin: -6px -8px -6px 0; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); }
.term-pop-x:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.06); }
.term-pop-x svg { width: 15px; height: 15px; }
.term-pop p { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-2); }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } }

/* ---- sheet (bottom sheet on phones, dialog on desktop) ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: calc(var(--z-toast) - 1); display: grid; align-items: end; justify-items: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); opacity: 0; transition: opacity var(--t-med) var(--ease); }
.sheet { position: relative; width: 100%; max-height: min(92vh, 92dvh); display: flex; flex-direction: column; background: var(--surface-sheet); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-pop); transform: translateY(24px); opacity: 0; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); outline: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; opacity: 1; }
.sheet-grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line-3); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 0 20px; flex: none; }
.sheet-title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.015em; }
.sheet-x { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); }
.sheet-x:hover { background: rgba(var(--ink-rgb), 0.06); color: var(--text); }
.sheet-x svg { width: 18px; height: 18px; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
@media (min-width: 761px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { max-width: 520px; border-radius: var(--r-xl); border-bottom: 1px solid var(--line-2); max-height: min(86vh, 860px); }
  .sheet.lg { max-width: 760px; }
  .sheet-grab { display: none; }
  .sheet-body { padding: 8px 28px 28px; }
}

/* ---- onboarding ---- */
.onb .sheet-head { position: absolute; right: 0; top: 0; padding: 10px 10px 0; z-index: 2; }
.onb-head { padding: 14px 0 16px; }
.onb-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.onb-dots span { width: 22px; height: 4px; border-radius: 4px; background: var(--line-2); transition: background var(--t-med), width var(--t-med) var(--ease); }
.onb-dots span.done { background: var(--text-3); }
.onb-dots span.on { width: 36px; background: var(--accent); }
.onb-title { font-size: clamp(24px, 6vw, 32px); font-weight: 600; letter-spacing: var(--track-head); line-height: 1.1; margin-top: 6px; }
.onb-lead { color: var(--text-2); font-size: var(--fs-md); margin-top: 8px; max-width: 52ch; }
.onb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.onb-grid.teams { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 420px) { .onb-grid { grid-template-columns: 1fr 1fr; } .onb-grid.teams { grid-template-columns: 1fr; } }
.onb-signin { margin: 12px 0 0; font-size: var(--fs-sm); }
.onb-pick { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 12px 10px 10px; text-align: left; border-radius: var(--r-md);
  background: var(--surface-1); border: 1px solid var(--line); transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); min-width: 0; }
.onb-pick:hover { border-color: var(--line-3); }
.onb-pick:active { transform: scale(0.98); }
.onb-pick[aria-pressed="true"] { border-color: var(--team); background: color-mix(in srgb, var(--team) 14%, var(--surface-1)); box-shadow: 0 0 0 1px var(--team) inset; }
.onb-bar { width: 4px; align-self: stretch; border-radius: 3px; background: var(--team); flex: none; }
.onb-swatch { width: 26px; height: 26px; border-radius: 8px; background: var(--team); flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.onb-pick-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.onb-pick-txt b { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onb-pick-txt small { font-size: var(--fs-2xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onb-pick-txt small.dim { color: var(--text-3); }
.onb-num { position: absolute; top: 8px; right: 10px; font-size: var(--fs-micro); color: var(--text-3); }
.onb-none { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm); color: var(--text-2); border: 1px dashed var(--line-3); }
.onb-none[aria-pressed="true"] { color: var(--text); border-style: solid; border-color: var(--text-3); }
.onb-none svg { width: 15px; height: 15px; }
.onb-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .onb-modes { grid-template-columns: 1fr; } }
.onb-mode { display: flex; flex-direction: column; gap: 6px; padding: 16px; text-align: left; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); transition: border-color var(--t-fast), background var(--t-fast); }
.onb-mode b { font-size: 1.0625rem; font-weight: 600; }
.onb-mode span:last-child { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.onb-mode[aria-pressed="true"] { border-color: var(--text-3); background: var(--surface-2); box-shadow: 0 0 0 1px var(--text-3) inset; }
.onb-mode-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); margin-bottom: 4px; }
.onb-mode[aria-pressed="true"] .onb-mode-ic { color: var(--text); background: var(--surface-3); }
.onb-cal { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg-elev); }
.onb-cal b { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.onb-cal p { font-size: var(--fs-xs); margin-top: 4px; }
.onb-free { font-size: var(--fs-xs); margin-top: 14px; }
.onb-foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px; margin: 18px -20px calc(-20px - env(safe-area-inset-bottom)); padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--surface-sheet) 30%); border-top: 1px solid var(--line); }
@media (min-width: 761px) { .onb-foot { bottom: -28px; margin: 22px -28px -28px; padding: 16px 28px; } }

/* ---- partner slot (clearly labelled, never inside data) ---- */
.partner { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--r-md); border: 1px dashed var(--line-3); background: transparent; max-width: 560px; }
.partner-k { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3); }
.partner-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.partner-link svg { width: 14px; height: 14px; color: var(--text-3); }
.partner-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.partner-note { font-size: var(--fs-xs); color: var(--text-3); }

/* ---- support the project ---- */
.support-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-1); }
.support-card b { font-size: 0.9375rem; font-weight: 600; }
.support-card p { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; max-width: 48ch; }
.support-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.support-inline:hover { color: var(--text); }
.support-inline svg { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .more-menu.open, .term-pop, .onb-dots span { transition: none !important; animation: none !important; }
}

/* reminders panel (core/push.js) */
.push-panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: radial-gradient(420px 160px at 0% 0%, rgba(var(--ink-rgb), 0.05), transparent 65%), var(--surface-1); }
.push-panel .g-panel-body { padding: var(--s-5); display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; justify-content: space-between; }
.push-panel .push-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.push-panel .push-txt b { font-size: var(--fs-lg); font-weight: 600; }
.push-panel .push-txt span { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }
.push-panel .push-txt .icon { width: 1em; height: 1em; vertical-align: -2px; }

/* ============ touch & accessibility (revision 6) ============ */
/* finger-sized controls on touch screens (WCAG 2.5.8; 44 px where it fits) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .switch { width: 44px; height: 26px; }
  .switch::after { width: 20px; height: 20px; }
  .switch[aria-checked="true"]::after { transform: translateX(18px); }
  .sheet-x, .menu-btn { min-width: 44px; min-height: 44px; }
  .input, .select { height: 44px; }
  .tab { min-height: 44px; }
  .btn.sm { min-height: 44px; }
  .seg button { height: 44px; }
  .seg.sm button { height: 40px; }
  .link-arrow { min-height: 44px; }
  .footer li a { display: inline-block; padding: 11px 0; }
  .footer li { margin: 0; }
}
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } }
/* very short viewports (landscape phone, 200% zoom): give the content the height */
@media (max-height: 480px) { #tabbar { display: none; } }

/* Windows high contrast: keep "selected" and "on" states visible */
@media (forced-colors: active) {
  .seg button[aria-pressed="true"], .tab[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .tab[aria-selected="true"]::after { background: Highlight; forced-color-adjust: none; }
  .switch { border: 1px solid ButtonText; }
  .switch::after { background: ButtonText; forced-color-adjust: none; }
  .switch[aria-checked="true"] { background: Highlight; forced-color-adjust: none; }
}
h1[tabindex="-1"]:focus { outline: none; }
.menu-btn { gap: 6px; width: auto; padding: 0 10px; }
.menu-btn-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
/* on a page that lives in More, the More button is the active place (phones have no tab for it) */
.menu-btn { position: relative; }
.menu-btn.current { background: rgba(var(--ink-rgb), 0.07); }
.menu-btn.current .menu-btn-label { color: var(--text); }
.menu-btn.current::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--text); }

/* ---- reduced motion (revision 7): nothing slides, pulses or counts with motion when the reader asks for less ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---- "Pick your driver" bar: in the page flow under the header, never over content (core/onboarding.js) ---- */
.pick-bar { border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.pick-bar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding-block: 6px; }
.pick-bar-txt { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); min-width: 0; line-height: 1.35; }
.pick-bar-txt b { color: var(--text); font-weight: 600; }
.pick-bar-txt > svg { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.pick-bar-act { display: flex; align-items: center; gap: 4px; flex: none; }
.pick-bar-act .btn { min-height: 44px; }
.pick-bar-x { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-pill); color: var(--text-3); }
.pick-bar-x:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.05); }
.pick-bar-x svg { width: 18px; height: 18px; }
@media (max-width: 420px) { .pick-bar-more { display: none; } }

/* =====================================================================================================
   Revision 8: header (search + Me avatar), Races hub sub-navigation, global search, page header,
   champion card, "my driver" mark, inline link hit areas.
   ===================================================================================================== */
/* ---- header icon buttons: search, Me avatar (desktop: link to /me; phones: "Me & more" sheet) ---- */
.nav-ic-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill); color: var(--text-2); flex: none; transition: color var(--t-fast), background var(--t-fast); }
.nav-ic-btn:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.06); }
.nav-ic-btn svg { width: 20px; height: 20px; }
.nav-ic-btn[aria-current="page"], .nav-ic-btn.current { color: var(--text); background: rgba(var(--ink-rgb), 0.08); }
/* the Me avatar: a neutral ring, or a subtle ring in my team's colour (never a dot that looks like a notification) */
.me-av { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--team, var(--line-3));
  background: var(--surface-2); color: var(--text); font: 600 var(--fs-micro)/1 var(--font-mono); letter-spacing: 0.02em; }
.me-av svg { width: 17px; height: 17px; }
.nav-me-btn .me-label { display: none; }
#menu-btn { display: none; }
.nav-right { gap: 2px; }
.nav-right .nav-status { margin-right: 4px; }
@media (max-width: 860px) {
  #menu-btn { display: inline-grid; }
  .nav-right .nav-me-link { display: none; }
  .menu-btn-label, .menu-btn > svg { display: none; }
  .nav .wrap { gap: var(--s-2); }
  .logo-word { font-size: 20px; }
  .nav-status { padding: 0 12px; gap: 6px; }
}
@media (max-width: 380px) { .logo-bar { display: none; } .logo { gap: 0; } }

/* ---- Races hub sub-navigation (shell, app.js) and ui.subnav() for any page ---- */
.subnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); white-space: nowrap; border: 1px solid transparent; transition: color var(--t-fast), background var(--t-fast); }
@media (hover: hover) { .subnav a:hover { color: var(--text); background: rgba(var(--ink-rgb), 0.05); } }
.subnav a[aria-current="page"] { color: var(--text); background: rgba(var(--ink-rgb), 0.08); border-color: var(--line-2); }
.hub-nav { border-bottom: 1px solid var(--line); background: var(--bg); }
.hub-nav .subnav { padding-block: 8px; }
@media (pointer: coarse) { .subnav a { min-height: 44px; } }
.hub-nav + main#app { padding-top: var(--s-6); }

/* ---- page header with a back link that always sits in the same place (above the kicker) ---- */
.page-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -10px 0 2px; font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); }
.page-back:hover { color: var(--text); }
.page-back svg { width: 16px; height: 16px; }
.page-head .tabs, .page-head .subnav { margin-top: var(--s-4); }

/* ---- champion card (ui.championCard): team bar, trophy, white kicker, surname in the display face, ONE accent number ---- */
.champ { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-4); padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-5) + 4px);
  border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line-2); color: var(--text); overflow: hidden; }
.champ::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--team, var(--text-3)); }
a.champ:hover { border-color: var(--line-3); }
.champ-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(var(--ink-rgb), 0.06); color: var(--text); }
.champ-ic svg { width: 22px; height: 22px; }
.champ-k { display: flex; align-items: center; gap: 8px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text); }
.champ-name { display: block; margin-top: 4px; font: 800 clamp(1.75rem, 6vw, 2.5rem)/1 var(--font-display); letter-spacing: 0.005em; text-transform: uppercase; }
.champ-given { display: block; font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; font-weight: 500; }
.champ-sub { display: block; margin-top: 6px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.champ-num { text-align: right; }
.champ-num b { display: block; font: 600 clamp(1.5rem, 5vw, 2.25rem)/1 var(--font-mono); letter-spacing: -0.04em; color: var(--accent-ink, var(--accent)); font-variant-numeric: tabular-nums; }
.champ-num b.plain { color: var(--text); }
.champ-num span { display: block; margin-top: 4px; font-size: var(--fs-2xs); color: var(--text-3); }
.champ-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.champ.sm { grid-template-columns: auto 1fr auto; padding-block: var(--s-4); gap: var(--s-3); }
.champ.sm .champ-ic { width: 36px; height: 36px; border-radius: 10px; }
.champ.sm .champ-name { font-size: 1.5rem; }
.champ.lg { padding: var(--s-6) var(--s-6) var(--s-6) calc(var(--s-6) + 4px); }
.champ.lg .champ-name { font-size: clamp(2.25rem, 9vw, 4rem); }
@media (max-width: 420px) {
  .champ { grid-template-columns: auto 1fr; }
  .champ-num { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .champ-num span { margin: 0; }
}

/* ---- "my driver": team dot + bold, never red (ui.myDriver) ---- */
.my-driver { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.my-driver .team-dot { width: 8px; height: 8px; }

/* ---- inline links in running text: a bigger hit area without moving the text ---- */
p a:not(.btn):not(.link-arrow), li > a.u, .lead a, a.u { padding-block: 0.45em; text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
p a:not(.btn):not(.link-arrow):hover, a.u:hover { text-decoration-color: currentColor; }

/* ---- global search (core/search.js) ---- */
.gs-box { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-2); }
.gs-box:focus-within { border-color: var(--text-3); }
.gs-box svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.gs-box input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: var(--fs-md); color: var(--text); }
.gs-box input::-webkit-search-cancel-button { display: none; }
.gs-clear { width: 44px; height: 44px; margin-right: -10px; display: grid; place-items: center; color: var(--text-3); border-radius: var(--r-pill); }
.gs-list { margin-top: var(--s-3); display: grid; gap: 2px; }
.gs-head { padding: 14px 4px 6px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3); }
.gs-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px; border-radius: var(--r-md); color: var(--text); }
.gs-item:hover, .gs-item.on { background: rgba(var(--ink-rgb), 0.06); }
.gs-item .gs-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); position: relative; overflow: hidden; }
.gs-item .gs-ic svg { width: 16px; height: 16px; }
.gs-item .gs-ic.team::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--team); }
.gs-txt { min-width: 0; display: grid; }
.gs-txt b { font-weight: 600; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-txt span { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item > svg { width: 16px; height: 16px; margin-left: auto; color: var(--text-3); flex: none; }
.gs-empty { padding: 18px 4px; color: var(--text-2); font-size: var(--fs-sm); }
.gs-tips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s-4); }
.gs-tips button { min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line-2); font-size: var(--fs-sm); color: var(--text-2); }
.gs-tips button:hover { color: var(--text); border-color: var(--line-3); }
@media (pointer: coarse) { .gs-tips button { min-height: 44px; } }
.sheet.search { height: min(92vh, 92dvh); } /* phones: full height, the box stays at the top above the keyboard */
@media (min-width: 720px) { .sheet.search { height: auto; min-height: 420px; align-self: start; margin-top: 8vh; } }

/* ---- "Me & more" sheet (phones) ---- */
.mm-me { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.mm-me .me-av { width: 40px; height: 40px; font-size: var(--fs-2xs); }
.mm-me b { display: block; font-size: var(--fs-md); }
.mm-me small { display: block; font-size: var(--fs-sm); color: var(--text-3); }
.mm-me > svg { width: 16px; height: 16px; margin-left: auto; color: var(--text-3); }
.mm-h { margin: var(--s-5) 4px 4px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-kicker); text-transform: uppercase; color: var(--text-3); }
.text-size-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 10px 6px; font-size: var(--fs-sm); }
.text-size-row > span { flex: 1 1 140px; min-width: 0; }
.text-size-row > .seg { flex: none; } /* never squeeze the choices: the row wraps under the label instead (Large / Light were cut off) */
.text-size-row small { display: block; color: var(--text-3); font-size: var(--fs-xs); }
#menu-btn { width: 44px; padding: 0; margin: 0; gap: 0; }
#menu-btn.current::after { left: 10px; right: 10px; bottom: 1px; }
.nav-status .chip-place { color: var(--text-2); }
@media (max-width: 374px) { .nav-status .chip-place { display: none; } }
@media (max-width: 480px) { .text-lg .nav-status .chip-place { display: none; } } /* Large text: "Brazil ·" would be cut to "Bra" */
/* big text (Large, or a 150 % phone setting): the chip gives way first (place, then the label), never the page width */
.nav .wrap > #logo { flex: none; }
.nav-right { min-width: 0; flex: 0 1 auto; }
.nav-status { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.nav-status > * { flex: none; }
.nav-status .chip-place { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.nav-status b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  .tabbar a span { font-size: min(var(--fs-2xs), 14px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar { padding-inline: 2px; }
}
.nav-right .nav-ic-btn { flex: none; }
.nav-status, .nav-status .mono { font-size: min(var(--fs-xs), 15px); }
.nav-status b { flex: none; }
/* revision 9: the phone avatar button says "More" (rules, F1 words, text size and settings live there) */
#menu-btn { width: auto; min-width: 44px; padding: 0 10px 0 6px; gap: 6px; grid-auto-flow: column; align-items: center; }
#menu-btn .mm-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
#menu-btn.current .mm-label { color: var(--text); }
/* revision 9: .dot-live pulses red only while a session is on track (core/navstatus.js sets html.session-live) */
html:not(.session-live) .dot-live { animation: none; box-shadow: none; background: var(--text-3); }
@media (max-width: 400px) { #menu-btn { padding: 0 10px; } #menu-btn .me-av { display: none; } .nav-status .chip-place { display: none; } } /* narrow phones: the word, so the race chip keeps its room */

/* Phones: header and bottom bar are opaque and never blurred. backdrop-filter re-renders whatever scrolls underneath
   on every frame, which made both bars shimmer and lag on iPhones (owner report, 4 Nov). Own compositing layer each. */
@media (max-width: 860px) {
  .nav { background: var(--nav-bg); backdrop-filter: none; -webkit-backdrop-filter: none; transform: translateZ(0); }
  .tabbar { background: var(--tabbar-bg); backdrop-filter: none; -webkit-backdrop-filter: none; transform: translateZ(0); }
}

/* Phones: the window never scrolls, #scroller does (core/scroll.js says why). The browser keeps its toolbars still,
   so the sticky header and the fixed bottom bar never slide or jitter. Wider screens: #scroller is just a wrapper. */
#scroller { display: contents; }
@media (max-width: 860px) {
  html, body { height: 100%; overflow: hidden; }
  body::before { height: 100%; } /* nothing in the document may be taller than the screen, or iOS still nudges the window */
  #scroller { display: block; position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; overflow-x: clip; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}
