:root {
  --bg: #000000;
  --surface: #0c0c0f;
  --surface-2: #16161b;
  --border: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.16);
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 16px;
}

html[data-theme="emerald"] {
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 76px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { border-radius: 8px; }
.brand h1 { font-size: 1.05rem; margin: 0; }
.subtitle { margin: 0; font-size: 0.78rem; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.panels { padding: 14px 16px; flex: 1; }
.panel { display: none; flex-direction: column; gap: 14px; }
.panel.active { display: flex; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 { font-size: 0.98rem; margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.hero-card { border-color: var(--accent-soft); }
.hero-row { display: flex; justify-content: center; margin-bottom: 14px; }
.hero-btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.hero-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #09090b;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: currentColor;
}

.quick-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.pill-btn, .chip-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.pill-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.pill-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pill-btn.danger { border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.file-label { display: inline-flex; align-items: center; }

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
}
.seg-btn.active { background: var(--accent); color: #09090b; font-weight: 600; }

.meters { display: flex; flex-direction: column; gap: 8px; }
.meter-row { display: grid; grid-template-columns: 56px 1fr 64px; align-items: center; gap: 10px; }
.meter-label, .meter-val { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-val { text-align: right; }
.meter-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: var(--ok); transition: width 60ms linear; }
.meter-fill.accent { background: var(--accent); }

.dsp-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.active { border-color: var(--accent); color: var(--accent); }

.preset-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.preset-chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  cursor: pointer;
}
.preset-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.slider-list { display: flex; flex-direction: column; gap: 12px; }
.slider-item { display: flex; flex-direction: column; gap: 4px; }
.slider-top { display: flex; justify-content: space-between; font-size: 0.86rem; }
.slider-top span:last-child { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.86rem; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 0.85rem; color: var(--muted); }
select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
}

.rec-row, .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.download-area { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.download-link { color: var(--accent); font-size: 0.88rem; }

.banner {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
}
.banner.error { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.5); color: #fecaca; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; margin: 4px 0 0; }
.hidden { display: none !important; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(12, 12, 15, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  gap: 8px;
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
