:root {
  color-scheme: light;
  --fs-h1: 42px; --fs-h2: 34px; --fs-h3: 28px; --fs-h4: 24px;
  --fs-body: 20px; --fs-meta: 18px; --fs-tag: 16px;
  --page: #f7f7f3; --card: #fff; --ink: #182220; --muted: #52625e; --line: #d5dcd7;
  --tint: #e9ede8; --soft: #f3f5f1; --blue: #184fc0; --on-blue: #fff; --focus: #3973e1;
  --selected: #edf3ff; --disabled: #e4e8e3; --disabled-text: #616d69; --error: #a52a20;
  --track: #c5cfca;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", sans-serif;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --page: #141817; --card: #1c2221; --ink: #f2f4ef; --muted: #b8c4c0; --line: #38443f;
  --tint: #27342f; --soft: #212b27; --blue: #aac7ff; --on-blue: #142441; --focus: #9dbdff;
  --selected: #22334e; --disabled: #313a36; --disabled-text: #bdc8c4; --error: #ffb5a6;
  --track: #52615a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; background: var(--page); color: var(--ink); font-size: var(--fs-body); line-height: 1.45; }
h1, h2, p, ul { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: none; }
button:disabled, input:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.ic-fill { fill: currentColor; stroke: none; }
.topbar, .workbench { width: 100%; max-width: 1512px; margin-inline: auto; padding-inline: clamp(18px,3.2vw,58px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 24px; }
.brand { display: flex; align-items: center; gap: 14px; font-size: var(--fs-h1); font-weight: 670; line-height: 1.08; letter-spacing: -.06em; }
.brand-wave { display: grid; flex: none; place-items: center; width: 38px; height: 36px; color: var(--on-blue); background: var(--blue); border: 2px solid var(--ink); border-radius: 7px; }
.brand-wave .ic { width: 26px; height: 26px; stroke-width: 2; }
.appearance { display: grid; place-items: center; border-radius: 50%; width: 44px; height: 44px; flex: none; background: var(--card); border: 1px solid var(--line); }
.appearance i { width: 18px; height: 18px; border: 1.6px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.workbench { flex: 1 0 auto; display: grid; align-items: start; grid-template-columns: minmax(260px,.67fr) minmax(0,1.45fr); gap: clamp(18px,2.5vw,38px); padding-block: 8px 36px; }
.left, .right { min-width: 0; }
h2 { font-size: var(--fs-h2); line-height: 1.16; font-weight: 650; letter-spacing: -.045em; }
.left { padding-top: 13px; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 226px; margin-top: 17px; padding: 22px 18px; text-align: center; background: var(--card); border: 1.5px dashed var(--line); border-radius: 14px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--blue); background: var(--selected); }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 1px; color: var(--blue); background: var(--selected); border-radius: 10px; }
.drop-icon .ic { width: 23px; height: 23px; }
.drop-title { font-size: var(--fs-h4); font-weight: 650; letter-spacing: -.035em; }
.drop-hint, .hint { color: var(--muted); font-size: var(--fs-meta); }
.drop-btn, .download, .reset, select, .modal-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 7px 15px; border: 1px solid var(--line); border-radius: 8px; font-size: var(--fs-meta); font-weight: 600; }
.drop-btn, .download { border-color: var(--blue); color: var(--on-blue); background: var(--blue); }
.drop-btn { margin-top: 5px; }
.files { display: grid; gap: 6px; margin-top: 12px; padding: 0; list-style: none; }
.files li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 5px 4px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: var(--fs-meta); cursor: pointer; }
.files li:hover { border-color: var(--muted); }
.files li.active { border-color: var(--blue); background: var(--selected); }
.nm { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.len, .time, .row-val { font-variant-numeric: tabular-nums; }
.len, .time { color: var(--muted); font-size: var(--fs-tag); }
.right { padding: clamp(17px,2vw,28px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: var(--fs-h3); }
.ab { display: flex; align-items: center; gap: 7px; font-size: var(--fs-tag); color: var(--muted); }
.ab .active { color: var(--ink); font-weight: 650; }
.switch { position: relative; width: 44px; height: 44px; padding: 0; }
.switch::before, .switch::after { content: ""; position: absolute; top: 50%; transform: translateY(-50%); border-radius: 100px; }
.switch::before { width: 42px; height: 24px; left: 1px; background: var(--track); }
.switch.on::before { background: var(--blue); }
.switch::after { left: 4px; width: 18px; height: 18px; background: var(--card); }
.switch.on::after { left: 22px; background: var(--on-blue); }
.hint { margin: 5px 0 0; }
.transport { display: flex; align-items: center; gap: 12px; padding: 9px 13px; margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.play, .icon, .del { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none; border-radius: 8px; color: var(--muted); }
.play { width: 44px; height: 44px; background: var(--ink); color: var(--card); border-radius: 50%; }
.play .ic { width: 18px; height: 18px; }
.del:hover, .icon.muted { color: var(--error); }
.icon:hover, .del:hover, .appearance:hover, .reset:hover { background-color: var(--tint); }
.seek { min-width: 0; flex: 1; }
.row { display: grid; grid-template-columns: minmax(140px,.9fr) minmax(100px,1fr) 55px 40px; grid-template-rows: auto auto; align-items: center; column-gap: 12px; min-height: 82px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.rows:has([data-dl]) .row { grid-template-columns: minmax(130px,.9fr) minmax(90px,1fr) 55px 40px 40px; }
.row-top { display: contents; }
.row-name { grid-area: 1 / 1; font-size: var(--fs-body); font-weight: 600; }
.row-note { grid-area: 2 / 1; color: var(--muted); font-size: var(--fs-tag); }
.row-val { grid-area: 1 / 3 / 3 / 4; text-align: right; font-size: var(--fs-meta); font-weight: 600; }
.row.changed .row-val { color: var(--blue); }
.row [data-mute] { grid-area: 1 / 4 / 3 / 5; }
.row [data-dl] { grid-area: 1 / 5 / 3 / 6; }
.row input { grid-area: 1 / 2; }
.scale { grid-area: 2 / 2; display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-tag); }
input[type=range] { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 28px; padding: 0; margin: 0; background: transparent; cursor: pointer; accent-color: var(--blue); }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--track) var(--fill, 0%), var(--blue) var(--fill, 0%) var(--fill-end, 0%), var(--track) var(--fill-end, 0%)); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--track) var(--fill, 0%), var(--blue) var(--fill, 0%) var(--fill-end, 0%), var(--track) var(--fill-end, 0%)); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 17px; height: 17px; margin-top: -6px; border: 2px solid var(--blue); border-radius: 50%; background: var(--card); }
input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid var(--blue); border-radius: 50%; background: var(--card); }
.empty .ab, .empty .output { pointer-events: none; }
.empty .ab, .empty .rows { --blue: var(--disabled-text); }
.empty .ab, .empty .row-val, .empty .row-name { color: var(--muted); }
.empty .play, .download:disabled { background: var(--disabled); border-color: var(--disabled); color: var(--disabled-text); }
.output { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 17px; }
.export-group, .modal-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.export-group label { font-size: var(--fs-tag); color: var(--muted); }
.reset, select, .btn-cancel { color: var(--ink); background: var(--card); }
.reset .ic { width: 17px; }
.download:not(:disabled):hover { filter: brightness(.94); }
.report { display: block; text-align: right; margin-top: 10px; color: var(--muted); font-size: var(--fs-tag); font-variant-numeric: tabular-nums; }
.status { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 28px); padding: 12px 20px; border-radius: 10px; background: var(--ink); color: var(--card); font-size: var(--fs-meta); }
.spin { width: 18px; height: 18px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.modal-back { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 18px; background: rgb(0 0 0 / .5); }
.modal { width: min(100%,380px); padding: 24px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; }
.modal-title { font-size: var(--fs-h4); font-weight: 650; }
.modal-body { margin: 8px 0 20px; font-size: var(--fs-meta); color: var(--muted); overflow-wrap: anywhere; }
.modal-btns { justify-content: end; }
.btn-danger { color: var(--card); background: var(--error); }
@media (max-width: 900px) {
  .workbench { grid-template-columns: minmax(0,1fr); }
  .left { padding-top: 0; }
  .drop { flex-direction: row; flex-wrap: wrap; column-gap: 10px; min-height: 96px; padding: 12px 16px; }
  .drop-icon, .drop-btn { margin: 0; }
  .drop-title { font-size: var(--fs-body); }
}
@media (max-width: 680px) {
  :root { --fs-h1: 35px; --fs-h2: 28px; --fs-h3: 24px; --fs-h4: 21px; --fs-body: 18px; --fs-meta: 16px; --fs-tag: 15px; }
  .topbar { padding-block: 18px; }
  .brand { gap: 9px; }
  .brand-wave { width: 30px; height: 30px; }
  .brand-wave .ic { width: 20px; height: 20px; }
  .workbench { gap: 16px; padding-block: 4px 24px; }
  .drop { display: grid; grid-template-columns: auto minmax(0,1fr) auto; justify-items: start; gap: 0 8px; margin-top: 12px; text-align: left; }
  .drop-icon { grid-area: 1 / 1 / 3 / 2; width: 36px; height: 36px; }
  .drop-title { grid-area: 1 / 2; align-self: end; }
  .drop-hint { grid-area: 2 / 2; align-self: start; }
  .drop-btn { grid-area: 1 / 3 / 3 / 4; padding-inline: 10px; }
  .right { padding: 15px; }
  .row, .rows:has([data-dl]) .row { grid-template-columns: minmax(0,1fr) auto auto auto; row-gap: 0; column-gap: 6px; min-height: 0; padding: 11px 0 9px; }
  .row-name { grid-area: 1 / 1; }
  .row-val { grid-area: 1 / 4; min-width: 38px; }
  .row [data-mute] { grid-area: 1 / 2; }
  .row [data-dl] { grid-area: 1 / 3; }
  .row-note { grid-area: 2 / 1 / 3 / -1; }
  .row input { grid-area: 3 / 1 / 4 / -1; }
  .scale { grid-area: 4 / 1 / 5 / -1; }
  .icon, .del { width: 38px; height: 38px; }
  .export-group { margin-left: auto; }
  .time { white-space: nowrap; }
  .transport { gap: 8px; }
}
@media (max-width: 365px) {
  .topbar, .workbench { padding-inline: 12px; }
  .drop-icon { display: none; }
  .drop { grid-template-columns: minmax(0,1fr) auto; }
  .drop-title, .drop-hint { grid-column: 1; }
  .drop-btn { grid-column: 2; }
  .export-group { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.credits-link { color: var(--muted); font-size: var(--fs-tag); text-underline-offset: .2em; }
.credits-link { align-self: center; margin: 0 0 18px; }
.usage, .filename { margin-top: 16px; color: var(--muted); font-size: var(--fs-meta); line-height: 1.6; overflow-wrap: anywhere; }
.filename { margin-bottom: 8px; font-weight: 600; color: var(--ink); }
#cancel { color: inherit; text-decoration: underline; white-space: nowrap; min-height: 32px; }
#report[data-error=true] { color: var(--error); }
