/* VoiceRecorder · estilos */

:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --surface: #12151b;
  --surface-2: #181c24;
  --surface-3: #20252f;
  --border: #252b36;
  --border-strong: #353c4b;
  --text: #e9ecf2;
  --muted: #8f98ab;
  --faint: #5c6578;
  --accent: #3fc1b0;
  --accent-strong: #63d7c8;
  --accent-ink: #03201c;
  --accent-soft: rgba(63, 193, 176, 0.14);
  --rec: #ef4444;
  --rec-soft: rgba(239, 68, 68, 0.16);
  --warn: #f0a020;
  --ok: #34c77b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --wave-bg: #0d1015;
  --wave: #3fc1b0;
  --wave-center: #252b36;
  --wave-guide: #f0a020;
  --ruler-bg: #141820;
  --wave-sel: rgba(255, 255, 255, 0.14);
  --wave-sel-edge: rgba(255, 255, 255, 0.65);
  --wave-cut: rgba(239, 68, 68, 0.22);
  --wave-cut-line: rgba(239, 68, 68, 0.55);
  --wave-silence: rgba(120, 130, 150, 0.26);
  --wave-cursor: #ffffff;
  --wave-playhead: #fbbf24;
  --wave-join: rgba(239, 68, 68, 0.75);
  --ov-view: rgba(255, 255, 255, 0.1);
  --lane-bg: #0a0c10;
  --lane-voice: #3fc1b0;
  --lane-silence: #3d4555;
  --lane-breath: #c08a3e;
  --lane-threshold: #f0a020;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eef0f4;
    --surface: #ffffff;
    --surface-2: #f5f6f9;
    --surface-3: #eaedf2;
    --border: #dde1e8;
    --border-strong: #c7ccd6;
    --text: #171a21;
    --muted: #5f687b;
    --faint: #98a0b0;
    --accent: #0f8f80;
    --accent-strong: #0c7a6d;
    --accent-ink: #ffffff;
    --accent-soft: rgba(15, 143, 128, 0.12);
    --rec: #dc2626;
    --rec-soft: rgba(220, 38, 38, 0.1);
    --warn: #b86e00;
    --ok: #15803d;
    --shadow: 0 10px 30px rgba(20, 30, 50, 0.12);

    --wave-bg: #fafbfc;
    --wave: #1f6f66;
    --wave-center: #d6dae2;
    --wave-guide: #c77700;
    --ruler-bg: #eef0f4;
    --wave-sel: rgba(15, 143, 128, 0.15);
    --wave-sel-edge: rgba(15, 80, 72, 0.7);
    --wave-cut: rgba(220, 38, 38, 0.13);
    --wave-cut-line: rgba(220, 38, 38, 0.45);
    --wave-silence: rgba(100, 110, 130, 0.16);
    --wave-cursor: #111111;
    --wave-playhead: #d97706;
    --wave-join: rgba(220, 38, 38, 0.8);
    --ov-view: rgba(15, 143, 128, 0.12);
    --lane-bg: #f1f3f6;
    --lane-voice: #2a9d8f;
    --lane-silence: #b9c0cc;
    --lane-breath: #d4953f;
    --lane-threshold: #d97706;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

select {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 11px/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  text-align: center;
}

.i {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grow {
  flex: 1;
}

.show-sm {
  display: none !important;
}

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

/* Botones ------------------------------------------------------------------ */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn.icon {
  width: 36px;
  padding: 0;
}

.btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.btn.toggle.active {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}

#btn-monitor.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Barra superior ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0 4px var(--rec-soft);
}

.project {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.project-name {
  width: min(340px, 100%);
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
}

.project-name:hover,
.project-name:focus {
  border-color: var(--border);
  background: var(--surface-2);
  outline: none;
}

.save-state {
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.save-state[data-state='save.failed'] {
  color: var(--rec);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 4px 0 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
}

.lang-picker:hover {
  background: var(--surface-3);
}

.lang-picker select {
  height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 12px;
  z-index: 40;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu[hidden] {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-3);
}

/* Distribución ------------------------------------------------------------- */

.layout {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 16px;
  padding: 16px 20px 24px;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Transporte --------------------------------------------------------------- */

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  padding: 14px 18px;
}

.transport-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rec-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 22px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.rec-btn:hover {
  background: var(--surface-3);
}

.rec-btn:active,
.play-btn:active {
  transform: scale(0.97);
}

.rec-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0 4px var(--rec-soft);
  transition: border-radius 0.15s, transform 0.15s;
}

.is-recording .rec-btn {
  border-color: transparent;
  background: var(--rec);
  color: #fff;
  animation: rec-pulse 1.6s ease-in-out infinite;
}

.is-recording .rec-icon {
  border-radius: 5px;
  background: #fff;
  box-shadow: none;
  transform: scale(0.62);
}

@keyframes rec-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.play-btn {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.play-btn:hover:not(:disabled) {
  background: var(--surface-3);
}

.play-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.play-btn.playing {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.play-btn .icon-stop,
.play-btn.playing .icon-play {
  display: none;
}

.play-btn.playing .icon-stop {
  display: inline;
}

.clock {
  font: 600 24px ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.clock-len {
  margin-left: 8px;
  color: var(--faint);
  font-size: 14px;
  font-weight: 500;
}

.input {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: min(300px, 100%);
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meter-label {
  width: 62px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meter {
  position: relative;
  flex: 1;
  height: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

.meter-fill {
  position: absolute;
  inset: 0;
  /* −60 dB … 0 dB: verde hasta −12, amarillo hasta −6, naranja, rojo al final */
  background: linear-gradient(90deg, #1f9a55 0%, #2fbf6b 79%, #e5c02a 81%, #e5c02a 89%, #f08a24 91%, #f08a24 96%, #ef4444 97%);
  clip-path: inset(0 100% 0 0);
}

.meter-peak {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--text);
  opacity: 0.85;
}

.meter-ticks span {
  position: absolute;
  top: 0;
  bottom: 0;
  padding-left: 3px;
  border-left: 1px solid color-mix(in srgb, var(--bg) 55%, transparent);
  color: color-mix(in srgb, var(--text) 42%, transparent);
  font-size: 9px;
  line-height: 18px;
  pointer-events: none;
}

.meter-text {
  width: 96px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.meter.clip {
  border-color: var(--rec);
  box-shadow: 0 0 0 1px var(--rec);
}

.input-row,
.monitor-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-row select {
  flex: 1;
  font-size: 13px;
}

.input-row .btn[hidden] {
  display: none;
}

.monitor-row input[type='range'] {
  width: min(180px, 40%);
  accent-color: var(--accent);
}

/* Editor ------------------------------------------------------------------- */

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sep {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--border);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.seg {
  height: 28px;
  padding: 0 12px;
  white-space: nowrap;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 550;
  cursor: pointer;
}

.seg.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -2px 0 var(--accent);
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
}

.wave-wrap {
  position: relative;
  height: clamp(320px, 50vh, 600px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wave {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: text;
  touch-action: none;
}

.empty {
  position: absolute;
  inset: 22px 0 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.empty[hidden] {
  display: none;
}

.empty p {
  max-width: 520px;
  margin: 4px 0;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--rec-soft);
}

.empty-icon span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rec);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    transform: scale(0.82);
    opacity: 0.8;
  }
}

.empty-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.empty-drop {
  color: var(--faint);
  font-size: 13px;
}

.busy {
  position: absolute;
  top: 32px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.busy[hidden] {
  display: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.sel-info {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chip.accent b {
  color: var(--accent);
}

/* Efectos (barra lateral con acordeón) ------------------------------------ */

.sidebar {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.sidebar-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.sidebar-sub {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.fx {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.fx-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s;
}

.fx-card.open {
  border-color: var(--border-strong);
}

.fx-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
}

.fx-open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.fx-open:hover {
  background: var(--surface-3);
}

.fx-num {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.fx-num .i {
  width: 15px;
  height: 15px;
}

.fx-titles {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.fx-title {
  font-weight: 650;
}

.fx-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fx-open .chevron {
  color: var(--faint);
  transition: transform 0.2s;
}

.fx-card.open .chevron {
  transform: rotate(180deg);
}

.fx-card.off .fx-num {
  background: var(--surface-3);
  color: var(--faint);
}

.fx-card.off .fx-title {
  color: var(--muted);
}

.fx-body {
  display: grid;
  gap: 12px;
  padding: 6px 14px 14px;
}

.fx-body[hidden] {
  display: none;
}

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  font-size: 13px;
}

.field-label {
  color: var(--muted);
}

.field input[type='range'] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.field-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.field input[type='number'] {
  width: 70px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.unit {
  min-width: 20px;
  color: var(--muted);
  font-size: 12px;
}

.field.check {
  grid-template-columns: auto 1fr;
  gap: 8px;
  cursor: pointer;
}

.field.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.field.select select {
  min-width: 160px;
}

.field.muted,
.field.disabled {
  opacity: 0.42;
}

.field.muted {
  pointer-events: none;
}

.note {
  margin: 2px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
}

.switch {
  display: inline-flex;
}

.switch input {
  position: relative;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  appearance: none;
  cursor: pointer;
  transition: background 0.15s;
}

.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}

.switch input:checked {
  background: var(--accent);
}

.switch input:checked::after {
  transform: translateX(16px);
}

/* Ayuda y avisos ----------------------------------------------------------- */

.help-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.help-dialog form {
  padding: 16px 20px 20px;
}

.help-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.help-dialog h2 {
  margin: 0;
  font-size: 17px;
}

.help-dialog table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.help-dialog td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.help-dialog td:first-child {
  width: 40%;
  padding-right: 12px;
  white-space: nowrap;
}

.help-foot {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.info {
  border-left-color: var(--accent);
}

.toast.warn {
  border-left-color: var(--warn);
}

.toast.error {
  border-left-color: var(--rec);
}

.toast.ok {
  border-left-color: var(--ok);
}

/* Mientras se graba, la edición queda en pausa. */
.is-recording .toolbar,
.is-recording .sidebar,
.is-recording .statusbar {
  opacity: 0.45;
  pointer-events: none;
}

.is-recording #btn-mark {
  opacity: 1;
}

/* Tabletas y portátiles pequeños: los efectos pasan debajo. */
@media (max-width: 1180px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .fx {
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    align-items: start;
  }
}

/* Móvil ----------------------------------------------------------------- */

@media (max-width: 760px) {
  .hide-sm {
    display: none !important;
  }

  .show-sm {
    display: inline-flex !important;
  }

  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .topbar {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 12px;
  }

  .project {
    flex-basis: 100%;
    order: 3;
  }

  .project-name {
    flex: 1;
    width: auto;
  }

  .top-actions {
    margin-left: auto;
  }

  .layout {
    gap: 12px;
    padding: 12px 10px 20px;
  }

  .workspace {
    gap: 12px;
  }

  .transport {
    padding: 12px;
  }

  /* Grabar, reproducir y guardar quedan siempre a mano, abajo. */
  .transport-main {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    justify-content: space-between;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
  }

  .rec-btn {
    height: 52px;
  }

  .clock {
    flex: 1;
    font-size: 18px;
    text-align: center;
  }

  .clock-len {
    display: block;
    margin: 0;
    font-size: 12px;
  }

  #btn-export-m {
    width: 52px;
    height: 52px;
    border-radius: 50%;
  }

  .input {
    min-width: 0;
  }

  .input-row {
    flex-wrap: wrap;
  }

  .input-row select {
    flex: 1 1 140px;
  }

  .meter-label {
    width: auto;
  }

  .meter {
    min-width: 90px;
  }

  .meter-text {
    width: auto;
    font-size: 11px;
  }

  .editor-panel {
    padding: 8px;
  }

  .toolbar {
    gap: 4px;
  }

  .toolbar .lbl,
  .toolbar .sep {
    display: none;
  }

  .segmented {
    flex: 1;
  }

  .seg {
    flex: 1;
    padding: 0 8px;
  }

  .tool-group .btn:not(.icon) {
    width: 36px;
    padding: 0;
  }

  .zoom .btn.icon {
    width: 32px;
  }

  .wave-wrap {
    height: clamp(240px, 44vh, 420px);
  }

  .statusbar {
    flex-direction: column;
    align-items: stretch;
  }

  .statusbar,
  .editor-panel {
    min-width: 0;
  }

  .stats {
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .fx {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    padding: 12px;
  }

  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
