/* ============================================================================
   sdoux · control — PUBLIC status board
   A standalone, buildless, strict-CSP page shown to anyone (no auth). Deliberately
   self-contained: it copies only the handful of design tokens it needs from the
   panel's system so it never depends on the private app.css and can't drift it.
   Shows game / online / player count ONLY — no host stats, addresses, or names.
   ========================================================================== */
:root {
  --bg:#0A0C10; --surface:#0F131A; --surface-raised:#151A22;
  --border:#222A35; --border-strong:#2C3644;
  --text-primary:#E6ECF3; --text-secondary:#C4CEDA; --text-muted:#8A97A8;
  --text-faint:#6E7A8B;
  --ok:#35C97F; --idle:#6B7A8D; --danger:#F2695E;
  --boiii:#E6A23C; --palworld:#22B8CF; --minecraft:#5DBB54; --zomboid:#B7C244;
  --accent:var(--boiii);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius:10px; --radius-lg:14px; --radius-pill:999px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%),
    var(--bg);
  color: var(--text-primary);
  font: 400 14px/1.5 var(--font-ui);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.statuspage {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 64px) clamp(16px, 4vw, 28px) 48px;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.sp-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px; flex-wrap: wrap;
  padding-bottom: 20px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.sp-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sp-logo {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--accent); font-size: 20px; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.sp-brand h1 { margin: 0; font: 600 21px/1.15 var(--font-ui); letter-spacing: -.01em; }
.sp-sub { margin: 2px 0 0; color: var(--text-muted); font-size: 12.5px; letter-spacing: .02em; }

.sp-live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font: 600 11px/1 var(--font-ui);
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.sp-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--idle); flex: none;
}
.sp-live[data-fresh="1"] .sp-live-dot { background: var(--ok); animation: sp-pulse 2.4s ease-in-out infinite; }
.sp-live[data-fresh="err"] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.sp-live[data-fresh="err"] .sp-live-dot { background: var(--danger); }

/* ── Grid + cards ─────────────────────────────────────────────────────── */
.sp-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.sp-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 18px 18px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
  transition: border-color .2s ease, transform .2s ease;
}
/* Signature: a left identity edge in each game's accent, brighter when online. */
.sp-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--game, var(--accent)); opacity: .35;
  transition: opacity .2s ease;
}
.sp-card[data-online="1"]::before { opacity: 1; }
.sp-card[data-online="1"]:hover { transform: translateY(-1px); border-color: var(--border-strong); }

.sp-card-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sp-icon {
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  object-fit: cover; background: var(--bg);
  border: 1px solid var(--border); image-rendering: auto;
}
.sp-icon-fallback {
  display: grid; place-items: center;
  color: var(--game, var(--accent)); font: 700 14px/1 var(--font-mono);
}
.sp-name {
  margin: 0; font: 600 15px/1.2 var(--font-ui); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

.sp-card-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.sp-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 9px; border-radius: var(--radius-pill);
  font: 600 12px/1 var(--font-ui);
  border: 1px solid var(--idle-border, color-mix(in srgb, var(--idle) 30%, transparent));
  background: color-mix(in srgb, var(--idle) 13%, var(--surface));
  color: var(--text-secondary);
}
.sp-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.sp-card[data-online="1"] .sp-pill {
  border-color: color-mix(in srgb, var(--ok) 34%, transparent);
  background: color-mix(in srgb, var(--ok) 13%, var(--surface));
  color: color-mix(in srgb, var(--ok) 60%, var(--text-primary));
}
.sp-card[data-online="1"] .sp-pill-dot { background: var(--ok); animation: sp-pulse 2.4s ease-in-out infinite; }

.sp-count { text-align: right; line-height: 1; }
.sp-count-n { font: 500 26px/1 var(--font-mono); color: var(--text-primary); }
.sp-count[data-empty="1"] .sp-count-n { color: var(--text-faint); }
.sp-count-label { display: block; margin-top: 4px; font-size: 10.5px; color: var(--text-muted); letter-spacing: .03em; }

.sp-detail {
  font: 450 12px/1.4 var(--font-mono); color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Footer + states ──────────────────────────────────────────────────── */
.sp-footer { margin-top: 26px; color: var(--text-faint); font-size: 12px; text-align: center; }
.sp-footer a { color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); }
.sp-footer a:hover { color: var(--text-secondary); }

.sp-message {
  grid-column: 1 / -1; padding: 40px 20px; text-align: center;
  color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
}

.sp-grid[data-loading="1"] .sp-card { opacity: .5; }

@keyframes sp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  50% { box-shadow: 0 0 0 4px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-card, .sp-live-dot, .sp-pill-dot { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
