:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e3e5ea;
  --present: #1f9d63;
  --present-bg: #e3f6ec;
  --empty: #6b7280;
  --empty-bg: #eceef1;
  --warn: #b45309;
  --warn-bg: #fdf0dc;
  --bar: #1f9d63;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --text: #e8eaee;
    --muted: #8b919c;
    --line: #2a2e36;
    --present: #3ccf8e;
    --present-bg: #12291f;
    --empty: #9aa1ad;
    --empty-bg: #22262e;
    --warn: #f0a24a;
    --warn-bg: #2e2214;
    --bar: #3ccf8e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top, main, footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 8px;
}

h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.conn { font-size: 13px; color: var(--muted); }
.conn.bad { color: var(--warn); }

main { display: grid; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* Status banner */
.status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--empty-bg);
  transition: background 0.3s;
}
.status .dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--empty); flex: none;
}
.status .headline { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
.status .sub { color: var(--muted); }

.status[data-state="present"] { background: var(--present-bg); }
.status[data-state="present"] .dot {
  background: var(--present);
  box-shadow: 0 0 0 0 var(--present);
  animation: pulse 2s infinite;
}
.status[data-state="present"] .headline { color: var(--present); }
.status[data-state="offline"] { background: var(--warn-bg); }
.status[data-state="offline"] .dot { background: var(--warn); }
.status[data-state="offline"] .headline { color: var(--warn); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--present) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Snapshot */
.snapshot { padding: 0; overflow: hidden; }
.img-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; }
.img-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #9aa1ad;
}
.placeholder[hidden] { display: none; }
.caption {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 16px; font-size: 13px;
}

/* Timeline */
.timeline {
  position: relative;
  height: 28px;
  border-radius: 6px;
  background: var(--empty-bg);
  overflow: hidden;
}
.timeline .seg {
  position: absolute; top: 0; bottom: 0;
  background: var(--bar);
  min-width: 2px;
}
.timeline .now {
  position: absolute; top: 0; bottom: 0; right: 0; width: 2px;
  background: var(--text); opacity: 0.4;
}
.ticks {
  position: relative; height: 18px; margin-top: 4px;
  font-size: 12px; color: var(--muted);
}
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* Log table */
.log { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.log th, .log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.log th { font-size: 12px; color: var(--muted); font-weight: 600; }
.log tr:last-child td { border-bottom: none; }
.log .num { text-align: right; }
.log .live { color: var(--present); font-weight: 600; }

.muted { color: var(--muted); }

footer { padding: 18px 16px 28px; font-size: 12px; }

@media (max-width: 520px) {
  .status .headline { font-size: 20px; }
  .log th:nth-child(4), .log td:nth-child(4) { display: none; }
}
