/* Palco — avatar (animacao idle) + tela Guarda-roupa. Variaveis de cor em style.css (:root). */

/* ---------- avatar: luz de recorte, respiracao, balanco da cabeca, piscada, brilho ---------- */
/* Luz de recorte (rim light): halo lavanda fino em volta da silhueta. Fica no <svg> (caixa HTML)
   para a espessura ser em px de tela, igual a 120 px e a 400 px (no <g> ela escalaria com o
   viewBox). Roupa preta e pele retinta nao somem mais no palco roxo-preto. */
.avatar-svg {
  display: block;
  overflow: hidden;
  filter: drop-shadow(0 0 0.5px rgba(234, 224, 255, 0.95)) drop-shadow(0 0 1.3px rgba(185, 166, 255, 0.5));
}
.avatar-svg.av-costas,
.avatar-svg.av-sem-luz { filter: none; }

/* respiracao com um balanco minimo em volta do pe de apoio (contrapposto) */
.av-anim .av-figura {
  transform-box: view-box;
  transform-origin: 82px 472px;
  animation: av-respirar 4.2s ease-in-out infinite;
}
@keyframes av-respirar {
  0%, 100% { transform: rotate(-0.22deg) scale(1, 1); }
  50% { transform: rotate(0.22deg) scale(1.003, 1.0055); }
}

.av-anim .av-balanco {
  transform-box: view-box;
  transform-origin: 100px 112px;
  animation: av-balanco 7.5s ease-in-out infinite;
}
@keyframes av-balanco {
  0%, 100% { transform: rotate(-0.7deg); }
  50% { transform: rotate(0.7deg); }
}

.av-anim .av-olho {
  transform-box: fill-box;
  transform-origin: 50% 55%;
  animation: av-piscar 5.4s linear infinite;
  animation-delay: var(--av-piscar, 0s);
}
@keyframes av-piscar {
  0%, 94%, 100% { transform: scaleY(1); }
  95.5% { transform: scaleY(0.12); }
  97% { transform: scaleY(1); }
}

.av-anim .av-brilho {
  transform-box: fill-box;
  transform-origin: center;
  animation: av-brilhar var(--av-bd, 2.4s) ease-in-out infinite;
  animation-delay: var(--av-b, 0s);
}
@keyframes av-brilhar {
  0%, 100% { opacity: 0.15; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.15); }
}
.avatar-svg:not(.av-anim) .av-brilho { opacity: 0.75; }

@media (prefers-reduced-motion: reduce) {
  .av-anim .av-figura,
  .av-anim .av-balanco,
  .av-anim .av-olho,
  .av-anim .av-brilho { animation: none !important; }
}

/* ---------- avatar dentro de circulos (perfil, lista de cantores) ---------- */
.avatar.avatar-svgbox { overflow: hidden; padding: 0; position: relative; }
/* fundo de "palco" igual pra todo avatar em circulo (a cara ja diferencia as pessoas) */
.avatar.avatar-svgbox,
.perfil-cabeca .avatar-g {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 61, 154, 0.55), rgba(255, 61, 154, 0) 62%),
    linear-gradient(180deg, #2a1245 0%, #150a26 100%);
}
.avatar.avatar-svgbox .avatar-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
button.avatar { border: 0; cursor: pointer; font: inherit; }
button.avatar:focus-visible { outline: 2px solid var(--ciano); outline-offset: 3px; }
.perfil-cabeca .avatar-g { position: relative; overflow: visible; padding: 0; }
.perfil-cabeca .avatar-g .avatar-recorte { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.perfil-cabeca .avatar-g .avatar-recorte .avatar-svg { width: 100%; height: 100%; }
.avatar-editar {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 2px solid var(--magenta);
  color: #fff;
}
.avatar-editar .ic { width: 14px; height: 14px; }

/* ---------- tela Guarda-roupa ---------- */
.tela-guarda-roupa { gap: 12px; }
.gr-fixo {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 calc(-1 * (var(--safe-r) + 16px)) 0 calc(-1 * (var(--safe-l) + 16px));
  padding: 6px calc(var(--safe-r) + 16px) 8px calc(var(--safe-l) + 16px);
  background: rgb(11, 6, 20);
}
/* degrade curto por baixo: as opcoes somem suave ao passar por tras */
.gr-fixo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 16px;
  background: linear-gradient(180deg, rgb(11, 6, 20), rgba(11, 6, 20, 0));
  pointer-events: none;
}

.gr-palco {
  position: relative;
  height: clamp(230px, 37vh, 370px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--borda);
  background:
    radial-gradient(ellipse 58% 72% at 50% -8%, rgba(255, 61, 154, 0.30), rgba(255, 61, 154, 0) 70%),
    radial-gradient(ellipse 46% 16% at 50% 94%, rgba(180, 77, 255, 0.45), rgba(180, 77, 255, 0) 72%),
    linear-gradient(180deg, #221039 0%, #150a26 68%, #0f0719 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--sombra);
  isolation: isolate;
}
.gr-palco::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 236, 250, 0.16) 0%, rgba(255, 236, 250, 0) 88%);
  clip-path: polygon(41% 0, 59% 0, 84% 100%, 16% 100%);
  pointer-events: none;
}
.gr-palco::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 16%;
  z-index: -1;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 22px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 60%);
  mask-image: linear-gradient(180deg, transparent, #000 60%);
  pointer-events: none;
}
.gr-avatar {
  position: absolute;
  inset: 8px 0 24px;
  display: flex;
  justify-content: center;
  overflow: hidden; /* a luz de recorte nao vaza na borda quando a camera corta o corpo */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gr-avatar .avatar-svg { width: 100%; height: 100%; }

.gr-flutuante {
  position: absolute;
  top: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--borda-2);
  background: rgba(11, 6, 20, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--texto);
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.2s ease;
}
.gr-flutuante:active { transform: scale(0.95); }
.gr-flutuante .ic { width: 18px; height: 18px; }
.gr-aleatorio { right: 10px; }
.gr-aleatorio .ic { color: var(--ouro); }
.gr-desfazer { left: 10px; }
.gr-dica {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  z-index: 2;
  text-align: center;
  font-size: 0.7rem;
  color: var(--texto-3);
  pointer-events: none;
}

.gr-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  margin: 0 -2px;
}
.gr-cats::-webkit-scrollbar { display: none; }
.gr-cat {
  flex: none;
  scroll-snap-align: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--borda-2);
  background: var(--card-2);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.gr-cat.ativa {
  color: #fff;
  background: rgba(255, 61, 154, 0.2);
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(255, 61, 154, 0.14);
}
.gr-cat:focus-visible,
.gr-op:focus-visible,
.gr-cor:focus-visible,
.gr-tribo:focus-visible,
.gr-flutuante:focus-visible { outline: 2px solid var(--ciano); outline-offset: 2px; }

.gr-painel { display: flex; flex-direction: column; gap: 18px; padding-bottom: 4px; min-height: 30vh; }
.gr-grupo-titulo {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto-3);
  margin: 0 0 10px 2px;
}
.gr-grade {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}
.gr-grade.alto,
.gr-grade.largo { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.gr-op {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 6px 6px 7px;
  border-radius: 16px;
  border: 1px solid var(--borda);
  background: radial-gradient(ellipse 80% 70% at 50% 18%, rgba(180, 77, 255, 0.16), rgba(255, 255, 255, 0.035) 72%);
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.gr-op:active { transform: scale(0.96); }
.gr-op-img { display: block; aspect-ratio: 1 / 1; border-radius: 11px; overflow: hidden; }
.gr-op.alto .gr-op-img { aspect-ratio: 3 / 5; }
.gr-op.largo .gr-op-img { aspect-ratio: 3 / 2; }
.gr-op-img .avatar-svg { width: 100%; height: 100%; }
.gr-op-nome {
  font-size: 0.72rem;
  font-size: clamp(11px, 3.1vw, 13px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--texto-2);
  /* nunca quebra no meio da palavra ("Cavanhaqu / e") */
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: manual;
}
.gr-op.ativo {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(255, 61, 154, 0.18), 0 8px 20px rgba(255, 61, 154, 0.18);
}
.gr-op.ativo .gr-op-nome { color: #fff; }
.gr-op.ativo::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--magenta) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
  box-shadow: 0 0 0 2px var(--bg-0);
}

.gr-cores { display: flex; flex-wrap: wrap; gap: 12px; }
.gr-cor {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: var(--c);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.gr-cor:active { transform: scale(0.92); }
.gr-cor.ativo {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 5px var(--magenta), inset 0 -6px 10px rgba(0, 0, 0, 0.18);
}
.gr-cor-mic { width: 22px; height: 22px; color: rgba(255, 255, 255, 0.92); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }

.gr-tribos { display: flex; flex-wrap: wrap; gap: 8px; }
.gr-tribo {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--borda-2);
  background: transparent;
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--texto-2);
  cursor: pointer;
}
/* mesma linguagem de "selecionado" das categorias e opcoes (contorno magenta) */
.gr-tribo.ativa {
  color: #fff;
  background: rgba(255, 61, 154, 0.2);
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(255, 61, 154, 0.14);
}

/* fileira de pontos de partida (estreia, e perfil com avatar ainda provisorio) */
.gr-presets .gr-grupo-titulo { margin-bottom: 8px; }
/* "Monte o teu avatar": o visual ainda e o provisorio do app (perfil antigo / nunca escolheu) */
.gr-presets.gr-presets-montar {
  padding: 12px 12px 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 200, 61, 0.5);
  background:
    radial-gradient(ellipse 70% 90% at 0% 0%, rgba(255, 200, 61, 0.13), rgba(255, 200, 61, 0) 70%),
    rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 3px rgba(255, 200, 61, 0.08);
}
.gr-presets-montar .gr-grupo-titulo {
  margin-bottom: 2px;
  font-size: 1.05rem;
  color: var(--ouro);
  letter-spacing: 0;
  text-transform: none;
}
.gr-presets-aviso {
  margin: 0 0 10px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--texto-2);
}
.gr-presets-lista {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 3px 3px 6px;
  margin: 0 -3px;
}
.gr-presets-lista::-webkit-scrollbar { display: none; }
.gr-preset {
  flex: none;
  width: 78px;
  aspect-ratio: 148 / 197;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--borda);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  background:
    radial-gradient(ellipse 80% 60% at 50% 18%, rgba(180, 77, 255, 0.3), rgba(255, 255, 255, 0.04) 72%),
    #170b2a;
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.gr-preset .avatar-svg { width: 100%; height: 100%; }
.gr-preset:active { transform: scale(0.96); }
.gr-preset.ativo {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(255, 61, 154, 0.18), 0 8px 20px rgba(255, 61, 154, 0.18);
}
.gr-preset:focus-visible { outline: 2px solid var(--ciano); outline-offset: 2px; }

.gr-rodape {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 0 calc(-1 * (var(--safe-r) + 16px)) calc(-1 * (var(--safe-b) + 28px)) calc(-1 * (var(--safe-l) + 16px));
  padding: 18px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 14px) calc(var(--safe-l) + 16px);
  background: linear-gradient(180deg, rgba(11, 6, 20, 0) 0%, rgba(11, 6, 20, 0.94) 38%);
}
.gr-rodape .btn { width: 100%; }
.gr-estreia {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(61, 224, 255, 0.3);
  background: rgba(61, 224, 255, 0.07);
  font-size: 0.86rem;
  color: var(--texto-2);
}
.gr-estreia .ic { color: var(--ciano); }
.gr-estreia b { color: var(--ciano); font-family: var(--mono); letter-spacing: 0.04em; }

/* revelacao "Seu cantor ta pronto!": corpo inteiro grande, sob o holofote (o climax da criacao) */
.criado-avatar {
  position: relative;
  width: min(100%, 300px);
  height: clamp(280px, 44vh, 340px);
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--borda);
  background:
    radial-gradient(ellipse 58% 72% at 50% -8%, rgba(255, 61, 154, 0.34), rgba(255, 61, 154, 0) 70%),
    radial-gradient(ellipse 50% 16% at 50% 95%, rgba(180, 77, 255, 0.5), rgba(180, 77, 255, 0) 72%),
    linear-gradient(180deg, #221039 0%, #150a26 70%, #0f0719 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--sombra);
  isolation: isolate;
  animation: criado-entra 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.criado-avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 236, 250, 0.2) 0%, rgba(255, 236, 250, 0) 90%);
  clip-path: polygon(40% 0, 60% 0, 88% 100%, 12% 100%);
  pointer-events: none;
}
.criado-avatar .avatar-svg { position: absolute; left: 0; right: 0; top: 12px; bottom: 6px; width: 100%; height: calc(100% - 18px); }
@keyframes criado-entra {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .criado-avatar { animation: none; }
}

@media (max-height: 700px) {
  .gr-palco { height: clamp(210px, 36vh, 300px); }
}

/* ---------- desktop (>= 900 px): palco grande a esquerda, chips + opcoes a direita ---------- */
@media (min-width: 900px) {
  #app:has(> .tela-guarda-roupa:not([hidden])) { max-width: 1160px; }
  .tela-guarda-roupa {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    column-gap: 32px;
    row-gap: 0;
    align-items: start;
  }
  .tela-guarda-roupa > .topo { grid-column: 1 / -1; margin-bottom: 14px; }
  /* o bloco fixo do celular se desfaz: palco vai pra coluna da esquerda (fixo na tela ao rolar),
     chips vao pro topo da coluna da direita, logo acima das opcoes */
  .tela-guarda-roupa > .gr-fixo { display: contents; }
  .tela-guarda-roupa > .gr-fixo::after { display: none; }
  .tela-guarda-roupa .gr-palco {
    grid-column: 1;
    grid-row: 2 / span 6;
    position: sticky;
    top: 16px;
    height: clamp(420px, calc(100vh - 110px), 780px);
  }
  .tela-guarda-roupa > :not(.topo):not(.gr-fixo),
  .tela-guarda-roupa .gr-cats { grid-column: 2; margin-bottom: 18px; }
  /* sobra espaco: os chips quebram linha em vez de rolar */
  .tela-guarda-roupa .gr-cats { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; }
  .tela-guarda-roupa .gr-cat { scroll-snap-align: none; }
  .tela-guarda-roupa > .gr-rodape { position: static; margin: 4px 0 0; padding: 0 0 20px; background: none; }
}
