:root {
  --bg: #f6f4fb; --panel: #ffffff; --ink: #1b1726; --muted: #625b73; --line: #e4e0ee;
  --accent: #6b3fd4; --accent-ink: #ffffff; --accent-soft: #efe9fd;
  --wave: #c9bdf0; --wave-done: #6b3fd4; --head: #e0457b; --shade: rgba(27, 23, 38, .08);
  --ok: #157f3b; --ok-soft: #e7f6ec; --bad: #b42318; --bad-soft: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #100d18; --panel: #1a1626; --ink: #ece8f6; --muted: #a59dba; --line: #2d2740;
  --accent: #b39cff; --accent-ink: #160f2c; --accent-soft: #2a2245;
  --wave: #3f3566; --wave-done: #b39cff; --head: #ff7aa8; --shade: rgba(0, 0, 0, .35);
  --ok: #4ade80; --ok-soft: #12301d; --bad: #f87171; --bad-soft: #3a1414;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h2 { font-size: 15px; margin: 0 0 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.backlink { text-decoration: none; color: var(--muted); }
.backlink:hover { color: var(--ink); }
.sep { color: var(--line); }
.topactions { display: flex; align-items: center; gap: 10px; }
.freebadge { font-size: 12px; color: var(--ok); background: var(--ok-soft); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }

button, input, select { font: inherit; color: inherit; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 7px 12px; cursor: pointer; }
.ghost:hover { border-color: var(--muted); }
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 9px; padding: 8px 16px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { opacity: .55; cursor: progress; }
.small { padding: 4px 10px; font-size: 13px; }
.big { padding: 11px 22px; font-size: 16px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; }
.linklike { color: var(--accent); text-decoration: underline; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, .drop:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
.hero h1 { font-size: clamp(26px, 4.4vw, 36px); line-height: 1.15; margin: 0 0 6px; letter-spacing: -.01em; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 640px; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 30px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.compact { padding: 12px 16px; display: none; }
.dropicon { font-size: 34px; line-height: 1; color: var(--accent); margin-bottom: 6px; }
.droptitle { margin: 0 0 4px; font-size: 17px; }
.dropsub, .dropor { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.msg { margin: 12px 0 0; padding: 9px 12px; border-radius: 9px; background: var(--accent-soft); font-size: 14px; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }

.studio { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.trackhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.trackname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.trackname .muted { font-weight: 400; font-size: 13px; }
.wavebox { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg); }
#wave { display: block; width: 100%; height: 120px; cursor: pointer; touch-action: none; }
.transport { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.play { min-width: 104px; }
.time { font-variant-numeric: tabular-nums; }
.ab { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.outlen { font-size: 13px; margin-left: auto; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.preset {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 99px; padding: 8px 16px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.preset:hover { border-color: var(--accent); }
.preset[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.customtag { font-size: 13px; color: var(--muted); border: 1px dashed var(--line); border-radius: 99px; padding: 6px 12px; }

.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ctl { display: grid; grid-template-columns: 110px minmax(0, 1fr) 76px; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.ctl > span { color: var(--muted); }
.ctl output { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.ctl.off { opacity: .45; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; height: 24px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

.exportgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
input[type="text"], input[type="number"], select {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 9px; min-width: 0; width: 100%;
}
input.bad { border-color: var(--bad); }
.exportrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.progress { margin-top: 14px; }
.steps { display: flex; gap: 18px; list-style: none; padding: 0; margin: 0 0 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.steps li::before { content: "\25CB  "; }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { content: "\25D4  "; color: var(--accent); }
.steps li.done { color: var(--ok); }
.steps li.done::before { content: "\2713  "; }
.steps li.skip { text-decoration: line-through; }
.bar { height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.barfill { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.result p { margin: 0; overflow-wrap: anywhere; }
#resultAudio { width: 100%; margin-top: 12px; }

.about { margin-top: 28px; max-width: 760px; color: var(--muted); font-size: 14px; }
.about h2 { color: var(--ink); }
.about strong { color: var(--ink); }
.foot { border-top: 1px solid var(--line); padding: 18px 20px; text-align: center; color: var(--muted); font-size: 13px; }

body.loaded .drop { padding: 12px 16px; }
body.loaded .drop .dropicon, body.loaded .drop .dropsub { display: none; }
body.loaded .drop .droptitle { font-size: 15px; }

@media (max-width: 760px) {
  .wrap { padding: 16px 16px 32px; }
  .topbar { padding: 8px 16px; }
  .freebadge { display: none; }
  .controls { grid-template-columns: minmax(0, 1fr); }
  .ctl { grid-template-columns: 92px minmax(0, 1fr) 64px; gap: 8px; }
  .exportgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exportgrid .field:last-child { grid-column: 1 / -1; }
  .outlen { margin-left: 0; width: 100%; }
  .preset { padding: 7px 13px; font-size: 13px; }
}
