@font-face {
  font-family: 'Handlee';
  src: url('../fonts/handlee.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #f4efe6;
  --muted: #b9b1a3;
  --line: rgba(255, 255, 255, .28);
  --gold: #e9b23c;
  --violet: #8b5cf6;
  --font: 'Handlee', 'Noto Sans Bamum', 'Segoe Print', 'Comic Neue', cursive;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 700px at 50% 38%, rgba(139, 92, 246, .10), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* Topo */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 8px;
  gap: 8px;
}
.brand { grid-column: 2; width: min(440px, 62vw); }
.iconbar { grid-column: 3; justify-self: end; display: flex; gap: 2px; }
.icon {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  color: var(--fg); opacity: .85; transition: opacity .2s, background .2s;
}
.icon:hover { opacity: 1; background: rgba(255, 255, 255, .08); }

@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr; justify-items: center; }
  .brand { grid-column: 1; grid-row: 2; width: min(340px, 86vw); margin-top: 4px; }
  .iconbar { grid-column: 1; grid-row: 1; justify-self: end; }
}

main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 16px; }

/* Tela "Conecte-se" */
.connect { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 720px; padding-top: clamp(12px, 4vh, 40px); }
.spiral {
  position: relative;
  width: clamp(160px, 34vw, 220px); aspect-ratio: 1; border-radius: 50%;
  padding: 0;
  transition: transform .4s ease;
  animation: breathe 6s ease-in-out infinite;
}
.spiral::before {
  content: ''; position: absolute; inset: -38%; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 178, 60, .32), rgba(139, 92, 246, .14) 42%, transparent 68%);
  opacity: .55; animation: halo 6s ease-in-out infinite;
}
.spiral img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.spiral:hover { transform: scale(1.04); }
.connect-title { font-weight: 400; font-size: clamp(26px, 5vw, 40px); margin: 22px 0 10px; cursor: pointer; }
.connect-desc { color: var(--muted); font-size: clamp(16px, 2.2vw, 19px); line-height: 1.6; margin: 0; max-width: 620px; }

/* Gerando: igual ao app antigo — espiral esmaecida (40%) com a animação da mandala por cima */
.loading-anim {
  position: absolute; left: 50%; top: 50%; width: 120%; height: 120%;
  transform: translate(-50%, -50%); object-fit: contain;
  -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 70%);
  mask-image: radial-gradient(circle, #000 52%, transparent 70%);
  z-index: 2; mix-blend-mode: screen; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.connect.loading .spiral { cursor: progress; animation: none; }
.connect.loading .spiral::before { opacity: .25; animation: none; }
.connect.loading .spiral img { opacity: .4; }
.connect.loading .loading-anim { opacity: 1; }

@keyframes breathe { 50% { transform: scale(1.03); } }
@keyframes halo { 50% { opacity: 1; transform: scale(1.08); } }
@keyframes spin { to { transform: rotate(-360deg); } }

/* imagens com fundo preto se fundem ao fundo da página */
.brand img, .intro-title, .spiral img, .mini-spiral, .intro-spiral { mix-blend-mode: screen; }

/* Mensagem */
.message-view { width: min(760px, 100%); display: flex; flex-direction: column; align-items: center; padding: clamp(8px, 4vh, 40px) 0 24px; }
.mini-spiral { width: 56px; height: 56px; border-radius: 50%; opacity: .9; margin-bottom: 18px; animation: spin 20s linear infinite; }
.message-text {
  font-size: clamp(19px, 2.6vw, 25px); line-height: 1.65;
  white-space: pre-line; text-align: center; margin: 0;
  min-height: 3em; cursor: text;
  text-wrap: pretty;
}

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 30px; animation: fadein .6s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ui); font-size: 15px;
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03);
  transition: background .2s, border-color .2s, color .2s;
}
.pill svg { width: 18px; height: 18px; }
.pill:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .5); }
.pill[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.pill:disabled { opacity: .5; cursor: default; }
.pill.ghost { border-style: dashed; }
.pill.gold { border-color: var(--gold); color: var(--gold); font-family: var(--font); font-size: 20px; padding: 10px 30px; }

@media (max-width: 520px) {
  .actions { gap: 8px; }
  .pill { padding: 10px 14px; }
  .actions .pill span { display: none; }
  .actions .pill svg { width: 22px; height: 22px; }
}

.inspired {
  margin: 22px 0 0; max-width: 560px; text-align: center;
  font: 13px/1.5 var(--ui); letter-spacing: .02em; color: rgba(233, 178, 60, .8);
  animation: fadein .6s ease both;
}

/* Rodapé */
.footer { display: flex; justify-content: center; padding: 14px 16px max(14px, env(safe-area-inset-bottom)); }
.langs { display: flex; gap: 4px; font-family: var(--ui); font-size: 12px; letter-spacing: .08em; }
.langs button { padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.langs button[aria-pressed="true"] { color: var(--gold); border: 1px solid rgba(233, 178, 60, .5); }

/* Introdução */
.intro { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; animation: fadein .5s ease both; }
.intro-inner { min-height: 100%; max-width: 760px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 16px 28px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.intro-title { width: min(420px, 82vw); }
.intro-spiral { width: clamp(110px, 22vw, 150px); border-radius: 50%; margin: clamp(18px, 4vh, 36px) 0; animation: spin 40s linear infinite; }
.intro-slide { font-size: clamp(18px, 2.4vw, 22px); line-height: 1.65; min-height: 9.5em; display: flex; flex-direction: column; justify-content: center; transition: opacity .3s ease; }
.intro-slide.fading { opacity: 0; }
.intro-slide ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: .9em; color: var(--muted); }
.intro-nav { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.intro-nav .icon:disabled { opacity: .2; cursor: default; }
.dots { display: flex; gap: 8px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .25); transition: background .3s; }
.dots span.on { background: var(--gold); }
.intro-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 22px; }
.link { font-family: var(--ui); font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* Diálogos */
.sheet {
  width: min(560px, calc(100% - 32px)); max-height: 86dvh;
  background: #0b0a10; color: var(--fg);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 18px;
  padding: 26px 24px 24px; overflow-y: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(3px); }
.sheet h2 { font-weight: 400; color: var(--gold); margin: 0 30px 14px 0; font-size: 26px; }
.sheet p { line-height: 1.6; color: var(--fg); margin: 0 0 12px; }
.sheet .close { position: absolute; top: 12px; right: 12px; }
#infoBody ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
form label { display: block; margin-bottom: 14px; }
form label span { display: block; font-family: var(--ui); font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, textarea {
  width: 100%; font: 16px var(--ui); color: var(--fg);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px; padding: 11px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--gold); }
form .pill { margin-top: 4px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #16141d; border: 1px solid rgba(255, 255, 255, .16);
  color: var(--fg); font: 14px var(--ui); padding: 10px 16px; border-radius: 999px;
  transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
