:root {
  color: #413451;
  background: #fff;
  font-family: Fredoka, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; }
.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #fff;
}
.nova-barra {
  --alvo: clamp(44px, 11.4vw, 52px);
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 3px 6px 5px;
  border-bottom: 1px solid #ebe6f1;
  background: #fcfaff;
  user-select: none;
}
.ferramentas {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--alvo);
  place-items: center;
  gap: 1px;
}
.icon-tool, .seta {
  width: var(--alvo, 38px);
  height: var(--alvo, 38px);
  display: grid;
  place-items: center;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #413451;
  cursor: pointer;
}
.icon-tool svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-tool.ativo { color: #674caf; background: #eeeaff; }
.cor { touch-action: none; }
.icon-tool:focus-visible, .cor:focus-visible, .seta:focus-visible {
  outline: 2px solid #674caf;
  outline-offset: 1px;
}
.legenda-escondida { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.meio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) 38px;
  grid-template-areas: "desenho desenho" "anterior proximo";
  min-width: 0;
  min-height: 0;
}
.mesa {
  grid-area: desenho;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}
.folha {
  position: relative;
  overflow: hidden;
  touch-action: none;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0) scale(var(--zoom, 1));
}
.folha canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.linhas { pointer-events: none; mix-blend-mode: multiply; }
.seta { align-self: center; background: #f4eefb; }
.seta:disabled { visibility: hidden; }
[data-ant] { grid-area: anterior; justify-self: start; }
[data-prox] { grid-area: proximo; justify-self: end; }
.gota {
  position: fixed;
  z-index: 4;
  width: 38px;
  height: 38px;
  margin: -50px 0 0 -19px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 16px #0004;
  pointer-events: none;
}
.album {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #23173580;
}
.album .caixa {
  width: min(980px, 100%);
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  padding: 14px;
  background: #faf7ff;
}
.album h2 { margin: 0 0 12px; text-align: center; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: 12px; }
.mini { padding: 5px; background: #fff; border: 0; border-radius: 10px; color: inherit; cursor: pointer; }
.mini.atual { outline: 3px solid #f3ba14; }
.mini img { width: 100%; aspect-ratio: 3/4; object-fit: contain; display: block; }
.mini span { display: block; padding-top: 5px; }
.dica {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: calc(43px + env(safe-area-inset-bottom));
  translate: -50% 0;
  width: max-content;
  max-width: min(82vw, 420px);
  padding: 6px 12px;
  border-radius: 14px;
  background: #413451e8;
  color: #fff;
  text-align: center;
  font-size: .82rem;
  pointer-events: none;
  transition: opacity .2s;
}
.dica.some { opacity: 0; }
.parabens { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.parabens i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: cai 2.2s ease-in forwards; }
@keyframes cai { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 370px) and (orientation: portrait) {
  .ferramentas {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, var(--alvo));
  }
}
@media (prefers-reduced-motion: reduce) {
  .dica { transition: none; }
  .parabens { display: none; }
}
.nova-barra .area-paleta { grid-column: 1 / -1; }

.progresso-pintura {
  grid-area: 2 / 1 / 3 / 3;
  align-self: center;
  justify-self: center;
  max-width: calc(100% - 86px);
  margin: 0;
  color: #685b75;
  text-align: center;
  font: 500 .78rem Fredoka, system-ui, sans-serif;
  pointer-events: none;
}
.opcoes-desenho {
  width: min(390px, calc(100% - 28px));
  padding: 20px;
  border: 0;
  border-radius: 18px;
  color: #413451;
  background: #fcfaff;
}
.opcoes-desenho::backdrop { background: #23173580; }
.opcoes-desenho h2 { margin: 0 0 12px; }
.opcoes-desenho p { margin: 0 0 14px; line-height: 1.4; }
.opcoes-desenho button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #dad0e5;
  border-radius: 9px;
  color: #413451;
  background: #fff;
  cursor: pointer;
}
.opcoes-desenho button:focus-visible { outline: 2px solid #674caf; outline-offset: 2px; }
.opcoes-acoes { display: grid; gap: 8px; }
.opcoes-confirmacao { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.opcoes-desenho [data-apagar-pintura] { color: #832737; border-color: #e6bfc6; background: #fff0f2; }
