/* DR3 — dark rally design system */

:root {
  --bg: #181C14;
  --surface: #3C3D37;
  --muted: #afff95;
  --text: #ECDFCC;

  --paper: #181C14;
  --paper-2: #3C3D37;
  --card: #3C3D37;
  --ink: #ECDFCC;
  --ink-soft: #afff95;
  --line: #697565;
  --accent: #ECDFCC;
  --accent-deep: #697565;
  --mustard: #ECDFCC;
  --olive: #697565;
  --danger: #697565;
  --warning: #C4635A;
  --startingBlue: #95c8f7;

  --display: 'Oswald', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;
  --shadow: rgba(0, 0, 0, 0.45);
  /* Content column: full width on small screens, capped + centered on big ones */
  --page-max: 1440px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* The design is rem-based; 24px root = what the site looked like at 150%
   browser zoom on a 16px default, so no zooming is needed (backlog #30). */
html { font-size: 24px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(rgba(236, 223, 204, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: var(--body);
  line-height: 1.55;
}

a { color: var(--muted); }
a:hover { color: var(--text); }
.driver-link { font-weight: 600; color: var(--ink); text-decoration: none; }
.driver-link:hover { color: var(--muted); }
.ink { color: var(--ink); }

main { max-width: var(--page-max); width: 100%; margin: 0 auto; padding: 0 1.25rem 2rem; flex: 1 0 auto; }

/* ── Header ─────────────────────────────────────────── */

.site-header { background: var(--bg); color: var(--text); border-bottom: 2px solid var(--line); }
.header-inner {
  max-width: var(--page-max); margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.65rem; margin-right: auto; text-decoration: none; color: var(--text); }
.brand-text { font-family: var(--display); font-weight: 700; font-size: 2em; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
.brand-year { background: var(--accent); color: var(--bg); padding: 0.05em 0.4em 0.12em; margin-left: 0.3em; display: inline-block; transform: skewX(-8deg); }

.site-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }
.site-nav a {
  color: var(--text); text-decoration: none; font-family: var(--display);
  text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.95rem;
  padding: 0.25rem 0.1rem; border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--text); border-bottom-color: var(--accent); }
.site-nav button.nav-link {
  background: none; border: none; cursor: pointer;
  color: var(--text); text-decoration: none; font-family: var(--display);
  text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.95rem;
  padding: 0.25rem 0.1rem; margin-top: 0; border-radius: 0; box-shadow: none;
  border-bottom: 3px solid transparent;
}
.site-nav button.nav-link:hover { color: var(--text); border-bottom-color: var(--accent); transform: none; box-shadow: none; background: none; }
.site-nav button.nav-link:active { transform: none; box-shadow: none; background: none; }
/* The header logout form must not inherit the member-row inline-form margins. */
.site-nav form.inline { margin: 0; }

.checker {
  height: 16px;
  background-image: repeating-conic-gradient(var(--text) 0% 25%, var(--bg) 0% 50%);
  background-size: 16px 16px;
}
.stripe-accent {
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 12px, var(--bg) 12px 24px);
}

/* ── Footer ─────────────────────────────────────────── */

.site-footer { background: var(--bg); color: var(--text); margin-top: auto; border-top: 2px solid var(--line); }
.footer-inner {
  max-width: var(--page-max); margin: 0 auto; padding: 0.6rem;
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
  font-size: 0.9rem; letter-spacing: 0.03em;
}
.site-footer a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--muted); }
.site-footer a:hover { color: var(--text); }
.footer-brand { display: inline-flex; align-items: center; gap: 0.55rem; line-height: 24px; }
.footer-logo { width: 24px; height: 24px; flex: none; object-fit: contain; }
.footer-inner + .footer-inner { border-top: 1px solid var(--line); }
.footer-legal { max-width: var(--page-max); margin: 0 auto; padding: 0.2rem 1.25rem 0.9rem; color: var(--line); font-size: 0.72rem; letter-spacing: 0.03em; text-align: center; }

/* ── Headings ───────────────────────────────────────── */

h1 {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em;
  font-size: clamp(1.8rem, 4vw, 2.3rem); line-height: 1.05; font-weight: 700;
  margin: 1.4rem 0 0.8rem; display: flex; align-items: center; gap: 0.6rem; width: 100%;
}
h1::before { content: ''; width: 2em; height: 0.5em; flex: none; transform: skewX(-14deg); background: repeating-linear-gradient(-45deg, var(--accent) 0 0.35em, transparent 0.35em 0.7em); }

h2 {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 1.3rem; font-weight: 600; margin: 1.8rem 0 0.7rem;
  padding-bottom: 0.3rem; border-bottom: 2px solid var(--line);
  display: flex; align-items: center; gap: 0.55rem;
}
h2::before {
  content: ''; width: 2.1em; height: 0.45em; flex: none;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 0.35em, transparent 0.35em 0.7em);
}

h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.05em; font-size: 1.05rem; }

hr {
  border: 0; height: 2px; margin: 1.6rem 0; opacity: 0.45;
  background: repeating-linear-gradient(-45deg, var(--muted) 0 10px, transparent 10px 20px);
}

/* ── Panels / cards ─────────────────────────────────── */

.panel {
  background: var(--card); border: 2px solid var(--line);
  box-shadow: 4px 4px 4px var(--shadow);
  padding: 1.1rem 1.25rem; margin: 1rem 0;
}
.panel h2:first-child { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; margin: 1.1rem 0; }
.club-card {
  background: var(--card); border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.club-card h3 { margin: 0; font-size: 1.25rem; }
.club-card .title-link {
  display: block;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.club-card .title-link:hover { color: var(--text); text-decoration: underline; }
.club-card .desc { color: var(--muted); font-size: 0.95rem; flex: 1; }
.club-card .owner-chip {
  align-self: flex-start;
  width: 100%;
  text-align: center;
}

.grid-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.1rem; margin: 1.1rem 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin: 1.1rem 0; }

.stat-card {
  background: var(--card);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: space-between;
  text-align: center;
}
.stat-num { font-family: var(--display); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--accent); }
.stat-label { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; color: var(--muted); }
.stat-sub { font-family: var(--body); text-transform: none; letter-spacing: normal; font-size: 0.78rem; color: var(--muted); }
.stat-drivers .stat-num { font-size: 5rem; }
.stat-days .stat-num { font-size: 3.5rem; }
a.stat-card { text-decoration: none; transition: transform 0.12s ease, box-shadow 0.12s ease; }
a.stat-card:hover {
  transform: scale(1.03); z-index: 1;
  box-shadow: inset 0 0 18px -8px rgba(175, 175, 175, 0.6), 4px 4px 0 var(--shadow), 0 8px 20px rgba(0, 0, 0, 0.35);
}
.stat-clubs {
  padding: 0;
  gap: 0;
}
.stat-clubs .stat-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  padding: .7rem 1.1rem;
  border: 2px solid transparent;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.stat-clubs .stat-link + .stat-link { border-top: 2px solid var(--line); }
.stat-clubs .stat-link:hover {
  border-top-left-radius: .3rem;
  border-top-right-radius: .3rem;
  transform: scale(1.06);
  z-index: 1;
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
  background: var(--card);
  box-shadow: inset 0 0 18px -8px rgba(175, 175, 175, 0.6), 4px 4px 0 var(--shadow), 0 8px 20px rgba(0, 0, 0, 0.35);
}
.stat-clubs .stat-link + .stat-link:hover {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: .3rem;
  border-bottom-right-radius: .3rem;
  transform: scale(1.06);
  z-index: 1;
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--shadow);
  background: var(--card);
  box-shadow: inset 0 0 18px -8px rgba(175, 175, 175, 0.6), 4px 4px 0 var(--shadow), 0 8px 20px rgba(0, 0, 0, 0.35);
}
.stat-stages {
  padding: 0;
  gap: 0;
}
.stat-stages .stat-part {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  padding: .7rem 1.1rem;
  border: 2px solid transparent;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.stat-stages .stat-part + .stat-part { border-top: 2px solid var(--line); }
.stat-distance {
  padding: 0;
  gap: 0;
}
.stat-distance .stat-part {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  padding: .7rem 1.1rem;
  border: 2px solid transparent;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.stat-distance .stat-part + .stat-part { border-top: 2px solid var(--line); }

/* ── Home panels (hero replacement) ────────────────── */

.home-panels { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr; gap: 1.1rem; margin: 1.5rem 0 1.1rem; align-items: stretch; }
.home-panels .club-card .desc { flex: none; }
.home-panels .card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.home-panels .card-actions .btn { margin-top: 0; width: 100%; }

.home-panels ul { list-style: disc; margin: 0.2rem 0 0; padding-left: 1.25rem; font-size: .9rem; }
.home-panels ul li { margin: 0.35rem 0; line-height: 1.4; }
.home-panels .discord-list { font-size: 1rem; }
.whats-new ul { list-style: circle; margin: 0.3rem 0 0.1rem; padding-left: 1.15rem; }
.whats-new ul li { font-size: 0.92em; color: var(--muted); line-height: 1.4; }

/* ── Buttons ────────────────────────────────────────── */

.btn, button {
  display: inline-block; font-family: var(--display); text-transform: uppercase;
  letter-spacing: 0.07em; font-size: 0.95rem; font-weight: 600;
  padding: 0.55rem 1.2rem; margin-top: 0.8rem;
  background: var(--accent); color: var(--bg); border: 2px solid var(--line);
  box-shadow: 3px 3px 3px var(--shadow); cursor: pointer; text-decoration: none;
}
.btn:hover, button:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--shadow); background: var(--accent-deep); color: var(--bg); }
.btn:active, button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow); }
.btn-ghost, .btn.ghost, button.ghost { background: var(--card); color: var(--text); }
.btn-ghost:hover, button.ghost:hover { background: var(--muted); color: var(--bg); }
.btn-dark, .btn.dark, button.dark { background: var(--bg); color: var(--text); }
.btn-dark:hover, button.dark:hover { background: var(--surface); color: var(--text); }
.btn-warn, .btn.warn, button.warn { background: var(--mustard); color: var(--bg); }
.btn-danger, .btn.danger, button.danger { background: var(--danger); color: var(--bg); }
.btn-danger:hover, button.danger:hover { background: var(--muted); color: var(--bg); }
.btn-sm, .btn-small, button.small { padding: 0.28rem 0.7rem; font-size: 0.78rem; margin-top: 0; box-shadow: 2px 2px 0 var(--shadow); }

form.inline { display: inline-block; margin: 0 0.4rem 0.4rem 0; }
button[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ──────────────────────────────────────────── */

label { display: block; margin: 0.7rem 0 0.25rem; font-weight: 600; font-size: 0.92rem; letter-spacing: 0.02em; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.6rem;
  border: 2px solid var(--line); background: var(--bg);
  font-family: var(--body); font-size: 1rem; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 3px 3px 0 rgba(236, 223, 204, 0.25);
}
input[type='checkbox'] { width: auto; max-width: none; }

/* Custom dropdown widget — base.html JS wraps every native <select> in a
   .cselect box and builds a button + listbox menu around it; the native
   element stays in the DOM for form submission but is rendered invisible.
   Pure CSS/JS: identical in all browsers (500px cap, accent hover/focus,
   same scrollbar as .recent-box). */
.cselect { position: relative; display: block; }
.cselect > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.cselect-btn {
  position: relative;
  width: 100%;
  padding: 0.5rem 2.1rem 0.5rem 0.6rem;
  border: none;
  background: var(--bg);
  font-family: var(--body);
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  margin-top: 0;
  outline: none;
}
.cselect-btn:hover, .cselect-btn:active { transform: none; box-shadow: none; background: var(--bg); color: var(--text); }
.cselect-btn::after {
  content: ''; position: absolute; right: 0.7rem; top: 30%;
  width: 24px; height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ECDFCC' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: rotate 0.3s;
}
.cselect.open .cselect-btn::after { rotate: 180deg; }
.cselect-menu {
  position: fixed; z-index: 30;
  max-height: 500px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) rgba(24, 28, 20, 0.5);
  background: var(--accent-deep); box-shadow: 4px 4px 4px var(--shadow);
  border-radius: .3rem;
  visibility: hidden; transform: scaleY(0); transform-origin: top;
  transition: transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
}
.cselect.open .cselect-menu { transform: scaleY(1); visibility: visible; pointer-events: auto; }
.cselect-list { list-style: none; margin: 0; padding: 0; }
.cselect-item {
  padding: 0.15rem 0.65rem;
  cursor: pointer;
  color: var(--text);
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cselect-item:hover, .cselect-item:focus, .cselect-item.cselect-focus { background: var(--accent); color: var(--bg); }
.cselect-group {
  padding: 0.15rem 0.4rem 0.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--surface);
  cursor: default;
}
.duration-row .cselect { flex: 1; min-width: 120px; max-width: none; }

.checkrow { display: flex; align-items: center; gap: 0.55rem; margin: 0.45rem 0; font-weight: 600; }
.checkrow input { margin: 0; }

/* Option cards — radio groups rendered as selectable tiles */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.9rem; margin: 0.6rem 0 1rem; user-select: none; }
.opt {
  position: relative; display: block; cursor: pointer; width: auto; max-width: none; margin: 0;
  background: var(--bg); border: 2px solid var(--line); box-shadow: 3px 3px 0 var(--shadow);
  padding: 0.75rem 0.9rem 0.85rem; font-weight: 400;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-title { display: block; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.07em; font-size: 1.02rem; color: var(--text); margin-bottom: 0.3rem; }
.opt-desc { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.opt-points { display: block; font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.03em; color: var(--text); margin-top: 0.5rem; }
.opt:has(input:checked) { background: var(--accent); border-color: var(--text); box-shadow: 3px 3px 0 var(--shadow); }
.opt:has(input:checked) .opt-title { color: var(--bg); }
.opt:has(input:checked) .opt-desc { color: var(--surface); }
.opt:has(input:checked) .opt-points { color: var(--bg); font-weight: 700; }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Numbered pickers — 1..N radio groups rendered as a strip of square tiles */
.num-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.5rem; margin: 0.6rem 0 1rem; }
.num-tile {
  position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer;
  aspect-ratio: 1 / 1; background: var(--bg); border: 2px solid var(--line); box-shadow: 3px 3px 0 var(--shadow);
  font-family: var(--mono); font-size: 1.05rem; color: var(--text); margin: 0;
}
.num-tile input { position: absolute; opacity: 0; pointer-events: none; }
.num-tile:has(input:checked) { background: var(--accent); border-color: var(--text); color: var(--bg); font-weight: 700; }
.num-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .num-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ── Tables ─────────────────────────────────────────── */

.table-wrap { overflow-x: auto; background: var(--card); border: 2px solid var(--line); box-shadow: 4px 4px 4px var(--shadow); margin: 1rem 0; }
.recent-box { max-height: 360px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) rgba(24, 28, 20, 0.5); }
.recent-box::-webkit-scrollbar { width: 10px; }
.recent-box::-webkit-scrollbar-track { background: rgba(24, 28, 20, 0.5); }
.recent-box::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--card); }
.recent-box::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.recent-box thead th { position: sticky; top: 0; z-index: 1; }
table.table, .table-wrap table { width: 100%; border-collapse: collapse; background: var(--card); margin: 0; font-size: 0.9rem; }
thead { height: 2rem; }
th, td { padding: 0.15rem 0.15rem; }
.table th, .table-wrap th {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 0.82rem; font-weight: 600; background: var(--bg); color: var(--text);
  text-align: left; border: 0;
}
.table-wrap thead th { border-bottom: 2px solid var(--line); color: var(--muted); font-size: 0.78rem; letter-spacing: 0.0em; }
.table td { border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap td { padding: .15rem; vertical-align: middle; }
.table tr:nth-child(even) td, .table-wrap tr:nth-child(even) td { background: rgba(24, 28, 20, 0.25); }
.table tr:last-child td, .table-wrap tr:last-child td { border-bottom: 0; }
.live-events th:nth-child(1), .live-events td:nth-child(1) { padding-left: .5rem; }
.live-events th:nth-child(2), .live-events td:nth-child(2), .live-events th:nth-child(7), .live-events td:nth-child(7) { text-align: center; }
td:has(.driver-dot) { display: flex; justify-content: center; align-items: center; gap: 0.4rem; }
.driver-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  font-weight: 600; font-size: 0.65rem; color: var(--bg); font-family: var(--body);
}
.dot-red { background: #e05252; box-shadow: 0 0 14px rgba(224, 82, 82, 0.75); }
.dot-yellow { background: #e8c33f; box-shadow: 0 0 14px rgba(232, 195, 63, 0.75); }
.dot-green { background: #71b348; box-shadow: 0 0 14px rgba(113, 179, 72, 0.75); }
.num { font-family: var(--mono); font-size: 0.92em; }
.recent-box .num { text-align: right; font-variant-numeric: tabular-nums; }
.recent-box th:first-child, .recent-box td:first-child { padding-left: .5rem; }
.recent-box thead th:first-child { padding-left: calc(40px + .5rem); }
.recent-box th:nth-child(4), .recent-box td:nth-child(4), .recent-box th:nth-child(5), .recent-box td:nth-child(5), .recent-box th:nth-child(6), .recent-box td:nth-child(6) { text-align: center; }
.recent-box table { table-layout: fixed; }
.recent-box th, .recent-box td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-box tbody tr { height: 1.8rem; }
.recent-box th:nth-child(1), .recent-box td:nth-child(1) { width: 12rem; }
.recent-box th:nth-child(2), .recent-box td:nth-child(2) { width: 10rem; }
.recent-box th:nth-child(3), .recent-box td:nth-child(3) { width: 13rem; }
.recent-box th:nth-child(4), .recent-box td:nth-child(4) { width: 2.5rem; }
.recent-box th:nth-child(5), .recent-box td:nth-child(5) { width: 3rem; }
.recent-box th:nth-child(6), .recent-box td:nth-child(6) { width: 3rem; }
.recent-box th:nth-child(7), .recent-box td:nth-child(7) { width: 3.5rem; }
.recent-box th:nth-child(8), .recent-box td:nth-child(8) { width: 5rem; }
.recent-box th:nth-child(9), .recent-box td:nth-child(9) { width: 4.5rem; }
.drivers-box { max-height: none; overflow-y: visible; }
.drivers-box th:nth-child(2), .drivers-box td:nth-child(2) { width: 6rem; }
.drivers-box th:nth-child(3), .drivers-box td:nth-child(3) { width: 6rem; }
.drivers-box th:nth-child(4), .drivers-box td:nth-child(4) { width: 7rem; }
.recent-box.drivers-box .num { text-align: right; }
.flag { height: .95em; width: auto; vertical-align: -0.18em; margin-right: 0.3em; }
.class-thumb { height: 1.3em; width: auto; vertical-align: -0.32em; }

/* ── Profile driving stats: two-column layout ───────── */

.driving { width: 100%; border-collapse: collapse; background: var(--card); margin: 0.2rem 0 0; }
.driving td { border-bottom: 1px solid var(--line); vertical-align: top; width: 50%; }
.driving tr:last-child td { border-bottom: 0; }
.driving td + td { border-left: 1px solid var(--line); }
.driving .stat-key { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-right: 0.35rem; }
.driving .top-title { display: block; margin-bottom: 0.4rem; }
.driving .top-list { margin: 0; padding: 0; list-style: none; }
.driving .top-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; padding: 0.12rem 0.35rem; font-size: 0.92rem; }
.driving .top-list li:nth-child(even) { background: rgba(24, 28, 20, 0.25); }
.driving .top-list .top-name { min-width: 0; }
.driving .top-list .top-km { margin-left: auto; white-space: nowrap; }

/* ── Chips / badges ─────────────────────────────────── */

.chip {
  display: inline-block; font-family: var(--display); text-transform: uppercase;
  letter-spacing: 0.08em; font-size: 0.74rem; font-weight: 600;
  padding: 0.12rem 0.55rem; border: 2px solid var(--line); background: var(--surface); color: var(--text);
}
.chip-accent { background: var(--accent); color: var(--bg); }
.chip-ok { background: var(--olive); color: var(--bg); }
.chip-warn { background: var(--mustard); color: var(--bg); }
a.chip { text-decoration: none; }
a.chip:hover {
  background: var(--card);
  border-color: var(--accent);
}
a.chip.chip-accent:hover { color: var(--text); }
.chips-row { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; margin: 0.3rem 0 0.8rem; }
.play-chips { justify-content: space-evenly; margin: 0.8rem 0 0; }
.club-card .chips-row { justify-content: space-between; }
.club-card .chips-row .members-chip { flex: 1; text-align: center; padding: 0.28rem 0.7rem; font-size: 0.78rem; }
.club-card .chips-row .chip-ok { width: 100%; text-align: center; }

/* ── Club detail: menu bar + tab panels ─────────────── */

.club-menu { display: flex; gap: 0.2rem 1rem; flex-wrap: wrap; align-items: stretch; margin-bottom: 0.5rem; }
.club-menu .club-title {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.03em;
  font-size: 1.5rem; font-weight: 700; align-self: center; margin-right: 0.4rem;
}
.club-menu a {
  font-family: var(--display);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
  padding: .3rem 0.15rem 0.1rem;
  border-bottom: 3px solid var(--line);
}
.club-menu a:hover { color: var(--text); }
.club-menu a.active { color: var(--text); border-bottom-color: var(--accent); }

.club-status-actions { margin-left: auto; display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.club-status-actions .inline { display: inline-flex; }

.club-tab[hidden] { display: none; }
.table-wrap td.dim { color: var(--line); }
.club-members .num, .club-champs .num { text-align: right; font-variant-numeric: tabular-nums; }
.club-champs th:nth-child(2), .club-champs td:nth-child(2) { text-align: center; }
.club-champs .btn.danger.small { padding: .25rem; margin: .1rem; font-size: .75rem; float: right; }
.club-members th:first-child, .club-champs th:first-child, .club-members td:first-child, .club-champs td:first-child { padding-left: .5rem; }
.club-members thead th:first-child { padding-left: calc(40px + .5rem); }
.club-members th:nth-child(2), .club-members td:nth-child(2) { text-align: center; }
.club-members form.inline { float: right; margin: .1rem; }
.club-members button.small { padding: .25rem; font-size: .75rem; }

/* ── Car page: selector + header + stats ─────────────── */

.car-pick { display: flex; gap: 0.8rem; align-items: center; }
.car-pick label { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.car-pick .cselect {
  width: 22rem;
}
.car-header { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.car-img { width: 50%; height: auto; }
.car-head-body { flex: 1; min-width: 10rem; align-self: stretch; }
.car-stats { display: flex; gap: 0.3rem 0; margin: 0; flex-direction: column; flex-wrap: wrap; max-height: 13rem; max-width: 18rem; align-content: space-between; }
.car-stat { width: 9rem; }
.car-stat dt { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.car-stat dd { margin: 0; font-weight: 600; font-size: .93rem; }
.car-diagram { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; zoom: 1.7; margin: 0 .2rem; }
.cd-front { color: var(--muted); font-size: 0.55rem; line-height: 1; }
.cd-body { position: relative; width: 80px; height: 150px; border: 2px solid var(--line); border-radius: 24px 24px 14px 14px; background: rgba(60, 61, 55, 0.5); }
.cd-wheel { position: absolute; width: 15px; height: 28px; background: var(--line); border-radius: 4px; }
.cd-fl { left: -7px; top: 20px; }
.cd-fr { right: -7px; top: 20px; }
.cd-rl { left: -7px; bottom: 16px; }
.cd-rr { right: -7px; bottom: 16px; }
.cd-engine { position: absolute; left: 50%; transform: translateX(-50%); width: 48px; height: 30px; background: var(--accent); color: var(--bg); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.car-diagram[data-engine="front"] .cd-engine { top: 8px; }
.car-diagram[data-engine="mid"] .cd-engine { top: 50%; margin-top: 6px; }
.car-diagram[data-engine="rear"] .cd-engine { bottom: 2px; }
.car-diagram[data-drive="front"] .cd-fl,
.car-diagram[data-drive="front"] .cd-fr,
.car-diagram[data-drive="rear"] .cd-rl,
.car-diagram[data-drive="rear"] .cd-rr,
.car-diagram[data-drive="4wd"] .cd-wheel { background: var(--muted); }
.car-info { flex: 1 1 100%; text-align: justify; margin: 0; line-height: 1.35; font-size: .9rem; font-family: var(--mono); letter-spacing: -0.035em; }
.car-fastest-duo { display: flex; gap: 1rem; flex-wrap: wrap; }
.car-fastest-col { flex: 1 1 240px; min-width: 0; }
.car-fastest th:first-child, .car-fastest td:first-child { padding-left: .5rem; }
.car-fastest th:last-child, .car-fastest td:last-child { width: 4rem; text-align: center; }
.car-distance th:first-child, .car-distance td:first-child { padding-left: .5rem; }
.car-distance thead th:first-child { padding-left: calc(40px + .5rem); }
.car-distance th:last-child, .car-distance td:last-child { text-align: right; }
.car-fastest tbody tr.fastest-row { cursor: pointer; font-weight: 600; user-select: none; }
.car-fastest tbody tr.fastest-row:hover td { background: rgba(24, 28, 20, 0.18); }
.car-fastest tr:nth-child(even) td { background: transparent; }
.car-fastest tr.fastest-detail td { padding: 0; border-bottom: 0; }
.fd-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.15s ease; }
.car-fastest tr.fastest-detail.open .fd-wrap { grid-template-rows: 1fr; }
.fd-inner {
  overflow: hidden; min-height: 0;
  padding-left: 1rem; padding-right: .5rem; color: var(--accent); font-size: 0.82rem; text-align: left;
  transition: padding 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.car-fastest tr.fastest-detail.open .fd-inner {
  padding-top: 0.2rem; padding-bottom: 0.2rem;
  background: rgba(24, 28, 20, 0.35); box-shadow: inset 0 -1px 0 var(--line);
}
.car-fastest tr.fastest-detail:last-child .fd-inner { box-shadow: none; }

/* ── Flash messages ─────────────────────────────────── */

.flash {
  border: 2px solid var(--line); border-left-width: 10px;
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 0.6rem 0.9rem; margin: 0.7rem 0; background: var(--card);
}
.flash.error { border-left-color: var(--text); }
.flash.success { border-left-color: var(--muted); }
.flash.warning { border-left-color: var(--text); }
.flash.info { border-left-color: var(--muted); }

input[type='search'] { max-width: none; }

/* ── Clubs list: filters, create toggle, membership tints ── */

.filters { position: sticky; top: 0; z-index: 20; padding: 0.9rem; }
.filters .opt-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 0.6rem 0 0 0; }
.filters .opt-title { text-align: center; letter-spacing: 0.01em; font-size: 0.74rem; }
.filters .opt { display: flex; flex-direction: column; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.filters .opt:hover {
  transform: scale(1.03); z-index: 1;
  box-shadow: inset 0 0 18px -8px rgba(175, 175, 175, 0.6), 4px 4px 0 var(--shadow), 0 8px 20px rgba(0, 0, 0, 0.35);
}
.opt-state { display: block; margin-top: auto; text-align: center; text-transform: uppercase; color: var(--text); font-size: 0.74rem; line-height: 1.45; font-weight: 900; font-style: italic; }
.opt:has(input:checked) .opt-state { color: var(--bg); }

details.create-club { padding: 0; }
details.create-club summary.create-toggle {
  cursor: pointer; list-style: none; user-select: none; margin: 0;
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 1.3rem; font-weight: 600; color: var(--text);
  padding: 1.1rem 1.25rem;
}
details.create-club summary.create-toggle::-webkit-details-marker { display: none; }
details.create-club .plus {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.3em; height: 1.3em; font-weight: 700; line-height: 1;
  background: var(--bg); border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--shadow);
  transition: transform 0.15s ease;
}
details.create-club[open] .plus { transform: rotate(45deg); }
details.create-club form {
  padding: 0 1.25rem 1.1rem;
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: stretch;
}

.club-card.in { background-image: linear-gradient(rgba(175, 255, 149, 0.08), rgba(175, 255, 149, 0.08)); border-color: #7f9a72; }
.club-card.out { background-image: linear-gradient(rgba(226, 122, 102, 0.1), rgba(226, 122, 102, 0.1)); border-color: #9c6a5e; }

.card-action { display: flex; align-items: center; }

.duration-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.duration-row select { flex: 1; min-width: 120px; max-width: none; }

.actions-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.actions-row button, .actions-row .btn { margin-top: 0; }

.new-champ-intro { background: var(--card); border: 2px solid var(--line); border-radius: 0.3rem; padding: 0.5rem 1rem 1.5rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.champ-actions { display: flex; justify-content: space-around; align-items: flex-start; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0 0.2rem; }
.champ-actions form { display: inline-flex; flex-direction: column; align-items: center; gap: 0.45rem; margin: 0; max-width: 22rem; }
.champ-actions .btn, .champ-actions form button { margin-top: 0; }
.champ-actions select { width: auto; max-width: 260px; min-width: 190px; margin: 0; }

.champ-stages th:first-child, .champ-stages td.num { text-align: center; width: 1.5rem; }
.champ-stages th:nth-child(2), .champ-stages th:nth-child(3), .champ-stages th:nth-child(4), .champ-stages th:nth-child(5) { padding-left: 0.7rem; }
.champ-stages th:nth-child(2), .champ-stages td:nth-child(2) { width: 20rem; }
.champ-stages th:nth-child(3), .champ-stages td:nth-child(3) { width: 16rem; }
.champ-stages th:nth-child(4), .champ-stages td:nth-child(4), .champ-stages th:nth-child(5), .champ-stages td:nth-child(5) { min-width: 6rem; }
.champ-stages .cselect-btn { font-size: 0.75rem; }
.champ-stages .cselect-item { font-size: 0.8rem; padding: 0.1rem 0.65rem; }
.champ-stages td:nth-child(2) .cselect-label, .champ-stages td:nth-child(3) .cselect-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 15rem; }

/* ── Misc components ────────────────────────────────── */

.auth-card { max-width: 550px; margin: 2rem auto; }
.register-btn { display: block; margin: .8rem auto; }
/* Register-page h1 only (the global h1 keeps its flex layout + ::before stripe). */
.register-title {
  display: block;
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  line-height: 1.05;
  font-weight: 700;
  margin: 0 1rem 1rem;
  text-align: center;
}
.register-title::before { content: none; }
.auth-logo {
  display: block; width: 72px; height: 72px; margin: 0 auto 0.6rem;
  object-fit: contain;
}
.about-panel { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.about-logo {
  flex: none; width: 120px; height: 120px;
  object-fit: contain;
}
.about-panel p { flex: 1 1 260px; margin: 0; }

.crumbs { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.85rem; color: var(--muted); margin: 1rem 0 0.2rem; }
.crumbs a { color: var(--text); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }

.meta { color: var(--muted); }
.meta.flush-top { margin-top: 0; }
.uninstall-note { margin: 0; }

code { font-family: var(--mono); font-size: 0.9em; background: var(--surface); border: 1px solid var(--line); padding: 0.1rem 0.35rem; word-break: break-all; }
pre, .codeblock {
  background: var(--bg); color: var(--text); padding: 0.8rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: 0.9rem; line-height: 1.5;
  border: 2px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); margin: 0.8rem 0;
}
pre code, .codeblock code { background: none; border: 0; padding: 0; color: inherit; word-break: normal; }

.steps { list-style: none; counter-reset: step; margin: 1rem 0; padding: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 0.75rem 1rem 0.75rem 3.6rem;
  background: var(--card); border: 2px solid var(--line);
  box-shadow: 3px 3px 0 var(--shadow); margin: 0.65rem 0;
}
.steps li::before {
  content: counter(step); position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  width: 2.1rem; height: 2.1rem; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--accent);
  background: var(--bg); border: 2px solid var(--line);
}

.big404 { text-align: center; padding: 3rem 1rem; }
.big404 .num-plate {
  display: inline-block; font-family: var(--display); font-weight: 700; font-size: 5rem; line-height: 1;
  background: var(--card); border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--shadow);
  padding: 0.4rem 1.2rem; transform: rotate(-2deg); color: var(--accent);
}

.token-box { display: flex; gap: 0.6rem; align-items: stretch; flex-wrap: wrap; }
.token-box code { flex: 1 1 260px; margin: 0; background: var(--bg); color: var(--text); border: 2px solid var(--line); padding: 0.55rem 0.7rem; font-size: 0.95rem; }
.token-box button { flex: none; align-self: center; margin-top: 0; }
.invite-link { min-width: 0; }
.invite-link code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.invite-link-row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding-top: .5rem; }
.invite-link-row > * { margin: 0; }

/* ── Events-tab board (EA WRC-style) ─────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.champ-selector { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.champ-arrow { flex: none; width: 2.8rem; height: 2.8rem; display: flex; align-items: center; justify-content: center; background: var(--card); border: 2px solid var(--line); color: var(--text); cursor: pointer; font-size: 0.9rem; margin: 0; }
.champ-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.champ-arrow:disabled { color: var(--line); cursor: default; }
.champ-center { flex: 1 1 auto; display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; background: var(--card); border: 2px solid var(--line); padding: 0.4rem 0.8rem; align-content: center; }
.champ-name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; }
.champ-window { color: var(--muted); font-size: 0.85rem; }

.round-strip { display: flex; gap: 0.6rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 0.8rem; scrollbar-width: thin; scrollbar-color: var(--line) rgba(24, 28, 20, 0.5); }
.round-strip::-webkit-scrollbar { height: 10px; }
.round-strip::-webkit-scrollbar-track { background: rgba(24, 28, 20, 0.5); }
.round-strip::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--card); }
.round-strip::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.round-box {
  flex: none;
  width: 32.6%;
  text-align: left;
  background: var(--card);
  border: none;
  padding: 0 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.round-box.active {
  background: var(--accent-deep);
}
.round-thumb-wrap { position: relative; display: block; }
.round-thumb { display: block; width: 100%; aspect-ratio: 736 / 347; object-fit: cover; filter: brightness(0.5) blur(3px); transition: filter 0.15s ease; }
.round-box:hover .round-thumb, .round-box.hovered .round-thumb, .round-box.active .round-thumb { filter: none; }
.round-class-thumb {
  position: absolute;
  top: 0;
  left: .5rem;
  width: min(4.5rem, 20%);
  filter: brightness(0.5) blur(3px);
  transition: filter 0.15s ease;
}
.round-box:hover .round-class-thumb, .round-box.hovered .round-class-thumb, .round-box.active .round-class-thumb { filter: none; }
.round-loc {
  font-weight: 900;
  font-size: 0.95rem;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4.5rem;
  border-bottom-left-radius: .3rem;
  border-bottom-right-radius: .3rem;
  padding-left: .5rem;
  padding-top: .25rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-deep) 45%, transparent);
}
.round-box.active .round-loc { background: color-mix(in srgb, var(--card) 65%, transparent); }
.round-window {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.8rem;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .25rem .75rem;
}

.board-toggles { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.mode-toggle { display: inline-flex; }
.mode-btn { background: var(--card); border: none; border-right: 2px solid var(--line); padding: 0.4rem 1rem; cursor: pointer; color: var(--accent); font-weight: 700; }
.mode-btn:last-child { border-right: none; }
.mode-btn.active { background: var(--accent); color: var(--bg); }
.stage-bar { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.stage-btn { background: var(--card); border: 2px solid var(--line); padding: 0.3rem 0.6rem; cursor: pointer; font-size: 0.85rem; color: var(--text); }
.stage-btn:hover { border-color: var(--accent); }
.stage-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.board-info { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.4rem 0.2rem 0.6rem; }
.board-info-row { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.info-key { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; color: var(--muted); font-family: var(--display); }

table.board { table-layout: fixed; }
table.board th, table.board td { padding: 0.15rem 0.15rem; text-align: left; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
table.board th:nth-child(4), table.board td:nth-child(4), table.board th:nth-child(5), table.board td:nth-child(5), table.board th:nth-child(6), table.board td:nth-child(6) { text-align: center; }
table.board thead th:nth-child(2) { padding-left: 40px; }
table.board th:nth-child(1), table.board td:nth-child(1) { width: 2rem; text-align: center; }
table.board th:nth-child(2), table.board td:nth-child(2) { width: 11.5rem; }
table.board th:nth-child(3), table.board td:nth-child(3) { width: 11.5rem; }
table.board th:nth-child(4), table.board td:nth-child(4) { width: 3rem; }
table.board th:nth-child(5), table.board td:nth-child(5) { width: 2.3rem; }
table.board th:nth-child(6), table.board td:nth-child(6) { width: 2.7rem; }
table.board th:nth-child(7), table.board td:nth-child(7) { width: 3.5rem; text-align: center; }
table.board th:nth-child(8), table.board td:nth-child(8) { width: 3.5rem; }
table.board th:nth-child(9), table.board td:nth-child(9) { width: 5.5rem; }
table.board th:nth-child(10), table.board td:nth-child(10) { width: 5.5rem; }
table.board.board--overall th:nth-child(9), table.board.board--overall td:nth-child(9) { width: 6.5rem; }
table.board.board--overall th:nth-child(4), table.board.board--overall td:nth-child(4) { width: 4.5rem; }
table.board .board-row:nth-child(even) td { background: rgba(24, 28, 20, 0.25); }
table.board .num { text-align: right; font-variant-numeric: tabular-nums; }
.board-row.dnf td { color: var(--warning); }
.dnf-tag { font-size: 0.7rem; color: var(--text); border: 1px solid var(--line); padding: 0 0.25rem; margin-left: 0.3rem; white-space: nowrap; }
.tyre-cell { white-space: nowrap; }
.input-cell { white-space: nowrap; }
.input-icon { height: 1.1em; width: auto; vertical-align: -0.2em; }
.tyre-img { position: relative; display: inline-block; }
.tyre-img img { height: 1.5em; width: auto; vertical-align: middle; }
.board--overall .tyre-cell .tyre-img + .tyre-img { margin-left: -0.75em; }
.input-tip { position: relative; display: inline-block; }
.board-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line) rgba(24, 28, 20, 0.5); }
.board-wrap::-webkit-scrollbar { height: 10px; }
.board-wrap::-webkit-scrollbar-track { background: rgba(24, 28, 20, 0.5); }
.board-wrap::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--card); }
.board-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }
#board-table th, #board-table td { white-space: nowrap; }
.expand-head, .expand-cell { width: 2rem; text-align: center; white-space: nowrap; }
.expand-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: .8rem;
  line-height: .8;
  padding: .3rem;
  margin: .4em;
}
.split-col { white-space: nowrap; width: 4rem; }
.split-best { color: var(--muted); }
.split-worse { color: var(--warning); }
.dash-tip { position: relative; display: inline-block; cursor: help; }
.hover-tip {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 50;
}
.hover-tip.show { opacity: 1; }
/* Pinned tyre-damage popup: click a board tyre image to pin the compound tip
   as a full vehicle-state model for the stage that set was used on. */
.dmg-popup {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  width: 23rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 51;
}
.dmg-popup.show { opacity: 1; pointer-events: auto; }
.dmg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.dmg-title { font-family: var(--display); font-size: 0.95rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink); }
.dmg-stage { color: var(--muted); white-space: nowrap; }
.dmg-body { display: flex; gap: 0.2rem; align-items: center; }
.dmg-car { width: 12.8rem; flex: none; }
.dmg-bars { flex: 1; min-width: 0; }
.dmg-bar { display: flex; align-items: center; font-size: .7rem; }
.dmg-bar-start { width: 2rem; flex: none; text-align: right; font-variant-numeric: tabular-nums; color: var(--startingBlue); margin-right: .25rem; font-family: var(--mono); }
.dmg-bar-label { position: absolute; left: 0px; top: 43%; width: 4.1rem; text-align: center; transform: translateY(-50%); font-size: 0.65rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.dmg-bar-track { position: relative; flex: 1; height: 0.75rem; background: rgba(105, 117, 101, 0.35); overflow: hidden; margin-right: .15rem; }
.dmg-bar-fill { display: block; height: 100%; }
.dmg-bar-val { width: 2rem; flex: none; text-align: right; font-variant-numeric: tabular-nums; color: var(--accent); font-family: var(--mono); }
.dmg-nodata { color: var(--muted); padding: 1.5rem 0; text-align: center; }
.dmg-cond { padding-top: 0.45rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; text-align: center; }
.splits-row td { background: var(--bg); color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
#lb-board-table .diff-col { width: 5.5rem; }
#lb-board-table .pen-col { width: 4.5rem; }
#lb-board-table .src-cell { text-align: center; }
table th:last-child, table td:last-child { padding-right: .5rem; }
.car-fastest tr.fastest-detail td:last-child { padding-right: 0; }
#lb-board-table .car-col { width: 14.5rem; white-space: nowrap; }
#lb-board-table th.car-col { padding-left: 42px; }
#lb-board-table td:nth-child(2) { white-space: nowrap; }
#lb-board-table:has(.deg-col) th:nth-child(2), #lb-board-table:has(.deg-col) td:nth-child(2) { width: 10.5rem; }
#lb-board-table:has(.deg-col) th:nth-child(4), #lb-board-table:has(.deg-col) td:nth-child(4) { width: 2.3rem; }
#lb-board-table:has(.deg-col) th:nth-child(7), #lb-board-table:has(.deg-col) td:nth-child(7) { width: 2.9rem; text-align: center; }
#lb-board-table:has(.deg-col) th:nth-child(8), #lb-board-table:has(.deg-col) td:nth-child(8) { text-align: center; width: 3.5rem; }
.board-empty td { text-align: center; color: var(--muted); padding: 1rem; }

.standings-title { margin-top: 1.6rem; font-size: 1.15rem; }
table.standings th, table.standings td { text-align: left; white-space: nowrap; }
table.standings tbody tr + tr td { border-top: 1px solid var(--line); }
table.standings .num { text-align: right; font-variant-numeric: tabular-nums; }
table.standings th:nth-child(1), table.standings td:nth-child(1) { width: 2rem; text-align: center; }
table.standings th:nth-child(2) { padding-left: 40px; }
table.standings td.strong { font-weight: 700; color: var(--accent); }
.ps-bonus { color: var(--accent); font-size: 0.85em; }
.standings-note { color: var(--muted); font-size: 0.8rem; margin-top: 0.35rem; }

/* Rounded corners on every bordered box (edge rules like header/footer/table-row borders stay square) */
.panel, .club-card, .stat-card, .btn, button, input, select, textarea,
.opt, .num-tile, .table-wrap, .chip, .flash, code, pre, .codeblock,
.steps li, .steps li::before, .big404 .num-plate, .token-box code,
details.create-club .plus, .hover-tip, .champ-center, .round-thumb, .round-class-thumb, .dmg-popup { border-radius: 0.3rem; }

@media (max-width: 900px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .home-panels { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  html { font-size: 18px; }
  .header-inner { gap: 0.8rem; }
  main { padding: 0 0.9rem 2rem; }
}
/* ── Leaderboard filter panel ─────────────────────────── */
.lb-filters { margin-bottom: 0.6rem; padding: 1rem; }
.lb-filter-row { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.lb-filter-row + .lb-filter-row { margin-top: 0.8rem; }
.lb-filter-row label { margin: 0 0 0.2rem; font-size: 0.82rem; color: var(--muted); }
.lb-filter-row .cselect { width: 10.66rem; }
.lb-mode-toggle { display: inline-flex; margin-top: 0.8rem; border: 2px solid var(--line); box-shadow: 3px 3px 3px var(--shadow); background: var(--card); }
.lb-mode-toggle label { margin: 0; padding: 0.45rem 1rem; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.lb-mode-toggle label + label { border-left: 2px solid var(--line); }
.lb-mode-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lb-mode-toggle label:has(input:checked) { background: var(--accent); color: var(--bg); }
.lb-filter-row .cselect:has(select[name=loc]), .lb-filter-row .cselect:has(select[name=stage]), .lb-filter-row .cselect:has(select[name=car]) { width: 27.2rem; }
.lb-extra-row { display: grid; grid-template-rows: 0fr; margin-top: 0; transition: grid-template-rows 0.15s ease; }
.lb-extra-row.open { grid-template-rows: 1fr; }
.lb-extra-inner { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; min-height: 0; overflow: hidden; padding-top: 0.8rem; transition: padding 0.15s ease; }
.lb-filters-btn { margin: 0 0 .2rem 0; padding: .2rem .53rem; align-self: flex-end; font-size: .9rem; }
.lb-filters .cselect-btn { position: relative; width: 100%; padding: 0.5rem 2.1rem 0.5rem 0.6rem; border: none; background: var(--bg); font-family: var(--body); font-size: .78rem; color: var(--text); text-align: left; cursor: pointer; margin-top: 0; outline: none; }
