:root {
  color-scheme: dark;
  --bg: #0c0c0e;
  --panel: #151518;
  --card: #18181c;
  --lime: #d6ff3c;
  --lime-ink: #14180a;
  --text: #f4f4f6;
  --muted: #9a9aa3;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --danger: #ff5d73;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(214, 255, 60, 0.07), transparent 55%),
    #070708;
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app {
  position: relative;
  width: min(440px, 100%);
  height: min(960px, 100dvh);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 820px) {
  .app {
    height: min(960px, calc(100dvh - 40px));
    border: 1px solid var(--line);
    border-radius: 32px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  }
}

/* Cabeçalho */

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.title-block { min-width: 0; }

.title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: text;
}

.title-input {
  min-width: 3ch;
  max-width: 250px;
  field-sizing: content;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: transparent;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  outline: none;
  text-overflow: ellipsis;
}

.title-input:focus { border-bottom-color: var(--lime); }

.pencil {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ratio-chip {
  flex: none;
  margin-top: 2px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--card);
  color: #d8d8de;
  font-size: 13px;
  font-weight: 600;
}

/* Prévia */

.stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
}

.stage {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

.stage.layout-split {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 0;
}

.stage.layout-pip { display: block; }

.stage.layout-pip #paneBottom {
  position: absolute;
  inset: 0;
}

.stage.layout-pip #paneTop {
  position: absolute;
  z-index: 2;
  left: 14%;
  top: 5%;
  width: 72%;
  height: 30%;
  border-radius: 16px;
  outline: 2px solid rgba(255, 255, 255, 0.92);
}

.stage:fullscreen {
  height: 100%;
  width: auto;
  max-width: 100%;
  margin: auto;
  border-radius: 0;
}

.stage::backdrop { background: #000; }

.pane {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #111114;
}

.pane-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  pointer-events: none;
}

.pane-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #c8c8d0;
  cursor: pointer;
}

.pane.has-video .pane-empty { display: none; }

.pane-empty .dash {
  padding: 12px 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  font-weight: 650;
  transition: border-color 0.15s, color 0.15s;
}

.pane-empty:hover .dash {
  border-color: var(--lime);
  color: var(--lime);
}

.pane-empty small {
  color: var(--muted);
  font-size: 12px;
}

.pane-loading {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(12, 12, 14, 0.78);
  backdrop-filter: blur(4px);
  font-size: 13px;
}

.pane-loading b { font-weight: 600; font-variant-numeric: tabular-nums; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(214, 255, 60, 0.25);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.divider {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 50%;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
  cursor: ns-resize;
  touch-action: none;
}

.divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--lime);
}

.divider-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  border: 2px solid var(--lime);
  border-radius: 50%;
  background: #101012;
  transform: translate(-50%, -50%);
  transition: transform 0.12s;
}

.divider-knob::before,
.divider-knob::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 2px;
  background: #f4f4f6;
}

.divider-knob::before { top: 10px; }
.divider-knob::after { bottom: 10px; }

.divider:hover .divider-knob,
.divider.dragging .divider-knob { transform: translate(-50%, -50%) scale(1.12); }

.divider:focus-visible { outline: none; }
.divider:focus-visible .divider-knob { box-shadow: 0 0 0 3px rgba(214, 255, 60, 0.35); }

.stage.layout-pip .divider,
.stage:fullscreen .divider { display: none; }

/* Controles */

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.time {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.time b {
  color: var(--text);
  font-weight: 600;
}

.play-btn {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #1d1d22;
  cursor: pointer;
  transition: transform 0.12s;
}

.play-btn:active { transform: scale(0.94); }
.play-btn svg { width: 20px; height: 20px; }
.play-btn .icon-pause { display: none; }
.play-btn.is-playing .icon-play { display: none; }
.play-btn.is-playing .icon-pause { display: block; }

.controls-right {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e4e4ea;
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.icon-btn:disabled { color: #55555c; cursor: default; }
.icon-btn svg { width: 21px; height: 21px; }

/* Timeline */

.tl {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  grid-template-rows: 26px 62px 62px 8px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.tl-label {
  display: flex;
  align-items: center;
  padding-right: 6px;
}

#labelCamera { grid-column: 1; grid-row: 2; }
#labelBackground { grid-column: 1; grid-row: 3; }

.tl-pill {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border-radius: 12px;
  background: var(--card);
  color: #e2e2e8;
  font-size: 13px;
  font-weight: 550;
}

.tl-pill svg { flex: none; width: 19px; height: 19px; }

.tl-scroll {
  grid-column: 2;
  grid-row: 1 / span 4;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.tl-inner {
  position: relative;
  min-width: 100%;
  height: 100%;
}

#tlContent { height: 150px; }

.ruler {
  position: relative;
  height: 26px;
  color: #8d8d96;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ruler span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
}

.ruler span:first-of-type { transform: none; }

.ruler i {
  position: absolute;
  bottom: 2px;
  width: 1px;
  height: 4px;
  background: #3a3a42;
}

.ruler i.major { height: 7px; background: #5a5a63; }

.track-row {
  position: relative;
  height: 62px;
}

.clip {
  position: absolute;
  top: 7px;
  height: 48px;
  border: 2px solid rgba(214, 255, 60, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: #222;
  cursor: grab;
  touch-action: none;
}

.clip.selected {
  border-color: var(--lime);
  border-width: 3px 0;
}

.clip:active { cursor: grabbing; }

.film {
  display: flex;
  height: 100%;
  pointer-events: none;
}

.film img {
  flex: 1 1 0;
  width: 0;
  height: 100%;
  object-fit: cover;
}

.speed-badge {
  position: absolute;
  z-index: 3;
  top: 4px;
  right: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: white;
  font-size: 10px;
  font-style: normal;
  pointer-events: none;
}

.mute-badge,
.loop-badge {
  position: absolute;
  z-index: 3;
  top: 4px;
  left: 18px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: white;
  pointer-events: none;
}

.mute-badge svg,
.loop-badge svg { width: 12px; height: 12px; }

.ghost-clip {
  position: absolute;
  top: 7px;
  height: 48px;
  border: 2px dashed rgba(214, 255, 60, 0.4);
  border-radius: 10px;
  overflow: hidden;
  background: #222;
  opacity: 0.45;
  pointer-events: none;
}

.ghost-clip .loop-badge { left: 6px; }

.tl-cut {
  position: absolute;
  z-index: 5;
  top: 26px;
  bottom: 0;
  border-left: 2px dashed rgba(255, 255, 255, 0.35);
  background: repeating-linear-gradient(135deg, rgba(12, 12, 14, 0.72) 0 6px, rgba(12, 12, 14, 0.55) 6px 12px);
  pointer-events: none;
}

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

.handle.left { left: 0; }
.handle.right { right: 0; }

.clip.selected .handle {
  background: var(--lime);
}

.clip.selected .handle::before,
.clip.selected .handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 2px;
  height: 14px;
  margin-top: -7px;
  border-radius: 2px;
  background: var(--lime-ink);
}

.clip.selected .handle::before { left: 4px; }
.clip.selected .handle::after { left: 8px; }

.add-chip {
  position: absolute;
  top: 7px;
  height: 48px;
  width: 72px;
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.add-chip:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.add-chip.rec:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.playhead {
  position: absolute;
  top: 2px;
  bottom: 4px;
  left: 0;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  z-index: 7;
  pointer-events: none;
}

/* Alça da linha do tempo: arraste para passar o vídeo. */
.playhead-knob {
  position: absolute;
  top: -2px;
  left: 50%;
  width: 20px;
  height: 24px;
  transform: translateX(-50%);
  pointer-events: auto;
  touch-action: none;
  cursor: ew-resize;
}

.playhead-knob::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--lime);
  border-radius: 5px 5px 0 0;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

/* Área de toque maior que o desenho, para o dedo acertar fácil. */
.playhead-knob::after {
  content: "";
  position: absolute;
  inset: -8px -12px;
}

.playhead.scrubbing .playhead-knob::before { background: #fff; }

/* Ferramentas */

.tools {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.tools button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  color: #e4e4ea;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.tools button:hover { background: #1c1c21; }
.tools button svg { width: 22px; height: 22px; }

.tools button span {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools button[aria-expanded="true"] {
  border-color: var(--lime);
  color: var(--lime);
}

.export {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 16px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 18px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}

.export:hover:not(:disabled) { filter: brightness(1.05); }
.export:active:not(:disabled) { transform: scale(0.985); }
.export svg { width: 22px; height: 22px; }
.export .chev { width: 18px; height: 18px; margin-left: 2px; }
.export:disabled { opacity: 0.38; cursor: default; }

/* Painéis */

.sheet,
.modal,
.recorder,
.toast { position: absolute; }

.sheet {
  z-index: 12;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 16px;
  background: #1b1b1f;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
}

.sheet.tall {
  top: 72px;
  display: flex;
  flex-direction: column;
}

.sheet.tall #sheetBody {
  flex: 1;
  min-height: 0;
  margin: 0 -16px -16px;
  padding: 0 16px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.lib-device {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: transparent;
  color: #e4e4ea;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.lib-device:hover { border-color: var(--lime); color: var(--lime); }
.lib-device svg { width: 20px; height: 20px; }

.lib-status { text-align: center; }

.lib-retry {
  margin-left: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: #2a2a30;
  cursor: pointer;
}

.lib-cats {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  margin: 0 -16px;
  padding: 12px 16px 10px;
  overflow-x: auto;
  background: #1b1b1f;
  scrollbar-width: none;
}

.lib-cats button {
  flex: none;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #24242a;
  font-size: 13px;
  cursor: pointer;
}

.lib-cats button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
}

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

.lib-tile {
  position: relative;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: #222;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}

.lib-tile:hover { border-color: var(--lime); }
.lib-tile:active { transform: scale(0.97); }

.lib-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lib-dur {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.lib-author {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 6px 5px;
  overflow: hidden;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-tile.loading { border-color: var(--lime); }

.lib-tile.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: lib-pulse 1s ease-in-out infinite alternate;
}

@keyframes lib-pulse { from { opacity: 0.3; } to { opacity: 0.8; } }

.lib-credit { text-align: center; }
.lib-credit a { color: var(--lime); }

.sheet-head,
.modal-actions,
.rec-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-head h2,
.modal-card h2 {
  margin: 0;
  font-size: 16px;
}

.sheet-head button,
.modal-actions button,
.rec-actions button {
  border: 0;
  background: #2a2a30;
  color: white;
  border-radius: 10px;
  cursor: pointer;
}

.sheet-head button {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
}

.choice-row,
.layout-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.choice-row button,
.layout-row button,
.sheet-actions button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #24242a;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.choice-row button[aria-pressed="true"],
.layout-row button[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
  font-weight: 700;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.volume-row input { flex: 1; accent-color: #b6e020; }
.sheet p,
.modal-card p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.sheet-actions button { text-align: left; }

.sheet-actions .switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row strong { font-weight: 600; }
.switch-row small { color: var(--muted); font-size: 12px; }

.switch {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 99px;
  background: #3a3a42;
  transition: background 0.15s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch-row[aria-pressed="true"] .switch { background: var(--lime); }
.switch-row[aria-pressed="true"] .switch::after { transform: translateX(16px); background: var(--lime-ink); }

.layout-row button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 76px;
}

.mini {
  width: 28px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  background: #111;
  display: grid;
  gap: 2px;
}

.mini i { display: block; background: #d6ff3c; }
.layout-row button[aria-pressed="true"] .mini { background: var(--lime); }
.layout-row button[aria-pressed="true"] .mini i { background: var(--lime-ink); }
.mini b { display: block; background: #7f8cff; }
.mini.half { grid-template-rows: 1fr 1fr; }
.mini.focus { grid-template-rows: 1.7fr 0.8fr; }
.mini.pip { position: relative; display: block; }
.mini.pip b { position: absolute; inset: 0; }
.mini.pip i {
  position: absolute;
  left: 18%;
  top: 10%;
  width: 64%;
  height: 32%;
  border-radius: 2px;
}

.recorder {
  z-index: 20;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}

.recorder video {
  flex: 1;
  width: 100%;
  min-height: 0;
  object-fit: cover;
}

.rec-hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

#recTime { display: block; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.rec-actions button { flex: 1; height: 48px; }
.rec-go { background: var(--danger) !important; font-weight: 750; }
.rec-go.is-live { background: #fff !important; color: #111; }

.modal {
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: rgba(0, 0, 0, 0.62);
}

.modal-card {
  width: 100%;
  padding: 16px;
  background: #1b1b1f;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
}

.bar {
  height: 8px;
  margin-top: 14px;
  border-radius: 99px;
  background: #2c2c32;
  overflow: hidden;
}

#exportBar {
  width: 0%;
  height: 100%;
  background: var(--lime);
}

#exportPct { font-variant-numeric: tabular-nums; }

.modal-actions { margin-top: 14px; }
.modal-actions button { flex: 1; height: 44px; }
.modal-download {
  background: var(--lime) !important;
  color: var(--lime-ink) !important;
  font-weight: 750;
}

.toast {
  z-index: 40;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  background: #2a2a30;
  color: white;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

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

#mediaBin {
  position: fixed;
  left: -2400px;
  top: 0;
  width: 320px;
  height: 320px;
  overflow: hidden;
  pointer-events: none;
}

#mediaBin video {
  width: 320px;
  height: 320px;
}

[hidden] { display: none !important; }

@media (max-width: 380px) {
  .title-input { font-size: 22px; }
  .tools { gap: 4px; }
  .tools button span { font-size: 10px; }
  .tl { grid-template-columns: 86px minmax(0, 1fr); }
  .tl-pill { padding: 0 7px; font-size: 12px; }
}

/* Celular com a barra do navegador aberta: tudo mais compacto para a prévia crescer. */
@media (max-height: 760px) {
  .app { gap: 8px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .subtitle { display: none; }
  .title-input { font-size: 21px; }
  .ratio-chip { padding: 4px 10px; font-size: 12px; border-radius: 10px; }
  .play-btn { width: 42px; height: 42px; }
  .play-btn svg { width: 17px; height: 17px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 19px; height: 19px; }
  .time { font-size: 13px; }
  .tl { grid-template-rows: 22px 50px 50px 4px; padding-top: 2px; }
  #tlContent { height: 122px; }
  .ruler { height: 22px; }
  .track-row { height: 50px; }
  .clip, .ghost-clip, .add-chip { top: 5px; height: 40px; }
  .tl-pill { height: 40px; font-size: 12px; }
  .tl-pill svg { width: 17px; height: 17px; }
  .tl-cut { top: 22px; }
  .tools { gap: 5px; }
  .tools button { gap: 3px; padding: 6px 0 5px; border-radius: 12px; }
  .tools button svg { width: 19px; height: 19px; }
  .tools button span { font-size: 10px; }
  /* Exportar vira um botão compacto no canto de cima, no lugar do selo 9:16. */
  header { padding-right: 118px; }
  .ratio-chip { display: none; }
  .export {
    position: absolute;
    z-index: 4;
    top: calc(max(10px, env(safe-area-inset-top)) - 3px);
    right: 16px;
    height: 30px;
    gap: 6px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
  }
  .export svg { width: 16px; height: 16px; }
  .export .chev { display: none; }
}

@media (max-height: 640px) {
  .controls { margin-top: -2px; }
  .tl { grid-template-rows: 20px 44px 44px 2px; }
  #tlContent { height: 108px; }
  .ruler { height: 20px; }
  .track-row { height: 44px; }
  .clip, .ghost-clip, .add-chip { top: 4px; height: 36px; }
  .tl-pill { height: 36px; }
  .tl-cut { top: 20px; }
  .tools button { padding: 5px 0 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .play-btn, .export, .divider-knob { transition: none; }
}

.sheet .sheet-label {
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lang-row { margin-top: 8px; }

.modal-actions { flex-wrap: wrap; }

.modal-actions .modal-share {
  flex-basis: 100%;
  order: -1;
  height: 50px;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 750;
  font-size: 16px;
}

.modal-card .share-hint {
  margin-top: 12px;
  color: #d8d8de;
}

/* Com o compartilhar visível, o download vira opção secundária. */
.modal-share:not([hidden]) ~ .modal-download {
  background: #2a2a30 !important;
  color: #fff !important;
  font-weight: 600;
}

.sheet .sheet-links { margin-top: 16px; text-align: center; font-size: 12px; }
.sheet-links a { color: var(--muted); }
