/* SEDRA (#13): Sedra testnet status page (status_page.py). PuddlePool look (puddlepool.com "Cosmos" UI: void
   background, plasma cyan and nebula violet accents, Orbitron / Space Grotesk / Inter / Fira Code), adapted to a light
   variant. Dark follows the system unless the visitor picked a theme (data-theme on <html>). */
:root {
  --bg: #030712;
  --bg-grad: radial-gradient(ellipse at top, #0f1d3a 0%, #060b18 55%, #030712 100%);
  --panel: rgba(10, 18, 36, 0.72);
  --panel-solid: #0a1224;
  --border: rgba(56, 189, 248, 0.18);
  --border-strong: rgba(56, 189, 248, 0.45);
  --head: rgba(6, 11, 24, 0.88);
  --th: rgba(4, 9, 20, 0.6);
  --row: rgba(255, 255, 255, 0.05);
  --hover: rgba(56, 189, 248, 0.05);
  --text: #e2e8f0;
  --bright: #f8fafc;
  --dim: #94a3b8;
  --muted: #64748b;
  --cyan: #00f5ff;
  --link: #38bdf8;
  --violet: #a855f7;
  --gold: #fbbf24;
  --good: #10b981;
  --bad: #ef4444;
  --native: #38bdf8;
  --merged: #c084fc;
  --bar: rgba(255, 255, 255, 0.08);
  --banner-bg: repeating-linear-gradient(135deg, #3b2a05 0 14px, #2d2004 14px 28px);
  --banner-fg: #fde68a;
  --banner-line: #fbbf24;
  --title-grad: linear-gradient(90deg, #ffffff, #00f5ff, #c084fc);
  --glow: 0 0 20px rgba(0, 245, 255, 0.35);
  --f-display: 'Orbitron', 'Space Grotesk', system-ui, sans-serif;
  --f-head: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Fira Code', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f7fb;
    --bg-grad: radial-gradient(ellipse at top, #e6eefc 0%, #f4f7fb 60%);
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --border: rgba(14, 116, 144, 0.18);
    --border-strong: rgba(14, 116, 144, 0.45);
    --head: rgba(255, 255, 255, 0.92);
    --th: #eef3f9;
    --row: rgba(15, 23, 42, 0.07);
    --hover: rgba(14, 116, 144, 0.05);
    --text: #1e293b;
    --bright: #0f172a;
    --dim: #475569;
    --muted: #64748b;
    --cyan: #0e7490;
    --link: #0369a1;
    --violet: #7e22ce;
    --gold: #b45309;
    --good: #047857;
    --bad: #b91c1c;
    --native: #0284c7;
    --merged: #9333ea;
    --bar: rgba(15, 23, 42, 0.1);
    --banner-bg: repeating-linear-gradient(135deg, #fef3c7 0 14px, #fde68a 14px 28px);
    --banner-fg: #78350f;
    --banner-line: #d97706;
    --title-grad: linear-gradient(90deg, #0f172a, #0e7490, #7e22ce);
    --glow: none;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-grad: radial-gradient(ellipse at top, #e6eefc 0%, #f4f7fb 60%);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --border: rgba(14, 116, 144, 0.18);
  --border-strong: rgba(14, 116, 144, 0.45);
  --head: rgba(255, 255, 255, 0.92);
  --th: #eef3f9;
  --row: rgba(15, 23, 42, 0.07);
  --hover: rgba(14, 116, 144, 0.05);
  --text: #1e293b;
  --bright: #0f172a;
  --dim: #475569;
  --muted: #64748b;
  --cyan: #0e7490;
  --link: #0369a1;
  --violet: #7e22ce;
  --gold: #b45309;
  --good: #047857;
  --bad: #b91c1c;
  --native: #0284c7;
  --merged: #9333ea;
  --bar: rgba(15, 23, 42, 0.1);
  --banner-bg: repeating-linear-gradient(135deg, #fef3c7 0 14px, #fde68a 14px 28px);
  --banner-fg: #78350f;
  --banner-line: #d97706;
  --title-grad: linear-gradient(90deg, #0f172a, #0e7490, #7e22ce);
  --glow: none;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg-grad) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--f-mono); font-size: 0.85em; }
h1, h2, h3 { font-family: var(--f-head); color: var(--bright); margin: 0; }
h2 { font-size: 1.15rem; margin-bottom: 0.35rem; }
h3 { font-size: 0.95rem; margin: 1.1rem 0 0.4rem; }
p { margin: 0.35rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
[hidden] { display: none !important; }

/* TESTNET banner: always on top, impossible to miss */
.testnet-banner {
  background: var(--banner-bg);
  color: var(--banner-fg);
  border-bottom: 2px solid var(--banner-line);
  text-align: center;
  padding: 0.35rem 16px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.testnet-banner b { font-family: var(--f-display); letter-spacing: 0.14em; }

/* Header, as puddlepool.com */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--head);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1160px; margin: 0 auto; padding: 0.7rem 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none !important; }
.halo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.2), rgba(168, 85, 247, 0.3));
  border: 1px solid var(--cyan); box-shadow: var(--glow);
}
.halo img { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name {
  font-family: var(--f-display); font-weight: 800; font-size: 1.02rem; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--title-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-badge { font-family: var(--f-mono); font-size: 0.66rem; color: var(--cyan); letter-spacing: 0.14em; text-transform: uppercase; }
.top-nav { display: flex; align-items: center; gap: 0.2rem 1rem; flex-wrap: wrap; font-family: var(--f-head); font-size: 0.9rem; font-weight: 600; }
.top-nav a { color: var(--dim); }
.top-nav a:hover { color: var(--cyan); text-decoration: none; }
.theme-btn {
  font: inherit; color: var(--dim); background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer;
}
.theme-btn:hover { color: var(--cyan); border-color: var(--border-strong); }

main { max-width: 1160px; margin: 0 auto; padding: 1.5rem 16px 2rem; }

/* Hero */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: center; margin-bottom: 1.25rem; }
.hero-coins { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; color: var(--muted); }
.hero-coins svg { width: 124px; height: auto; display: block; overflow: visible; }
.hero-coins .branch path { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.hero-coins figcaption { font-size: 0.68rem; line-height: 1.25; text-align: center; max-width: 11rem; color: var(--dim); }
.hero h1 {
  font-family: var(--f-display); font-size: 1.55rem; font-weight: 800; letter-spacing: 0.03em; margin-bottom: 0.3rem;
  background: var(--title-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lead { color: var(--dim); max-width: 760px; }
.phase-chip {
  display: inline-flex; align-items: center; gap: 0.55rem; white-space: nowrap;
  font-family: var(--f-head); font-weight: 700; color: var(--bright);
  padding: 0.55rem 0.95rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--border-strong);
}
.phase-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--native); box-shadow: 0 0 10px var(--native); }
.phase-ban .phase-chip .dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.phase-merged .phase-chip .dot { background: var(--merged); box-shadow: 0 0 10px var(--merged); }

.alert {
  border: 1px solid var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent);
  border-radius: 10px; padding: 0.6rem 0.9rem; margin-bottom: 1rem; font-weight: 600;
}

/* Cards */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; margin-bottom: 0.9rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; margin-bottom: 1.25rem; }
.grid4.inner { margin: 0.6rem 0 0.4rem; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 0.95rem 1.1rem;
  transition: border-color 0.2s, box-shadow 0.2s; min-width: 0;
}
.card:hover { border-color: var(--border-strong); box-shadow: 0 0 22px rgba(0, 245, 255, 0.08); }
.card-label {
  font-family: var(--f-head); font-size: 0.74rem; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 0.4rem;
}
.big {
  font-family: var(--f-head); font-size: 1.55rem; font-weight: 700; color: var(--bright);
  font-variant-numeric: tabular-nums; margin: 0.15rem 0; overflow-wrap: anywhere;
}
.big.medium { font-size: 1.15rem; display: flex; flex-direction: column; }
.big.good { color: var(--good); }
.big.bad { color: var(--bad); }
.countdown .big { color: var(--cyan); }
.countdown.done .big { color: var(--good); }
.bar { background: var(--bar); border-radius: 999px; height: 7px; margin: 0.55rem 0 0.4rem; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--violet)); }
.countdown.done .bar i { background: var(--good); }

/* Panels and tables, as the puddlepool.com observatory tables */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.2rem 1.3rem; margin-bottom: 1.25rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.scroll { overflow-x: auto; margin-top: 0.6rem; border-radius: 10px; border: 1px solid var(--row); }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
th {
  background: var(--th); text-align: left; padding: 0.6rem 0.85rem; white-space: nowrap;
  font-family: var(--f-head); font-size: 0.72rem; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--row);
}
td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--row); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
.kind { font-weight: 600; }
.kind.native { color: var(--native); }
.kind.merged { color: var(--merged); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.native { background: var(--native); }
.sw.merged { background: var(--merged); }
.sw.line { background: var(--cyan); height: 3px; }

.pill {
  display: inline-block; padding: 0.08rem 0.55rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill.ok { color: var(--good); }
.pill.bad { color: var(--bad); }
.pill.wait { color: var(--muted); }
.pill.run { color: var(--gold); }

/* Join */
.join-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-top: 0.7rem; }
.join-card {
  display: flex; flex-direction: column; gap: 0.25rem; padding: 0.85rem 1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--dim); font-size: 0.84rem;
}
.join-card b { color: var(--bright); font-family: var(--f-head); font-size: 0.98rem; }
.join-card:hover { border-color: var(--cyan); text-decoration: none; box-shadow: var(--glow); }
.join-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.3rem; }
ul.plain { list-style: none; padding: 0; margin: 0.3rem 0; }
ul.plain li { padding: 0.15rem 0; }

/* Criteria */
.crit-list { list-style: none; padding: 0; margin: 0.7rem 0 0; display: grid; gap: 0.5rem; }
.crit {
  display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.8rem; align-items: center;
  padding: 0.65rem 0.85rem; border-radius: 10px; border: 1px solid var(--row); border-left: 3px solid var(--muted);
  background: var(--panel-solid);
}
.crit.ok { border-left-color: var(--good); }
.crit.bad { border-left-color: var(--bad); }
.crit.run { border-left-color: var(--gold); }
.crit-n {
  font-family: var(--f-display); font-weight: 800; color: var(--cyan); text-align: center;
  width: 2rem; height: 2rem; line-height: 2rem; border-radius: 8px; border: 1px solid var(--border);
}
.crit-text { color: var(--bright); font-weight: 600; font-size: 0.9rem; }
.crit-note { color: var(--dim); font-size: 0.8rem; }

/* Charts (server-side SVG) */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.chart-grid > div { min-width: 0; } /* a wide table scrolls inside its cell instead of widening the page */
.legend { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--dim); margin-bottom: 0.3rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font: 11px var(--f-mono); }
svg.chart .axis { stroke: var(--row); stroke-width: 1; }
svg.chart .b-native { fill: var(--native); }
svg.chart .b-merged { fill: var(--merged); }
svg.chart .line { fill: none; stroke: var(--cyan); stroke-width: 2; vector-effect: non-scaling-stroke; }

.foot {
  max-width: 1160px; margin: 0 auto; padding: 1rem 16px 2.5rem; text-align: center;
  color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--border);
}
.foot b { color: var(--gold); }

@media (max-width: 980px) {
  .grid4, .join-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 0.7rem; }
  .hero-coins { flex-direction: row; justify-content: flex-start; gap: 0.7rem; }
  .hero-coins svg { width: 96px; }
  .hero-coins figcaption { text-align: left; }
  .hero h1 { font-size: 1.25rem; }
  .phase-chip { justify-self: start; white-space: normal; }
  .grid2, .join-cols { grid-template-columns: 1fr; }
  .grid4, .join-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .card { padding: 0.75rem 0.85rem; }
  .big { font-size: 1.2rem; }
  .panel { padding: 1rem 0.9rem; }
  .crit { grid-template-columns: 1.8rem 1fr; }
  .crit .pill { grid-column: 2; justify-self: start; }
  .testnet-banner .wide { display: none; }
  .top-inner { padding: 0.5rem 16px; gap: 0.4rem; }
  .halo { width: 32px; height: 32px; }
  .halo img { width: 20px; height: 20px; }
  .brand-name { font-size: 0.9rem; }
  .brand-badge { letter-spacing: 0.08em; font-size: 0.6rem; }
  .top-nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; font-size: 0.82rem; gap: 0.9rem; scrollbar-width: none; }
  .top-nav a { white-space: nowrap; }
  .theme-btn { width: 28px; height: 28px; flex-shrink: 0; margin-left: auto; }
}
