@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --papel: #fbf6ee;
  --papel-2: #f4ecdf;
  --linha: #e4d8c6;
  --tinta: #2a1f1d;
  --tinta-2: #5b4b45;
  --pinho: #1f5c3f;
  --pinho-escuro: #154530;
  --pinho-claro: #e3efe7;
  --cereja: #b3202f;
  --cereja-claro: #fbe6e6;
  --ouro: #e9a923;
  --ouro-claro: #fdf1d4;
  --branco: #fffdf9;
  --raio: 18px;
  --sombra: 0 6px 18px -8px rgba(58, 34, 34, .28), 0 2px 4px -2px rgba(58, 34, 34, .14);
  --titulo: "Fredoka", ui-rounded, system-ui, sans-serif;
  --texto: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --abas: 64px;
  --seguro-baixo: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 16px/1.45 var(--texto);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
::selection { background: var(--ouro-claro); color: var(--tinta); }
img, canvas, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--pinho); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 16px 16px calc(var(--abas) + var(--seguro-baixo) + 24px); max-width: 640px; width: 100%; margin: 0 auto; outline: none; }
body.sem-abas main { padding-bottom: calc(var(--seguro-baixo) + 24px); }

/* topo */
.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  min-height: 56px; padding: env(safe-area-inset-top, 0px) 8px 0;
  background: rgba(251, 246, 238, .94);
  -webkit-backdrop-filter: saturate(1.2) blur(8px); backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--linha);
}
.topo-voltar { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.topo-voltar svg { width: 26px; height: 26px; fill: none; stroke: var(--tinta); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.topo-voltar:active { background: var(--papel-2); }
.topo-titulo { font: 600 1.18rem/1.2 var(--titulo); margin: 0; flex: 1; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.topo-offline { font-size: .78rem; font-weight: 600; color: var(--cereja); background: var(--cereja-claro); padding: 4px 10px; border-radius: 99px; margin-right: 6px; }

/* abas */
.abas {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--abas) + var(--seguro-baixo)); padding-bottom: var(--seguro-baixo);
  background: var(--branco); border-top: 1px solid var(--linha);
}
.abas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--tinta-2); font-size: .74rem; font-weight: 600; }
.abas svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.abas a[aria-current="page"] { color: var(--pinho); }
.abas a[aria-current="page"] svg { stroke-width: 2.4; }

/* tipografia */
h2 { font: 600 1.6rem/1.15 var(--titulo); margin: 8px 0 6px; letter-spacing: -.02em; text-wrap: balance; }
h3 { font: 600 1.15rem/1.2 var(--titulo); margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.sub { color: var(--tinta-2); }
.pequeno { font-size: .88rem; color: var(--tinta-2); }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0;
  font: 600 1.05rem/1 var(--titulo); letter-spacing: .005em; text-decoration: none; cursor: pointer;
  background: var(--pinho); color: #fff; box-shadow: 0 3px 0 var(--pinho-escuro);
  transition: transform .12s ease-out, box-shadow .12s ease-out, background .2s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--pinho-escuro); }
.btn[disabled] { background: #b9c4bd; box-shadow: none; cursor: not-allowed; }
.btn.largo { width: 100%; }
.btn.cereja { background: var(--cereja); box-shadow: 0 3px 0 #7d1520; }
.btn.claro { background: var(--branco); color: var(--pinho); box-shadow: inset 0 0 0 2px var(--pinho), 0 3px 0 var(--linha); }
.btn.claro:active { box-shadow: inset 0 0 0 2px var(--pinho); }
.btn.texto { background: none; color: var(--pinho); box-shadow: none; min-height: 44px; padding: 0 8px; text-decoration: underline; text-underline-offset: 4px; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pilha { display: grid; gap: 12px; }
.linha-btn { display: flex; gap: 10px; flex-wrap: wrap; }
.linha-btn > .btn { flex: 1 1 140px; }

/* formulários */
label.campo { display: grid; gap: 6px; font-weight: 600; }
.input {
  min-height: 52px; width: 100%; padding: 0 14px; border-radius: 12px;
  border: 2px solid var(--linha); background: var(--branco); font-size: 1.05rem;
}
.input:focus { border-color: var(--pinho); outline: none; box-shadow: 0 0 0 3px var(--pinho-claro); }
.senha-caixa { position: relative; display: block; }
.senha-caixa .input { padding-right: 96px; }
.senha-caixa .mostrar { position: absolute; right: 4px; top: 4px; min-height: 44px; font-weight: 600; font-size: .95rem; }
.erro { color: var(--cereja); background: var(--cereja-claro); border-radius: 12px; padding: 10px 14px; font-weight: 500; }
.ok { color: var(--pinho-escuro); background: var(--pinho-claro); border-radius: 12px; padding: 10px 14px; }
.dica { background: var(--ouro-claro); border-radius: 12px; padding: 10px 14px; font-size: .95rem; }

/* entrar */
.boas-vindas { display: grid; gap: 18px; padding-top: 6vh; }
.marca { display: flex; align-items: center; gap: 12px; }
.marca img { width: 56px; height: 56px; border-radius: 14px; box-shadow: var(--sombra); }
.marca strong { font: 700 1.5rem/1 var(--titulo); letter-spacing: -.02em; color: var(--pinho); }
.vitrine { display: flex; justify-content: center; gap: 4px; margin: 4px 0 0; }
.vitrine img { width: 30%; max-width: 132px; filter: drop-shadow(0 6px 8px rgba(58,34,34,.18)); }
.vitrine img:nth-child(2) { transform: translateY(-8px); }

/* início */
.categorias { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.cat {
  position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 168px; padding: 10px 12px 12px;
  border-radius: var(--raio); background: var(--branco); border: 1px solid var(--linha); box-shadow: var(--sombra);
  text-decoration: none; color: var(--tinta); overflow: hidden;
}
.cat img { height: 112px; width: auto; margin: 0 auto; object-fit: contain; }
.cat b { font: 600 1.1rem/1.1 var(--titulo); }
.cat small { display: block; color: var(--tinta-2); font-size: .8rem; margin-top: 2px; }
.cat.bloq img { opacity: .55; filter: grayscale(.5); }
.cadeado {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 700; color: var(--cereja); background: var(--cereja-claro); padding: 4px 8px; border-radius: 99px;
}
.cadeado svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.cat:nth-child(1) { background: linear-gradient(180deg, var(--pinho-claro), var(--branco) 60%); }
.cat:nth-child(2) { background: linear-gradient(180deg, var(--ouro-claro), var(--branco) 60%); }
.cat:nth-child(3) { background: linear-gradient(180deg, var(--cereja-claro), var(--branco) 60%); }
.atalhos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.atalho {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border-radius: 14px;
  background: var(--branco); border: 1px solid var(--linha); text-decoration: none; color: var(--tinta); font-weight: 600;
}
.atalho svg { width: 28px; height: 28px; flex: none; fill: none; stroke: var(--pinho); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.atalho.destaque { grid-column: 1 / -1; background: var(--pinho); color: #fff; border: 0; min-height: 68px; }
.atalho.destaque svg { stroke: #fff; }
.atalho.destaque span small { display: block; font-weight: 400; opacity: .88; font-size: .84rem; }
.privacidade { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; font-size: .9rem; color: var(--tinta-2); }
.privacidade svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--pinho); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* galeria */
.filtros { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--linha);
  background: var(--branco); font-weight: 600; font-size: .92rem; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--pinho); color: #fff; border-color: var(--pinho); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.molde {
  position: relative; border: 1px solid var(--linha); background: var(--branco); border-radius: var(--raio); padding: 10px 8px 12px;
  display: grid; gap: 6px; text-align: center; cursor: pointer; box-shadow: var(--sombra);
}
.molde img { aspect-ratio: 2 / 3; height: auto; width: 100%; object-fit: contain; }
.molde span { font-weight: 600; font-size: .95rem; }
.molde.bloq img { opacity: .55; filter: grayscale(.5); }
.molde[aria-pressed="true"] { border: 2px solid var(--pinho); box-shadow: 0 0 0 3px var(--pinho-claro); }
.vazio { text-align: center; padding: 32px 12px; color: var(--tinta-2); }
.vazio svg { width: 64px; height: 64px; margin: 0 auto 10px; fill: none; stroke: var(--linha); stroke-width: 1.6; }

/* foto */
.escolha-foto { display: grid; gap: 12px; margin-top: 16px; }
.molde-escolhido { display: flex; gap: 14px; align-items: center; background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px; }
.molde-escolhido img { width: 72px; }
.input-arquivo { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* editor */
.editor { display: grid; gap: 12px; }
.palco {
  position: relative; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 2 / 3; border-radius: var(--raio);
  background:
    radial-gradient(circle at 20% 15%, #fff 0 1.5px, transparent 2px) 0 0 / 28px 28px,
    linear-gradient(180deg, var(--pinho-claro), var(--papel-2));
  border: 1px solid var(--linha); overflow: hidden; touch-action: none;
}
.palco canvas { width: 100%; height: 100%; }
.palco .processando {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; padding: 24px;
  background: rgba(251, 246, 238, .9); font-weight: 600;
}
.passos-proc { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; font-weight: 500; }
.passos-proc li { display: flex; gap: 8px; align-items: center; color: var(--tinta-2); }
.passos-proc li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--linha); flex: none; }
.passos-proc li.feito { color: var(--tinta); }
.passos-proc li.feito::before { background: var(--pinho); border-color: var(--pinho); }
.passos-proc li.agora::before { border-color: var(--ouro); border-top-color: transparent; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.controles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 420px; margin: 0 auto; width: 100%; }
.ctl {
  min-height: 52px; border-radius: 14px; border: 1.5px solid var(--linha); background: var(--branco);
  display: grid; place-items: center; cursor: pointer;
}
.ctl { gap: 2px; padding: 6px 0; min-height: 60px; }
.ctl span { font-size: .74rem; font-weight: 600; color: var(--tinta-2); line-height: 1; }
.ctl svg { width: 24px; height: 24px; fill: none; stroke: var(--tinta); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ctl:active { background: var(--papel-2); }
.ctl[aria-pressed="true"] { background: var(--pinho-claro); border-color: var(--pinho); }
.painel { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px; display: grid; gap: 12px; max-width: 420px; width: 100%; margin: 0 auto; }
.deslize { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 10px; font-size: .92rem; font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--pinho); height: 32px; }
.escolher-rosto { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.escolher-rosto button { border: 2px solid var(--linha); border-radius: 14px; background: var(--branco); padding: 4px; cursor: pointer; }
.escolher-rosto canvas { width: 100%; aspect-ratio: 1; border-radius: 10px; }
.folha {
  position: fixed; inset: auto 0 0 0; z-index: 50; max-height: 78dvh; overflow: auto;
  background: var(--branco); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + var(--seguro-baixo));
  box-shadow: 0 -12px 40px -12px rgba(42,31,29,.35);
  animation: sobe .28s cubic-bezier(.16, 1, .3, 1);
}
.folha::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 99px; background: var(--linha); margin: 0 auto 10px; }
.veu { position: fixed; inset: 0; z-index: 45; background: rgba(42,31,29,.35); }
@keyframes sobe { from { transform: translateY(40px); opacity: .4; } }

/* turma */
.progresso { height: 12px; border-radius: 99px; background: var(--papel-2); overflow: hidden; border: 1px solid var(--linha); }
.progresso i { display: block; height: 100%; width: 0; background: var(--pinho); transition: width .3s ease-out; }
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.fig {
  position: relative; border: 1.5px solid var(--linha); background: var(--branco); border-radius: 14px; padding: 6px;
  display: grid; gap: 4px; cursor: pointer; text-align: center; font-size: .8rem; font-weight: 600;
}
.fig img { aspect-ratio: 2 / 3; width: 100%; object-fit: contain; }
.fig.ajustar { border-color: var(--ouro); background: var(--ouro-claro); }
.fig .selo { position: absolute; top: 6px; left: 6px; font-size: .7rem; background: var(--ouro); color: var(--tinta); padding: 2px 7px; border-radius: 99px; }
.fig[aria-pressed="true"] { border: 2.5px solid var(--pinho); box-shadow: 0 0 0 3px var(--pinho-claro); }
.fig .marca-sel { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--linha); background: var(--branco); }
.fig[aria-pressed="true"] .marca-sel { background: var(--pinho); border-color: var(--pinho); }
.fig[aria-pressed="true"] .marca-sel::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.fig select { font-size: .8rem; min-height: 36px; border-radius: 8px; border: 1.5px solid var(--linha); background: var(--branco); }
.barra-acoes {
  position: sticky; bottom: calc(var(--abas) + var(--seguro-baixo) + 8px); z-index: 10; margin-top: 16px;
  background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 10px; box-shadow: var(--sombra);
  display: grid; gap: 8px;
}

/* instalar */
.passo-instalar { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); padding: 12px; }
.passo-instalar svg { width: 96px; height: 96px; }
.passo-instalar b { font: 600 1.05rem/1.2 var(--titulo); display: block; margin-bottom: 2px; }

/* ajuda */
details { background: var(--branco); border: 1px solid var(--linha); border-radius: 14px; padding: 0 14px; margin-bottom: 8px; }
summary { min-height: 52px; display: flex; align-items: center; font-weight: 600; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; margin-left: auto; font: 600 1.4rem/1 var(--titulo); color: var(--pinho); }
details[open] summary::after { content: "–"; }
details > div { padding-bottom: 14px; }
.lista-conta { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lista-conta li { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--branco); border: 1px solid var(--linha); border-radius: 12px; padding: 10px 12px; }
.etiqueta { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--pinho-claro); color: var(--pinho-escuro); margin: 0 6px 6px 0; }
.etiqueta.off { background: var(--papel-2); color: var(--tinta-2); }
.passos-imprimir { counter-reset: p; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.passos-imprimir li { counter-increment: p; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
.passos-imprimir li::before { content: counter(p); width: 32px; height: 32px; border-radius: 50%; background: var(--pinho); color: #fff; display: grid; place-items: center; font: 600 1rem var(--titulo); }
.texto-legal { font-size: .92rem; }
.texto-legal h4 { margin: 14px 0 4px; }

/* aviso */
.aviso {
  position: fixed; left: 50%; bottom: calc(var(--abas) + var(--seguro-baixo) + 14px); z-index: 60; transform: translateX(-50%);
  max-width: calc(100% - 32px); width: max-content; padding: 12px 18px; border-radius: 14px;
  background: var(--tinta); color: #fff; font-weight: 500; box-shadow: var(--sombra);
  animation: sobe .25s cubic-bezier(.16, 1, .3, 1);
}

@media (min-width: 700px) {
  .categorias { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
