/* MP3 cutter and M4A to MP3 converter (audio-edit.js). Site tokens only, so dark mode follows them. */
[data-webtool="audioedit"] [hidden] { display: none !important; }
[data-webtool="audioedit"] .ae-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
[data-webtool="audioedit"] .ae-probe { display: none; }
[data-webtool="audioedit"] .wt-status.ae-bad { color: var(--bad); }

/* file picker: the transparent input covers the zone, so clicks, taps and native drops all land on it */
[data-webtool="audioedit"] .ae-drop { position: relative; display: grid; justify-items: center; align-content: center; gap: 0.3rem; min-height: 136px; padding: 1.25rem 1rem; text-align: center; font-size: 0.9rem; color: var(--text-2); background: var(--bg); border: 2px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s ease; }
[data-webtool="audioedit"] .ae-drop:hover, .ux-drag [data-webtool="audioedit"] .ae-drop { border-color: var(--accent); }
[data-webtool="audioedit"] .ae-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-webtool="audioedit"] .ae-drop .ae-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; font-size: 0; }
[data-webtool="audioedit"] .ae-drop-icon { width: 30px; height: 30px; color: var(--accent); }
[data-webtool="audioedit"] .ae-drop-title { font-size: 1.05rem; font-weight: 600; color: var(--text); }
[data-webtool="audioedit"] .ae-drop-sub { display: block; max-width: 36rem; }
[data-webtool="audioedit"] .ae-drop-name { max-width: 100%; margin-top: 0.2rem; padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); background: var(--bg-2); color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
[data-webtool="audioedit"] .ae-drop.is-compact { min-height: 0; padding: 0.75rem 1rem; }
[data-webtool="audioedit"] .ae-drop.is-compact .ae-drop-icon, [data-webtool="audioedit"] .ae-drop.is-compact .ae-drop-sub { display: none; }

/* editor */
[data-webtool="audioedit"] .ae-editor { display: grid; gap: 0.9rem; min-width: 0; }
[data-webtool="audioedit"] .ae-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); gap: 0.5rem; }
[data-webtool="audioedit"] .ae-stats strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
[data-webtool="audioedit"] .ae-hint { margin: 0; font-size: 0.85rem; color: var(--text-2); }
[data-webtool="audioedit"] .ae-lens { margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
[data-webtool="audioedit"] .ae-time { font-variant-numeric: tabular-nums; }

/* waveform: handles are 44px wide hit areas centred on a 2px line; the wrap's side padding gives them room at the edges */
[data-webtool="audioedit"] .ae-wave-wrap { padding: 8px 14px; }
[data-webtool="audioedit"] .ae-wave { position: relative; height: 140px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: text; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
[data-webtool="audioedit"] .ae-canvas { display: block; width: 100%; height: 100%; border-radius: inherit; }
[data-webtool="audioedit"] .ae-playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 1; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
[data-webtool="audioedit"] .ae-handle { position: absolute; top: -8px; bottom: -8px; left: 0; z-index: 2; width: 44px; margin-left: -22px; cursor: ew-resize; touch-action: none; -webkit-tap-highlight-color: transparent; }
[data-webtool="audioedit"] .ae-handle:focus, [data-webtool="audioedit"] .ae-handle:focus-visible { outline: none; }
[data-webtool="audioedit"] .ae-handle::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 21px; width: 2px; background: var(--accent); }
[data-webtool="audioedit"] .ae-handle::after { content: ""; position: absolute; left: 14px; width: 16px; height: 26px; box-sizing: border-box; border: 2px solid var(--surface-raised); border-radius: 8px; background: var(--accent); }
[data-webtool="audioedit"] .ae-handle-start::after { top: 0; }
[data-webtool="audioedit"] .ae-handle-end::after { bottom: 0; }
[data-webtool="audioedit"] .ae-handle:focus-visible::after, [data-webtool="audioedit"] .ae-handle.is-drag::after { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-webtool="audioedit"].is-remove .ae-handle::before, [data-webtool="audioedit"].is-remove .ae-handle::after { background: var(--bad); }
[data-webtool="audioedit"].is-remove .ae-handle:focus-visible::after, [data-webtool="audioedit"].is-remove .ae-handle.is-drag::after { outline-color: var(--bad); }
[data-webtool="audioedit"] .ae-ruler { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: -0.6rem; padding: 0 14px; font-size: 0.78rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
[data-webtool="audioedit"] .ae-pos { color: var(--text); font-weight: 600; }
@media (max-width: 734px) { [data-webtool="audioedit"] .ae-wave { height: 116px; } }

/* progress */
[data-webtool="audioedit"] .ae-progress { display: grid; gap: 0.35rem; }
[data-webtool="audioedit"] .ae-track { height: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
[data-webtool="audioedit"] .ae-bar, [data-webtool="audioedit"] .ae-mini-bar { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.2s linear; }
[data-webtool="audioedit"] .is-wait .ae-bar, [data-webtool="audioedit"] .is-wait .ae-mini-bar { width: 35%; transform: none; transition: none; animation: ae-wait 1.2s ease-in-out infinite alternate; }
@keyframes ae-wait { from { transform: translateX(0); } to { transform: translateX(186%); } }
[data-webtool="audioedit"] .ae-progress-text { font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* export result */
[data-webtool="audioedit"] .ae-result { display: grid; gap: 0.75rem; padding: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
[data-webtool="audioedit"] .ae-result-title { margin: 0; font-weight: 600; color: var(--text); }
[data-webtool="audioedit"] .ae-preview { display: block; width: 100%; }
[data-webtool="audioedit"] .ae-result.is-stale .ae-stats, [data-webtool="audioedit"] .ae-result.is-stale .ae-preview { opacity: 0.55; }
[data-webtool="audioedit"] .ae-stale { margin: 0; font-size: 0.85rem; color: var(--text-2); }

/* converter file list */
[data-webtool="audioedit"] .ae-list { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
[data-webtool="audioedit"] .ae-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
[data-webtool="audioedit"] .ae-table th, [data-webtool="audioedit"] .ae-table td { padding: 0.55rem 0.5rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
[data-webtool="audioedit"] .ae-table thead th { font-size: 0.78rem; font-weight: 600; color: var(--text-2); text-transform: none; letter-spacing: normal; }
[data-webtool="audioedit"] .ae-c-name { min-width: 9rem; overflow-wrap: anywhere; }
[data-webtool="audioedit"] .ae-fname { display: block; font-weight: 600; color: var(--text); }
[data-webtool="audioedit"] .ae-fsize { display: block; font-size: 0.78rem; color: var(--text-2); }
[data-webtool="audioedit"] .ae-c-dur { white-space: nowrap; color: var(--text-2); }
[data-webtool="audioedit"] .ae-c-st { min-width: 8rem; color: var(--text-2); }
[data-webtool="audioedit"] .is-working .ae-st { color: var(--text); }
[data-webtool="audioedit"] .is-done .ae-st { color: var(--ok); font-weight: 600; }
[data-webtool="audioedit"] .is-error .ae-st { color: var(--bad); }
[data-webtool="audioedit"] .ae-mini { display: block; height: 4px; margin-top: 0.35rem; overflow: hidden; background: var(--bg-2); border-radius: var(--radius-pill); }
[data-webtool="audioedit"] .ae-c-act { white-space: nowrap; text-align: right; }
[data-webtool="audioedit"] .ae-c-act .btn { min-height: 44px; }
[data-webtool="audioedit"] .ae-rm { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: 0.25rem; padding: 0; vertical-align: middle; border: 0; border-radius: 50%; background: none; color: var(--text-2); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
[data-webtool="audioedit"] .ae-rm:hover { background: var(--bg-2); color: var(--text); }
[data-webtool="audioedit"] .ae-rm:disabled { visibility: hidden; }
@media (max-width: 560px) {
  [data-webtool="audioedit"] .ae-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  [data-webtool="audioedit"] .ae-table, [data-webtool="audioedit"] .ae-table tbody { display: block; width: 100%; }
  [data-webtool="audioedit"] .ae-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.15rem 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
  [data-webtool="audioedit"] .ae-table td { display: block; min-width: 0; padding: 0; border: 0; }
  [data-webtool="audioedit"] .ae-c-name { grid-column: 1 / -1; }
  [data-webtool="audioedit"] .ae-c-dur, [data-webtool="audioedit"] .ae-c-st { grid-column: 1; }
  [data-webtool="audioedit"] .ae-c-dur::before { content: attr(data-label) ": "; }
  [data-webtool="audioedit"] .ae-c-act { grid-column: 2; grid-row: 2 / span 2; }
}

@media (prefers-reduced-motion: reduce) {
  [data-webtool="audioedit"] .ae-drop, [data-webtool="audioedit"] .ae-bar, [data-webtool="audioedit"] .ae-mini-bar { transition: none; }
  [data-webtool="audioedit"] .is-wait .ae-bar, [data-webtool="audioedit"] .is-wait .ae-mini-bar { width: 100%; opacity: 0.35; animation: none; }
}
