:root {
  --bg: #111318;
  --panel: #1a1d25;
  --panel-2: #222633;
  --border: #2d3242;
  --text: #e8eaf0;
  --muted: #8b91a5;
  --accent: #7c9cff;
  --accent-2: #4fd1a5;
  --danger: #ff6b6b;
  --wave: #5b6482;
  --wave-sel: #b9c6ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top, main, footer { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.top { padding-top: 28px; }
.top h1 { margin: 0 0 4px; font-size: 28px; }
.top p { margin: 0 0 20px; color: var(--muted); }
footer { padding: 28px 16px 40px; color: var(--muted); font-size: 13px; }
footer a { color: var(--muted); }

.muted { color: var(--muted); }
.spacer { flex: 1; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 28px 16px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop span { color: var(--muted); font-size: 13px; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--panel-2); outline: none; }

.status { color: var(--muted); margin: 12px 0 0; }
.status.err { color: var(--danger); }

.clips { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

.clip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 14px;
}
.clip.dragging { opacity: .5; }
.clip.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.clip.drop-after { box-shadow: 0 3px 0 var(--accent); }

.clip-head, .clip-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clip-head { margin-bottom: 10px; cursor: grab; }
.clip-head .num {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #0b0d12; font-weight: 700; font-size: 13px;
}
.clip-head .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 50%; }
.clip-head .dur { font-size: 13px; }

.wave {
  position: relative; height: 96px;
  background: var(--panel-2);
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shade { position: absolute; top: 0; bottom: 0; background: rgba(10, 12, 18, .6); pointer-events: none; }
.shade.left { left: 0; }
.shade.right { right: 0; }
/* The selection is marked only by a thin white line at each end (everything
   outside is dimmed). The handles are invisible, just wider hit areas for
   dragging the lines. */
.sel {
  position: absolute; top: 0; bottom: 0;
  cursor: grab;
}
.handle {
  position: absolute; top: 0; bottom: 0; width: 16px;
  cursor: ew-resize;
}
.handle::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; margin-left: -.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(10, 12, 18, .45);
  pointer-events: none;
}
.h-start { left: -8px; }
.h-end { right: -8px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-2); left: 0; display: none; pointer-events: none; }

.clip-foot { margin-top: 10px; font-size: 14px; }
.clip-foot label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.clip-foot input[type=text] {
  width: 80px; padding: 5px 8px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-variant-numeric: tabular-nums;
}
.clip-foot input[type=text].bad { border-color: var(--danger); }
.vol input { width: 100px; }

button, .btn {
  font: inherit; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b0d12; font-weight: 600; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.icon { padding: 2px 9px; font-size: 16px; line-height: 1.4; }
button.rm:hover { border-color: var(--danger); color: var(--danger); }
button.icon:disabled { opacity: .35; cursor: default; }
.btn.disabled { opacity: .5; pointer-events: none; }

.build { margin-top: 26px; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.build h2 { margin: 0 0 12px; font-size: 18px; }
.opts { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.opts label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 14px; }
.opts select { padding: 6px 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.slider-row { display: flex; align-items: center; gap: 10px; color: var(--text); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
progress { width: 100%; height: 8px; margin-top: 12px; }
.result { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.result audio { width: 100%; }

@media (max-width: 560px) {
  .clip-head .name { max-width: 100%; order: 5; flex-basis: 100%; }
  .vol { margin-left: 0; }
}

/* time marks under the waveform */
.ruler {
  position: relative; height: 18px; margin-top: 2px;
  font-size: 11px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  user-select: none; pointer-events: none;
}
.ruler .mark {
  position: absolute; top: 0; padding-top: 6px;
  transform: translateX(-50%); white-space: nowrap; line-height: 1.2;
}
.ruler .mark::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 1px; height: 4px; background: var(--muted);
}
.ruler .mark.first { transform: none; }
.ruler .mark.first::before { left: 0; }
.ruler .mark.last { transform: translateX(-100%); }
.ruler .mark.last::before { left: 100%; }

/* "Hear transition" row between two parts */
.trans { display: flex; align-items: center; justify-content: center; gap: 12px; margin: -6px 0; }
.trans::before, .trans::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.trans-btn { padding: 4px 14px; font-size: 13px; border-radius: 999px; }
.trans-btn.playing { border-color: var(--accent-2); color: var(--accent-2); }
.trans-label { font-size: 12px; white-space: nowrap; }
