:root {
  --bg: #0c0d10;
  --bg-2: #302019;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f7f3f0;
  --muted: #c6bdba;
  --faint: #a99e99;
  --accent: #f06a3c;
  --accent-2: #ffad83;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --pending: #7c82a8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 50px -24px rgba(0, 0, 0, 0.7);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.hero { padding: clamp(24px, 6vw, 64px); border: 1px solid #724735; border-radius: 22px; background: radial-gradient(ellipse at top right, #503021, transparent 65%), #1b1514; }
.hero-link { margin-top: 16px; }
.links-heading { margin: 26px 0 12px; font-size: 1.25rem; }
.brand img.logo { object-fit: contain; border-radius: 8px; filter: none; }
.btn.btn-primary { color: #1a100c; font-weight: 800; }
.card dl, .card .detail { display: none; }
:focus-visible { outline: 2px solid #ffad83; outline-offset: 4px; }

.glow {
  position: fixed; z-index: -1; pointer-events: none;
  width: 520px; height: 520px; border-radius: 50%;
  filter: blur(110px); opacity: 0.22;
}
.glow-a { background: var(--accent); top: -220px; left: -160px; }
.glow-b { background: var(--accent-2); top: 30vh; right: -260px; opacity: 0.12; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(16px, calc((100vw - 1120px) / 2));
  background: rgba(11, 13, 23, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 36px; height: 36px; filter: drop-shadow(0 6px 18px rgba(139, 92, 246, 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -0.01em; }
.brand-text span { font-size: 12px; color: var(--muted); }

.conn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pending); }
.conn[data-state="good"] .conn-dot { background: var(--good); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15); }
.conn[data-state="bad"] .conn-dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15); }

/* Layout */
.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 40px 0 24px; }
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 5vw, 46px); line-height: 1.05; letter-spacing: -0.035em;
  background: linear-gradient(100deg, #fff 30%, #c4b5fd 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; max-width: 640px; color: var(--muted); font-size: 16px; }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin: 28px 0 18px;
}
.stat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat[data-tone="good"] .stat-value { color: var(--good); }
.stat[data-tone="accent"] .stat-value { color: #c4b5fd; }

/* Toolbar */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.countdown { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kbd-hint { margin-left: auto; font-size: 12px; color: var(--faint); }
kbd {
  font: 11px var(--mono); padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel);
  font-size: 13.5px; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--panel-2); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .switch input:focus-visible + .switch-track, .host:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-primary {
  border-color: transparent; color: #0b0d17;
  background: linear-gradient(100deg, #a78bfa, var(--accent-2));
  box-shadow: 0 8px 24px -10px rgba(139, 92, 246, 0.8);
}
.btn-primary:hover { background: linear-gradient(100deg, #b9a2ff, #5ee0f3); border-color: transparent; }
.btn-solid { background: #eef0ff; color: #0b0d17; border-color: transparent; }
.btn-solid:hover { background: #fff; border-color: transparent; }
.is-spinning svg { animation: spin .9s linear infinite; }

.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 36px; height: 20px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line-2); transition: background .2s;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.card {
  position: relative; overflow: hidden;
  padding: 20px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: linear-gradient(90deg, transparent, var(--tone, var(--pending)), transparent);
  opacity: .8;
}
.card[data-state="good"] { --tone: var(--good); }
.card[data-state="warn"] { --tone: var(--warn); }
.card[data-state="bad"] { --tone: var(--bad); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ident-text { min-width: 0; }
.dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--tone, var(--pending));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--tone, var(--pending)) 18%, transparent);
}
.card[data-state="pending"] .dot { animation: pulse 1.2s ease-in-out infinite; }
.label { margin: 0; font-size: 18px; letter-spacing: -0.015em; }
.host { font: 13px var(--mono); color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.host:hover { color: var(--text); }
.chip {
  flex: none; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: #ddd6fe; background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.35);
}

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check {
  --c: var(--pending);
  padding: 14px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line);
}
.check[data-tone="good"] { --c: var(--good); }
.check[data-tone="warn"] { --c: var(--warn); }
.check[data-tone="bad"] { --c: var(--bad); }
.check-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.check-name { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.check-name svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 650;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.check[data-tone="pending"] .badge { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.metric { display: flex; align-items: baseline; gap: 4px; margin: 12px 0 2px; }
.big { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.unit { font-size: 13px; color: var(--faint); }
.detail { margin: 0 0 12px; min-height: 2.9em; font-size: 13px; color: var(--muted); }
.facts { display: grid; gap: 6px; margin: 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.facts div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; color: var(--text); font-family: var(--mono); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.spark { width: 84px; height: 20px; }
.spark path { fill: none; stroke: var(--c); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

.card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.updated { font-size: 12.5px; color: var(--faint); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Explainer */
.explain {
  margin-top: 22px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
}
.explain summary { cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::after { content: "+"; color: var(--muted); font-size: 18px; line-height: 1; }
.explain[open] summary::after { content: "–"; }
.explain-body { padding: 0 18px 8px; color: var(--muted); font-size: 14px; }
.explain-body strong { color: var(--text); }

.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  width: min(1120px, 100% - 32px); margin: 0 auto; padding: 18px 0 32px;
  color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px;
  background: #eef0ff; color: #0b0d17; font-size: 14px; font-weight: 600;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { text-align: center; color: var(--warn); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kbd-hint { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding-top: 28px; }
  .conn-text { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
  .checks { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .actions .btn { padding: 0 8px; }
  .detail { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
