/* Trackmania Asia Cup — the same look as Race Control (Design D): Geist, flat blocks, 1px borders, no shadows. */
@font-face { font-family: Geist; src: url(fonts/geist-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/geist-mono-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --ground: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f5;
  --group: #f3f3f1;
  --raise: #e9e9e6;
  --ink: #171717;
  --ink-2: #5c5c5c;
  --ink-3: #6b6b6b;
  --line: #efefed;
  --line-strong: #ebebe9;
  --connector: #e2e2e0;
  --field-line: #d4d4d1;
  /* Trackmania Asia pinks: accents only, on Race Control's neutral greys. */
  --pink-100: #ffdce9; --pink-200: #ffb9d3; --pink-300: #ff8fb8; --pink-400: #fa5e97;
  --pink-500: #ee3a7f; --pink-600: #d02466; --pink-700: #a8174e;
  --pink: var(--pink-600);
  --pink-text: var(--pink-700);
  --pink-soft: var(--pink-100);
  --on-pink: #fff1f6;
  --signal: var(--ink);
  --signal-fill: var(--pink);
  --on-signal: var(--on-pink);
  --signal-soft: var(--group);
  --signal-ink: var(--ink);
  --live: var(--pink-600);
  --live-soft: var(--pink-100);
  --live-ink: var(--pink-700);
  --caution-ink: #8a3a06;
  --gold: #f2c744;
  --gold-ink: #8a6500;
  --ok-ink: #15803d;
  --chrome: #ffffff;
  --chrome-line: #e2e2e0;
  --chrome-rule: #ebebe9;
  --chrome-ink: #171717;
  --chrome-ink-2: #5c5c5c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0b0b0c; --surface: #0b0b0c; --surface-2: #151517; --group: #1e1e21; --raise: #2a2a2e;
    --ink: #ededed; --ink-2: #a1a1a1; --ink-3: #8a8a8f;
    --line: #1b1b1e; --line-strong: #222225; --connector: #2e2e32; --field-line: #3a3a3f;
    --pink-text: var(--pink-300); --pink-soft: #2a0f1c; --live: var(--pink-500); --live-ink: var(--pink-300);
    --live-soft: #2a0f1c; --caution-ink: #f5a35a; --gold-ink: #f2c744; --ok-ink: #5fe3a1;
    --chrome: #0b0b0c; --chrome-line: #2e2e32; --chrome-rule: #222225; --chrome-ink: #ededed; --chrome-ink-2: #a1a1a1;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0b0b0c; --surface: #0b0b0c; --surface-2: #151517; --group: #1e1e21; --raise: #2a2a2e;
  --ink: #ededed; --ink-2: #a1a1a1; --ink-3: #8a8a8f;
  --line: #1b1b1e; --line-strong: #222225; --connector: #2e2e32; --field-line: #3a3a3f;
  --pink-text: var(--pink-300); --pink-soft: #2a0f1c; --live: var(--pink-500); --live-ink: var(--pink-300);
  --live-soft: #2a0f1c; --caution-ink: #f5a35a; --gold-ink: #f2c744; --ok-ink: #5fe3a1;
  --chrome: #0b0b0c; --chrome-line: #2e2e32; --chrome-rule: #222225; --chrome-ink: #ededed; --chrome-ink-2: #a1a1a1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 Geist, ui-sans-serif, system-ui, sans-serif; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.mono, .num { font-family: "Geist Mono", ui-monospace, monospace; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.caps { font-size: 12px; line-height: 1rem; color: var(--ink-2); }

/* Header (chrome) */
.chrome { background: var(--chrome); color: var(--chrome-ink); }
.bar { max-width: 60rem; margin: 0 auto; min-height: 56px; display: flex; align-items: center; gap: 16px; padding: 8px 16px; }
.where { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.site { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--chrome-ink-2); text-decoration: none; white-space: nowrap; }

.slash { color: var(--chrome-line); }
.event { display: flex; flex-direction: column; min-width: 0; }
.event a { font-size: 18px; line-height: 1.25; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event span { font-size: 12px; color: var(--chrome-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { height: 32px; width: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--chrome-ink-2); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--chrome-ink); background: var(--surface-2); }
.tabs { max-width: 60rem; margin: 0 auto; height: 48px; display: flex; align-items: center; gap: 2px; padding: 0 16px; overflow-x: auto; }
.tab { flex: none; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--chrome-ink-2); text-decoration: none; white-space: nowrap; }
.tab:hover { background: var(--surface-2); color: var(--chrome-ink); }
.tab[aria-current="page"] { background: var(--surface-2); color: var(--chrome-ink); }

main { max-width: 60rem; margin: 0 auto; padding: 32px 16px 56px; display: flex; flex-direction: column; gap: 40px; }
body[data-page="bracket"] main, body[data-page="pickem"] main { max-width: 80rem; gap: 20px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
h2 .meta { font: 500 13px "Geist Mono", monospace; color: var(--ink-2); }
section { display: flex; flex-direction: column; gap: 14px; }
/* Schedule: one quiet list, the next part in pink. */
.sched { list-style: none; margin: 0; padding: 0; border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.sched a { display: grid; grid-template-columns: 88px 1fr auto; gap: 12px; align-items: center; padding: 14px 18px; text-decoration: none; }
.sched li + li a { box-shadow: inset 0 1px var(--ground); }
.sched a:hover { background: var(--group); }
.sched .st { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.sched .t { font: 500 13px "Geist Mono", monospace; color: var(--ink-2); text-align: right; }
.sched li.done b { color: var(--ink-2); font-weight: 500; text-decoration: line-through; }
.sched li.next .st { color: var(--pink-text); }
.sched li.live .st { color: var(--live-ink); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Blocks */
.block { border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.hero { padding: 28px; display: flex; flex-direction: column; gap: 20px; border-radius: 16px; }
.hero h1 { margin-top: 12px; }
.hero { position: relative; }
/* Sponsor credit, bottom right of the Overview's top block. */
.sponsor { position: absolute; right: 28px; bottom: 24px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sponsor img { height: 28px; width: auto; display: block; }
.sponsor b { font-size: 15px; font-weight: 700; letter-spacing: 0.01em; }
@media (max-width: 640px) {
  .sponsor { position: static; align-items: flex-start; }
}
.hero h1 { font-size: clamp(28px, 6vw, 44px); }
.hero .when { color: var(--ink-2); margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--group); width: fit-content; }
.chip.live { background: var(--live); color: #fff; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
.chip.live .dot { background: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .chip.live .dot { animation: none; } }
.facts { display: flex; flex-wrap: wrap; gap: 24px; }
.fact .caps { display: block; }
.fact b { font: 600 15px "Geist Mono", monospace; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 6px; border: 0; background: var(--group); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--raise); }
.btn.primary { background: var(--signal-fill); color: var(--on-signal); }
.btn.primary:hover { filter: brightness(1.08); }
.countdown { font: 600 15px "Geist Mono", monospace; }
.empty { padding: 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.note { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.badge.signal { background: var(--signal-soft); color: var(--signal-ink); }


/* Part switcher (Bracket page) */
.parts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.part-btn { flex: none; min-width: 140px; text-align: left; padding: 8px 12px; border-radius: 8px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; font: inherit; }
.part-btn .caps { display: block; font-size: 11px; font-weight: 600; }
.part-btn b { font-size: 13px; font-weight: 600; }
.part-btn[aria-selected="true"] { background: var(--ink); color: var(--ground); }
.parts .part-btn[aria-selected="true"] .caps, .parts .part-btn[aria-selected="true"] .muted { color: inherit; opacity: 0.7; }
.part-btn.done .caps { color: var(--ink-3); }
.part-btn.next .caps { color: var(--pink-text); }
.part-btn.live .caps { color: var(--live-ink); }

/* Bracket rounds and match cards */
.rounds { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.round { flex: none; width: 216px; display: flex; flex-direction: column; gap: 8px; }
.round.wide { width: 440px; }
.round-grid { display: grid; grid-template-columns: repeat(2, 216px); gap: 8px; }
.round-head { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.round-head b { font-weight: 600; }
.round-head span { font: 500 12px "Geist Mono", monospace; color: var(--ink-2); margin-left: 6px; }
.match-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.card { width: 216px; flex: none; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.card.waiting { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.card.next { box-shadow: inset 0 0 0 1px var(--pink); }
.card.next .card-head .s { color: var(--pink-text); }
.card.live { box-shadow: inset 0 0 0 1px var(--live), 0 0 0 2px var(--live-soft); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 26px; padding: 0 8px; font-size: 11px; font-weight: 600; background: var(--group); }
.card-head .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .s { flex: none; font-family: "Geist Mono", monospace; color: var(--ink-2); }
.card.next .card-head { background: var(--signal-soft); color: var(--signal-ink); }
.card.next .card-head .s { color: var(--signal-ink); }
.card.live .card-head { background: var(--live); color: #fff; }
.card.live .card-head .s { color: #fff; }
.card.waiting .card-head { background: transparent; }
.through { flex: none; border-radius: 4px; padding: 0 4px; font-size: 10px; font-weight: 700; background: var(--signal-soft); color: var(--signal-ink); }
.seat { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; font-size: 12px; }
.seat:first-of-type { border-top: 0; }
.seat .p { width: 18px; flex: none; font: 600 11px "Geist Mono", monospace; color: var(--ink-3); }
.seat .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .n.tbd { color: var(--ink-3); font-style: italic; }
.seat .n.out { color: var(--ink-3); }
.seat .pts { font: 500 11px "Geist Mono", monospace; color: var(--ink-3); }
.seat .x { flex: none; font: 600 11px "Geist Mono", monospace; }
.seat .x.go { color: var(--ink); }
.seat .x.drop { color: var(--caution-ink); }
.seat .x.out { color: var(--ink-3); font-weight: 500; }
.seat.adv { font-weight: 600; }
.key { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); }
.key .go { color: var(--signal); font-family: "Geist Mono", monospace; }
.key .drop { color: var(--caution-ink); font-family: "Geist Mono", monospace; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { height: 36px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.table td { height: 36px; padding: 0 12px; }
.table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.table tr.cut td { border-top: 1px dashed var(--ink-3); }
.table tfoot td { font-weight: 700; }
.table .num, .table th.num { text-align: right; }
.table .rank { width: 48px; font: 600 12px "Geist Mono", monospace; color: var(--ink-2); }
.scroll-x { overflow-x: auto; }
.tag { display: inline-block; font: 600 11px "Geist Mono", monospace; color: var(--signal); white-space: nowrap; }
.tag.out { color: var(--ink-3); font-weight: 500; }

/* Players */
.field { height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--ink); font: 13px Geist, sans-serif; width: 100%; max-width: 320px; }
.players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.players li { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; font-size: 13px; min-width: 0; }
.players li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.players li.withdrawn .n { color: var(--ink-3); text-decoration: line-through; }
.flag { width: 20px; height: 14px; border-radius: 2px; flex: none; object-fit: cover; background: var(--surface-2); }

/* Rules */
.prose { font-size: 15px; max-width: 46rem; }
.prose p { margin: 0 0 12px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 16px; }
.steps li:first-child { border-top: 0; }
.steps li .caps { font-weight: 600; }
.steps li b { display: block; margin-bottom: 2px; }
.steps li p { margin: 0; font-size: 13px; color: var(--ink-2); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 2fr 1fr; } }

/* Home (Trackmania Asia) */
.home { max-width: 56rem; gap: 32px; }
.home-hero { padding: 32px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.home-hero h1 { font-size: clamp(40px, 9vw, 64px); line-height: 1; letter-spacing: -0.02em; }
.pink { color: inherit; }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; text-decoration: none; }

.cup-card { display: flex; flex-direction: column; gap: 6px; padding: 28px; border-radius: 16px; background: var(--surface-2); text-decoration: none; transition: background 0.15s; }
.cup-card:hover { background: var(--group); }
.cup-title { font-size: clamp(24px, 5vw, 34px); font-weight: 700; line-height: 1.15; }
.cup-card .chip { margin-top: 6px; }
.chip.pink { background: var(--ink); color: var(--ground); }
.go-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.go-btn { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); text-decoration: none; transition: background 0.15s; }
.go-btn:hover { background: var(--group); }
.go-btn b { font-size: 14px; font-weight: 600; }
.go-btn span { font-size: 12px; color: var(--ink-2); }
.go-btn.community { flex-direction: row; align-items: center; gap: 12px; }
.go-btn.community > span { display: flex; flex-direction: column; gap: 2px; }
.go-btn.community .flag { width: 24px; height: 17px; }
.go-btn.primary { background: var(--pink); }
.go-btn.primary:hover { filter: brightness(1.05); }
.go-btn.primary b, .go-btn.primary span { color: var(--on-pink); }

footer { margin-top: 24px; }
footer div { max-width: 60rem; margin: 0 auto; padding: 16px; font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .site, .slash { display: none; }
  .hero { padding: 16px; }
  .btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .field { height: 40px; font-size: 14px; }
  .steps li { grid-template-columns: 1fr; gap: 4px; }
  .sched a { grid-template-columns: 1fr; gap: 2px; }
  .sched .t { text-align: left; }
  .hero { padding: 20px; }
  main { gap: 32px; padding-top: 24px; }
}

/* Pick'em (mock-up) */
.pk-head, .pk-body { display: flex; flex-direction: column; gap: 12px; }
.pk-body { gap: 36px; }
.pk-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pk-progress { display: flex; gap: 8px; flex-wrap: wrap; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pk-chip { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--ink); font: 13px Geist, sans-serif; text-align: left; cursor: pointer; min-width: 0; }
.pk-chip .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-chip .flag { width: 18px; height: auto; border-radius: 2px; flex: none; }
.pk-chip .mk { flex: none; font: 600 11px "Geist Mono", monospace; color: var(--pink-text); }
.pk-chip:hover:not(:disabled) { background: var(--group); }
.pk-chip:disabled { cursor: default; }
.pk-chip:disabled:not(.on) { opacity: 0.45; }
.pk-chip.on { font-weight: 600; box-shadow: inset 0 0 0 1px var(--pink); }
.pk-chip.ok .mk, .pk-sel.ok .mk { color: var(--ok-ink); }
.pk-chip.bad .n, .pk-sel.bad select { text-decoration: line-through; color: var(--ink-3); }
.pk-chip.bad .mk, .pk-sel.bad .mk { color: var(--ink-3); }
.pk-slots { display: flex; flex-direction: column; gap: 6px; }
.pk-slot { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.pk-slot b { font: 600 13px "Geist Mono", monospace; }
.pk-slot.top { box-shadow: inset 0 0 0 1px var(--pink); }
.pk-slot > div { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-sel { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 160px; max-width: 280px; }
.pk-sel select { background: var(--group); }
#pk-search { max-width: 360px; }
/* Standings: Overall / League / Playoffs */
#standings .rank { width: auto; white-space: nowrap; }
#standings td .flag { margin-right: 8px; vertical-align: -2px; }
#standings .parts .part-btn { flex: 1; min-width: 0; }
@media (max-width: 640px) { #standings .table td, #standings .table th { padding: 0 8px; } #standings .hide-sm { display: none; } }
