/* Personagens: o botão de personalizar e o editor, no tema escuro da marca (barra/tema.css).
   Tudo do editor fica dentro de #editor. */
.hud-botao {
  font: inherit; font-size: 12px; border: 1px solid var(--accent); border-radius: 4px; padding: 4px 8px; cursor: var(--cursor-clique, pointer);
  background: var(--accent); color: var(--sobre-accent); font-weight: 700; box-shadow: var(--sombra);
}
.hud-botao:hover { filter: brightness(1.08); }
.hud-botao:focus-visible { outline: 2px solid var(--foco); outline-offset: 1px; }


/* ---- Editor ---- */
#editor {
  --ed-bg: var(--bg); --ed-bg-2: var(--card); --ed-panel: var(--card); --ed-panel-2: var(--superficie); --ed-tile: var(--superficie);
  --ed-tile-h: color-mix(in srgb, var(--accent) 16%, var(--superficie)); --ed-line: var(--line); --ed-fg: var(--fg);
  --ed-muted: var(--muted); --ed-accent: var(--accent); --ed-accent-ink: var(--sobre-accent); --ed-warn: var(--aviso);
  --ed-sans: var(--body);
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; overflow: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--veu); color: var(--ed-fg); font: 400 14px/1.45 var(--ed-sans);
}
#editor * { box-sizing: border-box; }
#editor button, #editor input { font: inherit; color: inherit; }
#editor button { cursor: var(--cursor-clique, pointer); }
#editor :focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.ed-caixa { width: min(1100px, 100%); background: var(--ed-bg); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--ed-line); }
.ed-linha { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-btn { border: 0; border-radius: 999px; padding: 8px 15px; font-weight: 700; background: var(--ed-tile); color: var(--ed-fg); text-decoration: none; display: inline-block; }
.ed-btn:hover { background: var(--ed-tile-h); }
.ed-btn { border: 1px solid var(--ed-line); }
.ed-primario { border-color: var(--ed-accent); }
.ed-primario { background: var(--ed-accent); color: var(--ed-accent-ink); }
.ed-primario:hover { background: var(--ed-accent); filter: brightness(1.1); }
.ed-icone { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; font-size: 16px; }
.ed-rodape { justify-content: flex-end; }
.ed-pequeno { padding: 6px 12px; font-size: 12px; }
/* O palco e o painel com a mesma altura fixa: o painel não cresce e encolhe a cada aba (a grade rola dentro dele). */
.ed-app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px); gap: 16px; align-items: stretch; height: min(560px, calc(100vh - 150px)); }
@media (max-width: 880px) { .ed-app { grid-template-columns: minmax(0, 1fr); height: auto; } }

/* palco */
.ed-palco {
  position: relative; border-radius: 14px; overflow: hidden; min-height: 0; display: flex; align-items: center; justify-content: center;
  cursor: var(--cursor-agarrar, grab); touch-action: none; user-select: none; -webkit-user-select: none;
  background: var(--ed-bg-2);
}
.ed-palco.arrastando { cursor: var(--cursor-agarrando, grabbing); }
.ed-palco input { cursor: text; user-select: text; }
@media (max-width: 880px) { .ed-palco { min-height: 400px; } }
.ed-nome { position: absolute; left: 14px; top: 14px; z-index: 2; background: var(--panel); border-radius: 10px; padding: 6px 10px; max-width: calc(100% - 28px); }
.ed-nome input { background: transparent; border: 0; border-bottom: 1px dashed var(--ed-line); width: 190px; max-width: 100%; padding: 2px 0; font-weight: 700; }
.ed-figura { position: relative; width: min(88%, 420px); aspect-ratio: 1 / 1; display: grid; place-items: center; }
.ed-figura canvas { width: 100%; height: 100%; position: relative; z-index: 1; }
.ed-sombra { position: absolute; left: 50%; bottom: 12%; width: 46%; height: 9%; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(0, 17, 43, .22), transparent 70%); border-radius: 50%; }
#ed-random { position: absolute; right: 14px; top: 14px; z-index: 2; }
.ed-cam { position: absolute; left: 14px; bottom: 14px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
.ed-cam button { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--panel); font-weight: 700; font-size: 16px; line-height: 1; }
.ed-cam button:hover { background: var(--ed-tile); }
.ed-ctrls { position: absolute; right: 14px; bottom: 14px; z-index: 2; display: flex; gap: 8px; align-items: center; }
.ed-rotulo { font-size: 11px; color: var(--ed-muted); font-weight: 700; }
.ed-seg { display: inline-flex; background: var(--panel); border-radius: 999px; padding: 3px; gap: 2px; }
.ed-seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 700; color: var(--ed-muted); }
.ed-seg button[aria-pressed="true"] { background: var(--ed-tile); color: var(--ed-fg); }
@media (max-width: 520px) {
  .ed-palco { flex-direction: column; justify-content: flex-start; gap: 10px; padding: 56px 12px 14px; min-height: 0; }
  .ed-cam, .ed-ctrls { position: static; flex-direction: row; }
}

/* painel */
.ed-painel { background: var(--ed-panel); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow: hidden; }
.ed-painel .ed-grade { flex: 1; min-height: 0; max-height: none; align-content: start; }
.ed-abas { display: flex; border-bottom: 2px solid var(--ed-line); }
.ed-abas button { flex: 1; border: 0; background: transparent; padding: 10px 4px; font-weight: 700; color: var(--ed-muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.ed-abas button[aria-selected="true"] { color: var(--ed-fg); border-bottom-color: var(--ed-fg); }
.ed-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-chips button { border: 0; border-radius: 999px; padding: 7px 14px; background: var(--ed-panel-2); color: var(--ed-muted); font-weight: 700; font-size: 13px; }
.ed-chips button[aria-pressed="true"] { background: var(--ed-accent); color: var(--ed-accent-ink); }
.ed-cores[hidden] { display: none; }
.ed-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 9px 8px; }
.ed-cor { width: 100%; aspect-ratio: 1 / 1; max-width: 36px; border-radius: 50%; border: 2px solid transparent; padding: 0; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }
.ed-cor[aria-pressed="true"] { border-color: var(--ed-fg); box-shadow: 0 0 0 2px var(--ed-panel), 0 0 0 4px var(--ed-fg); }
.ed-grade { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; padding: 3px; scrollbar-width: thin; }
/* A linha antes das camisas estampadas, na largura toda da grade, com o rótulo no meio. */
.ed-separador { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.ed-separador::before, .ed-separador::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.ed-grade.ed-grande { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ed-item { position: relative; border: 2px solid transparent; background: var(--ed-tile); border-radius: 12px; padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.ed-item:hover { background: var(--ed-tile-h); }
/* O escolhido: borda e fundo na cor de destaque, e um ✓ no canto (não só a cor, para quem não distingue o azul). */
.ed-item[aria-pressed="true"] { border-color: var(--ed-accent); background: color-mix(in srgb, var(--ed-accent) 24%, var(--ed-tile)); }
.ed-item[aria-pressed="true"]::after {
  content: "✓"; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ed-accent); color: var(--ed-accent-ink); font-size: 12px; font-weight: 700;
}
.ed-item canvas { width: 100%; aspect-ratio: 1 / 1; display: block; }
.ed-x { font-size: 30px; line-height: 1; color: var(--ed-fg); display: grid; place-items: center; aspect-ratio: 1 / 1; width: 100%; }
.ed-item em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ed-fg); text-align: center; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
/* Opções bloqueadas por um especial: esmaecidas, sem clique, com o bloco do aviso por cima. */
.ed-opcoes { position: relative; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.ed-opcoes.bloqueado > :not(.ed-bloqueio) { opacity: 0.25; filter: grayscale(0.6); pointer-events: none; }
.ed-bloqueio { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center; border-radius: 12px; background: color-mix(in srgb, var(--ed-panel) 55%, transparent); }
.ed-bloqueio[hidden] { display: none; }
.ed-bloqueio p { margin: 0; max-width: 300px; font-size: 14px; font-weight: 600; color: var(--ed-fg); }
.ed-nota { background: var(--ed-bg-2); border-left: 4px solid var(--ed-warn); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ed-dica { color: var(--ed-muted); font-size: 13px; margin: 0; }

/* folha de sprites */
@media (prefers-reduced-motion: reduce) { #editor * { transition: none !important; } }

/* ---- Mock neobrutalista cozy (tela T06 Camarim) ----
   Um bloco Azul Smart em três colunas: à esquerda o título e as abas, cada uma com a bolha colorida do ícone (a escolhida
   num bloco Off White); no meio o palco, um arco escuro com as luzes de camarim na borda e o chão de luz amarelo, e ao
   lado a coluna do dado e do zoom; à direita o painel Off White das peças, com as categorias em segmento (a escolhida
   cheia de tinta), as cores em bolhas e a dica num papel. Embaixo, depois de uma linha de tinta, o aviso e os botões. */
#editor .ed-caixa { width: min(1400px, 100%); background: var(--snx-azul); border: var(--contorno); border-radius: 28px; box-shadow: var(--brilho), 8px 8px 0 var(--tinta-sombra); padding: 22px; gap: 22px; }
#editor .ed-app { grid-template-columns: 240px minmax(0, 1fr) minmax(0, 440px); gap: 22px; height: min(690px, calc(100vh - 160px)); }
@media (max-width: 1100px) { #editor .ed-app { grid-template-columns: 200px minmax(0, 1fr) minmax(0, 360px); } }
@media (max-width: 880px) { #editor .ed-app { grid-template-columns: minmax(0, 1fr); height: auto; } }

/* Coluna das abas. */
.ed-nav { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ed-nav-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ed-eb { font: 700 11px var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--tinta); }
.ed-titulo { margin: 6px 0 0; font: 700 30px/1.1 var(--display); letter-spacing: -.015em; color: var(--tinta); }
#editor .ed-abas { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; background: none; }
#editor .ed-abas button {
  flex: none; display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 14px 8px 8px; margin: 0; border-radius: 18px;
  border: 3px solid transparent; background: transparent; color: var(--tinta); font-weight: 700; font-size: 15px; text-align: left;
  transition: translate .25s var(--mola);
}
#editor .ed-abas button:hover { translate: 4px 0; }
#editor .ed-abas button[aria-selected="true"] { background: var(--snx-off-white); border-color: var(--tinta-borda); box-shadow: var(--sombra-peca); color: var(--tinta); }
.ed-bolha { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: var(--contorno-fino); color: var(--tinta); }
.ed-bolha-base { background: var(--pastel-amarelo); } .ed-bolha-roupas { background: var(--pastel-rosa); }
.ed-bolha-acessorios { background: var(--pastel-verde); } .ed-bolha-especial { background: var(--pastel-ciano); }
@media (max-width: 880px) { #editor .ed-abas { flex-direction: row; flex-wrap: wrap; } #editor .ed-abas button { width: auto; } }

/* O palco no arco, do tamanho que cabe na coluna (a proporção do mock, 430 × 610). */
.ed-centro { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; }
.ed-arco { position: relative; height: calc(100% - 16px); max-width: calc(100% - 128px); aspect-ratio: 430 / 610; }
@media (max-width: 880px) { .ed-arco { height: 480px; } }
#editor .ed-palco {
  position: absolute; inset: 0; min-height: 0; border: var(--contorno); border-radius: 50% 50% 30px 30px / 35% 35% 30px 30px; box-shadow: 8px 8px 0 var(--tinta-sombra);
  background: radial-gradient(ellipse 60% 30% at 50% 88%, var(--pastel-ciano), transparent 70%), #0b2a55;
}
.ed-luzes { position: absolute; inset: 0; pointer-events: none; }
.ed-luzes span { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--pastel-amarelo); border: var(--contorno); }
@media (prefers-reduced-motion: no-preference) {
  .ed-luzes span { animation: ed-pisca 2.4s ease-in-out infinite; }
  .ed-luzes span:nth-child(odd) { animation-delay: 1.2s; }
  @keyframes ed-pisca { 50% { background: #fffbe0; box-shadow: 0 0 10px 2px rgba(255, 241, 168, .8); } }
}
/* O personagem em pé no chão de luz amarelo. */
#editor .ed-figura { position: absolute; inset: 0; width: auto; aspect-ratio: auto; }
#editor .ed-figura canvas { position: absolute; left: 50%; bottom: 4%; width: auto; height: 82%; aspect-ratio: 1 / 1; translate: -50% 0; }
#editor .ed-sombra { left: 50%; bottom: 5%; width: 60%; height: 7.5%; translate: -50% 0; transform: none; border-radius: 50%; border: var(--contorno); background: var(--pastel-amarelo); }
#editor .ed-nome {
  left: 50%; top: 15%; translate: -50% 0; display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 5px; max-width: calc(100% - 40px);
  border: var(--contorno-fino); border-radius: 999px; background: var(--snx-off-white); box-shadow: 2px 2px 0 var(--tinta-sombra);
}
#editor .ed-nome input { width: 150px; border: 0; background: transparent; box-shadow: none; outline-offset: 2px; padding: 0; font-weight: 700; font-size: 13px; text-align: center; }
.ed-bolinha { flex: none; width: 12px; height: 12px; border-radius: 50%; border: var(--contorno-fino); background: var(--ok); }
/* O dado e o zoom numa coluna, no alto à direita do palco. */
#editor .ed-cam { position: absolute; right: 0; top: 0; left: auto; bottom: auto; flex-direction: column; gap: 10px; }
#editor .ed-cam button, #editor #ed-random {
  position: static; width: 46px; height: 46px; padding: 0; display: grid; place-items: center; border-radius: 999px; border: var(--contorno);
  background: var(--snx-off-white); color: var(--tinta); font-size: 18px; font-weight: 700; box-shadow: var(--sombra-peca); transition: translate .25s var(--mola), box-shadow .12s;
}
#editor #ed-random { background: var(--pastel-amarelo); }
@media (max-width: 880px) { #editor .ed-cam { position: static; flex-direction: row; margin-top: 12px; } .ed-centro { display: flex; flex-direction: column; } .ed-arco { max-width: 100%; } }

/* O painel das peças. */
#editor .ed-painel { background: var(--snx-off-white); border: var(--contorno); border-radius: 20px; box-shadow: var(--brilho), 5px 5px 0 var(--tinta-sombra); padding: 20px; gap: 18px; overflow: visible; }
#editor .ed-chips { display: inline-flex; flex-wrap: wrap; align-self: flex-start; gap: 2px; padding: 4px; border: var(--contorno); border-radius: 26px; background: var(--snx-off-white); box-shadow: var(--sombra-peca); }
#editor .ed-chips[hidden] { display: none; }
#editor .ed-chips button { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--tinta); font-size: 14px; box-shadow: none; }
#editor .ed-chips button[aria-pressed="true"] { background: var(--tinta-fundo); color: var(--sobre-tinta); }
#editor .ed-cores { grid-template-columns: repeat(auto-fill, 48px); gap: 16px; padding: 4px; }
#editor .ed-cor { width: 48px; height: 48px; max-width: none; border: var(--contorno); box-shadow: 3px 3px 0 var(--tinta-sombra); transition: translate .25s var(--mola), scale .25s var(--mola); }
#editor .ed-cor:hover { translate: -2px -3px; scale: 1.06; }
#editor .ed-cor[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--snx-off-white), 0 0 0 7px var(--tinta); }
#editor .ed-opcoes { min-height: 0; overflow: hidden; }
#editor .ed-grade { gap: 12px; padding: 4px 8px 8px 4px; }
#editor .ed-item { border: var(--contorno); border-radius: 18px; background: var(--superficie); box-shadow: var(--sombra-peca); transition: translate .25s var(--mola); }
#editor .ed-item:hover { background: var(--pastel-amarelo); translate: -2px -3px; }
#editor .ed-item[aria-pressed="true"] { border-color: var(--tinta-borda); background: var(--pastel-amarelo); box-shadow: 0 0 0 2px var(--tinta), var(--sombra-peca); }
#editor .ed-item[aria-pressed="true"]::after { background: var(--tinta-fundo); color: var(--sobre-tinta); }
#editor .ed-separador { color: var(--tinta); font-weight: 700; }
#editor .ed-separador::before, #editor .ed-separador::after { border-top: var(--contorno-fino); }
/* A dica num papel, um pouco torto, com o rótulo em cima. */
#editor .ed-dica {
  flex: none; position: relative; margin: auto 0 0; padding: 14px 18px; border: var(--contorno); border-radius: 18px; background: var(--claro-fbfaf7, #FBFAF7); color: var(--escuro-13213a, #13213a);
  box-shadow: 5px 5px 0 var(--tinta-sombra); rotate: -1deg; font-size: 15px; line-height: 1.45;
}
#editor .ed-dica::before { content: "Dica"; display: block; margin-bottom: 4px; font: 700 11px var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--texto-link, var(--snx-azul-medio)); }
#editor .ed-dica:empty { display: none; }
#editor .ed-bloqueio { background: color-mix(in srgb, var(--snx-off-white) 70%, transparent); }

/* Botões e rodapé. */
#editor .ed-btn { height: 46px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: var(--contorno); background: var(--snx-off-white); color: var(--tinta); box-shadow: var(--sombra-peca); transition: translate .25s var(--mola), box-shadow .12s; }
#editor .ed-btn:hover { translate: -2px -3px; box-shadow: 6px 7px 0 var(--tinta-sombra); background: var(--snx-off-white); filter: none; }
#editor .ed-btn:focus-visible { translate: -2px -3px; box-shadow: 6px 7px 0 var(--tinta-sombra); background: var(--snx-off-white); filter: none; outline: none; }
#editor .ed-btn:active { translate: 4px 4px; box-shadow: 0 0 0 var(--tinta); }
#editor .ed-primario, #editor .ed-primario:hover { background: var(--pastel-amarelo); color: var(--tinta); }
#editor .ed-pequeno { height: 36px; padding: 0 14px; font-size: 13px; }
#editor #ed-close { flex: none; width: 46px; padding: 0; border-radius: 50%; }
#editor .ed-rodape { gap: 12px; padding-top: 16px; border-top: 3px solid var(--tinta-borda); }
.ed-aviso-rodape { flex: 1; min-width: 0; color: var(--tinta); font-size: 15px; }
#editor :focus-visible { outline: 3px solid var(--tinta); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .ed-luzes span { animation: none; } }
