/* ============================================================
   Tela pública — formulário de perguntas
   ============================================================ */
.top {
  display: flex; justify-content: center;
  padding: calc(22px + var(--safe-top)) 16px 0;
}
.logo {
  width: 132px; height: auto;
  filter: drop-shadow(0 10px 30px rgba(251, 69, 6, .35));
  animation: logoIn 1s var(--spring) both, sway 6s ease-in-out 1s infinite;
  transform-origin: 20% 80%;
}
@keyframes logoIn { from { opacity: 0; transform: scale(.6) rotate(-8deg); } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg); } }

.app {
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: 8px 16px calc(120px + var(--safe-bottom));
}

.view { display: none; }
.view.active { display: block; animation: viewIn .5s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------------- hero ---------------- */
.hero { text-align: center; padding: 18px 4px 22px; }
.hero-sm { padding-top: 26px; }
.kicker {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .4rem .9rem .4rem .75rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2);
}
.hero h1 { font-size: clamp(2.6rem, 13vw, 3.6rem); margin: 18px 0 12px; }
.lead { margin: 0 auto; max-width: 380px; color: var(--text-2); font-size: 1rem; }
.lead strong { color: var(--text); }

/* ---------------- card do formulário ---------------- */
.card { padding: 18px; }

.ta-wrap { position: relative; }
.ta-wrap .textarea { min-height: 150px; font-size: 1.08rem; position: relative; z-index: 1; background: rgba(0,0,0,.4); }
.ta-glow {
  position: absolute; inset: -2px; border-radius: 18px; z-index: 0; opacity: 0;
  background: conic-gradient(from var(--a, 0deg), var(--brand), var(--brand-3), var(--brand-deep), var(--brand));
  filter: blur(14px); transition: opacity .4s;
  animation: rot 4s linear infinite;
}
.ta-wrap:focus-within .ta-glow { opacity: .45; }
@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes rot { to { --a: 360deg; } }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-foot { display: flex; align-items: center; justify-content: space-between; margin: 14px 2px 16px; }
.anon { display: flex; align-items: center; gap: .55rem; font-size: .88rem; font-weight: 600; color: var(--text-2); }
.anon-ico {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: rgba(34,197,94,.12); color: var(--ok);
}
.anon-ico .icon { width: 17px; height: 17px; }

.counter { position: relative; width: 38px; height: 38px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--text-3); }
.counter span { position: relative; font-variant-numeric: tabular-nums; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 97.4; stroke-dashoffset: 97.4; transition: stroke-dashoffset .25s var(--ease), stroke .2s; }
.counter.warn { color: var(--warn); } .counter.warn .ring-fg { stroke: var(--warn); }
.counter.max { color: var(--danger); } .counter.max .ring-fg { stroke: var(--danger); }

.btn-send { height: 58px; font-size: 1.05rem; border-radius: 18px; }
.btn-send .btn-ico { transition: transform .35s var(--spring); }
.btn-send:hover .btn-ico { transform: translate(3px, -3px) rotate(8deg); }
.btn-send.fly .btn-ico { animation: fly .6s var(--ease) forwards; }
@keyframes fly { to { transform: translate(60px, -40px) rotate(20deg); opacity: 0; } }

/* ---------------- sucesso ---------------- */
.success, .closed { text-align: center; padding: 34px 22px 22px; animation: pop .6s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(20px); } }
.success h2, .closed h2 { font-size: 2.2rem; margin: 18px 0 10px; }
.success p, .closed p { color: var(--text-2); margin: 0 auto 24px; max-width: 340px; }

.check-anim { position: relative; width: 96px; height: 96px; margin: 0 auto; }
.check-anim svg { position: relative; width: 100%; height: 100%; }
.check-anim circle {
  fill: var(--brand); stroke: none;
  transform-origin: center; animation: scaleIn .5s var(--spring) both;
}
.check-anim path {
  fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .35s var(--ease) forwards;
}
.check-anim .ring {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--brand);
  animation: ripple 1.8s var(--ease) .3s infinite;
}
.check-anim .r2 { animation-delay: .9s; }
@keyframes scaleIn { from { transform: scale(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ripple { from { transform: scale(1); opacity: .8; } to { transform: scale(1.9); opacity: 0; } }

/* ---------------- fechado ---------------- */
.closed-ico {
  display: grid; place-items: center; width: 88px; height: 88px; margin: 0 auto; border-radius: 28px;
  background: linear-gradient(145deg, rgba(251,69,6,.25), rgba(251,69,6,.05));
  border: 1px solid rgba(251,69,6,.35); color: var(--brand-2);
  animation: bob 3s ease-in-out infinite;
}
.closed-ico .icon { width: 40px; height: 40px; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.waiting { display: flex; justify-content: center; gap: 8px; }
.waiting span { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: dots 1.2s ease-in-out infinite; }
.waiting span:nth-child(2) { animation-delay: .15s; }
.waiting span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------------- features ---------------- */
.features { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.features li {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 14px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  font-size: .74rem; font-weight: 600; color: var(--text-2);
}
.features .icon { width: 22px; height: 22px; color: var(--brand-2); }

/* ---------------- respondidas ---------------- */
.answers { display: flex; flex-direction: column; gap: 14px; }
.answer { padding: 18px; animation: reveal .6s var(--ease) both; }
.answer.mine { border-color: rgba(251,69,6,.45); box-shadow: var(--shadow), 0 0 0 1px rgba(251,69,6,.2), 0 0 40px -10px var(--brand-glow); }
.answer .q { display: flex; gap: 12px; }
.answer .q-ico, .answer .a-ico {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; flex: none;
}
.answer .q-ico { background: var(--surface-2); color: var(--text-2); }
.answer .a-ico { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; }
.answer .q-ico .icon, .answer .a-ico .icon { width: 17px; height: 17px; }
.answer .q p { margin: 5px 0 0; font-weight: 600; font-size: 1.02rem; white-space: pre-wrap; word-break: break-word; }
.answer .a { display: flex; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.answer .a p { margin: 5px 0 0; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.answer .meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .78rem; color: var(--text-3); }
.answer .meta .icon { width: 14px; height: 14px; }
.tag-mine {
  margin-left: auto; padding: .2rem .6rem; border-radius: 999px; font-weight: 700; font-size: .7rem;
  letter-spacing: .05em; text-transform: uppercase; background: rgba(251,69,6,.15); color: var(--brand-2);
}

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .e-ico {
  display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.empty .e-ico .icon { width: 34px; height: 34px; }
.empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------- tab bar ---------------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(14px + var(--safe-bottom));
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  width: min(calc(100% - 32px), 360px); padding: 6px; border-radius: 22px;
  background: rgba(20, 20, 24, .75);
}
.tab {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: .5rem;
  height: 50px; border-radius: 16px; font-weight: 600; font-size: .92rem; color: var(--text-3);
  transition: color .3s;
}
.tab.active { color: #fff; }
.tab .icon { width: 20px; height: 20px; }
.tab-pill {
  position: absolute; top: 6px; left: 6px; height: 50px; width: calc(50% - 8px); border-radius: 16px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand) 60%, var(--brand-deep));
  box-shadow: 0 8px 24px -6px var(--brand-glow);
  transition: transform .5s var(--spring);
}
.tabbar[data-active="respondidas"] .tab-pill { transform: translateX(calc(100% + 4px)); }
.badge {
  position: absolute; top: 6px; right: 14px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: #fff; color: var(--brand-deep); font-size: .7rem; font-weight: 800;
  display: grid; place-items: center; animation: pop .4s var(--spring);
}

/* ---------------- instalar ---------------- */
.install {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(92px + var(--safe-bottom)); width: min(calc(100% - 32px), 488px);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  background: rgba(20, 20, 24, .9); animation: slideUp .5s var(--spring) both;
}
.install img { border-radius: 12px; }
.install div { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.install div span { font-size: .8rem; color: var(--text-3); }
.install .btn-icon { width: 36px; height: 36px; border: 0; background: transparent; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 30px); } }

@media (min-width: 700px) {
  .logo { width: 160px; }
  .top { padding-top: 40px; }
  .card { padding: 22px; }
}
