:root {
  --bg: #050816;
  --bg-alt: #0b1022;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.2);
  --accent-strong: rgba(124, 92, 255, 0.6);
  --accent-danger: #ff4b81;
  --accent-alien: #42f5b0;
  --text: #f5f5ff;
  --muted: #a0a3c0;
  --border: #22263a;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --transition-fast: 180ms ease-out;
  --transition-med: 260ms ease-out;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", sans-serif;
  background: radial-gradient(circle at top left, #181b34 0, #050816 45%, #02020a 100%);
  color: var(--text);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app {
  margin: 18px;
  flex: 1;
  max-width: 1100px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 18px;
}

.panel {
  background: radial-gradient(circle at top left, #15192c 0, #050816 45%, #050712 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(124, 92, 255, 0.35);
  box-shadow: var(--shadow-soft);
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(124, 92, 255, 0.32), transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.7;
  pointer-events: none;
}

.panel-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

h1 {
  margin: 0;
  font-size: 2.4rem;
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, #ffffff, #c9b5ff, #8f9bff);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  margin-top: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 30rem;
}

.btn-primary,
.btn-secondary {
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast),
    opacity var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #a87dff);
  color: #050816;
  box-shadow: 0 16px 30px rgba(124, 92, 255, 0.5);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(124, 92, 255, 0.7);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 10px 25px rgba(124, 92, 255, 0.5);
}

.btn-secondary {
  margin-left: 10px;
  background: rgba(10, 14, 31, 0.9);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(15, 20, 40, 0.95);
}

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

.status {
  display: flex;
  align-items: center;
  margin-top: 14px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.3);
  transition: background var(--transition-fast), box-shadow var(--transition-med),
    transform var(--transition-med);
}

.dot-off {
  background: #666a84;
}

.dot-on {
  background: #4cffb8;
  box-shadow: 0 0 14px rgba(76, 255, 184, 0.7);
}

.meters {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meter {
  background: rgba(7, 9, 22, 0.9);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meter-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.meter-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.meter-value {
  font-size: 0.88rem;
  color: #e3e4ff;
}

.meter-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 0% 50%, rgba(255, 255, 255, 0.15), transparent 50%),
    linear-gradient(90deg, #14162d, #090c1f);
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #69f0ff, #7c5cff, #ff4b81);
  box-shadow: 0 0 20px rgba(124, 92, 255, 0.7);
  transform-origin: left center;
  transition: width 120ms linear, background 160ms linear, transform 160ms linear;
}

.meter-fill-alt {
  background: linear-gradient(90deg, #ffb74d, #ff4b81, #42f5b0);
}

.legend {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  margin-right: 6px;
}

.badge-low {
  background: #1a4bff;
}

.badge-grave {
  background: #375cff;
}

.badge-normal {
  background: #4bc1ff;
}

.badge-high {
  background: #ffb74d;
}

.badge-very-high {
  background: #ff4b81;
}

.badge-alien {
  background: #42f5b0;
}

canvas#waveform {
  width: 100%;
  height: 100%;
  display: block;
}

.warning {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(5, 8, 22, 0.9);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    margin: 12px;
  }

  .panel {
    padding: 18px 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .legend {
    grid-template-columns: 1fr;
  }

  .warning {
    max-width: min(100% - 24px, 420px);
    text-align: center;
  }
}


