/**
 * Full-width audio editor (waveform + timeline).
 * Theme: follows site light/dark (html[data-theme]) like video-editor / pintar-online.
 * Tier 1–2: zoom, multitrack, master EQ, loop, markers, mix preview.
 */

/* ---- Draft restore banner ---- */
.aeditor-draft-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(250, 91, 15, 0.35);
  background: rgba(250, 91, 15, 0.1);
  color: var(--dica-ink, #0f172a);
  font-size: 0.88rem;
  font-weight: 600;
}

html[data-theme='dark'] .aeditor-draft-banner {
  color: #e8eef6;
  background: rgba(250, 91, 15, 0.14);
  border-color: rgba(250, 91, 15, 0.4);
}

.aeditor-draft-banner[hidden] {
  display: none !important;
}

.aeditor-draft-btn {
  appearance: none;
  border: 1px solid rgba(250, 91, 15, 0.45);
  background: #fa5b0f;
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.aeditor-draft-btn.aeditor-draft-dismiss {
  background: transparent;
  color: inherit;
}

/* ---- Workspace shell (light default) ---- */
body.is-fullscreen .fs-workspace.aeditor-fs {
  --ae-bg: #eef1f6;
  --ae-app: #ffffff;
  --ae-panel: #f8fafc;
  --ae-panel-2: #f1f5f9;
  --ae-line: #e2e8f0;
  --ae-text: var(--dica-ink, #0f172a);
  --ae-muted: var(--dica-muted, #64748b);
  --ae-faint: #94a3b8;
  --ae-accent: #fa5b0f;
  --ae-accent-2: #e04f0a;
  --ae-wave: #0284c7;
  --ae-wave-sel: rgba(250, 91, 15, 0.22);
  --ae-btn: #eef2f7;
  --ae-btn-hover: #e2e8f0;
  --ae-input-bg: #ffffff;
  --ae-stage: #dce2ec;
  --ae-stage-glow: rgba(148, 163, 184, 0.35);
  --ae-drop-bg: rgba(255, 255, 255, 0.88);
  --ae-drop-border: #cbd5e1;
  --ae-item: #ffffff;
  --ae-item-hover: #f1f5f9;
  --ae-timeline-bg: #f1f5f9;
  --ae-lane: #ffffff;
  --ae-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 32px rgba(15, 23, 42, 0.07);
  --ae-topbar-h: 52px;
  --ae-timeline-h: 220px;
  --ae-side-w: 240px;
  --ae-danger: #b91c1c;

  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 12px 14px 16px !important;
  box-sizing: border-box;
  background: var(--ae-bg) !important;
  border-color: var(--ae-line) !important;
  color: var(--ae-text);
  min-height: min(78vh, 900px) !important;
  height: min(calc(100vh - 120px), 920px);
  max-height: none;
  overflow: hidden;
}

html[data-theme='dark'] body.is-fullscreen .fs-workspace.aeditor-fs {
  --ae-bg: #0b0e14;
  --ae-app: #151922;
  --ae-panel: #1a2030;
  --ae-panel-2: #12161f;
  --ae-line: #2a3140;
  --ae-text: #e8eef6;
  --ae-muted: rgba(232, 238, 246, 0.62);
  --ae-faint: rgba(232, 238, 246, 0.42);
  --ae-accent: #fa5b0f;
  --ae-accent-2: #ff8a3d;
  --ae-wave: #38bdf8;
  --ae-wave-sel: rgba(250, 91, 15, 0.28);
  --ae-btn: rgba(255, 255, 255, 0.08);
  --ae-btn-hover: rgba(255, 255, 255, 0.14);
  --ae-input-bg: rgba(0, 0, 0, 0.28);
  --ae-stage: #080b11;
  --ae-stage-glow: rgba(40, 60, 90, 0.25);
  --ae-drop-bg: rgba(12, 16, 24, 0.78);
  --ae-drop-border: rgba(255, 255, 255, 0.16);
  --ae-item: rgba(255, 255, 255, 0.04);
  --ae-item-hover: rgba(255, 255, 255, 0.08);
  --ae-timeline-bg: rgba(0, 0, 0, 0.28);
  --ae-lane: rgba(255, 255, 255, 0.03);
  --ae-shadow: none;
  --ae-danger: #fca5a5;
  background: var(--ae-bg) !important;
  border-color: #0a0e14 !important;
}

.aeditor-app {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: min(70vh, 860px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--ae-app);
  color: var(--ae-text);
  font-family: inherit;
  border-radius: 18px;
  border: 1px solid var(--ae-line);
  box-shadow: var(--ae-shadow);
  overflow: hidden;
}

.aeditor-app * {
  box-sizing: border-box;
}

.aeditor-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.aeditor-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---- Top bar ---- */
.aeditor-topbar {
  flex: 0 0 var(--ae-topbar-h);
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(200px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--ae-panel);
  border-bottom: 1px solid var(--ae-line);
  z-index: 5;
}

.aeditor-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.aeditor-brand {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(250, 91, 15, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aeditor-brand svg {
  width: 18px;
  height: 18px;
  fill: var(--ae-accent);
}

.aeditor-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.aeditor-brand-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ae-text);
}

.aeditor-project-meta {
  font-size: 0.72rem;
  color: var(--ae-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aeditor-topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.aeditor-topbar-sep {
  width: 1px;
  height: 22px;
  background: var(--ae-line);
  margin: 0 2px;
}

.aeditor-topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.aeditor-out-label input {
  width: 140px;
  max-width: 28vw;
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-input-bg);
  color: var(--ae-text);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.82rem;
}

.aeditor-out-label input:focus {
  outline: 2px solid var(--ae-accent);
  outline-offset: 1px;
}

/* Buttons */
.aeditor-btn {
  appearance: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 8px 14px;
  transition: background 0.12s ease, opacity 0.12s ease, transform 0.1s ease;
  color: var(--ae-text);
  background: var(--ae-btn);
  white-space: nowrap;
}

.aeditor-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.aeditor-btn:not(:disabled):active {
  transform: scale(0.98);
}

.aeditor-btn:focus-visible {
  outline: 2px solid var(--ae-accent);
  outline-offset: 2px;
}

.aeditor-btn-ghost {
  background: var(--ae-btn);
}

.aeditor-btn-ghost:hover:not(:disabled) {
  background: var(--ae-btn-hover);
}

.aeditor-btn-primary {
  background: linear-gradient(180deg, var(--ae-accent) 0%, #e04f0a 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(250, 91, 15, 0.28);
}

.aeditor-btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff6a1f 0%, var(--ae-accent) 100%);
}

.aeditor-btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: 7px;
}

.aeditor-icon-btn {
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  color: var(--ae-text);
  border-radius: 8px;
  padding: 6px 11px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.aeditor-icon-btn:hover:not(:disabled) {
  background: var(--ae-item-hover);
}

.aeditor-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.aeditor-icon-btn--danger:hover:not(:disabled) {
  border-color: rgba(185, 28, 28, 0.45);
  color: var(--ae-danger);
}

.aeditor-icon-btn--accent {
  border-color: rgba(250, 91, 15, 0.45);
  background: rgba(250, 91, 15, 0.12);
  color: var(--ae-accent);
  font-weight: 750;
}

.aeditor-icon-btn--accent:hover:not(:disabled) {
  background: rgba(250, 91, 15, 0.2);
}

.aeditor-btn-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- Body ---- */
.aeditor-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--ae-side-w) minmax(0, 1fr) var(--ae-side-w);
  gap: 0;
  background: var(--ae-app);
}

.aeditor-panel {
  background: var(--ae-panel);
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aeditor-panel--left {
  border-right: 1px solid var(--ae-line);
}

.aeditor-panel--right {
  border-left: 1px solid var(--ae-line);
}

.aeditor-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ae-faint);
  margin-bottom: 2px;
}

.aeditor-media-list {
  flex: 1 1 auto;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.aeditor-media-empty {
  margin: 12px 4px;
  font-size: 0.82rem;
  color: var(--ae-faint);
  line-height: 1.4;
}

.aeditor-media-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}

.aeditor-media-item:hover {
  background: var(--ae-item-hover);
}

.aeditor-media-item.is-selected {
  border-color: var(--ae-accent);
  background: rgba(250, 91, 15, 0.1);
}

.aeditor-media-idx {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(250, 91, 15, 0.15);
  color: var(--ae-accent);
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aeditor-media-main {
  min-width: 0;
  flex: 1;
}

.aeditor-media-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aeditor-media-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--ae-faint);
  margin-top: 1px;
}

/* Stage / waveform */
.aeditor-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 30%, var(--ae-stage-glow), transparent 55%),
    var(--ae-stage);
}

.aeditor-drop {
  position: absolute;
  inset: 16px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  border: 2px dashed var(--ae-drop-border);
  border-radius: 16px;
  background: var(--ae-drop-bg);
  backdrop-filter: blur(6px);
  cursor: pointer;
  padding: 24px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.aeditor-drop:hover,
.aeditor-drop.is-dragover {
  border-color: var(--ae-accent);
  background: rgba(250, 91, 15, 0.08);
}

.aeditor-drop:focus-visible {
  outline: 2px solid var(--ae-accent);
  outline-offset: 2px;
}

.aeditor-app.has-media .aeditor-drop {
  display: none;
}

.aeditor-drop-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(250, 91, 15, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.aeditor-drop-icon svg {
  width: 30px;
  height: 30px;
  fill: var(--ae-accent);
}

.aeditor-drop h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--ae-text);
}

.aeditor-drop p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ae-muted);
  max-width: 340px;
}

.aeditor-drop-cta {
  margin-top: 10px;
  display: inline-flex;
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--ae-accent) 0%, #e04f0a 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(250, 91, 15, 0.3);
}

.aeditor-editor {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  opacity: 0.35;
  pointer-events: none;
}

.aeditor-app.has-media .aeditor-editor {
  opacity: 1;
  pointer-events: auto;
}

.aeditor-wave-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 18px 8px;
  gap: 8px;
}

.aeditor-wave-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.aeditor-wave-toolbar-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ae-faint);
}

.aeditor-fx-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.aeditor-fx-grid .aeditor-btn {
  width: 100%;
  text-align: center;
}

.aeditor-keys {
  line-height: 1.45;
}

.aeditor-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.aeditor-zoom-label {
  min-width: 3rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ae-muted);
}

.aeditor-snap-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ae-muted);
  cursor: pointer;
  user-select: none;
}

.aeditor-snap-check input {
  accent-color: var(--ae-accent);
}

.aeditor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ae-muted);
  margin-top: 6px;
  cursor: pointer;
}

.aeditor-check input {
  accent-color: var(--ae-accent);
}

.aeditor-master {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aeditor-markers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow: auto;
}

.aeditor-marker-row {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.aeditor-marker-go {
  flex: 1 1 auto;
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  color: var(--ae-text);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.aeditor-marker-go:hover {
  background: var(--ae-item-hover);
}

.aeditor-marker-rm {
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  color: var(--ae-muted);
  border-radius: 8px;
  width: 32px;
  cursor: pointer;
  font: inherit;
}

.aeditor-btn.is-active,
.aeditor-icon-btn.is-active {
  border-color: var(--ae-accent);
  background: rgba(250, 91, 15, 0.14);
  color: var(--ae-accent);
}

.aeditor-loop-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(250, 91, 15, 0.12);
  border-left: 1px solid rgba(250, 91, 15, 0.55);
  border-right: 1px solid rgba(250, 91, 15, 0.55);
  pointer-events: none;
  z-index: 5;
}

.aeditor-ruler-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #eab308;
  transform: translateX(-1px);
  z-index: 2;
}

.aeditor-ruler-marker::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #eab308;
}

.aeditor-wave-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 140px;
  border-radius: 12px;
  border: 1px solid var(--ae-line);
  background: var(--ae-panel);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

html[data-theme='dark'] .aeditor-wave-shell {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  background: var(--ae-panel-2);
}

.aeditor-wave-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 160px;
}

.aeditor-wave-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ae-faint);
  font-size: 0.88rem;
  pointer-events: none;
}

.aeditor-wave-empty[hidden] {
  display: none;
}

.aeditor-transport {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 16px 14px;
}

.aeditor-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  color: var(--ae-text);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.aeditor-play-btn:hover {
  background: var(--ae-item-hover);
}

.aeditor-play-btn:focus-visible {
  outline: 2px solid var(--ae-accent);
  outline-offset: 2px;
}

.aeditor-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: var(--ae-muted);
  min-width: 11rem;
}

/* Right panel */
.aeditor-formats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.aeditor-formats button {
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-item);
  color: var(--ae-text);
  border-radius: 8px;
  padding: 9px 6px;
  font: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: center;
}

.aeditor-formats button:hover {
  background: var(--ae-item-hover);
}

.aeditor-formats button.is-selected {
  border-color: var(--ae-accent);
  background: rgba(250, 91, 15, 0.1);
  box-shadow: inset 0 0 0 1px var(--ae-accent);
}

.aeditor-formats button small {
  display: block;
  font-weight: 550;
  font-size: 0.65rem;
  color: var(--ae-faint);
  margin-top: 2px;
}

.aeditor-clip-empty {
  font-size: 0.82rem;
  color: var(--ae-faint);
  line-height: 1.4;
  padding: 4px 2px;
}

.aeditor-clip-name {
  font-size: 0.88rem;
  font-weight: 700;
  word-break: break-all;
  margin-bottom: 4px;
}

.aeditor-clip-meta {
  font-size: 0.75rem;
  color: var(--ae-muted);
  margin-bottom: 10px;
}

.aeditor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.aeditor-field label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ae-faint);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aeditor-field input,
.aeditor-field select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--ae-line);
  background: var(--ae-input-bg);
  color: var(--ae-text);
  border-radius: 8px;
  padding: 8px 9px;
  font: inherit;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.aeditor-field input:focus,
.aeditor-field select:focus {
  outline: 2px solid var(--ae-accent);
  outline-offset: 1px;
}

.aeditor-slider-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ae-muted);
  margin-top: 8px;
}

.aeditor-slider-label input[type='range'] {
  width: 100%;
  accent-color: var(--ae-accent);
}

.aeditor-hint {
  margin: 10px 0 0;
  font-size: 0.74rem;
  color: var(--ae-faint);
  line-height: 1.35;
}

/* Timeline */
.aeditor-timeline-wrap {
  flex: 0 0 auto;
  background: var(--ae-panel);
  border-top: 1px solid var(--ae-line);
  padding: 8px 12px 12px;
  min-height: var(--ae-timeline-h);
}

.aeditor-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.aeditor-timeline-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ae-faint);
}

.aeditor-timeline-hint {
  font-size: 0.72rem;
  color: var(--ae-faint);
}

.aeditor-timeline {
  background: var(--ae-timeline-bg);
  border: 1px solid var(--ae-line);
  border-radius: 10px;
  padding: 8px 10px 10px;
  overflow-x: auto;
  position: relative;
}

.aeditor-ruler {
  position: relative;
  height: 16px;
  margin-bottom: 6px;
  min-width: 100%;
  border-bottom: 1px solid var(--ae-line);
}

.aeditor-ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--ae-line);
  transform: translateX(-0.5px);
}

.aeditor-ruler-tick span {
  position: absolute;
  top: 0;
  left: 4px;
  font-size: 0.62rem;
  color: var(--ae-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.aeditor-tracks-rel {
  position: relative;
}

.aeditor-tracks-rel {
  position: relative;
  min-width: 100%;
}

.aeditor-track {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 48px;
  margin-bottom: 6px;
}

.aeditor-track-label {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ae-faint);
}

.aeditor-track-lane {
  position: relative;
  flex: 1 1 auto;
  min-height: 44px;
  min-width: 120px;
  border-radius: 8px;
  background: var(--ae-lane);
  border: 1px dashed var(--ae-line);
  color: var(--ae-faint);
  font-size: 0.78rem;
  display: block;
  padding: 0;
}

.aeditor-track-lane.is-empty {
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.aeditor-track-lane:not(.is-empty) {
  border-style: solid;
}

.aeditor-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.72) 0%, rgba(3, 105, 161, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  white-space: nowrap;
  cursor: grab;
  min-width: 24px;
  touch-action: none;
  user-select: none;
}

.aeditor-clip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

html[data-theme='dark'] .aeditor-clip {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.55) 0%, rgba(14, 165, 233, 0.88) 100%);
}

.aeditor-clip.is-selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ae-accent);
  z-index: 2;
}

.aeditor-clip.is-dragging {
  opacity: 0.9;
  cursor: grabbing;
  z-index: 30;
}

.aeditor-clip.has-xfade::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.aeditor-clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 4;
  background: transparent;
}

.aeditor-clip-handle::after {
  content: '';
  position: absolute;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.aeditor-clip:hover .aeditor-clip-handle::after,
.aeditor-clip.is-selected .aeditor-clip-handle::after {
  opacity: 1;
}

.aeditor-clip-handle--l {
  left: 0;
}

.aeditor-clip-handle--l::after {
  left: 2px;
}

.aeditor-clip-handle--r {
  right: 0;
}

.aeditor-clip-handle--r::after {
  right: 2px;
}

.aeditor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ae-accent);
  z-index: 20;
  pointer-events: none;
  transform: translateX(-1px);
}

.aeditor-transport .aeditor-btn-sm {
  min-width: 2.2rem;
}

.aeditor-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--ae-accent);
}

/* Progress / result / status (visibility via .is-visible from media-tools) */
.aeditor-app .aeditor-progress {
  flex: 0 0 auto;
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 10px 14px;
  background: var(--ae-panel-2);
  border-top: 1px solid var(--ae-line);
  align-items: center;
  gap: 12px;
}

.aeditor-app .mtool-progress-bar {
  background: rgba(15, 23, 42, 0.08);
}

html[data-theme='dark'] .aeditor-app .mtool-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.aeditor-app .mtool-progress-text {
  color: var(--ae-muted);
}

.aeditor-app .aeditor-result {
  flex: 0 0 auto;
  margin: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 12px 14px;
  background: var(--ae-panel);
  border-top: 1px solid var(--ae-line);
}

.aeditor-app .aeditor-result audio {
  width: 100%;
  margin-top: 8px;
  max-height: 40px;
}

.aeditor-app .aeditor-status {
  flex: 0 0 auto;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--ae-line);
  padding: 6px 14px;
  font-size: 0.78rem;
  background: var(--ae-panel);
  color: var(--ae-danger);
}

.aeditor-app .aeditor-status:empty {
  display: none;
  border: 0;
  padding: 0;
}

/* Recording pulse */
.aeditor-icon-btn.is-recording {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  animation: aeditor-pulse 1.2s ease infinite;
}

@keyframes aeditor-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

/* ---- Responsive ---- */
@media (max-width: 980px) {
  body.is-fullscreen .fs-workspace.aeditor-fs {
    height: auto;
    min-height: 0 !important;
    max-height: none;
    overflow: auto;
  }

  .aeditor-app {
    min-height: 0;
    height: auto;
  }

  .aeditor-topbar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    padding: 10px;
    gap: 8px;
  }

  .aeditor-topbar-center,
  .aeditor-topbar-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .aeditor-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(280px, 42vh) auto;
  }

  .aeditor-panel--left,
  .aeditor-panel--right {
    border: 0;
    border-bottom: 1px solid var(--ae-line);
    max-height: 220px;
  }

  .aeditor-timeline-hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .aeditor-brand-text strong {
    font-size: 0.82rem;
  }

  .aeditor-out-label input {
    width: 100px;
  }

  .aeditor-fields {
    grid-template-columns: 1fr;
  }

  /* Compact topbar: fewer wrapped rows */
  .aeditor-topbar {
    padding: 8px;
    gap: 6px;
  }

  .aeditor-topbar-center {
    gap: 4px;
    max-height: 76px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .aeditor-topbar-center .aeditor-icon-btn {
    flex: 0 0 auto;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .aeditor-topbar-sep {
    flex: 0 0 1px;
  }

  .aeditor-timeline-hint {
    display: none;
  }

  body.is-fullscreen .fs-workspace.aeditor-fs {
    --ae-timeline-h: 180px;
    padding: 8px 8px 12px !important;
  }
}
