:root {
  --c-laranja: #ff9639;
  --c-laranja-dark: #e07a1a;
  --c-laranja-soft: rgba(255, 150, 57, 0.18);
  --ink: #1a2332;
  --ink-soft: #4a5568;
  --bg: #fff9f3;
  --surface: #ffffff;
  --border: #ece4dc;
  --font: 'DM Sans', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 0.75rem) 1rem calc(var(--safe-bottom) + 1rem);
  max-width: 480px;
  margin: 0 auto;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.app-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(255, 150, 57, 0.35);
}

.app-mark {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--c-laranja), var(--c-laranja-dark));
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(255, 150, 57, 0.35);
}

.app-brand-text strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.app-brand-text span {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem 1.25rem;
  box-shadow: 0 8px 28px rgba(26, 35, 50, 0.06);
  margin-bottom: 1rem;
}

.hero-card h1 {
  margin: 0 0 0.65rem;
  font-size: 1.45rem;
  line-height: 1.25;
}

.hero-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.55;
}

.pill {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--c-laranja-soft);
  color: var(--c-laranja-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.feature-list li:last-child { border-bottom: 0; }

.feature-list strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.feature-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--c-laranja-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3rem;
  margin-top: 1rem;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--c-laranja);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 150, 57, 0.35);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--c-laranja-dark);
  margin-top: 0.65rem;
}

.app-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.app-footer a {
  color: var(--c-laranja-dark);
}

.status-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 1rem);
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
  z-index: 20;
}

.status-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(26, 35, 50, 0.45);
}

.confirm-overlay[hidden] {
  display: none;
}

.confirm-box {
  width: min(100%, 22rem);
  padding: 1.1rem 1rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.confirm-box p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.confirm-actions .btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.confirm-actions .btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.cam-preview {
  position: fixed;
  right: 0.75rem;
  bottom: calc(var(--safe-bottom) + 0.75rem);
  z-index: 900;
  width: min(38vw, 180px);
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--c-laranja);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  background: #000;
}

.cam-preview video {
  display: block;
  width: 100%;
  height: auto;
}

.track-video-tag {
  flex: 0 0 auto;
  font-size: 0.75rem;
  line-height: 1;
}

.render-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(26, 35, 50, 0.6);
}

.render-box {
  width: min(100%, 26rem);
  padding: 1.1rem 1rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.render-box h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.render-canvas-slot {
  margin: 0 auto 0.75rem;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.render-canvas-slot canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 45vh;
  object-fit: contain;
  margin: 0 auto;
}

.render-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.render-progress-fill {
  height: 100%;
  width: 0;
  background: var(--c-laranja);
  transition: width 0.2s linear;
}

.render-progress-label {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.render-note {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink-soft, #667);
}

/* Diálogo de opções do vídeo (orientação, composição, pontos de troca) */
.vopt-box {
  width: min(100%, 30rem);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  text-align: left;
}

.vopt-box h2 {
  text-align: center;
}

.vopt-group {
  margin: 0 0 0.9rem;
}

.vopt-group h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.vopt-radio {
  display: block;
  margin: 0.2rem 0;
  font-size: 0.85rem;
  line-height: 1.35;
  cursor: pointer;
}

.vopt-radio-off {
  opacity: 0.55;
  cursor: default;
}

.vopt-hint {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-soft, #667);
}

.vopt-cut-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.vopt-cut-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.vopt-time {
  width: 5rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  text-align: center;
}

.vopt-track {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

.vopt-cut-del {
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft, #667);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.vopt-cut-del:hover {
  color: #c0392b;
  border-color: #c0392b;
}

/* Seletor de microfone na tela de calibração */
.mic-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.mic-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mic-option:active {
  background: var(--c-laranja-soft);
}

.mic-option.is-selected {
  border-color: var(--c-laranja);
  background: var(--c-laranja-soft);
}

.mic-option-icon {
  flex: 0 0 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg);
  font-size: 1.1rem;
}

.mic-option.is-selected .mic-option-icon {
  background: var(--surface);
}

.mic-option-text {
  flex: 1;
  min-width: 0;
}

.mic-option-text strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.3;
}

.mic-option-text em {
  display: block;
  font-style: normal;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mic-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  background: var(--c-laranja);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.mic-option-check {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: transparent;
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.mic-option.is-selected .mic-option-check {
  color: #fff;
  border-color: var(--c-laranja);
  background: var(--c-laranja);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view-root {
  flex: 1;
  min-height: 0;
}

.brand-back {
  margin-right: 0.15rem;
  margin-left: -0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 10px;
  background: var(--c-laranja-soft);
  color: var(--c-laranja-dark);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-back.hidden { display: none; }

.app-brand { flex-wrap: nowrap; }

.section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.jam-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.hint {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.hint.headphones {
  padding: 0.55rem 0.75rem;
  background: var(--c-laranja-soft);
  border-radius: 10px;
  color: var(--c-laranja-dark);
}

.empty-note {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  padding: 1rem 0;
}

.jam-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.jam-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.jam-row-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
}

.jam-row-meta {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.track-item {
  display: block;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.track-item:last-child { border-bottom: 0; }

.track-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.track-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--c-laranja-soft);
  color: var(--c-laranja-dark);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.track-name { color: var(--ink); font-size: 0.9375rem; font-weight: 600; }

.track-controls {
  padding-left: 2.15rem;
}

.ctrl-row {
  display: block;
  margin-bottom: 0.55rem;
}

.ctrl-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}

.ctrl-label strong {
  color: var(--c-laranja-dark);
  font-weight: 600;
}

.ctrl-range {
  width: 100%;
  accent-color: var(--c-laranja);
}

.ctrl-help {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.sync-hint {
  margin-bottom: 0.5rem;
}

.actions-card .btn { margin-top: 0.65rem; }
.actions-card .btn:first-of-type { margin-top: 0; }

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: #c53030;
  color: #fff;
  box-shadow: none;
}

.btn-danger.hidden { display: none; }

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

.app-shell--editor {
  max-width: 960px;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.app-shell--editor .app-brand {
  margin-bottom: 0.85rem;
}

.app-shell--editor .app-footer {
  display: none;
}

.editor-head {
  margin-bottom: 0.65rem;
}

.editor-head .jam-title {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}

.jam-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.jam-title-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.1rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.jam-title-input:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.jam-title-input:focus {
  outline: none;
  border-color: var(--c-laranja);
  background: #fff;
  box-shadow: 0 0 0 2px var(--c-laranja-soft);
}

.btn-title-edit {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.btn-title-edit:hover {
  border-color: var(--c-laranja);
  color: var(--c-laranja-dark);
}

.btn-title-delete {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: transparent;
  color: #a0aec0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.btn-title-delete:hover {
  border-color: #fecaca;
  background: #fff5f5;
  color: #dc2626;
}

.transport-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tbtn {
  min-height: 2.35rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.tbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tbtn-play {
  background: var(--c-laranja);
  border-color: var(--c-laranja);
  color: #fff;
  min-width: 2.6rem;
  font-size: 0.95rem;
}

.tbtn-play.is-playing {
  background: #2d3748;
  border-color: #2d3748;
}

.tbtn-record.is-recording,
.tbtn-danger {
  background: #c53030;
  border-color: #c53030;
  color: #fff;
}

.tbtn-danger.hidden { display: none; }

.tbtn-ghost {
  margin-left: auto;
  color: var(--ink-soft);
}

/* Folha de acoes (adicionar faixa / exportar): no celular sobe do rodape;
   em telas maiores vira um cartao centralizado. */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-box {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.25);
  animation: sheet-up 0.18s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 640px) {
  .sheet-overlay { align-items: center; padding: 1rem; }
  .sheet-box { border-radius: 16px; }
}

.sheet-box h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.sheet-section {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 3.25rem;
  margin: 0.3rem 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.sheet-item:active { background: #eef1f5; }

.sheet-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sheet-item-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex: 0 0 auto;
}

.sheet-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sheet-item-text strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.sheet-item-text small {
  font-size: 0.76rem;
  line-height: 1.3;
  color: var(--ink-soft);
}

.sheet-cancel {
  width: 100%;
  margin-top: 0.6rem;
}

.timeline-scroll.is-track-dragging {
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #eef1f5;
  -webkit-overflow-scrolling: touch;
  /* pan-y mantem a rolagem vertical da pagina no toque; o pan horizontal
     e o pinch-zoom sao tratados pelo JS do editor. */
  touch-action: pan-y;
}

.timeline-scroll.is-pinching {
  touch-action: none;
}

.timeline-inner {
  min-width: 100%;
  width: max-content;
  position: relative;
  --panel-width: 148px;
  --playhead-sec: 0;
  --px-per-sec: 72px;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--panel-width) + var(--playhead-sec) * var(--px-per-sec));
  width: 2px;
  margin-left: -1px;
  background: #ff9639;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 10px rgba(255, 150, 57, 0.65);
  pointer-events: none;
  z-index: 6;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.timeline-playhead.is-visible {
  opacity: 1;
}

.timeline-playhead-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--panel-width) + var(--playhead-sec) * var(--px-per-sec));
  width: 22px;
  margin-left: -11px;
  z-index: 7;
  cursor: ew-resize;
  touch-action: none;
}

.editor.is-seeking .timeline-playhead-hit {
  cursor: grabbing;
}

.editor.is-seeking .timeline-playhead {
  opacity: 1;
}

.timeline-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #ff9639;
}

.tbtn-stop {
  min-width: 2.35rem;
  color: var(--ink-soft);
}

.tbtn-stop:disabled {
  opacity: 0.35;
}

.timeline-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e0;
}

.track-panel-head {
  flex: 0 0 var(--panel-width, 148px);
  width: var(--panel-width, 148px);
  padding: 0.35rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border-right: 1px solid #cbd5e0;
}

.track-panel-head-label {
  display: block;
}

.timeline-zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.2rem;
}

.zoom-btn {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.zoom-btn:active {
  background: #edf2f7;
}

.timeline-zoom-badge {
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--c-laranja-dark);
  letter-spacing: 0;
  text-transform: none;
}

.zoom-input {
  width: 3rem;
  padding: 0.12rem 0.2rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
}

.zoom-input::-webkit-outer-spin-button,
.zoom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.timeline-ruler {
  position: relative;
  flex: 0 0 var(--timeline-width, 400px);
  height: 1.65rem;
  width: var(--timeline-width, 400px);
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.timeline-ruler.is-panning {
  cursor: grabbing;
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  font-style: normal;
  font-size: 0.625rem;
  color: var(--ink-soft);
}

.ruler-line {
  display: block;
  width: 1px;
  height: 0.45rem;
  background: #a0aec0;
}

.ruler-tick em {
  display: block;
  margin-top: 0.1rem;
  font-style: normal;
}

.timeline-tracks {
  display: flex;
  flex-direction: column;
}

.track-row {
  display: flex;
  border-bottom: 1px solid #cbd5e0;
}

.track-row:last-child { border-bottom: 0; }

.track-panel {
  flex: 0 0 var(--panel-width, 148px);
  width: var(--panel-width, 148px);
  padding: 0.5rem 0.55rem;
  background: #f8fafc;
  border-right: 1px solid #cbd5e0;
  border-left: 3px solid var(--track-color, var(--c-laranja));
}

.track-panel-top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.track-badge {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 4px;
  background: var(--track-color, var(--c-laranja));
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-panel .track-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mix-knob {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.6875rem;
  color: var(--ink-soft);
}

.mix-knob span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.12rem;
}

.mix-knob strong {
  color: var(--ink);
  font-weight: 600;
}

.mix-knob input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--track-color, var(--c-laranja));
}

.pan-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.625rem;
  color: #a0aec0;
  margin-top: 0.05rem;
}

.btn-norm {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.5625rem;
  font-weight: 600;
  padding: 0.05rem 0.3rem;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.3;
}

.btn-norm:hover {
  border-color: var(--track-color, var(--c-laranja));
  color: var(--ink);
}

.gate-check {
  accent-color: var(--track-color, var(--c-laranja));
  margin: 0 0.15rem 0 0;
  vertical-align: middle;
}

.gate-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.track-offset {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.6875rem;
  color: var(--c-laranja-dark);
  font-weight: 600;
}

.btn-track-remove {
  width: 100%;
  padding: 0.28rem 0.4rem;
  border: 1px solid #e2b4b4;
  border-radius: 6px;
  background: #fff5f5;
  color: #c53030;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

.track-lane {
  position: relative;
  flex: 0 0 var(--timeline-width, 400px);
  width: var(--timeline-width, 400px);
  min-height: 108px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent calc(var(--px-per-sec, 72px))
    ),
    linear-gradient(#3d4a5c, #354052);
  --px-per-sec: 72px;
  background-size: var(--px-per-sec) 100%, 100% 100%;
}

.wave-clip {
  position: absolute;
  top: 4px;
  right: auto;
  bottom: 4px;
  height: auto;
  border-radius: 6px;
  overflow: visible;
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  /* pan-y: deslizar na vertical rola a pagina (o arrasto horizontal do
     clipe continua com os pointer events, cancelados pelo navegador se o
     gesto virar rolagem). */
  touch-action: pan-y;
  user-select: none;
}

/* Clipe selecionado (no toque, so ele pode ser movido/cortado) */
.wave-clip.is-selected {
  outline: 3px solid var(--c-laranja);
  box-shadow: 0 0 0 4px rgba(255, 150, 57, 0.28), 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

.wave-clip-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px;
  cursor: grab;
}

.wave-clip.is-dragging .wave-clip-body {
  cursor: grabbing;
}

.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  z-index: 4;
  touch-action: none;
  cursor: ew-resize;
}

.trim-handle--left {
  left: 0;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08));
}

.trim-handle--right {
  right: 0;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08));
}

.wave-clip.is-trimming {
  outline-color: #fff;
  z-index: 3;
}

.wave-clip.is-dragging {
  cursor: grabbing;
  outline-color: #fff;
  z-index: 3;
}

.wave-clip canvas {
  display: block;
  pointer-events: none;
}

.wave-stereo {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  height: 100%;
}

.wave-row {
  position: relative;
  flex: 1 1 50%;
  min-height: 0;
  overflow: hidden;
  background: #243044;
}

.wave-ch-tag {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 13px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.wave-row canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.track-ch-mode {
  margin: 0 0 0.35rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.editor-empty {
  padding: 2rem 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.editor-empty p { margin: 0 0 0.5rem; }

@media (max-width: 520px) {
  .timeline-inner {
    --panel-width: 120px;
  }
}
