:root {
  color-scheme: light;
  --bg: #f1f1f0;
  --ink: #141414;
  --muted: #6e6e6e;
  --panel: rgba(250, 250, 250, 0.96);
  --stroke: rgba(20, 20, 20, 0.08);
  --accent: #3f3f3f;
  --accent-2: #22262a;
  --shadow: 0 18px 40px rgba(20, 20, 20, 0.12);
  --radius: 22px;
  font-family: "Sora", "Noto Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.ambient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(210, 210, 210, 0.6), transparent 50%),
    radial-gradient(circle at 90% 0%, rgba(200, 200, 200, 0.5), transparent 55%),
    linear-gradient(160deg, rgba(248, 248, 248, 0.95), rgba(235, 235, 235, 0.95));
  z-index: -1;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 6vw 12px;
}

.title {
  font-family: "Sora", "Noto Sans", sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.badges {
  display: none;
}

.stack {
  display: grid;
  gap: 16px;
  padding: 0 6vw 40px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.radar-card {
  padding: 18px;
}

.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.metrics {
  display: grid;
  gap: 8px;
}

.metric-label {
  font-size: 11px;
  color: var(--muted);
}

.metric-value {
  font-size: 15px;
  font-weight: 600;
}

.radar {
  position: relative;
  margin: 16px auto 10px;
  width: 100%;
  height: 58vh;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(250, 250, 250, 0.9), rgba(235, 235, 235, 0.9)),
    linear-gradient(0deg, rgba(20, 20, 20, 0.04) 0, rgba(20, 20, 20, 0.04) 1px, transparent 1px, transparent 40px),
    linear-gradient(90deg, rgba(20, 20, 20, 0.04) 0, rgba(20, 20, 20, 0.04) 1px, transparent 1px, transparent 32px),
    linear-gradient(45deg, rgba(20, 20, 20, 0.06) 0 40px, transparent 40px 120px),
    linear-gradient(135deg, rgba(20, 20, 20, 0.05) 0 60px, transparent 60px 140px),
    repeating-linear-gradient(
      120deg,
      rgba(20, 20, 20, 0.04) 0,
      rgba(20, 20, 20, 0.04) 1px,
      transparent 1px,
      transparent 36px
    );
  border: 1px solid rgba(20, 20, 20, 0.08);
  overflow: hidden;
}

.radar-ring {
  position: absolute;
  inset: 12%;
  border-radius: 24px;
  border: 1px dashed rgba(20, 20, 20, 0.12);
}

.radar-ring.inner {
  inset: 32%;
  border-style: solid;
  border-color: rgba(20, 20, 20, 0.08);
}

.radar-dots {
  position: absolute;
  inset: 0;
}

.listener {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 8px rgba(34, 38, 42, 0.15);
  transform: translate(-50%, -50%);
}

.north {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
}

.radar-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(63, 63, 63, 0.2);
  transform: translate(-50%, -50%);
}

.radar-dot.detected {
  background: var(--accent-2);
  box-shadow: 0 0 0 8px rgba(34, 38, 42, 0.22);
}

.radar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.radar-footer .muted {
  display: none;
}

.mode {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.08);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
}

.status-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.record-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.record-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(12, 15, 18, 0.04);
  font-size: 12px;
  color: var(--muted);
}

.primary,
.ghost,
.toggle {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

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

.primary {
  background: var(--ink);
  color: #fff;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stroke);
}

.toggle {
  background: rgba(255, 107, 61, 0.15);
  color: var(--accent);
  border: 1px solid rgba(255, 107, 61, 0.4);
}

.toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.toggle-state {
  font-size: 12px;
  color: var(--muted);
}

.input-label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.muted.small {
  font-size: 12px;
  margin-top: 10px;
}

.muted.tiny {
  font-size: 11px;
  margin-top: 12px;
}

.panel-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.source-list {
  display: grid;
  gap: 12px;
}

.source-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(12, 15, 18, 0.08);
  background: rgba(12, 15, 18, 0.02);
}

.source-item.detected {
  border-color: rgba(63, 125, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(63, 125, 255, 0.3);
}

.source-title {
  font-weight: 600;
  font-size: 13px;
}

.source-meta {
  font-size: 12px;
  color: var(--muted);
}

.source-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stereo-meter {
  display: flex;
  gap: 8px;
}

.meter {
  width: 60px;
  height: 8px;
  background: rgba(12, 15, 18, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.meter span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transform-origin: left center;
  transform: scaleX(0);
}

.record-fab {
  position: fixed;
  right: 18px;
  bottom: 24px;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 4;
  touch-action: none;
}

.record-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f7f7f7;
  border: 1px solid var(--ink);
  box-shadow: 0 10px 24px rgba(20, 20, 20, 0.15);
  position: relative;
}

.record-icon::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d14a4a;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.record-label {
  font-size: 11px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 15, 18, 0.25);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(340px, 90vw);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-title {
  font-weight: 600;
  font-size: 16px;
}

.modal-close {
  width: 100%;
  margin-top: 16px;
}


body.modal-open main {
  filter: blur(6px);
}

body.modal-open {
  overflow: hidden;
}
