/* Mini editor do vídeo enviado (fonte-editor.js).

   O jeito do editor de vídeo da galeria do iPhone: fundo preto, pílulas
   escuras, prévia grande com cantos arredondados, tira de miniaturas com
   alças amarelas e a barra de abas embaixo com um pontinho amarelo na ativa.
   Do Coyote ficam o roxo (OK, seleção, áreas marcadas), o vidro e as fontes. */

.fe {
  --fe-amarelo: #FFD60A;
  --fe-pilula: rgba(255, 255, 255, .13);
  --fe-pilula-hover: rgba(255, 255, 255, .2);
  --fe-tira-h: 52px;
  position: fixed; inset: 0;
  width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #000; color: #fff;
  overflow: hidden;
  font-family: var(--font-ui);
}
.fe::backdrop { background: #000; }
.fe[open] { display: block; }

.fe-tela {
  display: flex; flex-direction: column;
  height: 100%;
  max-width: 760px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  gap: 10px;
}

.fe svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9;
          stroke-linecap: round; stroke-linejoin: round; }
.fe svg .cheio { fill: currentColor; stroke: none; }
.fe button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.fe button:focus-visible, .fe [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ------------------------------------------------------------- topo */

.fe-topo { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.fe-pilula {
  min-height: 36px; min-width: 64px; padding: 0 16px;
  border: 0; border-radius: var(--r-pill);
  background: var(--fe-pilula); color: #fff;
  font: 700 15px/1 var(--font-ui); letter-spacing: -.01em; cursor: pointer;
  transition: background var(--t-fast) var(--t-ease), color var(--t-fast), box-shadow var(--t-base);
}
/* alvo de toque de 44 px sem a pílula ficar grande */
.fe-pilula { position: relative; }
.fe-pilula::after { content: ""; position: absolute; inset: -4px -2px; }
.fe-pilula:hover:not(:disabled) { background: var(--fe-pilula-hover); }
.fe-ok:disabled { color: rgba(255, 255, 255, .35); cursor: default; }
.fe-ok:not(:disabled) {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), .45);
}
.fe-ok:not(:disabled):hover { background: var(--accent-hover); }

.fe-barra {
  display: grid; grid-template-columns: 44px 36px 1fr 36px 44px; align-items: center; gap: 6px;
}
.fe-redondo {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fe-pilula); cursor: pointer;
  transition: background var(--t-fast) var(--t-ease), opacity var(--t-fast);
}
.fe-redondo:hover:not(:disabled) { background: var(--fe-pilula-hover); }
.fe-redondo:disabled { opacity: .3; cursor: default; }
.fe-mini { width: 36px; height: 36px; background: transparent; justify-self: center; }
.fe-mini svg { width: 20px; height: 20px; }
.fe-titulo {
  margin: 0; text-align: center;
  font: 600 15px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
}
.fe-som-off { display: none; }
#feSom[aria-pressed="true"] .fe-som-on { display: block; }
#feSom[aria-pressed="true"] .fe-som-off { display: none; }
#feSom[aria-pressed="false"] .fe-som-on { display: none; }
#feSom[aria-pressed="false"] .fe-som-off { display: block; }
#feMais svg { fill: currentColor; stroke: none; }

.fe-mais-caixa { position: relative; }
.fe-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5;
  min-width: 210px; padding: 6px;
  display: flex; flex-direction: column;
  background: var(--glass-bg-forte);     /* o vidro vem da pele.css */
  border: 1px solid var(--glass-line); border-radius: var(--r-xl);
  box-shadow: var(--glass-sombra);
}
.fe-menu[hidden] { display: none; }
.fe-menu button {
  min-height: 44px; padding: 0 14px; text-align: left;
  background: none; border: 0; border-radius: var(--r-lg);
  font: 500 15px/1.2 var(--font-ui); cursor: pointer;
}
.fe-menu button:hover { background: rgba(255, 255, 255, .08); }

/* ------------------------------------------------------------- palco */

.fe-palco-area {
  flex: 1 1 auto; min-height: 120px;
  display: grid; place-items: center;
  position: relative;
}
.fe-palco {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 12px; overflow: hidden;
  background: #0b0b0d;
  transition: transform .45s var(--t-ease);
}
.fe-palco.espelhado { transform: scaleX(-1); }
.fe-palco video, .fe-palco img, .fe-palco canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block;
}
.fe-palco video, .fe-palco img { object-fit: fill; }
.fe-palco img[hidden] { display: none; }
.fe-palco canvas { touch-action: none; }
.fe-palco canvas.pincel, .fe-palco canvas.borracha { cursor: none; }
.fe-palco canvas.laco, .fe-palco canvas.ret { cursor: crosshair; }
.fe-palco canvas.mover { cursor: move; }
.fe-aviso {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .62);
  font: 600 13px/1.2 var(--font-ui); white-space: nowrap;
}
.fe-palco.espelhado .fe-aviso { transform: translate(-50%, -50%) scaleX(-1); }
.fe-aviso[hidden] { display: none; }

/* -------------------------------------------------------- ferramentas */

.fe-ferramentas { min-height: 44px; }
.fe-painel { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.fe-painel[hidden] { display: none; }
/* as três linhas fluem: no computador cabem em uma ou duas; no celular, três */
.fe-painel-apagar { gap: 6px 14px; }
.fe-dica { margin: 0; color: rgba(255, 255, 255, .55); font-size: 13px; line-height: 1.35; text-align: center; }
.fe-dur { color: rgba(255, 255, 255, .8); font-size: 13px; }

.fe-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fe-chip {
  min-height: 36px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--fe-pilula); cursor: pointer;
  font: 600 13px/1 var(--font-ui); white-space: nowrap;
  transition: background var(--t-fast) var(--t-ease), border-color var(--t-fast), color var(--t-fast);
  position: relative;
}
.fe-chip::after { content: ""; position: absolute; inset: -4px 0; }
.fe-chip svg { width: 16px; height: 16px; }
/* hover só onde há mouse (no iPhone ele gruda depois do toque) e nunca por
   cima de um botão ligado ou do roxo do "Remover texto" */
@media (hover: hover) {
  .fe-chip:not(.on):not([aria-pressed="true"]):not(.fe-remover):not(:disabled):hover {
    background: var(--fe-pilula-hover);
  }
}
.fe-chip.on, .fe-chip[aria-pressed="true"] {
  background: rgba(var(--accent-rgb), .3); border-color: var(--accent);
}
.fe-chip:disabled { opacity: .4; cursor: default; }
.fe-chip-link { background: transparent; color: rgba(255, 255, 255, .7); }

.fe-linha-ferr, .fe-linha-areas, .fe-linha-acoes {
  display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap;
  max-width: 100%;
}
.fe-linha-ferr { flex-wrap: nowrap; width: 100%; max-width: 440px; }
.fe-ferrs { flex-wrap: nowrap; flex: none; gap: 4px; }
.fe-linha-areas { flex-wrap: nowrap; min-width: 0; }
.fe-ferr {
  width: 44px; height: 44px; border: 1px solid transparent; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fe-pilula); cursor: pointer;
  transition: background var(--t-fast) var(--t-ease), border-color var(--t-fast);
}
@media (hover: hover) { .fe-ferr:not(.on):hover { background: var(--fe-pilula-hover); } }
.fe-ferr.on { background: rgba(var(--accent-rgb), .32); border-color: var(--accent); }
.fe-ferr svg { width: 20px; height: 20px; }

.fe-tamanho {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 6px 0 4px; flex: 1 1 140px; min-width: 0; max-width: 200px;
}
.fe-tamanho[hidden] { display: none; }
.fe-tamanho-bola {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center;
}
.fe-tamanho-bola::before {
  content: ""; width: var(--d, 12px); height: var(--d, 12px); border-radius: 50%;
  background: rgba(var(--accent-rgb), .55); border: 1.5px solid #fff;
}
.fe-tamanho input {
  flex: 1; min-width: 56px; width: 100%; height: 44px; margin: 0;
  accent-color: var(--accent); background: transparent; cursor: pointer;
}

.fe-areas {
  display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  max-width: 100%; padding: 2px; scrollbar-width: none;
}
.fe-areas::-webkit-scrollbar { display: none; }
.fe-area {
  flex: none; min-height: 36px; padding: 0 6px 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--fe-pilula); cursor: pointer;
  font: 600 13px/1 var(--font-ui);
}
.fe-area .fe-area-cor {
  width: 10px; height: 10px; border-radius: 50%; background: var(--cor, var(--accent));
}
.fe-area.on { background: rgba(var(--accent-rgb), .3); border-color: var(--accent); }
.fe-area .fe-area-x {
  width: 28px; height: 28px; border: 0; border-radius: 50%; padding: 0;
  display: none; place-items: center; background: rgba(255, 255, 255, .12); cursor: pointer;
}
.fe-area.on .fe-area-x { display: grid; }
.fe-area-x svg { width: 14px; height: 14px; }
.fe-area-nova { padding: 0 12px; }
.fe-auto svg { color: var(--fe-amarelo); }
.fe-chip.fe-previa.on { background: #fff; color: #000; border-color: #fff; }
/* a ação da aba: tira do vídeo o que está marcado */
.fe-remover:not(:disabled) {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), .4);
}
.fe-remover:not(:disabled):hover { background: var(--accent-hover); }

.fe-espelho { min-height: 44px; padding: 0 20px; font-size: 15px; }
.fe-espelho svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ tira */

.fe-linha {
  display: flex; align-items: stretch; gap: 0;
  height: calc(var(--fe-tira-h) + 12px);
  padding: 6px; border-radius: 12px;
  background: rgba(118, 118, 128, .28);
}
.fe-play {
  flex: none; width: 48px; border: 0; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border-right: 1px solid rgba(0, 0, 0, .35);
  margin-right: 6px;
}
.fe-play svg { width: 24px; height: 24px; fill: #fff; stroke: none; }
.fe-play .fe-i-pausa { display: none; }
.fe-play.tocando .fe-i-play { display: none; }
.fe-play.tocando .fe-i-pausa { display: block; }

.fe-tira {
  position: relative; flex: 1; min-width: 0;
  touch-action: none; cursor: pointer;
  border-radius: 6px;
}
.fe-tira-img {
  position: absolute; inset: 0 18px;
  background-color: #1c1c1e; background-size: 100% 100%; background-repeat: no-repeat;
}
.fe-tira-fora {
  position: absolute; top: 0; bottom: 0; background: rgba(0, 0, 0, .58); pointer-events: none;
}
.fe-tira-fora.ini { left: 18px; }
.fe-tira-fora.fim { right: 18px; }

/* a janela do que fica: cinza clara parada, amarela quando aparada */
.fe-janela {
  position: absolute; top: -2px; bottom: -2px;
  border: 3px solid rgba(255, 255, 255, .0);
  border-left: 0; border-right: 0;
  pointer-events: none;
  transition: border-color var(--t-base) var(--t-ease);
}
.fe-alca {
  position: absolute; top: -3px; bottom: -3px; width: 18px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .0); color: #fff;
  pointer-events: auto; cursor: ew-resize; touch-action: none;
  transition: background var(--t-base) var(--t-ease), color var(--t-base);
}
.fe-alca::after { content: ""; position: absolute; inset: 0 -13px; }   /* 44 px de toque */
.fe-alca.ini { left: -18px; border-radius: 6px 0 0 6px; }
.fe-alca.fim { right: -18px; border-radius: 0 6px 6px 0; }
.fe-alca svg { width: 10px; height: 24px; stroke-width: 2.6; }
.fe-janela.aparada { border-color: var(--fe-amarelo); }
.fe-janela.aparada .fe-alca { background: var(--fe-amarelo); color: #000; }

.fe-faixa {
  position: absolute; bottom: 3px; height: 9px;
  border-radius: var(--r-pill);
  background: rgba(var(--accent-rgb), .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
  pointer-events: none;
}
.fe-faixa[hidden] { display: none; }
.fe-faixa-alca {
  position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; background: #fff; border: 3px solid var(--accent);
  pointer-events: auto; cursor: ew-resize; touch-action: none;
}
.fe-faixa-alca::after { content: ""; position: absolute; inset: -13px; }
.fe-faixa-alca.ini { left: -9px; }
.fe-faixa-alca.fim { right: -9px; }

.fe-cursor {
  position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px;
  border-radius: 2px; background: #fff; box-shadow: 0 0 4px rgba(0, 0, 0, .6);
  pointer-events: none;
}

/* ------------------------------------------------------------- abas */

.fe-abas {
  position: relative;
  align-self: center;
  display: flex; gap: 2px;
  padding: 6px 8px 4px;
  border-radius: var(--r-pill);
  background: rgba(30, 30, 32, .92);
  border: 1px solid rgba(255, 255, 255, .06);
}
.fe-aba {
  min-width: 66px; min-height: 52px; padding: 8px 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  background: none; border: 0; border-radius: 20px; cursor: pointer;
  color: rgba(255, 255, 255, .55);
  font: 600 11.5px/1 var(--font-ui); letter-spacing: -.01em; white-space: nowrap;
  transition: color var(--t-fast) var(--t-ease);
}
.fe-aba svg { width: 25px; height: 25px; }
.fe-aba[aria-selected="true"] { color: #fff; }
.fe-aba:hover { color: rgba(255, 255, 255, .85); }
.fe-ponto {
  position: absolute; top: 4px; left: 0;
  width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--fe-amarelo);
  pointer-events: none;
}

/* --------------------------------------------------------- celular */

@media (max-width: 420px) {
  .fe-tela { gap: 8px; padding-left: max(12px, env(safe-area-inset-left));
             padding-right: max(12px, env(safe-area-inset-right)); }
  .fe-aba { min-width: 60px; padding-left: 4px; padding-right: 4px; font-size: 11px; }
  .fe-barra { grid-template-columns: 44px 36px 1fr 36px 44px; gap: 2px; }
  .fe-titulo { font-size: 14px; }
}
@media (max-height: 700px) {
  .fe { --fe-tira-h: 44px; }
  .fe-aba { min-height: 46px; }
  .fe-aba svg { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .fe-palco { transition: none; }
}
