:root {
  --bg: #06060a;
  --bg-2: #0d0d14;
  --panel: rgba(18, 18, 28, 0.62);
  --panel-border: rgba(120, 120, 180, 0.16);
  --ink: #ececf7;
  --ink-dim: #8a8aa3;
  --ink-faint: #54546a;
  --accent: #7c5cff;
  --accent-2: #18e6c8;
  --accent-3: #ff5ca0;
  --good: #2bd96a;
  --bad: #ff4d6d;
  --warn: #ffb547;
  --grid: rgba(120, 120, 180, 0.055);
  --shadow: 0 20px 60px -20px rgba(124, 92, 255, 0.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(124, 92, 255, 0.30), transparent 55%),
    radial-gradient(ellipse at 88% 8%, rgba(24, 230, 200, 0.18), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(255, 92, 160, 0.14), transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-2%, 2%) scale(1.08); }
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  opacity: 0.035;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

.scanline {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(124, 92, 255, 0.07) 50%, transparent 100%);
  height: 220px;
  animation: scan 9s linear infinite;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}
@keyframes scan {
  0% { transform: translateY(-30vh); }
  100% { transform: translateY(120vh); }
}

main, .topbar, .footnote { position: relative; z-index: 2; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 28px var(--accent);
  animation: heartbeat 2.4s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.85; }
}

.brand-name { font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.brand-accent { color: var(--accent-2); }
.brand-sub { color: var(--ink-faint); font-size: 13px; margin-left: 6px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(124, 92, 255, 0.08);
  color: var(--ink-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: lowercase;
}
.status-pill.run { color: var(--accent-2); }
.status-pill.done { color: var(--good); }
.status-pill.err { color: var(--bad); }
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ============ HERO ============ */
.hero {
  text-align: center;
  padding: 56px 24px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}
.hero-title {
  font-size: clamp(40px, 7vw, 72px);
  margin: 4px 0 0;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.hero-title .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 50%, var(--accent-3));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradslide 6s ease-in-out infinite;
}
@keyframes gradslide {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-sub {
  max-width: 580px;
  color: var(--ink-dim);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 8px;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
}

.bigbtn {
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, 0.45), rgba(24, 230, 200, 0.18) 60%, rgba(7, 7, 11, 0.85) 100%);
  border: none;
  cursor: pointer;
  color: var(--ink);
  display: grid;
  place-items: center;
  isolation: isolate;
  transition: transform 0.15s ease, filter 0.2s ease;
  font-family: 'JetBrains Mono', monospace;
}
.btn-cluster {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.bigbtn-alt {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 92, 160, 0.42), rgba(255, 181, 71, 0.18) 60%, rgba(7, 7, 11, 0.85) 100%);
}
.bigbtn-alt .bigbtn-ring { border-color: rgba(255, 92, 160, 0.45); box-shadow: 0 0 60px rgba(255, 92, 160, 0.45), inset 0 0 40px rgba(255, 181, 71, 0.12); }
.bigbtn-alt .bigbtn-ring::before { border-color: rgba(255, 92, 160, 0.32); }
.bigbtn-alt .bigbtn-ring-2::before { border-color: rgba(255, 181, 71, 0.22); }
.bigbtn-alt .bigbtn-inner { font-size: 11px; }
.bigbtn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.1); }
.bigbtn:active { transform: translateY(0) scale(0.98); }
.bigbtn:disabled { cursor: wait; }

.bigbtn-ring, .bigbtn-ring-2 {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(124, 92, 255, 0.5);
  box-shadow:
    0 0 60px rgba(124, 92, 255, 0.5),
    inset 0 0 40px rgba(24, 230, 200, 0.15);
  pointer-events: none;
}
.bigbtn-ring::before, .bigbtn-ring-2::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(124, 92, 255, 0.35);
  animation: spin 18s linear infinite;
}
.bigbtn-ring-2::before {
  inset: -22px;
  border-color: rgba(24, 230, 200, 0.2);
  animation-duration: 32s;
  animation-direction: reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bigbtn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: 13px;
  text-transform: uppercase;
  z-index: 1;
}

.bigbtn::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.0), rgba(124, 92, 255, 0.18));
  pointer-events: none;
  animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.bigbtn.running .bigbtn-ring {
  animation: ringpulse 1.2s ease-out infinite;
  border-color: var(--accent-2);
}
.bigbtn.running .bigbtn-ring-2 {
  animation: ringpulse 1.2s ease-out 0.4s infinite;
  border-color: var(--accent);
}
@keyframes ringpulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.18); opacity: 0; }
}

.adv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--ink-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.adv-btn:hover { color: var(--ink); border-color: var(--accent); background: rgba(124, 92, 255, 0.08); }
.adv-btn[aria-expanded="true"] { color: var(--accent-2); border-color: var(--accent-2); }

.target-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-faint);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
}
.target-chip b { color: var(--ink); font-weight: 600; }

.adv-panel {
  width: 100%;
  max-width: 880px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 22px 24px;
  backdrop-filter: blur(14px);
  margin-top: 6px;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1.6fr auto;
  gap: 14px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field.small { max-width: 120px; }
.field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.field input {
  background: rgba(7, 7, 11, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.ghost-btn {
  padding: 12px 18px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--accent); }

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  text-align: left;
}

/* ============ panels ============ */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 22px 24px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.panel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent 40%);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  margin: 0 0 18px;
  font-weight: 600;
}
.panel-title .hash { color: var(--accent); font-weight: 800; }
.panel-sub {
  color: var(--ink-faint);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
  font-size: 11px;
}

/* ============ verdict ============ */
.verdict-panel {
  border-color: rgba(124, 92, 255, 0.4);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.10), rgba(24, 230, 200, 0.05));
}
.verdict-panel.good {
  border-color: rgba(43, 217, 106, 0.5);
  background: linear-gradient(135deg, rgba(43, 217, 106, 0.14), transparent);
  box-shadow: 0 20px 60px -20px rgba(43, 217, 106, 0.35);
}
.verdict-panel.bad {
  border-color: rgba(255, 77, 109, 0.5);
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.16), transparent);
  box-shadow: 0 20px 60px -20px rgba(255, 77, 109, 0.4);
}
.verdict-panel.warn {
  border-color: rgba(255, 181, 71, 0.5);
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.14), transparent);
}
.verdict-inner { display: flex; flex-direction: column; gap: 8px; }
.verdict-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.verdict-stats { display: flex; gap: 18px; }
.verdict-stats b { color: var(--ink); font-weight: 700; }
.verdict-text {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.verdict-detail {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.55;
}

/* ============ results ============ */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.panel-wide { grid-column: 1 / -1; }

.probe-list { display: flex; flex-direction: column; gap: 10px; }
.testbed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.empty {
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 18px 0;
}

.probe-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(7, 7, 11, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  animation: fadeIn 0.4s ease;
  transition: border-color 0.15s, transform 0.15s;
}
.probe-row:hover { border-color: rgba(124, 92, 255, 0.35); transform: translateX(2px); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.led {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.led.ok { background: var(--good); box-shadow: 0 0 8px var(--good); }
.led.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.led.pending { background: var(--warn); animation: heartbeat 1s ease-in-out infinite; }

.probe-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.probe-name {
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.probe-name .tag {
  background: rgba(124, 92, 255, 0.18);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.probe-reason {
  color: var(--ink-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.probe-time {
  color: var(--accent-2);
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.probe-time.bad { color: var(--bad); }

.testbed-grid .probe-row { flex-direction: column; align-items: flex-start; gap: 6px; }
.testbed-grid .probe-row .top { display: flex; width: 100%; align-items: center; gap: 10px; }

.log {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--ink-dim);
  line-height: 1.7;
}
.log .ts { color: var(--ink-faint); margin-right: 8px; }
.log .ev { color: var(--accent-2); margin-right: 8px; }
.log .ok { color: var(--good); }
.log .bad { color: var(--bad); }
.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-thumb { background: rgba(124, 92, 255, 0.3); border-radius: 3px; }

.footnote {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 22px;
  color: var(--ink-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.footnote .dot { opacity: 0.5; }

/* ============ stress ============ */
.stress-panel {
  border-color: rgba(255, 92, 160, 0.35);
  background: linear-gradient(135deg, rgba(255, 92, 160, 0.08), rgba(255, 181, 71, 0.04));
}
.stress-panel.running {
  border-color: rgba(255, 92, 160, 0.6);
  box-shadow: 0 20px 60px -20px rgba(255, 92, 160, 0.4);
}
.stress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.lane {
  background: rgba(7, 7, 11, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.lane[data-lane="target"] { border-color: rgba(255, 92, 160, 0.3); }
.lane[data-lane="control"] { border-color: rgba(24, 230, 200, 0.3); }
.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.lane-name { color: var(--ink); font-weight: 700; }
.lane-host { color: var(--ink-faint); }
.lane-metric { display: flex; align-items: baseline; gap: 12px; }
.lane-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.lane[data-lane="target"] .lane-val { color: var(--accent-3); }
.lane[data-lane="control"] .lane-val { color: var(--accent-2); }
.lane-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--ink-dim);
}
.spark {
  width: 100%;
  height: 80px;
  display: block;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}
.lane-foot {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}
.lane-foot b { color: var(--ink); font-weight: 600; margin-left: 4px; }
.lane-foot b.bad { color: var(--bad); }
.lane-foot b.ok { color: var(--good); }
.lane.dropped { border-color: rgba(255, 77, 109, 0.55); }
.lane.dropped::after {
  content: 'DROPPED';
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--bad);
  border: 1px solid var(--bad);
  padding: 2px 6px;
  border-radius: 4px;
  animation: blink 1.2s ease infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.stress-verdict {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}
.stress-verdict.good { border-color: rgba(43, 217, 106, 0.5); background: rgba(43, 217, 106, 0.08); }
.stress-verdict.bad { border-color: rgba(255, 77, 109, 0.5); background: rgba(255, 77, 109, 0.10); }
.stress-verdict.warn { border-color: rgba(255, 181, 71, 0.5); background: rgba(255, 181, 71, 0.08); }
.stress-verdict-text { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.stress-verdict-detail { color: var(--ink-dim); font-size: 13px; margin-top: 4px; line-height: 1.5; }

#stressTimer { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .stress-grid { grid-template-columns: 1fr; }
  .btn-cluster { gap: 18px; }
  .bigbtn { width: 156px; height: 156px; }
  .bigbtn-alt { width: 130px; height: 130px; }
}

@media (max-width: 900px) {
  .form-row { grid-template-columns: 1fr; }
  .field.small { max-width: none; }
  .results-grid { grid-template-columns: 1fr; }
  .verdict-text { font-size: 22px; }
  main { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .hero { padding: 32px 12px 24px; }
  .bigbtn { width: 168px; height: 168px; }
}
