:root {
  color-scheme: dark;
  --bg: #080b0a;
  --surface: #0e1311;
  --surface-raised: #131a17;
  --line: #253029;
  --line-soft: #1a231f;
  --text: #f2f6f3;
  --muted: #8e9d94;
  --accent: #98f0a9;
  --accent-strong: #63df7b;
  --offline: #ff7b68;
  --warning: #f5cb72;
  --radius: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% 0%, rgba(89, 207, 111, 0.09), transparent 28rem),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

button { font: inherit; }

.grid-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(114, 148, 126, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114, 148, 126, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
  position: relative;
}

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--accent);
  clip-path: polygon(50% 0, 94% 23%, 94% 76%, 50% 100%, 6% 76%, 6% 23%);
}

.brand-mark span {
  width: 9px;
  height: 9px;
  background: var(--bg);
  box-shadow: 0 5px 0 -2px var(--bg);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.875rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 5px rgba(99, 223, 123, 0.1);
}

main { padding: 62px 0 36px; }

.overview {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.3rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.lede { margin-bottom: 0; color: var(--muted); }

.overview-stat { text-align: right; flex: 0 0 auto; }

.stat-value {
  display: block;
  color: var(--accent);
  font-size: clamp(2.7rem, 7vw, 5.3rem);
  font-weight: 760;
  line-height: 0.86;
  letter-spacing: -0.07em;
}

.stat-label {
  display: block;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.875rem;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.server-card,
.activity-panel {
  background: linear-gradient(145deg, rgba(19, 26, 23, 0.96), rgba(12, 17, 15, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.server-card {
  min-height: 194px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.server-card:hover { border-color: #344239; }

.server-top,
.player-row,
.server-meta,
.panel-heading,
.chart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.server-name {
  margin: 0 0 3px;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.server-address {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.79rem;
}

.status-pill {
  padding: 5px 9px;
  border: 1px solid rgba(152, 240, 169, 0.25);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(152, 240, 169, 0.07);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status-pill.offline {
  color: var(--offline);
  border-color: rgba(255, 123, 104, 0.28);
  background: rgba(255, 123, 104, 0.07);
}

.player-row { align-items: flex-end; margin-top: 26px; }

.player-count {
  font-size: 2.8rem;
  font-weight: 760;
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.player-count small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
}

.motd {
  max-width: 55%;
  margin: 0;
  color: #c4cec8;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.server-meta {
  margin-top: 19px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.76rem;
}

.activity-panel { padding: 28px; }

.panel-heading { gap: 24px; }
.panel-controls { display: flex; align-items: center; gap: 10px; }

.range-tabs {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.range-tabs { display: flex; padding: 3px; }

.range-tabs button {
  min-width: 44px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.range-tabs button:hover { color: var(--text); }
.range-tabs button.active { color: var(--bg); background: var(--accent); }

.series-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 26px;
}

.series-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.series-toggle:hover { color: var(--text); border-color: #415046; }
.series-toggle[aria-pressed="false"] { opacity: 0.48; }
.series-toggle[aria-pressed="true"] { color: var(--text); }

.series-swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--series-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-color) 15%, transparent);
}

.chart-summary {
  justify-content: flex-start;
  gap: 38px;
  margin: 30px 0 18px;
}

.chart-summary > div { display: flex; align-items: baseline; gap: 8px; }
.summary-label { color: var(--muted); font-size: 0.75rem; }
.chart-summary strong { font-size: 1.05rem; }

.chart-wrap {
  position: relative;
  height: 300px;
  overflow: hidden;
}

#history-chart { width: 100%; height: 100%; display: block; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.chart-empty[hidden] { display: none; }
.chart-empty p { margin: 12px 0 0; }

.empty-block {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  box-shadow: 8px -8px 0 -2px var(--surface), 8px -8px 0 0 var(--line);
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  min-width: 172px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(8, 11, 10, 0.96);
  color: var(--text);
  font-size: 0.75rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.chart-tooltip strong { color: var(--accent); font-size: 0.9rem; }
.tooltip-time { display: block; margin-bottom: 6px; color: var(--muted); }
.tooltip-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 3px; }
.tooltip-name { display: inline-flex; align-items: center; gap: 7px; }
.tooltip-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--series-color); }

.skeleton {
  min-height: 194px;
  background: linear-gradient(90deg, var(--surface) 20%, var(--surface-raised) 50%, var(--surface) 80%);
  background-size: 240% 100%;
  animation: shimmer 1.4s infinite linear;
}

footer {
  padding: 22px 0 36px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes shimmer { to { background-position: -140% 0; } }

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 28px, 1180px); }
  main { padding-top: 42px; }
  .overview { align-items: flex-start; flex-direction: column; }
  .overview-stat { text-align: left; }
  .server-grid { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-controls { width: 100%; flex-wrap: wrap; }
  .activity-panel { padding: 21px 17px; }
  .chart-summary { gap: 14px 24px; flex-wrap: wrap; }
  .chart-wrap { height: 260px; }
}

@media (max-width: 480px) {
  .header-status span:last-child { display: none; }
  .motd { display: none; }
  .server-card { min-height: 180px; padding: 20px; }
  footer { gap: 12px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}
