:root {
  --bg: #03060d;
  --bg2: #0b1220;
  --card: #0b101f;
  --card-2: #0f1828;
  --line: #1b2741;
  --line-2: #2a385c;
  --text: #eaf0ff;
  --muted: #a9b3c7;
  --accent: #3ba9ff;
  --accent-2: #89d0ff;
  --good: #30d158;
  --bad: #ff5f57;
  --gold: #ffd166;
  --danger: #ff4d4f;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 10% 10%, #14223c, transparent 60%) fixed,
    conic-gradient(from 230deg at 70% 20%, #0c1830, #0b1220 25%, #0b1220 75%, #0c1830) fixed,
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }

.wrap { max-width: 1600px; margin: 0 auto; padding: 8px; }
main.wrap { padding-top: 16px; }

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 20;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10,16,30,.95), rgba(10,16,30,.80));
  backdrop-filter: blur(6px) saturate(1.15);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; border-radius: 8px; object-fit: contain; }
.brand h1 {
  margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .3px;
  background: linear-gradient(180deg, #fff, #cfe1ff 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .tag { color: var(--muted); font-size: 12px; margin-top: 3px; }
.navspacer { flex: 1; }
.btn, .btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 12px; font-weight: 600;
  border: 1px solid rgba(255,227,143,.28);
  background: rgba(5,10,22,.9); color: var(--text);
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease, background .12s ease;
  cursor: pointer; font-size: 14px;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,227,143,.75); background: rgba(14,20,36,.95); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1220; border-color: transparent;
  box-shadow: 0 10px 28px rgba(59,169,255,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(59,169,255,.45); color: #0b1220; }

/* ---------- bottom page meta (language + updated) ---------- */
.page-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
  margin: 0 0 40px; padding-top: 8px;
}
.langs { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-btn {
  appearance: none; background: transparent; color: var(--muted);
  border: 1px solid var(--line); padding: 6px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: .06em;
  transition: all .15s ease;
}
.lang-btn:hover { color: var(--text); border-color: var(--line-2); }
.lang-btn.active {
  color: #0b1220; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.updated-pill {
  color: var(--muted); font-size: 12px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------- machine translation notice ---------- */
.mt-note {
  margin: 14px 0;
  padding: 8px 14px; border-radius: 10px;
  background: rgba(59,169,255,.08);
  border: 1px dashed rgba(59,169,255,.35);
  color: var(--muted); font-size: 13px;
}

/* ---------- cards ---------- */
.card {
  background: color-mix(in oklab, var(--card) 92%, #0e1830);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 22px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}
.card h3 {
  margin: 0 0 14px; font-size: 22px;
  display: flex; align-items: baseline; gap: 10px;
}
.card h3 .sub { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---------- ban banner ---------- */
.ban-banner {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid color-mix(in oklab, var(--danger) 70%, #000);
  background: linear-gradient(180deg, rgba(255,77,79,.14), rgba(255,77,79,.08)), #1b0f13;
  color: #ffdede; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(255,77,79,.18), inset 0 1px 0 rgba(255,255,255,.04);
  margin-bottom: 16px;
}
img.ban-icon { display: block; flex: 0 0 auto; border-radius: 10px; object-fit: contain; }
.ban-text strong { color: #fff; display: block; margin-bottom: 2px; font-size: 14px; }
.ban-text .sub { color: #ffc7c7; font-size: 12.5px; }

/* ---------- rules ---------- */
.rules-intro { color: var(--muted); margin: 0 0 12px; line-height: 1.5; font-size: 14.5px; }
.rules-intro b { color: var(--text); }
.rules { display: grid; gap: 12px; counter-reset: ruleno; margin: 0; padding: 0; list-style: none; }
.rule {
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.rule:hover { transform: translateY(-1px); border-color: #3a4e7f; box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.rule .dot {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #3fd77c);
  display: grid; place-items: center; color: #fff8ec; font-weight: 800; font-size: 15px;
}
.rule .dot::before { counter-increment: ruleno; content: counter(ruleno); }
.rule h4 { margin: 0; font-size: 17px; }
.rule p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

/* ---------- main 3-column grid ----------
   Rules take the full flexible middle; scorers and servers sit in
   fixed side columns. align-items: stretch makes the side cards
   match the rules card height so all three columns visually align. */
.main-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: stretch;
  margin-top: 0;
}
.main-grid > .card { display: flex; flex-direction: column; }
.leaders-card .leaders-foot { margin-top: auto; }
.servers-card .loc-list { flex: 1; }
.rules-card h3 { margin-bottom: 10px; }

/* ---------- mini-boards (stacked inside scorers card) ---------- */
.mini-board { margin-bottom: 14px; }
.mini-board:last-of-type { margin-bottom: 6px; }
.mini-h {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 6px;
}

/* ---------- leaders table ---------- */
table.leaders { width: 100%; border-collapse: collapse; }
table.leaders th, table.leaders td {
  padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left; font-size: 14.5px;
}
table.leaders th {
  color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11.5px;
  letter-spacing: .08em;
}
table.leaders td.num, table.leaders th.num {
  text-align: right; width: 48px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Donor mini-board: the "Since" column needs room for YYYY-MM. Donors
   is the last mini-board in the card, so target via :last-of-type. */
.leaders-card .mini-board:last-of-type table.leaders td:nth-child(3),
.leaders-card .mini-board:last-of-type table.leaders th:nth-child(3) {
  width: 64px;
}
.leaders-card .mini-board:last-of-type table.leaders td,
.leaders-card .mini-board:last-of-type table.leaders th {
  padding: 7px 6px; font-size: 13.5px;
}
table.leaders tbody tr:nth-child(1) td:first-child,
table.leaders tbody tr:nth-child(2) td:first-child,
table.leaders tbody tr:nth-child(3) td:first-child { color: var(--gold); font-weight: 700; }
table.leaders tr:last-child td { border-bottom: 0; }
.leaders-foot {
  margin-top: 12px; text-align: right;
}
.leaders-foot a {
  color: var(--accent-2); font-size: 13px; font-weight: 600; border-bottom: 1px dashed transparent;
}
.leaders-foot a:hover { border-bottom-color: var(--accent-2); }

/* ---------- server locations list ---------- */
.servers-total {
  display: flex; align-items: baseline; gap: 8px;
  margin: -4px 0 12px; font-size: 13px; color: var(--muted);
}
.servers-total .big {
  font-size: 22px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.loc-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.loc {
  display: block; padding: 10px 12px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line);
  color: inherit; transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.loc:hover { transform: translateY(-1px); border-color: var(--line-2); background: #101b30; color: inherit; }
.loc-head {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px;
}
.loc-name { font-size: 14.5px; font-weight: 700; }
.loc-count {
  font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.loc-count .online { color: var(--good); font-weight: 700; }
.loc-count .off    { color: var(--bad);  font-weight: 700; }

/* Type breakdown inside each location card */
.loc-types {
  margin: 8px 0 0; padding: 8px 0 0; list-style: none;
  border-top: 1px dashed rgba(255,255,255,.06);
  display: grid; grid-template-columns: 1fr; gap: 3px;
}
.loc-type {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  font-size: 12.5px;
}
.ltype-name { color: var(--muted); }
.ltype-count {
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.ltype-count .online { color: var(--good); font-weight: 700; }
.ltype-count .off    { color: var(--bad);  font-weight: 700; }

/* ---------- server detail page ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  margin: 18px 0 12px;
}
.detail-back:hover { color: var(--accent-2); }
.detail-header {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px;
  margin-bottom: 16px;
}
.detail-header h2 { margin: 0; font-size: 28px; }
.detail-header .meta { color: var(--muted); font-size: 14px; }
.detail-header .meta strong { color: var(--text); font-variant-numeric: tabular-nums; }

.server-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.server-card {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.server-card.offline { opacity: .7; }
.server-card .row1 {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.server-card .label { font-size: 15px; font-weight: 700; }
.server-card .type-chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(59,169,255,.12); color: var(--accent-2);
  border: 1px solid rgba(59,169,255,.25);
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08); white-space: nowrap;
}
.badge.online  { color: #dfffea; background: rgba(48,209,88,.16); }
.badge.offline { color: #ffe5e3; background: rgba(255,95,87,.16); }
.badge .pulse {
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor; box-shadow: 0 0 10px currentColor;
}
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px;
  font-size: 13px;
}
.stat-grid .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.stat-grid .v { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- announcements ---------- */
.announce-list { display: grid; gap: 12px; }
.announce {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; position: relative;
}
.announce.pinned { border-color: rgba(255,209,102,.4); }
.announce .pin {
  position: absolute; top: 12px; right: 14px;
  color: var(--gold); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.announce .ahead {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap;
}
.announce h4 { margin: 0; font-size: 16px; }
.announce .date { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.announce .body { color: #d7def2; font-size: 14.5px; line-height: 1.5; word-wrap: break-word; }
.announce .body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
.announce .body a:hover { color: var(--accent); }

/* ---------- Discord markdown ---------- */
.d-h1 { margin: 10px 0 6px; font-size: 18px; font-weight: 800; color: #fff; }
.d-h2 { margin: 10px 0 6px; font-size: 16px; font-weight: 800; color: #fff; }
.d-h3 { margin: 10px 0 4px; font-size: 14.5px; font-weight: 700; color: #fff; }
.d-sub { color: var(--muted); font-size: 12.5px; margin: 4px 0; }
.d-list { margin: 6px 0 6px 20px; padding: 0; }
.d-list li { margin: 2px 0; }
.d-quote {
  margin: 8px 0; padding: 4px 10px;
  border-left: 3px solid var(--line-2); color: var(--muted);
}
.d-code {
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 6px; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.d-pre {
  background: rgba(0,0,0,.35); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0;
  overflow-x: auto; font-size: 13px; line-height: 1.45;
}
.d-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.d-spoiler {
  background: #1a2033; color: #1a2033; padding: 0 4px; border-radius: 3px;
  cursor: pointer; transition: color .15s ease;
}
.d-spoiler:hover, .d-spoiler:focus { color: var(--text); }
.announce .open {
  display: inline-block; margin-top: 8px;
  color: var(--accent-2); font-size: 13px; font-weight: 600; border-bottom: 1px dashed transparent;
}
.announce .open:hover { border-bottom-color: var(--accent-2); }

/* ---------- empty state ---------- */
.empty { color: var(--muted); padding: 4px 0; font-size: 14.5px; }

/* ---------- footer ---------- */
.footer-note {
  margin: 24px 0 16px; color: var(--muted); text-align: center; font-size: 13.5px;
}

/* ---------- responsive ---------- */
@media (max-width: 1300px) {
  .main-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-primary, .rule, .lang-btn, .loc { transition: none; }
}
