/* ── Reset & tokens ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --bg: #0a0f0d;
  --bg-2: #0e1512;
  --panel: #121a16;
  --panel-2: #16201b;
  --border: #1f2c25;
  --border-2: #2a3b31;
  --fg: #e7f0ea;
  --muted: #8aa295;
  --muted-2: #5f766b;
  --accent: #43d17a;
  --accent-dim: #2a8c54;
  --accent-glow: rgba(67, 209, 122, 0.18);
  --danger: #ef5a5a;
  --warn: #f0b429;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1140px;
  font-size: clamp(14px, 1.4vw, 17px);
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(67,209,122,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(67,209,122,0.06), transparent 55%),
    var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container { width: min(100% - 2.4rem, var(--maxw)); margin-inline: auto; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,15,13,0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1.4rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--font-head); font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 1.35rem; }
.brand-name { font-size: 1.25rem; letter-spacing: -.02em; }
.brand-name.small { font-size: 1.1rem; }
.nav { display: flex; gap: 1.3rem; margin-left: .6rem; }
.nav a { color: var(--muted); font-weight: 500; transition: color .15s; }
.nav a:hover, .nav a.active { color: var(--fg); }
.header-live {
  margin-left: auto; display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .82rem; color: var(--muted);
}
.header-live #header-players { color: var(--accent); font-weight: 700; }
.pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(67,209,122,0.5); }
  70% { box-shadow: 0 0 0 9px rgba(67,209,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(67,209,122,0); }
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero { padding: clamp(2.6rem, 6vw, 5rem) 0 2.2rem; }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 700; letter-spacing: -.03em; }
.hero h1 .accent { text-shadow: 0 0 30px var(--accent-glow); }
.hero p.lead { color: var(--muted); font-size: 1.12rem; max-width: 56ch; margin-top: 1rem; }
.hero-search { margin-top: 1.8rem; display: flex; gap: .6rem; max-width: 560px; }
.hero-search input {
  flex: 1; padding: .85rem 1.05rem; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--border-2); color: var(--fg);
  font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.hero-search input:focus { border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  padding: .85rem 1.3rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; transition: transform .12s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #04130a; }
.btn-primary:hover { background: #54e389; }
.btn-ghost { background: var(--panel); border-color: var(--border-2); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent-dim); }

/* ── Stat strip ─────────────────────────────────────────────────────────────── */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2.4rem;
}
.stat-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.stat-card .num { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--fg); }
.stat-card .num .accent { color: var(--accent); }
.stat-card .label { color: var(--muted); font-size: .82rem; margin-top: .25rem; text-transform: uppercase; letter-spacing: .06em; }

/* ── Sections ───────────────────────────────────────────────────────────────── */
.section { margin-top: 3rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1.2rem; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.6rem; }
.section-head p { color: var(--muted); font-size: .92rem; }
.link-more { color: var(--accent); font-weight: 600; font-size: .9rem; }

/* ── Filters bar ────────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.4rem; }
.filters input, .filters select {
  padding: .65rem .85rem; border-radius: var(--radius-sm); background: var(--panel);
  border: 1px solid var(--border-2); color: var(--fg); font: inherit; outline: none;
}
.filters input { flex: 1; min-width: 200px; }
.filters input:focus, .filters select:focus { border-color: var(--accent-dim); }

/* ── Server grid & cards ────────────────────────────────────────────────────── */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.server-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; cursor: pointer; transition: transform .14s, border-color .14s, box-shadow .14s;
  display: flex; flex-direction: column; gap: .75rem; position: relative; overflow: hidden;
}
.server-card:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: 0 12px 30px -18px rgba(0,0,0,.8); }
.server-card .rank {
  position: absolute; top: 0; right: 0; font-family: var(--font-mono); font-size: .72rem;
  color: var(--muted-2); background: var(--bg-2); border-bottom-left-radius: 10px;
  padding: .25rem .55rem; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.sc-head { display: flex; align-items: center; gap: .7rem; }
.sc-icon {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent-dim), #134b2c);
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; color: #d8ffe7;
  border: 1px solid var(--border-2);
}
.sc-title { font-family: var(--font-head); font-weight: 600; font-size: 1.06rem; }
.sc-host { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.sc-motd { font-size: .86rem; color: var(--muted); min-height: 2.4em; }
.sc-foot { display: flex; align-items: center; gap: 1.1rem; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.sc-foot .players { color: var(--fg); font-family: var(--font-mono); font-weight: 700; }
.sc-foot .players .on { color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .35rem; }
.dot.up { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.down { background: var(--danger); }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  font-size: .72rem; padding: .18rem .5rem; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.tag.ver { color: var(--accent); border-color: var(--accent-dim); }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination button {
  min-width: 38px; padding: .5rem .7rem; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--border-2); color: var(--fg); font-family: var(--font-mono); font-size: .85rem;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent-dim); }
.pagination button.active { background: var(--accent); color: #04130a; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* ── Server detail ──────────────────────────────────────────────────────────── */
.detail-top { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin: 1.6rem 0; }
.detail-top .sc-icon { width: 72px; height: 72px; font-size: 1.5rem; border-radius: 16px; }
.detail-top h1 { font-size: 2rem; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.panel h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.kv { display: flex; justify-content: space-between; padding: .55rem 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-family: var(--font-mono); }
.copy-host {
  display: flex; gap: .5rem; align-items: center; background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: .7rem .9rem; font-family: var(--font-mono); margin-bottom: 1.1rem;
}
.copy-host code { flex: 1; color: var(--accent); }
.copy-host button { background: var(--panel-2); border: 1px solid var(--border-2); color: var(--fg); padding: .4rem .7rem; border-radius: 7px; font-size: .8rem; }
canvas#chart { width: 100%; height: 240px; }
.chart-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: .5rem; font-family: var(--font-mono); }

/* ── About ──────────────────────────────────────────────────────────────────── */
.prose { max-width: 70ch; margin-top: 1.4rem; }
.prose h2 { font-size: 1.5rem; margin: 2rem 0 .8rem; }
.prose p { color: var(--muted); margin-bottom: 1rem; }
.prose ul { color: var(--muted); margin: 0 0 1rem 1.2rem; }
.prose li { margin-bottom: .4rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 1rem; margin-top: 1.4rem; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.feature .ic { font-size: 1.5rem; }
.feature h4 { margin: .6rem 0 .35rem; font-size: 1.05rem; }
.feature p { color: var(--muted); font-size: .88rem; }

/* ── Utility / states ───────────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-card { height: 168px; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.back-link { color: var(--muted); font-size: .9rem; display: inline-flex; gap: .4rem; margin: 1.4rem 0 .4rem; }
.back-link:hover { color: var(--fg); }
.fade-in { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--border); background: var(--bg-2); padding: 2.4rem 0 1.4rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.footer-inner .muted { max-width: 38ch; margin-top: .5rem; font-size: .88rem; }
.footer-cols { display: flex; gap: 3rem; }
.footer-cols h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); margin-bottom: .7rem; }
.footer-cols a { display: block; color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }
.footer-cols a:hover { color: var(--accent); }
.copy { margin-top: 2rem; color: var(--muted-2); font-size: .82rem; font-family: var(--font-mono); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .detail-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}
@media (max-width: 520px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .hero-search { flex-direction: column; }
  .header-live { display: none; }
}
