
:root {
  --bg: #fbfbfa;
  --panel: #ffffff;
  --panel-2: #f4f4f2;
  --line: #e4e3df;
  --line-strong: #d3d2cc;
  --ink: #1c1c1a;
  --ink-dim: #6b6b64;
  --ink-faint: #9d9c95;
  --accent: #722ED2;
  --accent-ink: #fff;
  --accent-soft: #f2e8ff;
  --teal: #0ea88e;
  --teal-soft: #e3f7f2;
  --amber-soft: #fbf3de;
  --red: #d64545;
  --red-soft: #fbeaea;
  --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;
}

/* ---- two-column layout ---- */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 680px) {
  .settings-row { grid-template-columns: 1fr; }
}

/* ---- waveform ---- */
.wave-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}
.wave-canvas {
  display: block;
  width: 100%;
  height: 130px;
}

.legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  flex-wrap: wrap;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.swatch.audio    { background: rgba(114,46,210,.4); }
.swatch.silence  { background: rgba(214,69,69,.3); }
.swatch.cut-line { background: #722ED2; border-radius: 1px; width: 3px; height: 12px; }

/* ---- stats ---- */
.stats-panel {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px 16px;
  margin-bottom: 0;
}
.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 0;
}
.stat-label { color: var(--ink-faint); }
.stat-value { color: var(--ink); font-weight: 700; }
.stat-value.accent { color: var(--accent); }

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

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: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---- text input ---- */
.text-input {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  width: 100%;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }

/* ---- preset buttons ---- */
.preset-btns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
}
@media (max-width: 460px) {
  .preset-btns { grid-template-columns: repeat(3, 1fr); }
}
.preset-btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.preset-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- CUE toggle ---- */
.cue-row { margin-bottom: 18px; }
.toggle-label-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-pill input { display: none; }
.pill-track {
  display: flex;
  align-items: center;
  width: 36px;
  height: 20px;
  background: var(--line-strong);
  border-radius: 10px;
  padding: 2px;
  transition: background .15s;
}
.toggle-pill input:checked + .pill-track { background: var(--accent); }
.pill-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.toggle-pill input:checked + .pill-track .pill-thumb { transform: translateX(16px); }
.toggle-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
}

/* ---- format select ---- */
.out-format { margin-bottom: 18px; }
.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); }

/* ---- info / warn boxes ---- */
.info-box {
  font-size: 12.5px;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 9px;
  margin-top: 14px;
  background: var(--accent-soft);
  color: #4a1a8a;
}

/* ---- 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;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.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);
  width: auto;
}

/* ---- progress ---- */
.bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 16px;
  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: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}
.status-line.show { display: block; }

/* ---- result header ---- */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.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);
}

/* ---- track list ---- */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.track-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  animation: rowIn .2s ease both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.track-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}
.track-info {
  min-width: 0;
}
.track-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-duration {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.track-size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.track-dl {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.track-dl:hover { background: var(--teal); color: #fff; }

@media (max-width: 520px) {
  .track-row { grid-template-columns: 24px 1fr auto; }
  .track-size { display: none; }
}
