:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --surface: #121821;
  --surface-2: #19212c;
  --border: #243040;
  --text: #e9eef5;
  --muted: #8d9aab;
  --faint: #5d6a7c;
  --accent: #f5a524;
  --accent-ink: #1b1204;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --ok: #3ccf7a;
  --bad: #ef5d5d;
  --warn: #f2c94c;
  --blurple: #5865f2;
  --radius: 12px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Menlo, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(245, 165, 36, 0.08), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(88, 101, 242, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.05em 0.4em; }
pre { background: #070a0e; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow: auto; max-height: 420px; }
img { max-width: 100%; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.section { margin: 36px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header ---------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--border); background: rgba(10, 13, 18, 0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: 0.02em; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 7px 11px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.site-header .menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.user-chip img, .user-chip .avatar { width: 28px; height: 28px; }

@media (max-width: 820px) {
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .site-header .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; flex-direction: column; display: none; padding-top: 6px; }
  .nav.open { display: flex; }
  .header-actions .btn-discord span { display: none; }
}

/* ---- buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font: 600 14px/1.2 var(--sans); cursor: pointer;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #33435a; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ffb53f; border-color: #ffb53f; }
.btn-discord { background: var(--blurple); border-color: var(--blurple); color: #fff; }
.btn-discord:hover { background: #6b76f5; border-color: #6b76f5; }
.btn-danger { background: transparent; border-color: rgba(239, 93, 93, 0.5); color: var(--bad); }
.btn-danger:hover { background: rgba(239, 93, 93, 0.1); border-color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 11px; }

/* ---- hero ------------------------------------------------------------ */
.hero { padding: 56px 0 18px; }
.hero .eyebrow { color: var(--accent); font: 700 12px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { max-width: 15ch; }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 60ch; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.stat-strip { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 30px; }
.stat-strip div { display: flex; flex-direction: column; }
.stat-strip b { font: 800 1.6rem/1.1 var(--mono); }
.stat-strip span { color: var(--muted); font-size: 13px; }

/* ---- cards ----------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; }

.server-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; }
.server-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--faint); }
.server-card.online::before { background: linear-gradient(90deg, var(--accent), #ff7a1a); }
.server-card .mode { color: var(--muted); font-size: 13px; }
.server-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.server-meta div { background: var(--surface-2); border-radius: 9px; padding: 9px 11px; min-width: 0; }
.server-meta dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.server-meta dd { margin: 2px 0 0; font: 700 14px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fill { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.fill > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.player-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 7px; background: var(--surface-2); font-size: 14px; }
.player-list li > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.player-list li > :last-child { flex: none; white-space: nowrap; }
.player-list.top { max-height: none; overflow: visible; }
.connect-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }
.connect-cmd { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; background: #070a0e; border: 1px solid var(--border); border-radius: 9px; padding: 0 0 0 10px; }
.connect-cmd code { background: none; border: 0; padding: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connect-cmd .btn { border: 0; border-left: 1px solid var(--border); border-radius: 0 9px 9px 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; font: 700 11px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge.ok { color: var(--ok); background: rgba(60, 207, 122, 0.1); }
.badge.bad { color: var(--bad); background: rgba(239, 93, 93, 0.1); }
.badge.warn { color: var(--warn); background: rgba(242, 201, 76, 0.1); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }
.online .badge.ok::before { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .online .badge.ok::before { animation: none; } }

.chip { display: inline-block; font: 600 12px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }

/* ---- avatars --------------------------------------------------------- */
.avatar { width: 32px; height: 32px; border-radius: 8px; flex: none; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--muted); font: 700 13px/1 var(--sans); object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; border-radius: 16px; font-size: 30px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > .who-text { min-width: 0; display: flex; flex-direction: column; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.who small { color: var(--muted); font-size: 12px; }
a.who:hover { text-decoration: none; }
a.who:hover b { color: var(--accent); }

/* ---- tables ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; background: var(--surface-2); }
th.num, td.num { text-align: right; font-family: var(--mono); }
th button { all: unset; cursor: pointer; }
th button:hover, th button[aria-pressed='true'] { color: var(--accent); }
td.pos { font: 700 14px var(--mono); color: var(--muted); width: 1%; }
tr.top-1 td.pos { color: #ffd166; } tr.top-2 td.pos { color: #cfd8e3; } tr.top-3 td.pos { color: #e09f6b; }
td.wrap-cell { white-space: normal; min-width: 200px; }

/* ---- tabs / controls ------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button { all: unset; cursor: pointer; padding: 7px 13px; border-radius: 8px; font-weight: 600; color: var(--muted); font-size: 14px; }
.tabs button[aria-selected='true'] { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); }
input, select, textarea {
  font: 14px var(--sans); color: var(--text); background: #070a0e; border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 11px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 140px; }
.search { flex: 1 1 220px; max-width: 320px; }

/* ---- misc ------------------------------------------------------------ */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }
.notice { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 9px; padding: 12px 14px; color: var(--muted); }
.notice.bad { border-left-color: var(--bad); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), #212b38, var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kv div { background: var(--surface-2); border-radius: 9px; padding: 9px 11px; }
.kv dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.kv dd { margin: 2px 0 0; font: 700 1.1rem/1.2 var(--mono); }
.rank-name { color: var(--accent); font-weight: 700; }
.ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.ladder div { background: var(--surface-2); border-radius: 9px; padding: 10px; border-top: 2px solid var(--accent); }
.ladder b { display: block; font-size: 14px; }
.ladder span { color: var(--muted); font: 12px var(--mono); }
.cmd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cmd-list li { display: grid; grid-template-columns: 10.5em minmax(0, 1fr); gap: 10px; align-items: baseline; }
.cmd-list code { justify-self: start; white-space: nowrap; }
.pair { display: inline-flex; align-items: center; gap: 6px; }
.cmd-list code { color: var(--accent); }
.members { display: flex; flex-wrap: wrap; gap: 6px; }
.members img, .members .avatar { width: 30px; height: 30px; border-radius: 50%; }
.member { position: relative; }
.member i { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--ok); }
.member i.idle { background: var(--warn); } .member i.dnd { background: var(--bad); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { border-color: var(--bad); }
.endpoint { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.method { font: 700 11px var(--mono); padding: 4px 7px; border-radius: 6px; background: rgba(60, 207, 122, 0.12); color: var(--ok); }

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 22px 0; color: var(--faint); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.card.skeleton { min-height: 260px; }
.mt { margin-top: 14px; }
.center { text-align: center; }
@media (max-width: 480px) {
  .server-meta { grid-template-columns: 1fr 1fr; }
  .server-meta div:first-child { grid-column: 1 / -1; }
}

/* ---- Premier tiers (Valve CS Rating colours) -------------------------- */
.cs-rating { display: inline-flex; align-items: center; font: 800 14px/1 var(--mono); padding: 5px 9px 5px 12px; border-radius: 4px; color: #fff; position: relative; letter-spacing: 0.02em; white-space: nowrap; }
.cs-rating::before { content: ''; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: rgba(255,255,255,.55); }
.tier-grey { background: #5b6472; } .tier-lightblue { background: #4f8fc7; } .tier-blue { background: #3355d6; }
.tier-purple { background: #7a3ed6; } .tier-pink { background: #c83ccb; } .tier-red { background: #d13b3b; }
.tier-gold { background: linear-gradient(90deg, #d9a521, #f2c94c); color: #2a1d00; }
.tier-gold::before { background: rgba(42, 29, 0, .45); }
.tier-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.faceit { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 800 12px/1 var(--mono); border: 2px solid #f50; color: #ff8a3d; }
.lfg-list { display: flex; flex-direction: column; gap: 8px; }
.lfg-post { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.lfg-post p { margin: 4px 0 0; overflow-wrap: anywhere; }
.attribution { font-size: 12px; color: var(--faint); }

/* ---- Tournaments ------------------------------------------------------- */
.t-list { display: grid; gap: 12px; }
.t-card { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; }
.t-card h3 a { color: var(--text); }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bracket-wrap { overflow-x: auto; padding-bottom: 8px; }
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 22px; min-width: min-content; }
.bracket-round { display: flex; flex-direction: column; gap: 8px; }
.bracket-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.bracket-round h4 { margin: 0 0 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.match { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.match .side { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; min-height: 38px; font-size: 14px; }
.match .side + .side { border-top: 1px solid var(--border); }
.match .side.win { background: var(--accent-soft); font-weight: 700; }
.match .side.win::after { content: '✓'; color: var(--accent); }
.match .side.lose { color: var(--faint); }
.match .side.empty { color: var(--faint); font-style: italic; }
.match .side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.match .score { padding: 4px 10px 6px; font: 12px var(--mono); color: var(--muted); }
.match .admin-row { display: flex; gap: 6px; padding: 6px 10px 8px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.match.final { border-color: var(--accent); }
.champion { display: flex; align-items: center; gap: 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; font-size: 1.1rem; }
.champion b { color: var(--accent); }
.team-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.team-list .card ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
textarea { resize: vertical; min-height: 70px; }
.signup-list { margin: 0; padding-left: 26px; columns: 2 240px; column-gap: 24px; } .signup-list li { padding: 3px 0; break-inside: avoid; } .signup-list li::marker { color: var(--faint); font-family: var(--mono); }
@media (max-width: 600px) {
  /* Keep #, player, CS Rating and FACEIT on phones. */
  .premier-table th:nth-child(n+5), .premier-table td:nth-child(n+5) { display: none; }
  .premier-table .who small, .premier-table .avatar { display: none; }
  .premier-table th, .premier-table td { padding: 9px 8px; }
}
