:root {
  --ink: #231A12;
  --ink-2: #6B5B4B;
  --paper: #FFF4E2;
  --card: #FFFFFF;
  --coral: #FF5A36;
  --coral-soft: #FFE1D8;
  --mint: #1FB985;
  --mint-soft: #D5F5E8;
  --grape: #7A5CFF;
  --grape-soft: #E7E1FF;
  --sun: #FFC23D;
  --sun-soft: #FFF0C7;
  --sky: #48B4FF;
  --line: 2.5px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --r: 20px;
  --head: "Baloo 2", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12px 12px, rgba(35,26,18,.07) 2px, transparent 2.5px);
  background-size: 28px 28px;
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.45;
}
#app { max-width: 520px; margin: 0 auto; padding: 18px 16px calc(28px + var(--safe-b)); min-height: 100dvh; }
h1, h2, h3 { font-family: var(--head); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ---------- Cartões ---------- */
.card {
  background: var(--card); border: var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px;
}
.card.coral { background: var(--coral-soft); }
.card.mint { background: var(--mint-soft); }
.card.grape { background: var(--grape-soft); }
.card.sun { background: var(--sun-soft); }
.card.ink { background: var(--ink); color: var(--paper); }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* ---------- Botões ---------- */
.btn {
  appearance: none; border: var(--line); border-radius: 16px; background: var(--card);
  color: var(--ink); font: 800 1.05rem/1 var(--body); padding: 15px 18px; min-height: 54px;
  box-shadow: var(--shadow); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; width: 100%;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn.primary { background: var(--coral); color: #fff; }
.btn.mint { background: var(--mint); color: #fff; }
.btn.grape { background: var(--grape); color: #fff; }
.btn.sun { background: var(--sun); }
.btn.wa { background: #25D366; color: #08361B; }
.btn.sm { min-height: 40px; padding: 9px 12px; font-size: .92rem; border-radius: 12px; box-shadow: var(--shadow-sm); width: auto; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.btn.ghost:active { transform: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: var(--line); background: var(--card);
  box-shadow: var(--shadow-sm); font-size: 1.2rem; display: grid; place-items: center; cursor: pointer; flex: none;
}

/* ---------- Formulários ---------- */
label.field { display: block; }
label.field > span { display: block; font-weight: 800; margin-bottom: 6px; }
label.field > small { display: block; color: var(--ink-2); margin-top: 6px; font-size: .84rem; }
input, textarea, select {
  width: 100%; font: 700 1.05rem var(--body); color: var(--ink); background: #fff;
  border: var(--line); border-radius: 14px; padding: 14px 14px; outline: none;
}
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 4px var(--sun); }
textarea { resize: vertical; min-height: 90px; font-weight: 600; }
.code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font: 800 1.5rem var(--head); }

/* ---------- Topo ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar .title { font: 800 1.15rem var(--head); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { display: inline-flex; align-items: center; gap: 6px; font: 800 1.25rem var(--head); text-decoration: none; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 14px 0 8px; }
.hero .mask {
  font-size: 4.6rem; display: inline-block; animation: wobble 3.2s ease-in-out infinite;
  filter: drop-shadow(4px 4px 0 var(--ink));
}
.hero h1 { font-size: 3.1rem; margin-top: 4px; }
.hero h1 em { font-style: normal; color: var(--coral); }
.hero p { font-size: 1.08rem; margin-top: 8px; color: var(--ink-2); font-weight: 600; }
.parade { display: flex; justify-content: center; gap: 6px; font-size: 1.9rem; margin: 12px 0 4px; }
.parade span { animation: hop 1.6s ease-in-out infinite; display: inline-block; }
.steps { counter-reset: s; display: grid; gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step::before {
  counter-increment: s; content: counter(s); flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--sun); border: var(--line); display: grid; place-items: center; font: 800 1rem var(--head);
}
.mylist a { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 10px 0; border-top: 2px dashed rgba(35,26,18,.15); }
.mylist a:first-child { border-top: 0; }
.mylist .emo { font-size: 1.7rem; }

/* ---------- Grade de bichos ---------- */
.zoo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zoo button {
  aspect-ratio: 1; border: var(--line); border-radius: 18px; background: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: var(--shadow-sm); padding: 4px; position: relative; font-family: var(--body); min-width: 0; color: var(--ink);
}
.zoo button .e { font-size: 2.1rem; line-height: 1; }
.zoo button .n { font-size: .68rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.zoo button.sel { background: var(--sun); transform: scale(1.06) rotate(-3deg); box-shadow: var(--shadow); animation: pop .3s ease; }
.zoo button:disabled { background: #EEE6D8; cursor: not-allowed; box-shadow: none; border-style: dashed; }
.zoo button:disabled .e { filter: grayscale(1); opacity: .35; }
.zoo button:disabled::after { content: "🔒"; position: absolute; top: 4px; right: 6px; font-size: .75rem; }
.zoo-mini { display: flex; flex-wrap: wrap; gap: 8px; }
.zoo-mini span {
  width: 48px; height: 48px; border-radius: 14px; border: var(--line); background: #fff;
  display: grid; place-items: center; font-size: 1.6rem; box-shadow: var(--shadow-sm); animation: pop .35s ease both;
}
.zoo-mini span.me { background: var(--sun); }

/* ---------- Avatar / disfarce ---------- */
.disguise { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 74px; height: 74px; flex: none; border-radius: 24px; border: var(--line); background: var(--sun);
  display: grid; place-items: center; font-size: 2.8rem; box-shadow: var(--shadow-sm);
}
.avatar.lg { width: 120px; height: 120px; border-radius: 34px; font-size: 4.8rem; box-shadow: var(--shadow); }
.avatar.mystery { background: var(--grape); }
.avatar.coral { background: var(--coral); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 2px solid var(--ink); font-weight: 800; font-size: .82rem; background: #fff; color: var(--ink);
}
.pill.mint { background: var(--mint-soft); }
.pill.coral { background: var(--coral-soft); }
.pill.grape { background: var(--grape-soft); }
.pill.sun { background: var(--sun-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Revelação do sorteio ---------- */
.flip { perspective: 1000px; height: 330px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .9s cubic-bezier(.2,.8,.2,1.2); transform-style: preserve-3d; }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; border: var(--line); border-radius: 28px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center;
}
.flip-front {
  background: var(--grape) repeating-linear-gradient(45deg, transparent 0 18px, rgba(255,255,255,.08) 18px 36px);
  color: #fff;
}
.flip-front .big { font-size: 5rem; animation: shake 1.2s ease-in-out infinite; }
.flip-back { background: var(--sun); transform: rotateY(180deg); }
.flip-back .big { font-size: 6rem; animation: pop .5s .6s ease both; }

/* ---------- Abas ---------- */
.tabs {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--ink); padding: 6px; border-radius: 18px; margin: 0 0 16px; box-shadow: var(--shadow-sm);
}
.tabs button {
  border: 0; background: transparent; color: var(--paper); font: 800 .86rem var(--body); padding: 10px 4px;
  border-radius: 13px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative;
}
.tabs button .ti { font-size: 1.3rem; line-height: 1; }
.tabs button.on { background: var(--paper); color: var(--ink); }
.tabs .dot { position: absolute; top: 6px; right: 18%; width: 10px; height: 10px; background: var(--coral); border-radius: 50%; border: 2px solid var(--ink); }

/* ---------- Chat ---------- */
.chat-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: var(--line); background: var(--sun-soft); }
.chat-head .avatar { width: 50px; height: 50px; font-size: 1.9rem; border-radius: 16px; }
.chat-body {
  padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 240px; max-height: 52dvh; overflow-y: auto;
  background: #FFFBF4;
}
.bubble {
  max-width: 82%; padding: 10px 13px; border: 2px solid var(--ink); border-radius: 18px; font-weight: 600;
  white-space: pre-wrap; word-wrap: break-word; animation: pop .25s ease both; position: relative;
}
.bubble.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--coral); color: #fff; border-bottom-right-radius: 5px; }
.bubble .meta { display: block; font-size: .7rem; opacity: .7; margin-top: 3px; font-weight: 700; text-align: right; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-2); padding: 10px; }
.chat-empty .e { font-size: 2.6rem; display: block; margin-bottom: 4px; }
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px 0; scrollbar-width: none; background: #fff; }
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: none; border: 2px solid var(--ink); border-radius: 999px; background: var(--grape-soft);
  font: 700 .84rem var(--body); padding: 7px 12px; cursor: pointer; color: var(--ink);
}
.composer { display: flex; gap: 8px; padding: 12px 14px; border-top: var(--line); background: #fff; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 120px; padding: 12px; border-radius: 16px; resize: none; font-weight: 600; font-size: 1rem; }
.composer .send {
  width: 52px; height: 52px; flex: none; border-radius: 16px; border: var(--line); background: var(--coral); color: #fff;
  font-size: 1.3rem; cursor: pointer; box-shadow: var(--shadow-sm);
}
.composer .send:active { transform: translate(2px,2px); box-shadow: none; }

/* ---------- Lista do admin ---------- */
.plist { display: flex; flex-direction: column; }
.pitem { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 2px dashed rgba(35,26,18,.15); }
.pitem:first-child { border-top: 0; }
.pitem .e { font-size: 1.9rem; width: 46px; height: 46px; border-radius: 14px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--sun-soft); flex: none; }
.pitem .who { font-weight: 800; }
.pitem .sub { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.chain { display: flex; flex-direction: column; gap: 8px; }
.chain .link { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 9px 12px; font-weight: 700; }
.chain .link .arrow { color: var(--coral); font-weight: 900; }
.chain .link.me { background: var(--sun); }
.spoiler { filter: blur(9px); user-select: none; transition: filter .3s; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border: var(--line); border-radius: 16px; padding: 10px; text-align: center; box-shadow: var(--shadow-sm); }
.stat b { display: block; font: 800 1.7rem/1 var(--head); }
.stat span { font-size: .75rem; font-weight: 800; color: var(--ink-2); }
.bigcode { font: 800 2.6rem/1 var(--head); letter-spacing: .14em; text-align: center; padding: 8px 0; }
.outbox { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.wamsg { font-feature-settings: "calt" 0, "liga" 0; background: #DCF8C6; border: 2px solid var(--ink); border-radius: 14px 14px 14px 4px; padding: 9px 12px; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.wamsg .to { font-weight: 800; font-size: .76rem; color: #1E6B3A; display: block; margin-bottom: 3px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: var(--line); border-radius: 16px; background: var(--sun-soft); font-weight: 600; font-size: .92rem; }
.banner .e { font-size: 1.4rem; line-height: 1; }

/* ---------- Toast & confete ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--paper); padding: 13px 18px; border-radius: 16px; font-weight: 800;
  max-width: calc(100% - 32px); z-index: 50; transition: transform .3s cubic-bezier(.2,.8,.2,1.2), opacity .2s; text-align: center;
  opacity: 0; visibility: hidden;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.confetti { position: fixed; top: -40px; font-size: 1.8rem; z-index: 40; pointer-events: none; animation: fall linear forwards; }

/* ---------- Animações ---------- */
@keyframes wobble { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) scale(1.05); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } }
@keyframes fall { to { transform: translateY(110dvh) rotate(540deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 60dvh; font-size: 3rem; }
.loading span { animation: hop 1s ease-in-out infinite; display: inline-block; }
.fade-in { animation: pop .35s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 560px) { #app { padding-top: 32px; } }

/* ---------- Preços ---------- */
.price-box { background: #fff; border: var(--line); border-radius: 18px; padding: 14px; text-align: center; box-shadow: var(--shadow-sm); }
.price-box .price { font: 800 2.6rem/1.1 var(--head); margin: 4px 0; }
.plans { display: flex; flex-direction: column; gap: 8px; }
.plan { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; }
.plan.on { background: var(--sun); }
.plan b { font-family: var(--head); font-size: 1.15rem; }
