:root {
  --bg: #0c0f14;
  --surface: #151b24;
  --border: #243044;
  --text: #e8edf5;
  --muted: #8b9bb5;
  --accent: #5b9cff;
  --accent-dim: #3d6fb8;
  --ok: #3dd68c;
  --warn: #f5b942;
  --err: #ff6b7a;
  --radius: 12px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(91, 156, 255, 0.18), transparent),
    var(--bg);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-top: 1.25rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.status.idle {
  background: rgba(139, 155, 181, 0.15);
  color: var(--muted);
}

.status.starting {
  background: rgba(245, 185, 66, 0.15);
  color: var(--warn);
}

.status.active {
  background: rgba(61, 214, 140, 0.15);
  color: var(--ok);
}

.status.error {
  background: rgba(255, 107, 122, 0.15);
  color: var(--err);
}

.source-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.source-row label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}

.source-row label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(91, 156, 255, 0.1);
}

.source-row input {
  accent-color: var(--accent);
}

.test-controls {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.field label span {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.btn-row {
  display: flex;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.1s;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0a1020;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #7ab0ff;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-ghost {
  background: rgba(91, 156, 255, 0.12);
  color: var(--accent);
  border-color: var(--accent-dim);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.note {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(91, 156, 255, 0.06);
  border: 1px solid rgba(91, 156, 255, 0.2);
  font-size: 0.85rem;
  color: var(--muted);
}

.note strong {
  color: var(--text);
}

footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  .btn-row {
    flex-direction: column;
  }
  .btn-row button {
    width: 100%;
  }
}
