:root {
  --bg1: #0b1016;
  --bg2: #16202b;
  --ink: #f2f6fb;
  --muted: #b8c6d6;
  --accent: #44e2c2;
  --warn: #f6bf5b;
  --danger: #ff6b77;
  --panel: rgba(16, 22, 30, 0.95);
  --stroke: rgba(255, 255, 255, 0.12);
  --input: rgba(255, 255, 255, 0.08);
  --input-focus: rgba(68, 226, 194, 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(75, 227, 199, 0.08), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(245, 177, 76, 0.1), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(255, 93, 108, 0.08), transparent 35%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 6px);
  z-index: 0;
  animation: haze 12s ease-in-out infinite alternate;
}

@keyframes haze {
  0% { filter: blur(0px); opacity: 0.9; }
  100% { filter: blur(1px); opacity: 1; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 26px;
  background: rgba(8, 12, 18, 0.92);
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dot {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(75, 227, 199, 0.8);
}

.title {
  font-size: 20px;
  letter-spacing: 1.2px;
  font-weight: 600;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
}

.status {
  text-align: right;
}

.badge {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 93, 108, 0.15);
  border: 1px solid rgba(255, 93, 108, 0.5);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1.1px;
}

.badge.ok {
  background: rgba(75, 227, 199, 0.15);
  border-color: rgba(75, 227, 199, 0.6);
}

.mini {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 1.6fr;
  gap: 18px;
  padding: 22px 26px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.panel h2 {
  margin: 0 0 10px 0;
  font-size: 13px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: rgba(68, 226, 194, 0.15);
  border: 1px solid rgba(68, 226, 194, 0.5);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: help;
  position: relative;
}

.help::after {
  content: attr(data-tip);
  position: absolute;
  left: 24px;
  top: -6px;
  min-width: 220px;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 10;
}

.help:hover::after {
  opacity: 1;
  transform: translateY(0);
}

input, select, textarea, button {
  font: inherit;
  color: var(--ink);
  background: var(--input);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
select option {
  color: #0b1016;
  background: #e7fbf6;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(68, 226, 194, 0.7);
  background: var(--input-focus);
  box-shadow: 0 0 0 2px rgba(68, 226, 194, 0.15);
}

textarea {
  width: 100%;
  resize: vertical;
}

button {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
  font-weight: 600;
  letter-spacing: 0.4px;
}

button:hover { transform: translateY(-1px); }

.test-status {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(12, 18, 26, 0.6);
}

.test-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.test-name {
  font-size: 13px;
  color: var(--ink);
  text-transform: none;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7dd3ff);
  transition: width 0.2s ease;
}

.test-progress-text {
  font-size: 12px;
  color: var(--muted);
}
button.primary { background: rgba(68, 226, 194, 0.22); border-color: rgba(68, 226, 194, 0.7); }
button.danger { background: rgba(255, 107, 119, 0.22); border-color: rgba(255, 107, 119, 0.7); }
button.ghost { background: transparent; }

.check {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.channel {
  padding: 12px;
  background: rgba(18, 24, 32, 0.98);
  border: 1px solid var(--stroke);
  border-left: 4px solid var(--ch-accent, var(--accent));
  border-radius: 14px;
  position: relative;
}

.ch-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.ch-value { font-size: 20px; margin: 6px 0; font-weight: 700; color: var(--ink); }
.ch-slider { width: 100%; }

.ch-slider {
  accent-color: var(--ch-accent, var(--accent));
}

.ch-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}

.logs {
  position: relative;
  z-index: 1;
  margin: 0 24px 24px 24px;
}

.note {
  font-size: 12px;
  color: var(--warn);
  margin-top: 6px;
}

.log {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px;
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.log-line {
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.log-line.tx { border-left: 3px solid var(--accent); }
.log-line.rx { border-left: 3px solid var(--warn); }
.log-line.error { border-left: 3px solid var(--danger); }

.hint {
  margin: -4px 0 12px 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* === Body view === */
.body-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.body-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 10px 6px 6px;
}
.body-caption {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 6px;
}
.body-svg {
  width: 100%;
  height: auto;
  max-height: 420px;
}
.body-svg .zone {
  fill: var(--accent);
  fill-opacity: 0;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 0.6;
  cursor: pointer;
  transition: fill-opacity 0.15s ease, stroke 0.15s ease;
}
.body-svg .zone:hover {
  stroke: rgba(255,255,255,0.6);
}
.body-svg .zone.active {
  animation: zonePulse 0.8s ease-in-out infinite;
}
@keyframes zonePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.6); }
}

/* === Pulse view === */
.pulse-view {
  background: rgba(8, 12, 18, 0.55);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}
.pulse-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-height: 18px;
}
.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  transition: background 0.05s linear, box-shadow 0.05s linear, transform 0.05s linear;
}
.pulse-dot.on {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transform: scale(1.15);
}
.pulse-meta {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.kv-k {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  margin-right: 4px;
}
.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.meter-bar {
  height: 100%;
  background: linear-gradient(90deg, #44e2c2, #ffd166, #ff6b77);
  transition: width 0.2s ease;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .channels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr; }
  .body-svg { max-height: 360px; }
}
