/* O'Cap — phone first: one column, big touch targets, tabs at the bottom within thumb reach. Light and dark. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f6; --surface: #ffffff; --ink: #111816; --ink-2: #4f5b58; --ink-3: #8a9592; --line: rgba(17, 24, 22, .09);
  --brand: #0f3d3e; --live: #e4572e; --live-wash: rgba(228, 87, 46, .12); --good: #1f7a4d; --good-wash: rgba(31, 122, 77, .12);
  --me-wash: rgba(15, 61, 62, .09); --star: #e0a400;
  --radius: 14px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1414; --surface: #151e1e; --ink: #eef3f2; --ink-2: #b5c1be; --ink-3: #7d8a87; --line: rgba(255, 255, 255, .09);
    --brand: #7cc7c0; --live: #ff7a52; --live-wash: rgba(255, 122, 82, .16); --good: #5fd39a; --good-wash: rgba(95, 211, 154, .14);
    --me-wash: rgba(124, 199, 192, .12); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font); }
main { max-width: 640px; margin: 0 auto; padding-bottom: calc(76px + var(--safe-b)); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.pad { padding: 8px 16px; }
.grow { flex: 1; min-width: 0; }

/* header */
.bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); background: var(--bg); }
.bar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.sticky { position: sticky; top: 0; z-index: 3; }
.back { font-size: 30px; line-height: 1; padding: 0 8px 4px 0; color: var(--brand); }

/* lists */
.search { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; color: var(--ink); }
.sec { font-size: 13px; text-transform: none; color: var(--ink-2); font-weight: 600; margin: 18px 16px 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 56px; }
.item .name { font-weight: 550; }
.chev { margin-left: auto; color: var(--ink-3); font-size: 22px; }

/* a race */
.status { padding: 0 16px 8px; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.status.live { color: var(--live); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--live-wash); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; position: sticky; top: 60px; z-index: 2; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--brand); color: var(--bg); border-color: transparent; font-weight: 600; }
.ticker { display: flex; flex-direction: column; gap: 2px; margin: 0 16px 6px; padding: 8px 12px; border-radius: 12px; background: var(--live-wash); }
.tick { text-align: left; background: none; border: 0; padding: 4px 0; font-size: 14px; }
.row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 40px; align-items: center; gap: 6px; padding: 10px 4px 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); min-height: 58px; transition: background .6s; }
.row .pl { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; color: var(--ink-2); }
.row .name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .who .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .res { text-align: right; font-variant-numeric: tabular-nums; }
.row .time { font-weight: 600; }
.row.just { background: var(--good-wash); }
.row.just .justin { color: var(--good); font-weight: 600; }
.row.me { background: var(--me-wash); box-shadow: inset 3px 0 0 var(--brand); }
.badge { font-size: 11px; font-weight: 700; color: var(--brand); border: 1px solid currentColor; border-radius: 8px; padding: 0 5px; vertical-align: 2px; }
.star { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; color: var(--line); filter: grayscale(1); }
.star.on { color: var(--star); filter: none; }
.splits { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* settings */
.card { background: var(--surface); margin: 10px 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 40px; border: 0; border-radius: 10px; background: none; font-size: 14px; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.field input { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; font-size: 16px; color: var(--ink); }
.saved { color: var(--good); margin: 8px 0 0; }
.frow { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs a { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: 11px; color: var(--ink-3); }
.tabs a.on { color: var(--brand); font-weight: 600; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } .row { transition: none; } }

/* Bientôt, Récemment */
.select { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-size: 16px; color: var(--ink); }
.select.sm { width: auto; height: 36px; font-size: 14px; }
.row2 { display: flex; gap: 8px; align-items: center; }
.chips.inline { position: static; padding-top: 0; }
.item.off { opacity: .55; }
.item.static { min-height: 0; }
.item.me { background: var(--me-wash); box-shadow: inset 3px 0 0 var(--brand); }
.date { flex: none; width: 46px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 3px 0; line-height: 1.15; }
.date span { display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.date b { display: block; font-size: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); }
.tag.ok { background: var(--me-wash); border-color: transparent; color: var(--brand); }
.tag.warn { background: var(--live-wash); border-color: transparent; color: var(--live); font-weight: 600; }
.tag.bad { background: var(--live); border-color: transparent; color: #fff; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; }
.links { margin: 6px 0; }
.btn { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 12px; background: var(--brand); color: var(--bg); font-weight: 600; }
.row { grid-template-columns: 30px minmax(0, 1fr) auto 40px; }

/* analyses */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stats b.bad { color: var(--live); }
.stats span { font-size: 11.5px; color: var(--ink-3); }
.legs { background: var(--surface); border-top: 1px solid var(--line); }
.leg { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.leg .lg { flex: none; width: 50px; font-weight: 600; color: var(--ink-2); font-size: 14px; }
.leg .cumr { text-align: right; font-size: 14px; }
.leg.err { background: var(--live-wash); }
.leg.top .lg { color: var(--good); }
.lostv { color: var(--live); font-weight: 600; margin-left: 6px; font-size: 14px; }
.lbar { height: 4px; background: var(--bg); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.lbar i { display: block; height: 100%; background: var(--live); border-radius: 2px; }
.up { color: var(--good); margin-left: 4px; }
.down { color: var(--live); margin-left: 4px; }
.rule { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.num-in { width: 70px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 8px; font-size: 15px; color: var(--ink); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grid { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid th, .grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.grid thead th { font-size: 12px; color: var(--ink-3); font-weight: 600; text-align: right; }
.grid .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-weight: 550; box-shadow: 1px 0 0 var(--line); }
.grid .pl { display: inline-block; min-width: 20px; color: var(--ink-3); }
.grid td.top { background: var(--good-wash); color: var(--good); font-weight: 600; }
.grid td.err { background: var(--live-wash); color: var(--live); font-weight: 600; }
.grid tr.me .sticky, .grid tr.me td { background: var(--me-wash); }
.chart { display: block; width: 100%; height: auto; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chart .ax { font-size: 10px; fill: var(--ink-3); }
.chart .gl { stroke: var(--line); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 10px 16px; font-size: 13.5px; }
.pk { display: flex; align-items: center; gap: 6px; min-height: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk i { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); }
