:root {
  color-scheme: dark;
  --bg: #111416;
  --surface: #181d20;
  --surface-strong: #20262a;
  --line: #30383d;
  --text: #f4f6f7;
  --muted: #9ba8ae;
  --cyan: #1da6c9;
  --green: #2ac94f;
  --amber: #f4b41a;
  --danger: #ff5a52;
  --font-condensed: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-family: var(--font-body); }
a { color: inherit; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 10px 14px; background: var(--cyan); color: #061216; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { height: 64px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 24px; border-bottom: 1px solid var(--line); background: #0d1012; }
.brand, .admin-link { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand { font-family: var(--font-condensed); font-size: 1.25rem; font-weight: 900; font-style: italic; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { width: 30px; display: grid; gap: 5px; }
.brand-mark i { display: block; height: 8px; border-radius: 2px; background: var(--cyan); position: relative; }
.brand-mark i::after { content: ""; position: absolute; right: 5px; top: 3px; width: 3px; height: 3px; border-radius: 50%; background: #082c36; }
.primary-nav { height: 100%; display: flex; align-items: center; gap: 28px; }
.primary-nav > a, .nav-menu > summary { position: relative; display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .82rem; font-weight: 800; letter-spacing: .05em; text-decoration: none; text-transform: uppercase; }
.primary-nav > a:hover, .primary-nav > a.active, .nav-menu > summary:hover, .nav-menu.active > summary { color: var(--text); }
.primary-nav > a.active::after, .nav-menu.active > summary::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--cyan); }
.nav-menu { position: relative; height: 100%; }
.nav-menu > summary { cursor: pointer; list-style: none; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::before { content: ""; position: absolute; right: -12px; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.nav-menu[open] > summary::before { transform: translateY(2px) rotate(225deg); }
.nav-submenu { position: absolute; z-index: 10; top: calc(100% - 1px); left: 50%; min-width: 160px; padding: 8px; border: 1px solid var(--line); background: #0d1012; box-shadow: 0 18px 34px rgb(0 0 0 / 35%); transform: translateX(-50%); }
.nav-submenu a { display: block; padding: 11px 12px; color: var(--muted); font-size: .78rem; font-weight: 750; text-decoration: none; text-transform: none; }
.nav-submenu a:hover, .nav-submenu a:focus-visible, .nav-submenu a[aria-current="page"] { color: var(--text); background: var(--surface-strong); }
.admin-link { justify-self: end; color: var(--cyan); font-size: .9rem; font-weight: 700; }

main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(28px, 5vw, 72px) clamp(18px, 4vw, 56px) 48px; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; min-height: 190px; padding-bottom: 32px; }
.hero::after { content: ""; position: absolute; inset: -10px 0 0 36%; opacity: .22; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 38px 38px; mask-image: linear-gradient(90deg, transparent, #000 30%, transparent); }
.hero-copy, .summary { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: var(--font-condensed); text-transform: uppercase; letter-spacing: .035em; }
h1 { font-size: clamp(2.7rem, 6vw, 5rem); line-height: .9; font-style: italic; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
.freshness { margin-top: 22px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; color: var(--muted); font-size: .82rem; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid color-mix(in srgb, var(--green), transparent 25%); border-radius: 999px; color: var(--green); font-weight: 800; background: color-mix(in srgb, var(--green), transparent 90%); }
.status-badge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-badge.stale { color: var(--amber); border-color: var(--amber); }
.status-badge.error { color: var(--danger); border-color: var(--danger); }
.summary { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); }
.summary div { padding: 0 28px; border-left: 1px solid var(--line); }
.summary dt { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.summary dd { margin: 7px 0 0; color: var(--cyan); font-family: var(--font-condensed); font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }

.leaderboard-shell { border: 1px solid var(--line); background: var(--surface); }
.filters { display: grid; grid-template-columns: 1.2fr 1fr .8fr auto; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); }
.filters.overview { grid-template-columns: minmax(0, 1fr) auto; }
.filters label { display: grid; gap: 8px; }
.filters label > span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
input, select, button { min-height: 44px; border: 1px solid #3a454b; border-radius: 2px; background: #111517; color: var(--text); }
input, select { width: 100%; padding: 0 12px; }
button { align-self: end; padding: 0 18px; color: var(--cyan); border-color: var(--cyan); font-weight: 800; cursor: pointer; }
button:hover, button:focus-visible { background: var(--cyan); color: #061216; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan), transparent 50%); outline-offset: 2px; }
.track-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 24px 24px 18px; }
.track-actions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.track-actions > p { margin: 0; color: var(--muted); font-size: .82rem; }
.join-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--cyan); border-radius: 2px; color: var(--cyan); font-weight: 850; text-decoration: none; white-space: nowrap; }
.join-button:hover, .join-button:focus-visible { background: var(--cyan); color: #061216; }
.join-button.compact { min-height: 36px; padding: 0 15px; font-size: .82rem; }
.table-wrap { margin: 0 24px 24px; overflow-x: auto; border: 1px solid var(--line); background: #131719; }
table { width: 100%; min-width: 740px; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; z-index: 1; color: #c5ced2; background: var(--surface-strong); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
td { color: #dce2e5; }
td:first-child { width: 68px; font-family: var(--font-mono); font-weight: 800; }
td:nth-child(2) { font-weight: 750; }
td:nth-child(3) { color: var(--text); font-family: var(--font-mono); font-size: 1.06rem; font-weight: 900; font-variant-numeric: tabular-nums; }
td:last-child { color: var(--muted); font-size: .84rem; white-space: nowrap; }
tbody tr:hover { background: #1b2226; }
tbody tr.podium-1 { box-shadow: inset 4px 0 var(--amber); background: color-mix(in srgb, var(--amber), transparent 92%); }
tbody tr.podium-2 { box-shadow: inset 4px 0 #bbc4c9; }
tbody tr.podium-3 { box-shadow: inset 4px 0 #c77b42; }
tbody tr.podium-1 td:first-child, tbody tr.podium-1 td:nth-child(2), tbody tr.podium-1 td:nth-child(3) { color: var(--amber); }
.track-record-link { color: var(--text); font-weight: 800; text-decoration-color: color-mix(in srgb, var(--cyan), transparent 55%); text-underline-offset: 4px; }
.track-record-link:hover { color: var(--cyan); }
.overview-table td:first-child { width: auto; font-family: var(--font-body); }
.overview-table td:nth-child(2) { font-weight: 750; }
.overview-table td:nth-child(3) { color: var(--text); font-family: var(--font-mono); font-size: 1.06rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.overview-table td:last-child { width: 96px; color: inherit; }
.section-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.section-toolbar button { align-self: center; }
.content-filters { grid-template-columns: minmax(0, 1fr) minmax(180px, .34fr) auto; }
.content-filters label b { font: inherit; }
.content-toolbar > p { margin: 0; color: var(--muted); font-size: .82rem; }
.content-list { border-top: 1px solid var(--line); }
.content-row { display: grid; grid-template-columns: minmax(260px, 1.35fr) minmax(300px, .9fr) auto; gap: 20px 28px; padding: 24px; border-bottom: 1px solid var(--line); }
.content-row:hover { background: #1b2226; }
.content-identity h3 { margin: 0; color: var(--text); font-family: var(--font-condensed); font-size: 1.45rem; letter-spacing: .025em; text-transform: uppercase; }
.content-identity p { max-width: 62ch; margin: 8px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.content-quick-meta, .content-facts, .release-metadata { margin: 0; }
.content-quick-meta { display: grid; grid-template-columns: repeat(3, minmax(74px, 1fr)); gap: 18px; }
.content-quick-meta dt, .content-facts dt, .release-metadata dt { color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.content-quick-meta dd, .content-facts dd, .release-metadata dd { margin: 5px 0 0; color: #dce2e5; font-size: .84rem; font-weight: 700; }
.content-quick-meta dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.content-action { display: flex; justify-content: flex-end; }
.content-facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.release-details { grid-column: 1 / -1; }
.release-details > summary { width: max-content; color: var(--cyan); font-size: .78rem; font-weight: 800; cursor: pointer; }
.release-list { margin-top: 16px; border: 1px solid var(--line); background: #131719; }
.release { padding: 18px; border-bottom: 1px solid var(--line); }
.release:last-child { border-bottom: 0; }
.release-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.release-heading h4 { margin: 0; color: var(--text); font-family: var(--font-mono); font-size: .9rem; }
.release-metadata { display: grid; grid-template-columns: 1fr 1.3fr .6fr 2.4fr; gap: 18px; margin-top: 16px; }
.release-metadata .checksum dd { overflow-wrap: anywhere; color: #bac5ca; font-family: var(--font-mono); font-size: .72rem; font-weight: 500; }
.dependencies { margin: 16px 0 0; color: var(--muted); font-size: .8rem; }
.dependencies strong { color: #dce2e5; }
.servers-table td:first-child { width: auto; font-family: var(--font-body); }
.servers-table td:nth-child(2), .servers-table td:nth-child(3) { font-family: var(--font-body); font-size: .92rem; font-weight: 650; }
.servers-table td:last-child { width: 96px; color: inherit; }
.servers-table tr.server-offline { opacity: .72; }
.server-name { display: grid; gap: 6px; }
.server-name strong { color: var(--text); }
.server-state { display: inline-flex; align-items: center; gap: 7px; width: max-content; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.server-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.server-state.online { color: var(--green); }
.server-state.offline { color: var(--danger); }
.car-list { display: block; max-width: 310px; overflow: hidden; color: #c7d0d4; text-overflow: ellipsis; white-space: nowrap; }
.offline-action { color: var(--muted); font-size: .8rem; font-weight: 700; }
.message { padding: 28px; color: var(--muted); text-align: center; }
.message[hidden] { display: none; }
footer { display: flex; justify-content: space-between; gap: 20px; width: min(1440px, 100%); margin: 0 auto; padding: 18px clamp(18px, 4vw, 56px) 36px; color: var(--muted); font-size: .75rem; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .summary { width: 100%; }
  .summary div:first-child { border-left: 0; padding-left: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters button { width: 100%; }
  .content-row { grid-template-columns: minmax(0, 1fr) auto; }
  .content-quick-meta { grid-column: 1 / -1; grid-row: 2; }
  .content-action { grid-column: 2; grid-row: 1; }
  .release-metadata { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .site-header { height: 58px; gap: 12px; padding: 0 16px; }
  .brand > span:last-child { display: none; }
  .primary-nav { gap: 16px; }
  .primary-nav > a, .nav-menu > summary { font-size: .7rem; }
  .nav-menu > summary::before { right: -9px; width: 5px; height: 5px; }
  .nav-submenu { left: 0; transform: none; }
  .admin-link { gap: 5px; font-size: 0; }
  .admin-link span { font-size: .78rem; }
  main { padding-top: 28px; }
  .hero { min-height: 0; }
  .hero::after { display: none; }
  .summary div { padding: 0 14px; }
  .summary dd { font-size: 2rem; }
  .filters { grid-template-columns: 1fr; padding: 18px; }
  .filters.overview { grid-template-columns: 1fr; }
  .track-heading { align-items: start; flex-direction: column; padding: 20px 18px 14px; }
  .track-actions { width: 100%; align-items: start; flex-direction: column; }
  .track-actions .join-button { width: 100%; }
  .table-wrap { margin: 0 0 12px; border-right: 0; border-left: 0; }
  table { min-width: 0; }
  th, td { padding: 13px 10px; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
  .overview-table { min-width: 0; }
  .overview-table thead { display: none; }
  .overview-table tbody { display: block; }
  .overview-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 18px; padding: 16px; border-bottom: 1px solid var(--line); }
  .overview-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .overview-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .overview-table td:first-child { grid-column: 1 / -1; }
  .overview-table td:nth-child(3) { text-align: right; }
  .overview-table td:nth-child(4), .overview-table td:nth-child(5), .overview-table td:nth-child(6) { display: block; grid-column: 1 / -1; }
  .overview-table td:nth-child(6) .join-button { width: 100%; }
  .section-toolbar { align-items: stretch; flex-direction: column; padding: 20px 18px; }
  .section-toolbar button { width: 100%; }
  .content-filters { grid-template-columns: 1fr; }
  .content-toolbar > p { margin-top: -10px; }
  .content-row { display: grid; grid-template-columns: 1fr; gap: 18px; padding: 20px 18px; }
  .content-identity, .content-quick-meta, .content-action, .content-facts, .release-details { grid-column: 1; grid-row: auto; }
  .content-action { justify-content: stretch; }
  .content-action .join-button { width: 100%; }
  .content-facts { grid-template-columns: 1fr; gap: 14px; }
  .release-heading { align-items: stretch; flex-direction: column; }
  .release-heading .join-button { width: 100%; }
  .release-metadata { grid-template-columns: 1fr; }
  .servers-table thead { display: none; }
  .servers-table tbody { display: block; }
  .servers-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 18px; border-bottom: 1px solid var(--line); }
  .servers-table td, .servers-table td:nth-child(4), .servers-table td:nth-child(5) { display: block; width: auto; padding: 0; border: 0; min-width: 0; }
  .servers-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .servers-table td:first-child, .servers-table td:nth-child(4), .servers-table td:last-child { grid-column: 1 / -1; }
  .servers-table td:last-child { display: block; }
  .servers-table .join-button { width: 100%; }
  td:first-child { width: 48px; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
