/* CRN design system — "dispatch board".
   Departments are transit lines: each owns a colour, and that colour means the same thing everywhere. */
:root {
  --asphalt: #0d1013;
  --kerb: #151a1f;
  --kerb-2: #1b2128;
  --lane: #262e36;
  --lane-2: #34404b;
  --chalk: #e9edf0;
  --muted: #8995a1;
  --faint: #5b6773;

  --line-network: #4d84ff;   /* network / default */
  --line-enforce: #ff5a4f;   /* bans, professional standards */
  --line-support: #2dd4a7;   /* tickets, support */
  --line-dev: #a78bfa;       /* developers, api */
  --line-hr: #f472b6;        /* applications, hr */
  --line-money: #fbbf24;     /* economy, finance */
  --line-sec: #fb923c;       /* security */
  --line-data: #38bdf8;      /* analytics */
  --line-pr: #a3e635;        /* public relations */
  --line: var(--line-network);

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--asphalt); color: var(--chalk);
  font: 400 16px/1.6 var(--font); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--line-network); color: #fff; }
:focus-visible { outline: 2px solid var(--line-network); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.015em; line-height: 1.08; font-stretch: 112%; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.005em; line-height: 1.25; }
p { margin: 0; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 58ch; line-height: 1.6; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 0.8125rem; }
.wrap { width: min(1180px, 100% - 48px); margin-inline: auto; }
.wrap-narrow { width: min(820px, 100% - 48px); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 50; background: rgba(13,16,19,.88);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--lane);
}
.top .wrap { display: flex; align-items: center; gap: 28px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-stretch: 125%; letter-spacing: .02em; font-size: 1.15rem; }
.logo-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--kerb-2); border: 1px solid var(--lane-2); display: grid; place-items: center; overflow: hidden; position: relative; }
.logo-mark i { position: absolute; left: 0; right: 0; height: 4px; }
.logo-mark i:nth-child(1) { top: 6px; background: var(--line-network); }
.logo-mark i:nth-child(2) { top: 13px; background: var(--line-enforce); }
.logo-mark i:nth-child(3) { top: 20px; background: var(--line-support); }
.navlinks { display: flex; gap: 2px; margin-left: 8px; }
.navlinks a { padding: 8px 12px; border-radius: var(--r-sm); font-size: .9rem; font-weight: 600; color: var(--muted); transition: color .15s, background .15s; position: relative; }
.navlinks a:hover { color: var(--chalk); background: var(--kerb); }
.navlinks a[aria-current="page"] { color: var(--chalk); }
.navlinks a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 3px; background: var(--line, var(--line-network)); border-radius: 2px 2px 0 0; }
.top .spacer { flex: 1; }
.kbd { font: 500 .72rem var(--mono); border: 1px solid var(--lane-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--muted); background: var(--kerb); }
.cmd-btn { display: flex; align-items: center; gap: 10px; background: var(--kerb); border: 1px solid var(--lane); color: var(--muted); border-radius: var(--r-md); padding: 7px 10px 7px 14px; font-size: .85rem; }
.cmd-btn:hover { border-color: var(--lane-2); color: var(--chalk); }
.menu-btn { display: none; background: none; border: 1px solid var(--lane); border-radius: var(--r-sm); width: 40px; height: 40px; }
.navlinks a.extra { display: none; }
@media (max-width: 1180px) { .cmd-btn span.label { display: none; } .top .wrap { gap: 18px; } .navlinks a { padding: 8px 9px; } }
@media (max-width: 1060px) {
  .navlinks { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--asphalt); border-bottom: 1px solid var(--lane); padding: 12px 24px 20px; }
  .navlinks.open { display: flex; }
  .navlinks.open a.extra { display: block; }
  .navlinks a[aria-current="page"]::after { display: none; }
  .navlinks a[aria-current="page"] { background: var(--kerb); }
  .menu-btn { display: block; }
  .cmd-btn span.label { display: none; }
}
.top .btn { white-space: nowrap; }
@media (max-width: 600px) { .cmd-btn { display: none; } .top .wrap { gap: 12px; } }

/* ---------- buttons, chips, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-md); padding: 11px 20px; font-weight: 700; font-size: .95rem; background: var(--line, var(--line-network)); color: var(--on-line, #fff); transition: transform .12s, filter .15s, background .15s; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; border-color: var(--lane-2); color: var(--chalk); }
.btn.ghost:hover { background: var(--kerb); }
.btn.danger { background: var(--line-enforce); color: #fff; }
.btn.ok { background: var(--line-support); color: #04231b; }
.btn.sm { padding: 7px 12px; font-size: .82rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid color-mix(in srgb, var(--line) 45%, transparent); color: var(--line); background: color-mix(in srgb, var(--line) 12%, transparent); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; flex: none; }
.dot.live { animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 color-mix(in srgb, var(--line) 60%, transparent)} 70%{box-shadow:0 0 0 8px transparent} 100%{box-shadow:0 0 0 0 transparent} }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; background: var(--asphalt); color: var(--chalk); border: 1px solid var(--lane); border-radius: var(--r-md);
  padding: 11px 14px; font: inherit; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--line, var(--line-network)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--line, var(--line-network)) 25%, transparent); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.hint { font-size: .8rem; color: var(--faint); }
.field.err .input { border-color: var(--line-enforce); }
.field.err .hint { color: var(--line-enforce); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { accent-color: var(--line-network); width: 18px; height: 18px; margin-top: 2px; }

/* ---------- plates (cards) ---------- */
.plate { background: var(--kerb); border: 1px solid var(--lane); border-radius: var(--r-md); padding: 22px; position: relative; }
.plate.bar { padding-left: 26px; }
.plate.bar::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--line); }
.plate.hover { transition: border-color .15s, transform .15s; cursor: pointer; }
.plate.hover:hover { border-color: var(--lane-2); transform: translateY(-2px); }

/* ---------- route rail (page sections as stops) ---------- */
.rail { position: fixed; left: 22px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 0; }
.rail a { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: .78rem; font-weight: 600; color: var(--faint); position: relative; }
.rail a::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--lane-2); background: var(--asphalt); z-index: 1; transition: all .2s; flex: none; }
.rail a:not(:last-child)::after { content: ""; position: absolute; left: 4.5px; top: 28px; height: calc(100% - 9px); width: 2px; background: var(--lane); }
.rail a span { opacity: 0; transform: translateX(-4px); transition: all .2s; white-space: nowrap; }
.rail a:hover span, .rail a.on span { opacity: 1; transform: none; }
.rail a.on { color: var(--chalk); }
.rail a.on::before { border-color: var(--line, var(--line-network)); background: var(--line, var(--line-network)); }
@media (max-width: 1560px) { .rail { display: none; } }

/* ---------- departures board ---------- */
.board { background: #07090b; border: 1px solid var(--lane); border-radius: var(--r-lg); overflow: hidden; font-family: var(--mono); }
.board-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--lane); color: var(--muted); font-size: .8rem; }
.board-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid #12171c; }
.board-row:last-child { border-bottom: 0; }
.board-row .name { color: var(--muted); font-size: .85rem; }
.flap { display: inline-flex; gap: 3px; }
.flap b { display: inline-grid; place-items: center; min-width: 1.35ch; height: 2.1rem; padding: 0 .35ch; background: linear-gradient(#171d23 49%, #0c1013 51%); border-radius: 4px; font-weight: 500; font-size: 1.45rem; color: #f5f7f8; position: relative; font-variant-numeric: tabular-nums; }
.flap b::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #000; }
.flap b.turn { animation: turn .22s ease-in; }
@keyframes turn { 0% { transform: rotateX(0); } 50% { transform: rotateX(-88deg); } 100% { transform: rotateX(0); } }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--lane); border-radius: var(--r-md); background: var(--kerb); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 12px 16px; background: var(--kerb-2); border-bottom: 1px solid var(--lane); position: sticky; top: 0; white-space: nowrap; }
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort:hover { color: var(--chalk); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--lane); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.025); }
.tbl tbody tr.click { cursor: pointer; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--kerb-2); border: 1px solid var(--lane-2); object-fit: cover; flex: none; }
.avatar.lg { width: 72px; height: 72px; }

/* ---------- modal / drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4,6,8,.7); z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.scrim.open { display: flex; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--kerb); border: 1px solid var(--lane-2); border-radius: var(--r-lg); width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 26px; animation: rise .2s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.drawer-scrim { align-items: stretch; justify-content: flex-end; padding: 0; }
.drawer { background: var(--kerb); border-left: 1px solid var(--lane-2); width: min(480px, 100%); height: 100%; overflow: auto; padding: 26px; animation: slide .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

/* ---------- command palette ---------- */
.palette { width: min(600px, 100%); background: var(--kerb); border: 1px solid var(--lane-2); border-radius: var(--r-lg); overflow: hidden; align-self: flex-start; margin-top: 12vh; animation: rise .18s; }
.palette input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--lane); padding: 18px 20px; font: inherit; font-size: 1.05rem; color: var(--chalk); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 340px; overflow: auto; }
.palette li { padding: 10px 12px; border-radius: var(--r-sm); display: flex; gap: 12px; align-items: center; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--kerb-2); }
.palette li small { margin-left: auto; color: var(--faint); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--kerb-2); border: 1px solid var(--lane-2); border-left: 4px solid var(--line, var(--line-network)); border-radius: var(--r-md); padding: 12px 16px; width: min(360px, calc(100vw - 40px)); font-size: .92rem; animation: slide .22s; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.ok { --line: var(--line-support); } .toast.err { --line: var(--line-enforce); } .toast.warn { --line: var(--line-money); }

/* ---------- skeleton & states ---------- */
.skel { background: linear-gradient(90deg, var(--kerb) 25%, var(--kerb-2) 50%, var(--kerb) 75%); background-size: 200% 100%; animation: sh 1.4s infinite; border-radius: var(--r-sm); min-height: 18px; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--chalk); margin-bottom: 4px; font-size: 1.05rem; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--lane); margin-top: 96px; padding: 40px 0 48px; color: var(--muted); font-size: .9rem; }
.foot .wrap { display: flex; gap: 40px; justify-content: space-between; flex-wrap: wrap; }
.foot nav { display: flex; gap: 22px; flex-wrap: wrap; }
.foot nav a:hover { color: var(--chalk); }

/* ---------- page sections ---------- */
.section { padding: 72px 0; }
.section-head { margin-bottom: 36px; display: grid; gap: 12px; }
.page-head { padding: 72px 0 40px; }
.page-head h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); }
.page-head .lede { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }

/* ---------- live servers, events timetable, leaderboards, player cards ---------- */
.seg { display: inline-flex; border: 1px solid var(--lane); border-radius: var(--r-md); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { background: var(--kerb); border: 0; padding: 9px 14px; font-size: .88rem; font-weight: 600; color: var(--muted); border-right: 1px solid var(--lane); white-space: nowrap; flex: none; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--kerb-2); color: var(--chalk); box-shadow: inset 0 -2px 0 var(--line); }
.depart { background: #07090b; border: 1px solid var(--lane); border-radius: var(--r-lg); overflow: hidden; }
.depart-head, .depart-row { display: grid; grid-template-columns: 6px minmax(0, 1.2fr) minmax(0, .8fr) 150px minmax(0, 1.4fr) 76px; gap: 16px; align-items: center; padding: 14px 18px 14px 0; }
.depart-head { font: 500 .75rem var(--mono); color: var(--faint); border-bottom: 1px solid var(--lane); padding-top: 11px; padding-bottom: 11px; }
.depart-row { border-bottom: 1px solid #12171c; }
.depart-row:last-child { border-bottom: 0; }
.depart-row > i { align-self: stretch; background: var(--line); border-radius: 0 3px 3px 0; }
.depart-row .g { font-weight: 800; font-stretch: 112%; font-size: 1.05rem; }
.depart-row .code { font: 500 .85rem var(--mono); color: var(--muted); }
.depart-row .flap b { height: 1.8rem; font-size: 1.15rem; }
.depart-row .note { font-size: .85rem; color: var(--muted); }
.depart-row .note.alert { color: var(--line-money); }
.depart-row .act { justify-self: end; }
@media (max-width: 760px) {
  .depart-head { display: none; }
  .depart-row { grid-template-columns: 6px minmax(0, 1fr) auto; grid-template-areas: "bar game players" "bar code join" "bar note note"; row-gap: 6px; }
  .depart-row > i { grid-area: bar; } .depart-row .g { grid-area: game; } .depart-row .code { grid-area: code; } .depart-row .flap { grid-area: players; justify-self: end; } .depart-row .note { grid-area: note; } .depart-row .act { grid-area: join; justify-self: end; }
}
.spark { display: flex; align-items: flex-end; gap: 4px; height: 72px; }
.spark i { flex: 1; min-width: 0; background: color-mix(in srgb, var(--line) 70%, transparent); border-radius: 3px 3px 0 0; min-height: 2px; }
.spark i:last-child { background: var(--line); }
.svc { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--lane); font-size: .92rem; }
.svc:last-child { border-bottom: 0; }
.day { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 26px 0; border-top: 1px solid var(--lane); }
.day:first-child { border-top: 0; padding-top: 4px; }
.day h3 { font-size: 1rem; position: sticky; top: 84px; align-self: start; }
.day h3 small { display: block; color: var(--muted); font-weight: 500; font-size: .82rem; margin-top: 2px; font-stretch: 100%; letter-spacing: 0; }
.slot { display: grid; grid-template-columns: 74px 1fr auto; gap: 18px; align-items: start; padding: 14px 16px; background: var(--kerb); border: 1px solid var(--lane); border-radius: var(--r-md); position: relative; }
.slot + .slot { margin-top: 10px; }
.slot::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--line)); }
.slot time { font: 500 1.05rem var(--mono); padding-top: 2px; }
.slot.live { border-color: color-mix(in srgb, var(--line-support) 55%, var(--lane)); }
.slot h4 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0; font-stretch: 100%; }
.slot p { color: var(--muted); font-size: .9rem; margin-top: 4px; }
@media (max-width: 700px) { .day { grid-template-columns: 1fr; gap: 12px; } .day h3 { position: static; } .slot { grid-template-columns: 58px 1fr; } .slot .act { grid-column: 1 / -1; } }
.ranks { display: grid; gap: 6px; }
.rank { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 16px; background: var(--kerb); border: 1px solid var(--lane); border-radius: var(--r-md); }
.rank .n { font: 500 1.3rem var(--mono); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rank.top .n { color: var(--chalk); }
.rank .who { display: grid; gap: 6px; min-width: 0; }
.rank .who a { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .who a:hover { color: var(--line); }
.rank .lane { height: 6px; background: var(--lane); border-radius: 3px; overflow: hidden; }
.rank .lane i { display: block; height: 100%; background: var(--line); border-radius: 3px; }
.rank .v { font: 500 1rem var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pass { background: var(--kerb); border: 1px solid var(--lane-2); border-radius: var(--r-lg); overflow: hidden; }
.pass-top { display: grid; grid-template-columns: 112px 1fr; gap: 22px; padding: 26px; align-items: center; border-bottom: 1px dashed var(--lane-2); }
.pass-top img, .pass-top .ph { width: 112px; height: 112px; border-radius: var(--r-md); background: var(--kerb-2); border: 1px solid var(--lane-2); object-fit: cover; }
.pass-stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.pass-stats div { padding: 18px 22px; border-right: 1px solid var(--lane); display: grid; gap: 4px; }
.pass-stats div:last-child { border-right: 0; }
.pass-stats b { font: 500 1.35rem var(--mono); font-variant-numeric: tabular-nums; }
.pass-stats span { color: var(--muted); font-size: .82rem; }
.pass-stamps { padding: 18px 22px 22px; border-top: 1px solid var(--lane); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stamp { --c: var(--line-network); border: 2px solid var(--c); color: var(--c); border-radius: 6px; padding: 4px 10px; font-weight: 800; font-size: .78rem; letter-spacing: .02em; transform: rotate(-1.5deg); }
.stamp:nth-child(even) { transform: rotate(1.2deg); }
@media (max-width: 640px) { .pass-top { grid-template-columns: 72px 1fr; padding: 18px; gap: 16px; } .pass-top img, .pass-top .ph { width: 72px; height: 72px; } .pass-stats { grid-template-columns: repeat(2, 1fr); } .pass-stats div:nth-child(2) { border-right: 0; } .pass-stats div:nth-child(-n+2) { border-bottom: 1px solid var(--lane); } }
