/* Titillium Web — same OFL-licensed typeface public-bot's card renderer
   uses, self-hosted here rather than pulled from a font CDN: this whole
   platform exists to not depend on a third party, and a Google Fonts
   request would leak every visitor's IP to Google on every page load of a
   supposedly self-hosted tool. Its digits are all the same width, so
   columns of numbers line up without any extra settings. */
@font-face { font-family: 'Titillium Web'; src: url('/fonts/TitilliumWeb-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Titillium Web'; src: url('/fonts/TitilliumWeb-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Titillium Web'; src: url('/fonts/TitilliumWeb-Black.ttf') format('truetype'); font-weight: 900; font-display: swap; }

/* ---------- tokens ----------
   Dark only: a pro tool for race control, not a light office app. Neutral
   greys in layers, hairline borders, one red accent kept for primary
   actions and "you are here". Numbers never go above 600: heavier weights
   fill in Titillium's digits. */
:root {
  color-scheme: dark;
  --max: 1160px;
  --bg: #0a0b0d;
  --bg-2: #0e1013;          /* app bar, input wells */
  --panel: #13151a;
  --panel-2: #191c22;       /* raised: menus, secondary buttons, hover */
  --line: #23262d;
  --line-2: #30343c;
  --text: #eef0f3;
  --text-2: #b4b9c1;
  --text-3: #868c96;
  --accent: #e10600;
  --accent-hi: #f5140d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(225, 6, 0, 0.12);
  --link: #ff5a52;
  --ok: #2fbf71;
  --warn: #f5a524;
  --bad: #ff5c5c;
  --info: #4da3ff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.7);
  /* older names, still used by the live timing page */
  --panel-raised: var(--panel-2);
  --border: var(--line);
  --muted: var(--text-3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 'Titillium Web', -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(225, 6, 0, 0.35); color: #fff; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
strong { font-weight: 600; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.86em; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0.05em 0.35em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 11, 13, 0.86); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar-in { max-width: var(--max); margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; display: block; }
.crumb-sep { color: var(--line-2); font-size: 22px; font-weight: 400; margin: 0 2px; }
.crumb { color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.crumb:hover { text-decoration: none; color: #fff; }
.appbar .spacer { flex: 1; }
.appbar-link { color: var(--text-2); font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap; }
.appbar-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.appbar-link.active { color: var(--text); }
.appbar .btn { margin: 0; }

/* account menu: <details>, no script */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font-weight: 600; font-size: 14px; text-transform: uppercase;
}
.user-menu[open] .avatar, .user-menu > summary:hover .avatar { border-color: #444a54; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head .menu-name { font-weight: 600; }
.menu-head .menu-email { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; margin: 0; height: auto; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 400; text-align: left; cursor: pointer; justify-content: flex-start;
}
.menu a:hover, .menu button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); text-decoration: none; }
.menu form { margin: 0; }
.menu .menu-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* league sections, under the app bar */
.subnav { border-top: 1px solid var(--line); }
.subnav-in {
  max-width: var(--max); margin: 0 auto; padding: 0 10px; display: flex; gap: 2px;
  overflow-x: auto; scrollbar-width: none;
}
.subnav-in::-webkit-scrollbar { display: none; }
@media (max-width: 720px) { .subnav-in { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 32px; } }
.subnav a {
  position: relative; padding: 11px 10px 12px; color: var(--text-3); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--text); }
.subnav a.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* ---------- page ---------- */
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 32px 20px 64px; flex: 1; }
.container.container-narrow { max-width: 760px; }

h1, h2, h3 { font-family: 'Titillium Web', sans-serif; font-weight: 600; color: var(--text); }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 16px; }
h2 { font-size: 17px; line-height: 1.3; margin: 32px 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head .actions > *, .page-head .actions form > button { margin: 0; }
.eyebrow { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.eyebrow a { color: var(--text-3); }
.eyebrow a:hover { color: var(--text); }
.page-sub { color: var(--text-2); margin: 6px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 14px; font-weight: 600; }

/* "+ New X" on list pages: <details>, no script */
details.new-item { position: relative; }
details.new-item > summary { list-style: none; cursor: pointer; user-select: none; margin-top: 0; }
details.new-item > summary::marker, details.new-item > summary::-webkit-details-marker { display: none; content: ''; }
details.new-item .new-item-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: max-content; min-width: 320px; max-width: min(420px, calc(100vw - 2.5rem));
  background: var(--panel-2); border-color: var(--line-2); box-shadow: var(--shadow);
}

/* ---------- panels ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head > * { margin: 0; }
.card-title { font-size: 12px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); margin: 0 0 14px; }
.card-head .card-title { margin: 0; }
.card-link { color: var(--text); }
.card-link:hover { color: var(--link); text-decoration: none; }
a.card { display: block; color: var(--text); transition: border-color 0.12s ease, background-color 0.12s ease; }
a.card:hover { text-decoration: none; border-color: var(--line-2); background: #161920; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.grid > .card { margin-bottom: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.split > .card, .split > div > .card:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.stat-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.2; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

.empty { text-align: center; padding: 36px 20px; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--radius); margin-bottom: 20px; }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty .btn, .empty button { margin-top: 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap.card { padding: 6px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td, tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
th.num, td.num { text-align: right; }
td.num { white-space: nowrap; }
td.strong, .num.strong { font-weight: 600; color: var(--text); }
td a:not(.btn) { color: var(--text); font-weight: 600; }
td a:not(.btn):hover { color: var(--link); text-decoration: none; }
td .actions, td.actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
td button, td .btn, td form button { margin-top: 0; }
th.w-min, td.w-min { width: 1%; white-space: nowrap; }

/* a driver or team with its colour */
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-bar { width: 3px; height: 26px; border-radius: 2px; background: var(--line-2); flex: none; }
.who-text { min-width: 0; line-height: 1.25; }
.who-name { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-no { font-size: 12.5px; color: var(--text-3); min-width: 1.6em; text-align: right; }
.p-pos { width: 1%; padding-right: 4px; font-weight: 600; color: var(--text-2); text-align: right; white-space: nowrap; }
tr.is-lead .p-pos { color: var(--text); }

/* finishing positions in a results grid */
.rr {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  min-width: 30px; height: 24px; padding: 0 5px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.04); color: var(--text-3); font-size: 12.5px; font-weight: 600;
}
.rr.is-pts { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.rr.is-p1 { color: #ffd65a; background: rgba(255, 196, 0, 0.14); }
.rr.is-p2 { color: #e4e9f0; background: rgba(214, 223, 235, 0.14); }
.rr.is-p3 { color: #eaa66a; background: rgba(214, 130, 60, 0.17); }
.rr.is-out { color: var(--bad); background: rgba(255, 92, 92, 0.08); }
.rr.is-none { background: none; color: var(--line-2); }
.rr.is-fl::after { content: ''; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: #b462ff; box-shadow: 0 0 0 2px var(--panel); }
.rr-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-3); margin: 10px 4px 4px; }
.rr-key span { display: inline-flex; align-items: center; gap: 6px; }
.rr-key .rr { min-width: 22px; height: 18px; font-size: 11px; }

/* ---------- forms ---------- */
form.inline { display: inline; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
label:first-child { margin-top: 0; }
.hint { font-size: 13px; color: var(--text-3); margin: 6px 0 0; }
input, select, textarea {
  width: 100%; height: 38px; padding: 0 12px; margin: 0;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: #5f656e; }
input:hover, select:hover, textarea:hover { border-color: #3d424b; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.22); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23868c96' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); vertical-align: -3px; }
input[type=color] { width: 52px; padding: 3px; cursor: pointer; }
input[type=file] { height: auto; padding: 8px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 400; font-size: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.form-row > div > label:first-child { margin-top: 16px; }

/* ---------- buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; margin-top: 16px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; white-space: nowrap;
  cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button:hover, .btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); text-decoration: none; }
button.secondary, .btn.secondary { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
button.secondary:hover, .btn.secondary:hover { background: #20242b; border-color: #41464f; }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover, .btn.ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
button.danger, .btn.danger { background: transparent; border-color: rgba(255, 92, 92, 0.4); color: var(--bad); }
button.danger:hover, .btn.danger:hover { background: rgba(255, 92, 92, 0.1); border-color: var(--bad); }
button.small, .btn.small { height: 30px; padding: 0 11px; font-size: 13px; }
button.big, .btn.big { height: 44px; padding: 0 22px; font-size: 15px; }
button:disabled, .btn[aria-disabled=true] { opacity: 0.5; cursor: not-allowed; }

/* ---------- notices & labels ---------- */
.toast {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; padding: 11px 14px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--info); border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.notice { padding: 12px 14px; border-radius: 8px; background: rgba(245, 165, 36, 0.08); border: 1px solid rgba(245, 165, 36, 0.3); color: var(--text); font-size: 14px; margin-bottom: 16px; }
.notice.is-ok { background: rgba(47, 191, 113, 0.08); border-color: rgba(47, 191, 113, 0.3); }
.notice.is-bad { background: rgba(255, 92, 92, 0.08); border-color: rgba(255, 92, 92, 0.3); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--text-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; vertical-align: middle;
}
.badge.status { text-transform: capitalize; }
.badge.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.is-completed, .badge.is-final, .badge.is-ok { color: var(--ok); border-color: rgba(47, 191, 113, 0.35); background: rgba(47, 191, 113, 0.08); }
.badge.is-active, .badge.is-live { color: #ff6b63; border-color: rgba(225, 6, 0, 0.45); background: var(--accent-soft); }
.badge.is-cancelled, .badge.is-revoked, .badge.is-disabled { color: var(--text-3); }
.badge.is-warn { color: var(--warn); border-color: rgba(245, 165, 36, 0.35); background: rgba(245, 165, 36, 0.08); }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); }
.site-foot-in { max-width: var(--max); margin: 0 auto; padding: 18px 20px; display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-3); }
.site-foot a { color: var(--text-3); }
.site-foot a:hover { color: var(--text); }
.site-foot .spacer { flex: 1; }

/* ---------- sign-in pages ---------- */
.auth { max-width: 420px; margin: 24px auto 0; }
.auth.is-wide { max-width: 680px; }
.auth h1 { margin-bottom: 6px; }
.auth .page-sub { margin-bottom: 24px; }
.auth .card { padding: 24px; }
.auth form button[type=submit] { width: 100%; height: 40px; margin-top: 22px; }
.auth-alt { text-align: center; color: var(--text-3); font-size: 14px; margin-top: 18px; }
.captcha-box { display: flex; align-items: center; gap: 10px; }
.captcha-box svg { border-radius: var(--radius-sm); background: #e9ebef; flex: none; }

/* Signup, step 1: driver or league. Whole cards are the links. */
.signup-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-bottom: 8px; }
.card.signup-kind { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 22px; color: var(--text); }
.signup-kind:hover, .signup-kind:focus-visible { border-color: var(--accent); background: #171419; outline: none; }
.signup-kind-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: #ff6b63; margin-bottom: 8px; }
.signup-kind-icon svg { width: 22px; height: 22px; }
.signup-kind-title { font-weight: 600; font-size: 18px; }
.signup-kind-text { color: var(--text-2); font-size: 14px; flex: 1; }
.signup-kind-go { color: var(--link); font-weight: 600; font-size: 14px; margin-top: 8px; }

.settings-form { max-width: 640px; }
.settings-form > button[type=submit] { margin-top: 0; }
.settings-sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings-sub .path-copy { font-size: 13px; overflow-wrap: anywhere; }
.settings-card { max-width: 640px; margin-top: 28px; }
.settings-card + .settings-card { margin-top: 20px; }
.settings-lede { margin: 0 0 16px; color: var(--text-2); font-size: 14px; max-width: 62ch; }
.settings-card > form.inline > button { margin-top: 0; }
.settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings-actions button { margin: 0; }
.settings-sub-line { margin: 16px 0 0; font-size: 14px; color: var(--text-2); }
.settings-sub-line strong { color: var(--text); }
.settings-sub-line form.inline button { margin: 0 0 0 4px; vertical-align: 1px; }

/* stream overlay: options, link + steps, preview */
#overlay { max-width: 1000px; }
.overlay-options { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 18px; }
.overlay-options .seg-btn { height: 30px; }
.overlay-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
@media (min-width: 860px) { .overlay-grid { grid-template-columns: minmax(0, 1fr) auto; } }
.overlay-grid label { margin-top: 0; }
.overlay-steps { margin: 16px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.overlay-steps li + li { margin-top: 4px; }
.overlay-steps strong { color: var(--text); }
.overlay-preview { justify-self: start; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: repeating-conic-gradient(#1b1e24 0 25%, #15171c 0 50%) 0 0 / 18px 18px; }
/* color-scheme matches the overlay page's, or Chrome paints the frame white */
.overlay-preview iframe { display: block; border: 0; max-width: 100%; background: transparent; color-scheme: normal; }
.overlay-preview-label { display: block; margin-top: 6px; font-size: 11.5px; letter-spacing: 0.04em; text-align: right; }

/* backups: keep-days, the saved list, a copy to take along */
.keep-form label { margin-top: 0; }
.keep-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.keep-row input { width: 84px; }
.keep-row button { margin: 0 0 0 4px; }
.backup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 8px; }
.backup-head h3 { margin: 0; font-size: 15px; }
.backup-head button { margin: 0; }
.backup-none { margin: 4px 0 0; font-size: 14px; }
.backup-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.backup-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.backup-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.backup-when strong { font-weight: 600; font-size: 14px; }
.backup-when .muted { font-size: 13px; }
.backup-what { grid-column: 1; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.backup-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.backup-actions .btn { margin: 0; }
.settings-sub .backup-facts { margin-top: 12px; }

.restore-card { max-width: 640px; }
.restore-compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.restore-compare th { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); text-align: left; padding: 0 0 8px; }
.restore-compare th.num, .restore-compare td.num { text-align: right; font-variant-numeric: tabular-nums; }
.restore-compare td { padding: 7px 0; border-top: 1px solid var(--line); color: var(--text-2); }
.restore-compare td.num { width: 140px; color: var(--text); }
.restore-diff { display: inline-block; padding: 0 7px; border-radius: 4px; background: rgba(245, 165, 36, 0.14); color: var(--warn); font-weight: 600; }
.restore-notes { margin: 18px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.restore-notes li + li { margin-top: 8px; }
.restore-notes strong { color: var(--text); }
.restore-actions { display: flex; gap: 8px; align-items: center; margin-top: 20px; }
.restore-actions .btn, .restore-actions button { margin: 0; }
@media (max-width: 560px) {
  .backup-list li { grid-template-columns: minmax(0, 1fr); }
  .backup-actions { grid-column: 1; grid-row: auto; margin-top: 6px; }
}

.backup-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 16px; color: var(--text-3); font-size: 14px; }
.backup-facts strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.backup-form button { margin-top: 10px; }

/* ---------- public league page ---------- */
.show-sm { display: none; }
.th-link { color: inherit; }
.th-link:hover { color: var(--text); text-decoration: none; }
tr.is-next td { background: rgba(255, 255, 255, 0.025); }
tr.is-out .who-name { color: var(--text-2); }
.t-fl { color: #c08bff; font-weight: 600; }
.fl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b462ff; margin-right: 4px; vertical-align: 0; }
.pen { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: rgba(245, 165, 36, 0.1); color: var(--warn); font-size: 11.5px; font-weight: 600; }

/* season switcher: <details>, no script */
.picker { position: relative; }
.picker > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.picker > summary::-webkit-details-marker { display: none; }
.picker > summary::after { content: ''; width: 7px; height: 7px; border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3); transform: translateY(-2px) rotate(45deg); margin-left: 2px; }
.picker > summary:hover { border-color: #41464f; }
.picker .menu { min-width: 240px; max-height: 60vh; overflow-y: auto; }
.picker .menu a { gap: 10px; }
.picker .menu a.is-current { color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* "Add to calendar": the .ics feed */
.subscribe .menu { width: 320px; max-width: calc(100vw - 32px); max-height: none; padding: 8px; }
.subscribe-note { margin: 4px 10px 8px; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.subscribe .menu-sep + .subscribe-copy { margin-top: 8px; }
.subscribe-pick { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 10px 8px; }
.subscribe-pick .seg-btn { height: 28px; }
.subscribe-copy { display: flex; gap: 6px; margin: 0 10px; }
.subscribe-copy input { flex: 1; min-width: 0; height: 30px; margin: 0; padding: 0 8px; font-size: 12.5px; color: var(--text-2); }
.subscribe-copy button { flex: none; margin: 0; }
.subscribe .menu .subscribe-copy button {
  width: auto; height: 30px; padding: 0 11px; justify-content: center;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; font-weight: 600;
}
.subscribe .menu .subscribe-copy button:hover { background: #20242b; border-color: #41464f; }

/* a round's sessions, as jump links */
.jump { display: flex; gap: 6px; flex-wrap: wrap; margin: -8px 0 4px; }
.jump a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.jump a:hover { color: var(--text); border-color: #41464f; text-decoration: none; }
[id^="s-"] { scroll-margin-top: 120px; }

/* "Live now" strip */
.live-now {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px 16px;
  border: 1px solid rgba(225, 6, 0, 0.45); border-radius: var(--radius); background: var(--accent-soft); color: var(--text); font-size: 14px;
}
.live-now:hover { text-decoration: none; border-color: var(--accent); }
.live-now-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: live-pulse 1.4s ease-in-out infinite; }
.live-now-go { margin-left: auto; color: #ff6b63; font-weight: 600; }

/* last race podium */
.podium { list-style: none; margin: 0; padding: 0; }
.podium li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.podium li:last-child { border-bottom: 0; }
.podium .who-text { flex: 1; }
.podium .num { font-size: 13px; white-space: nowrap; }

/* driver and team cards */
.grid.people { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card.person, .card.team-card { position: relative; overflow: hidden; margin: 0; }
.card.person { display: flex; align-items: center; gap: 14px; padding: 14px 16px 14px 20px; }
.card.person::before, .card.team-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--team); }
.person-no { flex: none; width: 2.1em; font-size: 24px; font-weight: 600; line-height: 1; color: var(--team); text-align: center; letter-spacing: -0.02em; }
.person-text { min-width: 0; flex: 1; line-height: 1.3; }
.person-pts { margin-left: auto; text-align: right; font-size: 13px; color: var(--text-2); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.person-pos { font-size: 15px; font-weight: 600; color: var(--text); }
.grid.teams { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card.team-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 14px 20px; }
.team-card-head { display: flex; align-items: flex-start; gap: 12px; }
.team-card-head .who-name { font-size: 16px; flex: 1; white-space: normal; }
.team-card-drivers { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.team-card-driver { display: flex; justify-content: space-between; gap: 10px; }

/* driver / team page header */
.profile { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.profile h1 { margin: 0; }
.profile-text { flex: 1; min-width: 0; }
.profile .actions { display: flex; gap: 8px; }
.profile-no {
  flex: none; min-width: 72px; height: 72px; padding: 0 10px; border-radius: 12px; display: grid; place-items: center;
  font-size: 34px; font-weight: 600; letter-spacing: -0.02em; color: var(--team);
  background: color-mix(in srgb, var(--team) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--team) 40%, var(--line));
}
.profile-no:empty { display: none; }
.profile-swatch { flex: none; width: 10px; align-self: stretch; min-height: 56px; border-radius: 5px; background: var(--team); }

@media (max-width: 640px) {
  .show-sm { display: block; }
  .profile { gap: 14px; }
  .profile-no { min-width: 56px; height: 56px; font-size: 26px; }
  .profile .actions { width: 100%; }
}

@media (max-width: 640px) {
  .container { padding: 22px 16px 48px; }
  .appbar-in { padding: 0 16px; gap: 8px; }
  .hide-sm { display: none !important; }
  h1 { font-size: 24px; }
  .page-head { align-items: flex-start; }
  .card { padding: 16px; }
  .table-wrap.card { padding: 4px 4px; }
  th, td { padding-left: 8px; padding-right: 8px; }
}

/* Live timing tower (Phase 3) */
.status-badge {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.7rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border);
}
.status-badge .live-dot {
  width: 0.55em; height: 0.55em; border-radius: 50%; background: currentColor; display: inline-block;
}
.status-badge.is-live { color: var(--accent); border-color: var(--accent); }
.status-badge.is-live .live-dot { animation: live-pulse 1.4s ease-in-out infinite; }
.status-badge.is-final { color: var(--ok); border-color: var(--ok); }
.status-badge.is-connecting, .status-badge.is-reconnecting { color: var(--muted); }
@keyframes live-pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.25; }
}

.incident-feed { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.incident-feed li {
  padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; display: flex; gap: 0.6rem;
}
.incident-feed li:last-child { border-bottom: none; }
.incident-feed .incident-time { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* Live timing page — tower, track map, race analysis charts */
.container.container-wide { max-width: 1480px; }
.live-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.live-head h1 { margin: 0; }
.live-head p { margin: 0.15rem 0 0; }
.live-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.live-lap { font-weight: 600; font-size: 1.2rem; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.live-lap[hidden], .live-sc[hidden], .live-weather[hidden] { display: none; }
.live-sc {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-weight: 600; font-size: 1rem; letter-spacing: 0.08em; padding: 0.3rem 0.9rem; border-radius: 6px;
  background: #ffd23f; color: #141414; box-shadow: 0 0 0 3px color-mix(in srgb, #ffd23f 30%, transparent);
}
.live-sc::before { content: '⚠'; font-size: 1.05em; line-height: 1; }
.live-sc[data-kind=vsc] { background: transparent; color: #ffd23f; box-shadow: inset 0 0 0 2px #ffd23f; }
.live-sc[data-kind=formation] { background: var(--panel-raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.live-sc[data-kind=formation]::before { content: none; }
/* while the safety car / VSC is out, a yellow strip along the top of the tower and map */
body.is-sc .live-tower-card, body.is-sc .live-map-card { box-shadow: inset 0 4px 0 #ffd23f; }
.live-weather { font-size: 0.85rem; }

.live-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (min-width: 1100px) { .live-grid { grid-template-columns: minmax(560px, 5fr) minmax(0, 6fr); } }
.live-grid .card { margin-bottom: 0; }
.live-tower-card { padding: 0.5rem 0.25rem 0.25rem; }
.live-tower-scroll { overflow-x: auto; }
.live-tower { font-size: 0.92rem; }
.live-tower th, .live-tower td { padding: 0.32rem 0.5rem; white-space: nowrap; }
.live-tower th.num, .live-tower td.num { text-align: right; }
.live-tower tbody tr { cursor: pointer; transition: background-color 0.12s ease; }
.live-tower tbody tr:hover, .live-tower tbody tr:focus-visible { background: color-mix(in srgb, var(--text) 6%, transparent); outline: none; }
.live-tower tbody tr.is-highlighted { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.live-tower tbody tr.is-out { opacity: 0.45; }
.live-tower .pos { font-weight: 600; font-size: 1.02rem; font-variant-numeric: tabular-nums; padding-left: 0.15rem; }
.live-tower .mono { font-family: inherit; font-size: 1em; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.live-tower th.delta, .live-tower td.delta { width: 2.6em; padding-right: 0; text-align: right; }
.live-tower .pos-delta { display: inline-block; font-size: 0.75rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-tower .pos-delta.up { color: var(--ok); }
.live-tower .pos-delta.down { color: #e05353; }
.live-tower .driver { min-width: 170px; }
.live-tower .driver-in { display: flex; align-items: center; gap: 0.5rem; }
.live-tower.is-history .pit-col, .live-tower.is-history .driver-team { display: none; } /* room for the stints */
.live-tower .team-bar { width: 4px; height: 1.3em; border-radius: 2px; flex: none; }
.live-tower .driver-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 14em; }
.live-tower .driver-team { font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
.live-tower .t-fastest { color: #b462ff; font-weight: 600; }
.live-tower .t-pb { color: var(--ok); }
.live-tower .pit-flag { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--text); color: var(--bg); }
.tyre { display: inline-flex; align-items: center; gap: 0.35rem; }
.tyre-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  font-size: 0.78rem; font-weight: 600; line-height: 1; flex: none;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.28); /* keeps the white hard visible on a light panel */
}
.tyre-dot.is-small { width: 1.25rem; height: 1.25rem; font-size: 0.66rem; }
.tyre-age { font-size: 0.82rem; color: var(--text); opacity: 0.8; font-variant-numeric: tabular-nums; }
.tyre-history { display: inline-flex; align-items: center; gap: 0.2rem; }
.stint-chip { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.1rem 0.3rem 0.1rem 0.1rem; border-radius: 999px; background: var(--panel-raised); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.stint-chip.is-current { box-shadow: inset 0 0 0 1px var(--muted); }
.stint-laps { min-width: 1.1em; text-align: right; }
/* tower toolbar: Gap leader|interval, Tyres now|history */
.tower-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; padding: 0.35rem 0.6rem 0.6rem; }
.seg { display: inline-flex; align-items: center; gap: 0.25rem; }
.seg-label { font-size: 0.8rem; margin-right: 0.25rem; }
.seg-btn {
  margin: 0; padding: 0.2rem 0.7rem; border-radius: 6px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed=true] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.live-hint { font-size: 0.8rem; margin: 0.4rem 0.6rem 0.2rem; }

.live-map-card { display: flex; flex-direction: column; min-height: 360px; }
.live-map-head { display: flex; align-items: center; justify-content: space-between; }
.live-map-head h2 { margin: 0; }
.live-check { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; cursor: pointer; }
.live-map-wrap { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; }
.live-map { width: 100%; height: auto; max-height: 78vh; display: block; }
.live-map-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2rem; margin: 0; }
.live-map-empty[hidden] { display: none; }
.track-edge { fill: none; stroke: var(--border); stroke-width: 16; stroke-linejoin: round; stroke-linecap: round; }
.track-line { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; opacity: 0.7; }
.track-edge.is-provisional { stroke-width: 10; opacity: 0.6; }
.track-line.is-provisional { stroke-dasharray: 6 8; }
.track-start { fill: var(--text); }
.track-marker { fill: none; stroke: var(--text); stroke-width: 3; }
.cars .car { cursor: pointer; }
.cars .car circle { stroke: var(--panel); stroke-width: 2.5; }
.cars .car-num { font-size: 12px; font-weight: 600; pointer-events: none; }
.cars .car-code { font-size: 13px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--panel); stroke-width: 3px; pointer-events: none; }
.cars .car.is-highlighted circle { stroke: var(--text); stroke-width: 3.5; }
.cars .car-lead { stroke: var(--muted); stroke-width: 1.3; pointer-events: none; }
.cars .car.is-dim { opacity: 0.35; }
.cars .car.is-pit { opacity: 0.55; }

.live-analysis { margin-top: 1.25rem; }
.live-tabs { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0.6rem; margin-bottom: 0.9rem; }
.live-tabs [role=tab] {
  margin: 0; padding: 0.4rem 0.85rem; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600;
}
.live-tabs [role=tab]:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.live-tabs [role=tab][aria-selected=true] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.live-tab[hidden] { display: none; }
.live-chips { margin-left: auto; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.chip {
  margin: 0; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--panel-raised); border: 1px solid var(--border); color: var(--text); font-size: 0.8rem;
}
.chip-key { width: 0.65rem; height: 0.65rem; border-radius: 50%; }
.chip-clear { color: var(--muted); }

.chart { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-width: 1; }
.chart-grid .chart-axis { stroke: var(--muted); opacity: 0.6; }
.chart-tick { font-size: 11px; fill: var(--muted); }
.chart-tick.is-strong { fill: var(--text); font-weight: 600; }
.chart-label { font-size: 11px; fill: var(--muted); font-weight: 600; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.is-dim { opacity: 0.18; }
.chart-line.is-emph { stroke-width: 3; }
.chart-endlabel { font-size: 11px; font-weight: 600; fill: var(--text); }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; margin-bottom: 0.5rem; font-size: 0.8rem; }
.legend-item {
  margin: 0; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.1rem 0.4rem; border-radius: 4px;
  background: none; border: 1px solid transparent; color: var(--muted); font-size: 0.8rem; font-weight: 600;
}
button.legend-item:hover { color: var(--text); }
.legend-item.is-on { color: var(--text); border-color: var(--border); }
.legend-key { width: 1.1rem; border-top: 3px solid; }
.tyre-swatch { display: inline-flex; align-items: center; justify-content: center; width: 1.4em; height: 1.1em; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
.stint rect { stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1; }
.stint:hover rect, .stint:focus rect { stroke: var(--text); stroke-width: 2; }
.stint:focus { outline: none; }
.stint-text { font-size: 11px; font-weight: 600; pointer-events: none; }
.chart-note { font-size: 0.82rem; margin: 0 0 0.4rem; }
.chart-empty { padding: 2.5rem 0; text-align: center; }
.chart-table { margin-top: 0.6rem; font-size: 0.85rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table table { font-size: 0.8rem; }
.chart-table th, .chart-table td { padding: 0.25rem 0.45rem; white-space: nowrap; }
.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 140px; max-width: 280px;
  background: var(--panel-raised); border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.6rem;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.5); font-size: 0.8rem;
}
.chart-tip[hidden] { display: none; }
.tip-title { color: var(--muted); font-weight: 600; margin-bottom: 0.2rem; }
.tip-row { display: flex; align-items: center; gap: 0.45rem; line-height: 1.5; }
.tip-row strong { font-variant-numeric: tabular-nums; }
.tip-key { width: 0.9rem; border-top: 3px solid; flex: none; }
.tele-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.8rem; }
.tele-controls label { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--text); font-size: 0.9rem; }
.tele-controls select { width: auto; min-width: 9rem; }
.tele-panel h3 { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 0.6rem 0 0.1rem; }
@media (max-width: 640px) {
  .live-tower .driver-team { display: none; }
  .live-tower .driver { min-width: 120px; }
}

/* Track art (shared/trackart): circuit map colours, both themes */
.live-map {
  --ta-bg: var(--panel); --ta-edge: #3a3f4b; --ta-tarmac: #23262e; --ta-text: var(--text); --ta-muted: var(--muted);
  --ta-badge: #2b2f39; --ta-badge-text: #fff; --ta-s1: #ff3b3b; --ta-s2: #2fb4ff; --ta-s3: #ffd400;
  --ta-zone: #22c55e; --ta-trap: #e040fb; --ta-chq-a: #fff; --ta-chq-b: #111;
}
.live-map-credit { font-size: 0.75rem; margin: 0.35rem 0 0; text-align: right; }

/* ---------- Race Director ---------- */
.count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; vertical-align: 1px;
}
h2 .count { vertical-align: 2px; }
.badge.kind.is-penalty { color: #ff6b6b; border-color: rgba(255, 92, 92, 0.4); background: rgba(255, 92, 92, 0.1); }
.badge.kind.is-warning { color: var(--warn); border-color: rgba(245, 165, 36, 0.35); background: rgba(245, 165, 36, 0.08); }
.badge.kind.is-contact { color: var(--info); border-color: rgba(77, 163, 255, 0.35); background: rgba(77, 163, 255, 0.08); }
.badge.kind.is-lap, .badge.kind.is-info { color: var(--text-3); }
.key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 4px 0 10px; vertical-align: 0; }
.key.is-penalty { background: #ff5c5c; } .key.is-warning { background: var(--warn); } .key.is-contact { background: var(--info); }

.rd-map svg {
  display: block; width: 100%; height: auto; max-height: 520px;
  --ta-bg: var(--panel); --ta-edge: #3a3f4b; --ta-tarmac: #23262e; --ta-text: var(--text); --ta-muted: var(--muted);
  --ta-badge: #2b2f39; --ta-badge-text: #fff; --ta-s1: #5a5f69; --ta-s2: #5a5f69; --ta-s3: #5a5f69;
  --ta-zone: #3a3f4b; --ta-trap: #3a3f4b; --ta-chq-a: #fff; --ta-chq-b: #111;
}
.rd-dot { stroke: var(--panel); stroke-width: 2.5; opacity: 0.92; }
.rd-dot.is-penalty { fill: #ff5c5c; }
.rd-dot.is-warning { fill: var(--warn); }
.rd-dot.is-contact { fill: var(--info); }
.rd-dot.is-lap, .rd-dot.is-info { fill: #7d838d; }
.rd-dot.is-hl { stroke: #fff; stroke-width: 4; opacity: 1; }

a.stat.stat-link { display: block; color: var(--text); transition: border-color 0.12s ease; }
a.stat.stat-link:hover { text-decoration: none; border-color: var(--line-2); }
a.stat.stat-link.is-on { border-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0 12px; }
.filters select { width: auto; min-width: 160px; }
.filters button, .filters .btn { margin-top: 0; }
table.incidents tr.is-struck .who-name { text-decoration: line-through; text-decoration-color: var(--text-3); }
table.incidents td .who-sub { margin-top: 1px; }

.review-list { display: grid; gap: 10px; margin-bottom: 8px; }
.card.review { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin: 0; padding: 16px 18px; }
.review-main { min-width: 0; }
.review-who { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.review-reason { margin: 8px 0 0; color: var(--text-2); font-style: italic; }
.review-meta { margin-top: 8px; font-size: 13px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.review-actions .btn { margin: 0; }
.review-line { padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-line:first-of-type { padding-top: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }

label.choice {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); color: var(--text); font-weight: 400; font-size: 14px;
}
label.choice:has(input:checked) { border-color: var(--accent); background: #170f10; }
label.choice input { margin-top: 2px; flex: none; }
label.choice > span { display: block; }
label.choice .hint { display: block; margin-top: 2px; }
.inline-fields { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.inline-fields select { width: auto; }
.inline-fields input { width: 80px; }
.moves { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.moves li { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 6px; background: var(--bg-2); }
.moves .up { color: var(--ok); } .moves .down { color: var(--bad); }
.decision-check { border-color: var(--line-2); }
@media (max-width: 640px) {
  .card.review { flex-direction: column; align-items: stretch; }
  .filters select { min-width: 0; flex: 1 1 140px; }
}
@media (max-width: 959px) { .split > .first-on-phone { order: -1; } }

/* ---------- race recordings ---------- */
/* file drop zone: a <label> round a hidden file input, so it's one big target */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 28px 16px;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2); color: var(--text-2);
  font-weight: 400; font-size: 14px; text-align: center; cursor: pointer; transition: border-color 0.12s ease, background-color 0.12s ease;
}
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--accent); background: #140f10; }
.drop.has-file { border-style: solid; border-color: var(--line-2); }
.drop.is-small { padding: 18px 12px; }
.drop-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: #ff6b63; margin-bottom: 4px; }
.drop-text strong { color: var(--text); }
.drop-name { font-size: 13px; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.drop-name:empty { display: none; }
form[data-recording-upload] [data-status] { margin: 14px 0 0; }
form[data-recording-upload] button[type=submit] { width: 100%; }
form[data-recording-upload] button[type=submit]:disabled { background: var(--panel-2); border-color: var(--line-2); color: var(--text-3); opacity: 1; }
.badge.status.as-text { text-transform: none; } /* a sentence, not a one-word state */
.path-copy { display: inline-block; padding: 6px 10px; font-size: 14px; user-select: all; }
.apply-card { margin-top: 16px; border-color: var(--line-2); }
.apply-card .use-list { display: grid; gap: 8px; margin: 14px 0 16px; }
.apply-card .choice { margin: 0; }
.apply-card label.choice:has(input:checked) { border-color: #41464f; background: var(--bg-2); } /* several can be ticked: red stays on the button */
.apply-card .choice .hint { margin: 3px 0 0; }
label.choice.is-off { cursor: default; opacity: 0.6; }

/* ---------- homepage (logged out) ----------
   Full-width bands; each sets its own width with .home-in. The product
   pictures are the real components (who-bar, rr, tyre-dot, kind badges)
   with example data, so they look like what people get. */
.page-bare { flex: 1; width: 100%; }
.home-in { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.home-flash { padding-top: 20px; }
.home-flash .toast { margin-bottom: 0; }
.site-foot .foot-note { flex-basis: 100%; font-size: 12px; color: #5f656e; }

.home-hero { position: relative; overflow: hidden; padding: 76px 0 64px; border-bottom: 1px solid var(--line); }
/* a faint engineering grid, fading out downwards */
.home-hero::before, .home-cta::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 30%, transparent 78%);
}
/* and a low red glow behind the timing screen */
.home-hero::after {
  content: ''; position: absolute; left: 50%; bottom: -260px; width: min(1200px, 120vw); height: 560px; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(225, 6, 0, 0.12), transparent);
}
.home-hero .home-in, .home-cta .home-in { position: relative; z-index: 1; }
/* no lone last words: headings balance their lines, paragraphs avoid orphans */
.door h2, .feature-copy h2, .home-cta h2 { text-wrap: balance; }
.hero-sub, .feature-copy p, .ticks li, .home-cta p { text-wrap: pretty; }
.hero-copy { max-width: 720px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
}
.hero-kicker i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero-title { font-size: clamp(40px, 6.2vw, 64px); line-height: 1.02; letter-spacing: -0.03em; margin: 22px 0 20px; }
.hero-sub { font-size: 18.5px; line-height: 1.55; color: var(--text-2); max-width: 640px; margin: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 32px; }
.hero-actions .btn { margin: 0; }
.hero-note { margin: 16px 0 0; font-size: 14px; color: var(--text-3); }

/* the timing screen */
.screen { margin: 60px 0 0; }
.screen-frame {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden;
  box-shadow: 0 60px 120px -50px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}
.screen-bar { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 18px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 14px; }
.screen-live {
  display: inline-flex; align-items: center; gap: 7px; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid rgba(225, 6, 0, 0.45); background: var(--accent-soft); color: #ff6b63;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
}
.screen-live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: live-pulse 1.4s ease-in-out infinite; }
.screen-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-bar .spacer { flex: 1; }
.screen-meta { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.screen-lap { font-weight: 600; white-space: nowrap; }
.screen-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.screen-tower { padding: 4px 8px 8px; border-right: 1px solid var(--line); }
.screen-tower table { font-size: 14px; }
.screen-tower th { padding: 11px 10px 9px; font-size: 11px; }
.screen-tower td { padding: 6px 10px; }
.screen-tower tbody tr:hover td, .mock tbody tr:hover td { background: none; }
.screen-tower .who-bar { height: 20px; }
.screen-tower tr.is-pit td { color: var(--text-3); }
.screen-tower tr.is-pit .who-name { color: var(--text-2); }
.screen .t-pb { color: var(--ok); }
.sc-pit { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; }
.screen-map {
  display: flex; align-items: center; padding: 18px 22px;
  --ta-bg: var(--panel); --ta-edge: #2a2e36; --ta-tarmac: #1b1e24; --ta-text: var(--text); --ta-muted: var(--text-3);
  --ta-line: #4d535e; --ta-s1: #4d535e; --ta-s2: #4d535e; --ta-s3: #4d535e; --ta-zone: #2a2e36; --ta-trap: #2a2e36; --ta-chq-a: #fff; --ta-chq-b: #111;
}
.screen-map svg { display: block; width: 100%; height: auto; }
.sc-car { stroke: var(--panel); stroke-width: 8; }
.sc-car.is-pit { opacity: 0.4; }
.screen-cap { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--text-3); }

/* bands below the hero */
.home-section { padding: 96px 0; border-bottom: 1px solid var(--line); }
.home-section h2 { margin: 0; }

.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.door { display: flex; flex-direction: column; padding: 30px 30px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.door h2 { font-size: 25px; line-height: 1.2; letter-spacing: -0.015em; margin: 2px 0 22px; }
.ticks { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 12px; flex: 1; color: var(--text-2); font-size: 15.5px; }
.ticks li { position: relative; padding-left: 30px; }
.ticks li::before { content: ''; position: absolute; left: 0; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-2); }
.ticks li::after { content: ''; position: absolute; left: 6.5px; top: 8.5px; width: 7px; height: 3.5px; border-left: 1.6px solid var(--text); border-bottom: 1.6px solid var(--text); transform: rotate(-45deg); }
.door-go { font-weight: 600; font-size: 15px; }
.door-go span { display: inline-block; transition: transform 0.15s ease; }
.door-go:hover { text-decoration: none; }
.door-go:hover span { transform: translateX(3px); }

.feature { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: center; }
.feature + .feature { margin-top: 112px; }
@media (min-width: 960px) {
  .feature { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 72px; }
  .feature.is-flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
  .feature.is-flip .feature-copy { order: 2; }
}
.feature-copy h2 { font-size: clamp(28px, 3.3vw, 38px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 18px; }
.feature-copy p { color: var(--text-2); font-size: 16.5px; line-height: 1.6; margin-bottom: 14px; }
.feature-copy p:last-child { margin-bottom: 0; }

/* product pictures */
.mock { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9); }
.mock-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 18px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 13px; }
.mock-title { font-size: 14px; font-weight: 600; color: var(--text); }
.mock-body { padding: 2px 8px 8px; }
.mock table { font-size: 14px; }
.mock th { padding: 11px 8px 9px; font-size: 11px; }
.mock td { padding: 8px; }
.mock .who-bar { height: 20px; }
.mock-note {
  display: flex; align-items: center; gap: 9px; margin: 14px 16px 4px; padding: 9px 12px; border-radius: 8px;
  background: rgba(47, 191, 113, 0.07); border: 1px solid rgba(47, 191, 113, 0.25); font-size: 13px; color: var(--text);
}
.mock-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }

.rd-list { list-style: none; margin: 0; padding: 6px 18px; }
.rd-list li { display: grid; grid-template-columns: 86px 82px minmax(0, 1fr); gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rd-list .badge { justify-self: start; }
.rd-where { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.rd-review { margin: 16px 18px 18px; padding: 16px; border-radius: 10px; border: 1px solid rgba(245, 165, 36, 0.32); background: rgba(245, 165, 36, 0.045); }
.rd-review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.rd-quote { margin: 12px 0 14px; color: var(--text); font-style: italic; }
.rd-decide { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.rd-q { font-weight: 600; color: var(--text); }
.rd-decide .up { color: var(--ok); }
.rd-decide .down { color: var(--bad); }
.rd-buttons { display: flex; gap: 8px; margin-top: 14px; }
.rd-buttons .btn { margin: 0; pointer-events: none; }

.radio-log { list-style: none; margin: 0; padding: 18px 18px 8px; display: grid; gap: 12px; }
.radio-log li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.radio-who { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.radio-log p { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 14.5px; }
.radio-log li.from-you p { background: transparent; border-style: dashed; border-color: var(--line-2); color: var(--text-2); }
.radio-log li.is-urgent p { border-color: rgba(225, 6, 0, 0.5); background: var(--accent-soft); }
.radio-ptt { padding: 10px 18px 18px 100px; font-size: 13px; color: var(--text-3); }
kbd {
  display: inline-block; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px;
  background: var(--panel-2); color: var(--text); font: 600 12px/1.4 'Titillium Web', sans-serif;
}

.home-cta { position: relative; overflow: hidden; padding: 104px 0 112px; text-align: center; }
.home-cta::before { -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 25%, transparent 75%); mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 25%, transparent 75%); background-position: center bottom; }
.home-cta h2 { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 14px; }
.home-cta p { max-width: 560px; margin: 0 auto; color: var(--text-2); font-size: 17px; }
.home-cta .hero-actions { justify-content: center; }

@media (max-width: 899px) {
  .screen-body { grid-template-columns: minmax(0, 1fr); }
  .screen-map { order: -1; padding: 14px 18px; border-bottom: 1px solid var(--line); }
  .screen-tower { border-right: 0; }
}
@media (max-width: 640px) {
  .home-in { padding: 0 16px; }
  .home-hero { padding: 44px 0 40px; }
  .hero-title { margin: 18px 0 16px; }
  .hero-sub { font-size: 16.5px; }
  .hero-actions { margin-top: 26px; }
  .hero-actions .btn { flex: 1 1 100%; }
  .screen { margin-top: 40px; }
  .screen-bar { padding: 0 14px; }
  .screen-tower { padding: 2px 4px 6px; }
  .home-section { padding: 60px 0; }
  .door { padding: 22px 20px 20px; }
  .door h2 { font-size: 22px; }
  .feature { gap: 26px; }
  .feature + .feature { margin-top: 72px; }
  .rd-list { padding: 4px 14px; }
  .rd-list li { grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; }
  .rd-list .who-text { grid-column: 1 / -1; }
  .rd-review { margin: 12px 14px 14px; }
  .radio-log { padding: 14px 14px 6px; }
  .radio-log li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .radio-ptt { padding: 8px 14px 16px; }
  .home-cta { padding: 72px 0 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .screen-live i { animation: none; }
  .door-go span { transition: none; }
}

/* ---------- championship rules: points systems, season rules ---------- */
.rules-form { max-width: 760px; }
.rules-form > .card + .card { margin-top: 16px; }
.rules-form .card-head { flex-wrap: wrap; margin-bottom: 6px; }
.rules-save { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 20px; }
.rules-save button { margin: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-row button { margin: 0; }
.pt-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.pt-cell { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-3); }
.pt-cell input { height: 34px; padding: 0 6px; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.pt-cell input::-webkit-outer-spin-button, .pt-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pt-more { margin-top: 10px; }
.rule + .rule { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.rule:first-of-type .rule-head { margin-top: 4px; }
.rule-pts { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.rule-pts input { width: 74px; text-align: center; }
.rule .check { margin-top: 14px; }
.rule-sub { margin: 10px 0 0 24px; }
.rule-sub .check:first-child { margin-top: 0; }
.rule-sub .check + .check { margin-top: 10px; }
.inline-num { display: inline-block; width: 70px; height: 32px; margin: 0 4px; padding: 0 6px; text-align: center; }
.check .inline-num { margin: -6px 4px; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.inline-field .inline-num { margin: 0; }

.ps-list { display: grid; gap: 12px; max-width: 900px; }
.ps-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ps-card .actions { display: flex; gap: 8px; }
.ps-card .actions button, .ps-card .actions .btn { margin: 0; }
.ps-main { min-width: 0; }
.ps-list > .card { margin: 0; }
.ps-name { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.ps-name a { color: var(--text); }
.ps-table { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ps-extras { margin: 6px 0 0; font-size: 13.5px; color: var(--text-2); }
.ps-main .hint { margin-top: 8px; }

/* round page: points per session, driver of the day */
select.compact { height: 30px; width: auto; min-width: 140px; font-size: 13px; padding-left: 10px; background-position: right 10px center; }
select.compact.is-set { border-color: rgba(245, 165, 36, 0.45); color: var(--warn); }
.session-table td { vertical-align: middle; }
.session-table form.auto-submit { margin: 0; }

/* standings: rules, dropped rounds, adjustments */
.standings-rules { margin: -8px 0 14px; font-size: 13.5px; color: var(--text-2); }
.rr.is-dropped { opacity: 0.55; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.rr.is-none.is-dropped { text-decoration: none; opacity: 0.35; }
.adj { display: inline-block; min-width: 34px; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.adj.is-minus { color: var(--bad); background: rgba(255, 92, 92, 0.1); }
.adj.is-plus { color: var(--ok); background: rgba(47, 191, 113, 0.1); }
.pts-note { margin-left: 1px; color: var(--text-3); font-weight: 400; }
.adj-card { max-width: 760px; }
.adj-list { list-style: none; margin: 0 0 6px; padding: 0; }
.adj-list li { display: grid; grid-template-columns: auto minmax(0, 12em) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.adj-list li:last-child { border-bottom: 1px solid var(--line); }
.adj-list .adj { min-width: 44px; }
.adj-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adj-why { color: var(--text-2); overflow-wrap: anywhere; }
.adj-list form button { margin: 0; }
.adj-form { margin-top: 18px; }
.adj-form-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 12px; }
.adj-form-row label { margin-top: 0; }

@media (max-width: 720px) {
  .pt-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .ps-card { flex-direction: column; }
  .adj-list li { grid-template-columns: auto minmax(0, 1fr) auto; }
  .adj-list .adj-why { grid-column: 2 / -1; }
  .adj-form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .adj-f-who { grid-column: 1 / -1; }
  .adj-form-row .adj-f-pts label, .adj-form-row .adj-f-round label { margin-top: 14px; }
}
.round-notes { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 8px 6px; font-size: 13px; color: var(--text-3); }
.session-factor { margin-left: 8px; vertical-align: 3px; font-size: 12px; }
.rule-label { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.thresholds { display: grid; gap: 8px; }
.threshold { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.threshold .inline-num { margin: 0; }
.threshold select.compact { min-width: 0; max-width: 100%; }
.threshold button { margin: 0; }
#add-threshold { margin-top: 10px; }
/* Race Director: penalty points */
.sanctions { list-style: none; margin: 0 0 14px; padding: 4px 16px; }
.sanctions li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; }
.sanctions li + li { border-top: 1px solid var(--line); }
.sanction-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; font-size: 14px; }
.sanction-main .muted { font-size: 13px; }
.badge.sanction { min-width: 112px; justify-content: center; }
.badge.sanction.is-warning { color: var(--warn); border-color: rgba(245, 165, 36, 0.35); background: rgba(245, 165, 36, 0.08); }
.badge.sanction.is-quali-ban { color: #ffb36b; border-color: rgba(255, 150, 60, 0.4); background: rgba(255, 150, 60, 0.1); }
.badge.sanction.is-race-ban, .badge.sanction.is-season-ban { color: #ff6b6b; border-color: rgba(255, 92, 92, 0.4); background: rgba(255, 92, 92, 0.1); }
a.badge.is-warn:hover { text-decoration: none; border-color: var(--warn); }
.pp { display: inline-block; min-width: 30px; padding: 1px 7px; border-radius: 4px; font-weight: 600; text-align: center; background: rgba(255, 255, 255, 0.06); font-variant-numeric: tabular-nums; }
.pp.is-close { color: var(--warn); background: rgba(245, 165, 36, 0.12); }
.pp-meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 4px; max-width: 260px; }
.pp-meter span { display: block; height: 100%; border-radius: 3px; background: var(--text-3); }
td.pts-dropped { color: var(--text-3); text-decoration: line-through; font-weight: 400; }

/* ---------- dashboard sections: sub-tabs, season switcher ---------- */
.subtabs { border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.015); }
.subtabs-in {
  max-width: var(--max); margin: 0 auto; padding: 7px 14px; display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.subtabs-in::-webkit-scrollbar { display: none; }
.subtabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  color: var(--text-3); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.subtabs a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.subtabs a.active { color: var(--text); background: rgba(255, 255, 255, 0.08); }
@media (max-width: 720px) { .subtabs-in { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 32px; } }

/* ---------- league sidebar (dashboard pages: partials/rail.ejs, /js/rail.js) ----------
   Names shown (232 px) or icons only (html.rail-slim, 64 px). The icons sit
   in the same spot either way, right under the logo, so nothing jumps when
   it's folded. "You are here" is the red edge, like the old tab underline.
   Phones: a drawer from the app bar's menu button. */
.appbar-full .appbar-in { max-width: none; padding-left: 18px; }
.appbar-menu { display: none; }
.shell { flex: 1; display: flex; align-items: stretch; min-width: 0; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shell-main > .subtabs { border-top: 0; border-bottom: 1px solid var(--line); background: transparent; }
.rail {
  flex: none; width: 232px; position: sticky; z-index: 30; top: 57px; align-self: flex-start;
  height: calc(100vh - 57px);
  display: flex; flex-direction: column; padding: 10px 10px 12px;
  background: var(--bg-2); border-right: 1px solid var(--line);
  overflow-x: hidden; overflow-y: auto; scrollbar-width: thin;
  transition: width 0.15s ease;
}
.rail-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  width: 100%; height: 40px; margin: 0; padding: 0 12px; flex: none;
  border: 0; border-radius: 8px; background: none; color: var(--text-3);
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.2; letter-spacing: normal; white-space: nowrap; text-align: left; cursor: pointer;
}
.rail-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.rail-link.is-active { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.rail-link.is-active::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-icon { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.rail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-note { color: var(--text-3); font-weight: 400; }
.rail-link .count { margin-left: auto; }
.rail-toggle { margin-bottom: 8px; }
.rail-toggle .rail-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.rail-sep { flex: none; height: 1px; margin: 8px 6px; background: var(--line); }
.rail-fill { flex: 1; min-height: 16px; }
.rail-backdrop { display: none; }
@media (min-width: 721px) {
  .rail-slim .rail { width: 64px; overflow: visible; }
  .rail-slim .rail-label {
    position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); z-index: 60;
    width: auto; height: auto; clip: auto; overflow: visible; padding: 5px 10px; border-radius: var(--radius-sm);
    background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow);
    color: var(--text); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
  }
  .rail-slim .rail-link:hover .rail-label, .rail-slim .rail-link:focus-visible .rail-label { opacity: 1; }
  .rail-slim .rail-link .count { position: absolute; top: 2px; right: 2px; margin: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .rail-slim .rail-sep { margin: 8px 4px; }
}
@media (max-width: 720px) {
  .appbar-full .appbar-in { padding-left: 8px; }
  .js .appbar-menu {
    display: grid; place-items: center; flex: none; width: 38px; height: 38px; margin: 0; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2);
  }
  .js .appbar-menu:hover, .js.rail-open .appbar-menu { color: var(--text); background: rgba(255, 255, 255, 0.06); }
  .js .rail {
    position: fixed; z-index: 45; top: 57px; left: 0; bottom: 0; height: auto; width: min(280px, 85vw);
    align-self: stretch; /* newer browsers apply align-self to fixed boxes too: flex-start would shrink it to its links */
    box-shadow: var(--shadow); transform: translateX(-100%); visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .js.rail-open .rail { transform: none; visibility: visible; transition: transform 0.2s ease; }
  .js .rail-toggle { display: none; }
  .js.rail-open .rail-backdrop { display: block; position: fixed; z-index: 44; inset: 57px 0 0 0; background: rgba(0, 0, 0, 0.55); }
  .js.rail-open body { overflow: hidden; }
  /* no script: the sections as a row above the page */
  html:not(.js) .shell { flex-direction: column; }
  html:not(.js) .rail { position: static; width: auto; height: auto; padding: 6px 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  html:not(.js) .rail-nav { flex-direction: row; }
  html:not(.js) .rail-link { width: auto; }
  html:not(.js) .rail-link.is-active::before { display: none; }
  html:not(.js) .rail-sep, html:not(.js) .rail-fill, html:not(.js) .rail-toggle { display: none; }
}
@media (prefers-reduced-motion: reduce) { .rail, .js .rail, .js.rail-open .rail, .rail-slim .rail-label { transition: none; } }

/* ---------- site banner (Admin > Site; partials/nav.ejs) ---------- */
.site-banner { border-bottom: 1px solid var(--line); background: rgba(77, 163, 255, 0.08); }
.site-banner[hidden] { display: none; }
.site-banner-in { max-width: var(--max); margin: 0 auto; padding: 9px 20px; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.site-banner-tag { flex: none; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--info); }
.site-banner-text { flex: 1; min-width: 0; color: var(--text); }
.site-banner-close { flex: none; width: 28px; height: 28px; margin: 0; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2); font-size: 20px; line-height: 1; }
.site-banner-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.site-banner.is-warning { background: rgba(245, 165, 36, 0.09); }
.site-banner.is-warning .site-banner-tag { color: var(--warn); }
.site-banner.is-maintenance { background: var(--accent-soft); }
.site-banner.is-maintenance .site-banner-tag { color: #ff6b63; }
.site-banner.is-preview { border: 1px solid var(--line-2); border-radius: var(--radius-sm); margin-bottom: 4px; }
.site-banner.is-preview .site-banner-in { padding: 9px 12px; }

/* ---------- admin portal ---------- */
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pills a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; color: var(--text-3); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pills a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.pills a.active { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.filters .pills { margin-left: auto; }
.mono-sm { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
a.stat-link { display: block; color: inherit; transition: border-color 0.12s ease; }
a.stat-link:hover { border-color: var(--line-2); text-decoration: none; }
.progress.is-warn > i { background: var(--warn); }
.toast.is-warn { border-left-color: var(--warn); }
.kv-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv-table tr:last-child td { border-bottom: 0; }
.kv-table td:first-child { color: var(--text-2); }
.kv-table td:last-child { text-align: right; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .badge { flex: none; }
.feed-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-when { flex: none; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.badge.kind.is-admin { color: var(--info); border-color: rgba(77, 163, 255, 0.35); background: rgba(77, 163, 255, 0.08); }
.badge.kind.is-signup { color: var(--ok); border-color: rgba(47, 191, 113, 0.35); background: rgba(47, 191, 113, 0.08); }
.badge.kind.is-login-failed { color: var(--warn); border-color: rgba(245, 165, 36, 0.35); background: rgba(245, 165, 36, 0.08); }
.badge.kind.is-login-locked { color: #ff6b6b; border-color: rgba(255, 92, 92, 0.4); background: rgba(255, 92, 92, 0.1); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1; min-width: 200px; }
.inline-form button { margin: 0; }
.danger-zone { border-color: rgba(255, 92, 92, 0.35); }
.danger-zone .card-title { color: var(--bad); }
.release-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 8px; }
.release-grid > .card { margin-bottom: 0; }
.release-version { font-size: 28px; font-weight: 600; line-height: 1.2; margin: 4px 0 2px; }
.users-table tr.is-off td { opacity: 0.6; }
.ai-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.ai-form input[type=number] { width: 4.6rem; height: 30px; }
.ai-form button { margin: 0; }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; margin: 0; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu .menu { min-width: 230px; }
.menu button.menu-danger { color: var(--bad); }
.triage-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.triage-form select { width: auto; height: 30px; }
.triage-form input[type=text] { width: 190px; height: 30px; }
.triage-form button { margin: 0; }
.report-note { max-width: 360px; overflow-wrap: anywhere; }
/* radio cards: the existing label.choice, in a plain fieldset */
.choice-list { border: 0; margin: 14px 0 0; padding: 0; }
.choice-list legend { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.choice-list label.choice input { width: auto; height: auto; accent-color: var(--accent); }
.badge.status.plain { text-transform: none; }

.season-switch { position: relative; min-width: 0; }
.season-switch > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px; margin-left: -8px; border-radius: var(--radius-sm); color: var(--text-2); }
.season-switch > summary::-webkit-details-marker { display: none; }
.season-switch > summary svg { flex: none; color: var(--text-3); }
.season-switch > summary:hover, .season-switch[open] > summary { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.season-switch .menu { left: 0; right: auto; min-width: 260px; max-height: 70vh; overflow-y: auto; }
.season-switch .menu a { justify-content: space-between; gap: 12px; }
.season-switch .menu a.is-current { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.menu-label { padding: 6px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.menu-group { padding: 8px 10px 2px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.menu-note { font-size: 12px; color: var(--text-3); }
@media (max-width: 720px) { .season-switch > summary { max-width: 32vw; } .season-switch .season-name { overflow: hidden; text-overflow: ellipsis; } .appbar .crumb { max-width: 30vw; } }

/* Results: a season's rounds */
.results-list { display: grid; gap: 10px; }
.result-round { display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(0, 2fr) auto; align-items: center; gap: 12px 20px; padding: 14px 18px; }
.result-round.is-future { opacity: 0.62; }
.result-round.is-waiting { border-color: rgba(245, 165, 36, 0.3); }
.res-round { display: flex; align-items: center; gap: 14px; min-width: 0; }
.res-num { flex: none; width: 38px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, 0.06); font-weight: 600; font-size: 13px; color: var(--text-2); }
.res-title { display: flex; flex-direction: column; min-width: 0; }
.res-title .strong { color: var(--text); }
.res-title .muted { font-size: 13px; }
.res-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }
.res-facts .k { color: var(--text-3); font-size: 12.5px; margin-right: 2px; }
.res-sessions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.res-sessions .btn { margin: 0; }
.res-source { font-size: 12.5px; color: var(--text-3); margin-right: 4px; }
@media (max-width: 900px) {
  .result-round { grid-template-columns: minmax(0, 1fr); }
  .res-sessions { justify-content: flex-start; }
}

/* Settings → Series & seasons */
.series-list { display: grid; gap: 16px; max-width: 900px; }
.series-card .card-head { align-items: flex-start; }
.series-card .card-head .actions { display: flex; gap: 8px; }
.series-card .card-head .actions .btn, .series-card .card-head .actions button { margin: 0; }
.series-name { margin: 0; font-size: 18px; font-weight: 600; }
.series-card table td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.series-card table td .actions .btn { margin: 0; }
.new-season { margin-top: 14px; }
.new-season > summary { list-style: none; display: inline-flex; margin: 0; }
.new-season > summary::-webkit-details-marker { display: none; }
.new-season[open] > summary { margin-bottom: 4px; }
.new-season-form > button { margin-top: 14px; }

/* Calendar */
.calendar-table tr.is-next td { background: rgba(255, 255, 255, 0.025); }
.session-chips { display: inline-flex; gap: 4px; }
.session-chip { min-width: 26px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); border: 1px solid var(--line-2); }
.session-chip.is-done { color: var(--text); border-color: transparent; background: rgba(255, 255, 255, 0.08); }

/* Overview: what needs doing, getting started */
.notice.todo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice.todo .btn { margin: 0; }
.setup-steps { list-style: none; margin: 0; padding: 6px 18px; max-width: 760px; }
.setup-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; }
.setup-steps li + li { border-top: 1px solid var(--line); }
.setup-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
.setup-steps li.is-done .setup-num { background: rgba(47, 191, 113, 0.14); color: var(--ok); }
.setup-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.setup-steps .btn { margin: 0; }
.todo-list { list-style: none; margin: 0 0 20px; padding: 4px 18px; }
.todo-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; font-size: 14px; }
.todo-list li + li { border-top: 1px solid var(--line); }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 165, 36, 0.12); }
.todo-text { overflow-wrap: anywhere; }
.todo-list .btn { margin: 0; }

/* Standings over several seasons */
.combined-picker { padding: 14px 18px; margin-bottom: 8px; }
.combined-picker-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.combined-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.combined-quick a { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.combined-quick a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.combined-quick a.is-on { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.combined-seasons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.combined-seasons button { margin: 0 0 0 4px; }
.season-chip { display: inline-flex; margin: 0; cursor: pointer; }
.season-chip input { position: absolute; opacity: 0; pointer-events: none; }
.season-chip span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; color: var(--text-3); }
.season-chip:hover span { color: var(--text); border-color: #41464f; }
.season-chip input:checked + span { color: var(--text); background: rgba(255, 255, 255, 0.08); border-color: transparent; }
.season-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.3); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.combined-table th.is-sorted .th-link { color: var(--text); }
.combined-table th.is-sorted .th-link::after { content: ' ↓'; color: var(--text-3); }
.title-count { display: inline-block; min-width: 26px; padding: 1px 6px; border-radius: 4px; font-weight: 600; color: #ffd65a; background: rgba(255, 196, 0, 0.14); }
