:root {
  --bg: #0b1020;
  --bg-2: #0f1630;
  --card: rgba(255, 255, 255, 0.04);
  --card-bd: rgba(255, 255, 255, 0.08);
  --txt: #e8ecf6;
  --muted: #9aa6c4;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-3: #a855f7;
  --good: #34d399;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--txt);
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(34, 211, 238, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 5vw, 56px);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(11, 16, 32, 0.55);
  border-bottom: 1px solid var(--card-bd);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.brand-mark { width: 28px; height: 28px; fill: url(#); fill: var(--accent-2); filter: drop-shadow(0 0 10px rgba(34,211,238,.5)); }
.nav { display: flex; gap: 22px; font-size: 15px; color: var(--muted); }
.nav a { padding: 6px 2px; transition: color .2s; }
.nav a:hover { color: var(--txt); }

/* ── Layout ──────────────────────────────────────────── */
main { max-width: 880px; margin: 0 auto; padding: clamp(28px, 6vw, 64px) clamp(16px, 5vw, 24px) 64px; }

.eyebrow { color: var(--accent-2); font-weight: 700; letter-spacing: 3px; text-transform: uppercase; font-size: 12px; margin: 0 0 10px; }
.hero { text-align: center; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); margin: 0 0 10px; line-height: 1.1; }
.sub { color: var(--muted); margin: 0 auto 26px; max-width: 46ch; }

/* ── Gauge ───────────────────────────────────────────── */
.gauge-wrap { position: relative; width: min(420px, 92vw); margin: 8px auto 6px; }
.gauge { width: 100%; height: auto; overflow: visible; }
.gauge-track { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 14; stroke-linecap: round; }
.gauge-arc {
  fill: none; stroke: url(#arc); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset .12s linear;
}
.gauge .tick { stroke: rgba(255,255,255,.28); stroke-width: 2; }
.gauge .tick-label { fill: var(--muted); font-size: 9px; text-anchor: middle; }
.needle { stroke: #fff; stroke-width: 3; stroke-linecap: round; transform-origin: 160px 200px; transition: transform .12s linear; filter: drop-shadow(0 0 6px rgba(255,255,255,.5)); }
.needle-hub { fill: #fff; }

.readout { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; pointer-events: none; }
.phase { display: block; color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.value { font-size: clamp(40px, 9vw, 60px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.unit { color: var(--muted); font-size: 14px; }

.go {
  margin-top: 14px; width: 96px; height: 96px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, var(--accent-2), var(--accent), var(--accent-3));
  color: #fff; font-weight: 800; font-size: 22px; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(99,102,241,.7);
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.go:hover { transform: translateY(-2px) scale(1.03); }
.go:active { transform: scale(.97); }
.go[disabled] { opacity: .55; cursor: progress; }

/* ── Stats ───────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 30px 0; }
.stat { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--card); border: 1px solid var(--card-bd); border-radius: var(--radius); }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat small { display: block; color: var(--muted); font-size: 11px; }
.stat-ico { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; font-size: 18px; background: rgba(255,255,255,.06); }
.stat-ico.down { color: var(--accent-2); }
.stat-ico.up { color: var(--accent-3); }

/* ── Cards ───────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--card-bd); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 18px 0; }
.conn { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: end; }
.conn small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.conn b { font-size: 16px; }
.conn select { margin-top: 4px; width: 100%; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--txt); border: 1px solid var(--card-bd); }

/* ── History ─────────────────────────────────────────── */
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.history h2 { margin: 0; font-size: 18px; }
.history table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--card-bd); }
.history td { padding: 10px 6px; border-bottom: 1px solid rgba(255,255,255,.05); font-variant-numeric: tabular-nums; }
.history tr:last-child td { border-bottom: 0; }
.history .empty td { color: var(--muted); text-align: center; padding: 18px; }
.ghost { background: transparent; border: 1px solid var(--card-bd); color: var(--muted); padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.ghost:hover { color: var(--txt); border-color: rgba(255,255,255,.25); }

/* ── Prose ───────────────────────────────────────────── */
.prose h2 { margin-top: 0; font-size: 20px; }
.prose p { color: #c7cfe6; }
.features { color: #c7cfe6; padding-left: 18px; margin: 12px 0 0; }
.features li { margin: 6px 0; }

/* ── Footer ──────────────────────────────────────────── */
.foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; padding: 28px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--card-bd); }
.foot a:hover { color: var(--txt); }
.foot .dot { opacity: .5; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .conn { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
