
:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --panel-2: #f4f4f2;
  --line: #e4e3df;
  --line-strong: #d3d2cc;
  --ink: #1c1c1a;
  --ink-dim: #6b6b64;
  --ink-faint: #9d9c95;
  --accent: #D97706;
  --accent-ink: #fff;
  --accent-soft: #fffbeb;
  --teal: #0ea88e;
  --teal-soft: #e3f7f2;
  --red: #d64545;
  --red-soft: #fbeaea;
  --blue: #0891B2;
  --radius: 12px;
  --disp: 'Space Grotesk', sans-serif;
  --body: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); }
::selection { background: var(--accent-soft); color: var(--accent); }

.wrap { max-width: 960px; margin: 0 auto; }

/* ---- top actions ---- */
.top-actions { display: flex; justify-content: flex-end; margin-bottom: -6px; }

/* ---- cards ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(20,20,15,.03);
  display: none;
}
.card.visible { display: block; }
.card h2 { font-family: var(--disp); font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ---- meta grid ---- */
.meta-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px 20px; }
@media (max-width: 560px) { .meta-grid { grid-template-columns: repeat(2,1fr); } }
.meta-item .label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px;
}
.meta-item .value {
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- waveform ---- */
.wave-box {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); margin-top: 14px; overflow: hidden;
}
.ch-wave-box { margin-top: 10px; }
.wave-canvas { display: block; width: 100%; }

/* ---- section blocks ---- */
.section-block { margin-bottom: 20px; }
.section-eyebrow {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; display: block;
}

/* ---- seg tabs ---- */
.seg-tabs { display: flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg-tab {
  flex: 1; font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 8px 6px; border: none;
  background: var(--panel); color: var(--ink-dim);
  cursor: pointer; transition: all .1s ease;
  border-right: 1px solid var(--line-strong);
}
.seg-tab:last-child { border-right: none; }
.seg-tab:hover { background: var(--accent-soft); color: var(--accent); }
.seg-tab.active { background: var(--accent); color: var(--accent-ink); }

/* ---- mode hint ---- */
.mode-hint {
  font-size: 12px; color: var(--ink-faint); line-height: 1.5;
  padding: 10px 14px; background: var(--panel-2);
  border-radius: 8px; border: 1px solid var(--line);
  margin-top: 10px;
}

/* ---- width presets ---- */
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-pill {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink-dim);
  cursor: pointer; transition: all .12s ease;
}
.preset-pill:hover { border-color: var(--accent); color: var(--accent); }
.preset-pill.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- channel strips ---- */
.channel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 600px) { .channel-row { grid-template-columns: 1fr; } }

.ch-strip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.ch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ch-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink);
}

/* ---- solo button ---- */
.solo-btn {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink-dim);
  cursor: pointer; transition: all .1s ease;
  letter-spacing: 1px;
}
.solo-btn:hover { border-color: var(--accent); color: var(--accent); }
.solo-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- controls ---- */
.ctrl { margin-bottom: 12px; }
.ctrl-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 8px;
}
.ctrl-val { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0; }

/* ---- range inputs ---- */
input[type=range] {
  -webkit-appearance: none; width: 100%;
  height: 4px; border-radius: 2px;
  background: var(--line-strong); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 2px solid #fff;
}

/* ---- RMS meter ---- */
.ch-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.meter-track {
  flex: 1; height: 6px;
  background: var(--line); border-radius: 3px; overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(to right, var(--teal) 0%, var(--accent) 70%, var(--red) 100%);
  border-radius: 3px;
  transition: width .15s ease;
}
.meter-val {
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  white-space: nowrap; min-width: 64px; text-align: right;
}

/* ---- phase correlation meter ---- */
.corr-row { display: flex; align-items: center; gap: 16px; }
.corr-meter { flex: 1; }

.corr-track {
  position: relative;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(to right, var(--red) 0%, #f59e0b 40%, #84cc16 65%, var(--teal) 100%);
  border: 1px solid var(--line-strong);
}

.corr-needle {
  position: absolute;
  top: -3px;
  width: 4px; height: 20px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 2px;
  transform: translateX(-50%);
  left: 50%;
  transition: left .2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.corr-scale {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 9px; color: var(--ink-faint);
  margin-top: 5px; padding: 0 2px;
}

.corr-val {
  font-family: var(--mono); font-size: 16px; font-weight: 700;
  color: var(--ink); min-width: 60px; text-align: right;
  transition: color .2s ease;
}

/* ---- stats grid ---- */
.stats-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 3px;
}
.stat-val {
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink);
}

/* ---- export row ---- */
.export-row {
  display: flex; gap: 12px; align-items: flex-end;
  margin-bottom: 12px;
}
.fmt-ctrl { flex: 1; margin-bottom: 0; }
.out-select {
  font-family: var(--mono); font-size: 13px;
  padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--panel); color: var(--ink);
  width: 100%; cursor: pointer; outline: none;
}
.out-select:focus { border-color: var(--accent); }

/* ---- buttons ---- */
.btn {
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  letter-spacing: .4px; padding: 13px 22px; border-radius: 8px;
  border: none; background: var(--accent); color: var(--accent-ink);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost {
  background: transparent; color: var(--ink-dim);
  border: 1px solid var(--line-strong); width: auto;
}
.btn.ghost:hover { border-color: var(--red); color: var(--red); }
.btn.download { background: var(--teal); }

/* ---- progress ---- */
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 12px; overflow: hidden; display: none; }
.bar.show { display: block; }
.bar > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--teal), var(--accent)); transition: width .15s ease; }
.status-line { display: none; margin-top: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.status-line.show { display: block; }

/* ---- info box ---- */
.info-box { font-size: 12.5px; line-height: 1.55; padding: 14px 16px; border-radius: 9px; background: var(--accent-soft); color: #78350f; }

/* ---- result header ---- */
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.status-pill { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--teal); text-transform: uppercase; }
.status-pill .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
