/* =========================================================
   Convitinho — Estúdio (editor de arrastar e soltar)
   ========================================================= */
body.est-aberto { overflow: hidden; }
.est {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 0 0, rgba(224,189,255,.35), transparent 60%), radial-gradient(800px 500px at 100% 100%, rgba(163,237,248,.35), transparent 60%), #F6F1FC;
  color: var(--tinta); font-family: var(--fonte-texto);
}
.est button { font: inherit; cursor: pointer; }
.est-topo {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: #fff; box-shadow: 0 1px 0 var(--linha); flex-wrap: wrap;
}
.est-titulo { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; }
.est-titulo b { font-family: var(--fonte-titulo); font-weight: 600; font-size: 20px; }
.est-titulo span { font-size: 12.5px; color: var(--tinta-2); font-weight: 700; }
.est-topo-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.est-ico { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--linha); background: #fff; font-size: 20px; font-weight: 900; }
.est-ico:disabled { opacity: .35; cursor: default; }
.est-formato { border: 2px solid var(--linha); border-radius: 999px; padding: 8px 12px; background: #fff; font-weight: 800; }
.est-btn { border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 14.5px; }
.est-btn.primario { background: var(--rosa); color: #fff; box-shadow: 0 4px 0 var(--rosa-escuro); }
.est-btn.secundario { background: #fff; border: 2px solid var(--linha); box-shadow: 0 3px 0 var(--linha); }
.est-btn.fantasma { background: transparent; color: var(--tinta-2); text-decoration: underline; text-underline-offset: 3px; padding-inline: 6px; }
.est-btn.largo { width: 100%; }
.est-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 84px 330px 1fr; }
.est-abas { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: #fff; border-right: 1px solid var(--linha); overflow-y: auto; }
.est-abas button { border: 0; background: transparent; border-radius: 16px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; color: var(--tinta-2); }
.est-abas button .est-ic { font-size: 22px; }
.est-abas button[aria-selected="true"] { background: #FFF0F8; color: var(--rosa-escuro); box-shadow: inset 0 0 0 2px var(--rosa); }
.est-abas button[data-aba="editar"] { background: var(--amarelo); color: var(--tinta); }
.est-abas button[data-aba="editar"][aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--tinta); }
.est-gaveta { background: #fff; overflow-y: auto; padding: 16px 16px 40px; border-right: 1px solid var(--linha); }
.est-gaveta h3 { font-family: var(--fonte-titulo); font-weight: 600; font-size: 19px; margin: 6px 0 2px; }
.est-sub { font-size: 13px; color: var(--tinta-2); margin: 0 0 10px; }
.est-rot { font-weight: 800; font-size: 13px; margin: 14px 0 6px; }
.est-busca { width: 100%; border: 2px solid var(--linha); border-radius: 999px; padding: 9px 14px; margin-bottom: 8px; font: inherit; background: var(--papel); }
.est-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.est-chips button { border: 2px solid var(--linha); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 800; color: var(--tinta-2); }
.est-chips button[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.est-grade-obj { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.est-obj { border: 2px solid var(--linha); background: var(--papel); border-radius: 16px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--tinta-2); transition: transform .12s, border-color .12s; }
.est-obj:hover { transform: translateY(-2px); border-color: var(--lilas); }
.est-obj canvas { width: 72px; height: 72px; }
.est-obj span { line-height: 1.15; text-align: center; }
.est-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.est-presets button { border: 2px solid var(--linha); background: var(--papel); border-radius: 14px; padding: 10px 8px; font-weight: 800; font-size: 13px; text-align: left; }
.est-presets button:hover { border-color: var(--rosa); background: #FFF0F8; }
.est-info { display: grid; gap: 10px; }
.est-info label, .est-campo { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.est input[type=text], .est input[type=date], .est input[type=time], .est textarea, .est select {
  width: 100%; border: 2px solid var(--linha); border-radius: 12px; padding: 9px 11px; font: inherit; font-weight: 600; background: var(--papel); color: var(--tinta);
}
.est-info input, .est-info textarea { width: 100%; border: 2px solid var(--linha); border-radius: 12px; padding: 9px 11px; font: inherit; font-weight: 600; background: var(--papel); }
.est-cores { display: flex; flex-wrap: wrap; gap: 6px; }
.est-cores button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--linha); padding: 0; }
.est-cores.mini button { width: 28px; height: 28px; }
.est-cor-livre { position: relative; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 1.5px var(--linha); background: conic-gradient(#FF6EB8, #FBD15F, #BDE22A, #A3EDF8, #E0BDFF, #FF6EB8); }
.est-cores.mini .est-cor-livre { width: 28px; height: 28px; }
.est-cor-livre input { position: absolute; inset: -8px; width: 50px; height: 50px; opacity: 0; cursor: pointer; }
.est-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-weight: 700; font-size: 13px; }
.est-linha input[type=color] { width: 40px; height: 34px; border: 0; background: none; padding: 0; }
.est-grade-fundos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.est-grade-fundos button { border: 3px solid transparent; border-radius: 12px; padding: 0; overflow: hidden; background: none; }
.est-grade-fundos button[aria-pressed="true"] { border-color: var(--rosa); }
.est-grade-fundos canvas { width: 100%; display: block; }
.est-envio { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.est-efeitos { display: grid; gap: 12px; }
.est-chave { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; cursor: pointer; margin: 8px 0; }
.est-chave input { position: absolute; opacity: 0; }
.est-chave span { width: 42px; height: 26px; border-radius: 999px; background: var(--linha); position: relative; flex: none; transition: background .2s; }
.est-chave span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform .2s; }
.est-chave input:checked + span { background: var(--verde); }
.est-chave input:checked + span::after { transform: translateX(16px); }
.est-faixa { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 13px; margin: 10px 0; }
.est-faixa output { color: var(--tinta-2); }
.est-faixa input { accent-color: var(--rosa); width: 100%; }
.est-seg { display: flex; background: var(--papel); border: 2px solid var(--linha); border-radius: 999px; padding: 3px; }
.est-seg button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 6px; font-weight: 800; font-size: 12.5px; }
.est-seg button[aria-pressed="true"] { background: var(--tinta); color: #fff; }
.est-camadas { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.est-camadas li { display: flex; align-items: center; gap: 4px; border: 2px solid var(--linha); border-radius: 12px; padding: 4px; }
.est-camadas li.sel { border-color: var(--rosa); background: #FFF0F8; }
.est-camadas button { border: 0; background: transparent; padding: 6px 7px; border-radius: 8px; font-weight: 800; }
.est-camadas .est-nome-camada { flex: 1; text-align: left; font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.est-edit-topo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.est-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.est-acoes button { border: 2px solid var(--linha); background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; }
.est-acoes .perigo { color: var(--erro); }
.est-palco { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
.est-folha { position: relative; border-radius: 16px; overflow: visible; box-shadow: 0 0 0 6px #fff, 0 24px 60px -24px rgba(59,42,92,.45); background: #fff; touch-action: none; user-select: none; }
.est-tela { width: 100%; height: 100%; display: block; border-radius: 16px; }
.est-sel-camada { position: absolute; inset: 0; pointer-events: none; }
.est-sel { position: absolute; border: 2px dashed var(--rosa); border-radius: 6px; pointer-events: none; transform-origin: center; box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
.est-al { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--rosa); pointer-events: auto; box-shadow: 0 1px 4px rgba(0,0,0,.25); touch-action: none; }
.est-al.nw { left: -10px; top: -10px; cursor: nwse-resize; } .est-al.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.est-al.ne { right: -10px; top: -10px; cursor: nesw-resize; } .est-al.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
.est-girar { position: absolute; left: 50%; top: -44px; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; background: var(--rosa); color: #fff; display: grid; place-items: center; font-weight: 900; pointer-events: auto; cursor: grab; box-shadow: 0 2px 6px rgba(0,0,0,.25); touch-action: none; }
.est-girar::after { content: ""; position: absolute; left: 50%; top: 30px; width: 2px; height: 14px; background: var(--rosa); }
.est-mini { position: absolute; left: 50%; bottom: -48px; transform: translateX(-50%); display: flex; gap: 2px; background: var(--tinta); border-radius: 999px; padding: 3px; pointer-events: auto; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.est-mini button { border: 0; background: transparent; color: #fff; width: 32px; height: 30px; border-radius: 999px; font-size: 14px; }
.est-mini button:hover { background: rgba(255,255,255,.15); }
.est-guia { position: absolute; background: var(--rosa); pointer-events: none; opacity: .8; }
.est-guia.v { top: 0; bottom: 0; width: 1.5px; } .est-guia.h { left: 0; right: 0; height: 1.5px; }
.est-dica { font-size: 12.5px; color: var(--tinta-2); font-weight: 700; margin: 14px 0 0; text-align: center; }
@media (max-width: 900px) {
  .est-topo { padding: 8px 10px; gap: 8px; }
  .est-titulo span { display: none; }
  .est-formato { padding: 6px 8px; font-size: 13px; }
  .est-ico { width: 36px; height: 36px; }
  .est-corpo { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto minmax(180px, 38vh); }
  .est-palco { grid-row: 1; padding: 8px; }
  .est-abas { grid-row: 2; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--linha); padding: 6px; scrollbar-width: none; }
  .est-abas::-webkit-scrollbar { display: none; }
  .est-abas button { flex: none; min-width: 64px; }
  .est-gaveta { grid-row: 3; border-right: 0; padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); }
  .est-grade-obj { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .est-grade-fundos { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .est-dica { display: none; }
}
@media (max-width: 420px) { .est-grade-obj { grid-template-columns: repeat(3, minmax(0, 1fr)); } .est-topo .est-btn.fantasma { display: none; } }

/* topo sempre numa linha no computador */
.est-topo-acoes { flex-wrap: nowrap; }
.est-topo-acoes .est-formato { width: auto; max-width: 160px; }
@media (max-width: 700px) {
  .est-topo { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
  .est-titulo b { font-size: 16px; white-space: nowrap; }
  .est-topo-acoes { flex-wrap: nowrap; gap: 5px; }
  .est-topo-acoes .est-formato { max-width: 96px; padding: 6px 6px; font-size: 12.5px; }
  .est-ico { width: 34px; height: 34px; font-size: 17px; }
  .est-topo .est-btn.primario { padding: 8px 12px; font-size: 13.5px; white-space: nowrap; }
  .est-corpo { grid-template-rows: minmax(0, 1fr) auto minmax(170px, 34vh); }
}
@media (max-width: 560px) { .est-titulo { display: none; } .est-topo { justify-content: space-between; } .est-topo-acoes { width: 100%; justify-content: space-between; } }

.est-grade-bib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.est-grade-bib button { border: 2px solid var(--linha); background: repeating-conic-gradient(#f4eefb 0 25%, #fff 0 50%) 50%/16px 16px; border-radius: 14px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 800; color: var(--tinta-2); }
.est-grade-bib img, .est-grade-bib video { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }
.est-grade-bib button:hover { border-color: var(--lilas); }

/* edição de texto: formatos e estilos com prévia */
.est-estilos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.est-estilos button { border: 2px solid var(--linha); background: #fff; border-radius: 14px; padding: 5px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 800; color: var(--tinta-2); cursor: pointer; }
.est-estilos button canvas { width: 100%; height: auto; border-radius: 9px; }
.est-estilos button[aria-pressed="true"] { border-color: var(--rosa); background: #FFF0F8; color: var(--tinta); box-shadow: 0 3px 0 var(--rosa); }
.est-estilos button:hover { border-color: var(--lilas); }
.est-det { border-top: 2px dashed var(--linha); padding-top: 10px; margin-top: 4px; }
.est-det summary { font-weight: 900; cursor: pointer; margin-bottom: 8px; }

/* painel: excluir itens direto das galerias */
.est-obj, .com-x, .est-efeitos .est-chave { position: relative; }
.est-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--erro, #C0264F); color: #fff; font-weight: 900; font-size: 16px; line-height: 22px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer; z-index: 2; }
.est-efeitos .est-chave .est-x { position: static; margin-left: auto; flex: none; }
.est-chips .com-x { padding-right: 22px; }
.est-chips .com-x .est-x { top: -8px; right: -8px; width: 20px; height: 20px; line-height: 18px; font-size: 13px; }
