:root {
  --bg: #0b1026;
  --bg2: #1a0b3a;
  --tile: rgba(38, 48, 102, 0.72);
  --tile-borda: rgba(140, 160, 255, 0.22);
  --texto: #f3f5ff;
  --suave: #a9b2e6;
  --inicio: #3cff9b;
  --fim: #ffcc33;
  --traco: #ffffff;
  --perigo: #ff5c7a;
  --raio: 16px;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(120% 80% at 50% 0%, #22186b 0%, var(--bg) 55%, #05060f 100%);
  color: var(--texto);
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

/* fundo animado */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; filter: blur(60px); opacity: .55; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; animation: flutua 18s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: #3cff9b33; left: -20vmax; top: -10vmax; }
.aurora span:nth-child(2) { background: #ff6ad533; right: -25vmax; top: 20vh; animation-duration: 22s; }
.aurora span:nth-child(3) { background: #4dd7ff2e; left: 10vw; bottom: -30vmax; animation-duration: 26s; }
@keyframes flutua { to { transform: translate(8vmax, -6vmax) scale(1.15); } }

.app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}

/* topo */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.marca { text-align: center; }
.marca h1 {
  margin: 0; font-size: clamp(26px, 8vw, 34px); font-weight: 900; letter-spacing: .04em; line-height: 1;
  background: linear-gradient(90deg, var(--inicio), #4dd7ff 45%, #ff6ad5 75%, var(--fim));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px #3cff9b44);
  background-size: 200% 100%; animation: brilho 6s linear infinite;
}
.marca h1 em { font-style: normal; font-size: .55em; vertical-align: middle; }
@keyframes brilho { to { background-position: 200% 0; } }
.marca p { margin: 4px 0 0; color: var(--suave); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.acoes-topo { display: flex; gap: 6px; }
.icone {
  width: 40px; height: 40px; border-radius: 12px; background: var(--tile); border: 1px solid var(--tile-borda);
  font-size: 18px; font-weight: 900; display: grid; place-items: center;
}
.icone:active { transform: scale(.94); }

/* modos */
.modos { display: grid; grid-template-columns: 1fr 1fr; background: #ffffff10; border-radius: 999px; padding: 4px; }
.modo { padding: 9px 0; border-radius: 999px; font-weight: 800; color: var(--suave); font-size: 14px; transition: .2s; }
.modo.ativo { background: linear-gradient(90deg, #3cff9b, #4dd7ff); color: #04110f; box-shadow: 0 4px 18px #3cff9b55; }

/* painel */
.painel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.meta { background: var(--tile); border: 1px solid var(--tile-borda); border-radius: 14px; padding: 8px; text-align: center; }
.meta span { display: block; font-size: 11px; color: var(--suave); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.meta strong { font-size: 18px; font-weight: 900; }

/* prévia da palavra */
.previa {
  min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #00000040; border: 1px solid var(--tile-borda); border-radius: 16px; padding: 8px 10px 8px 16px;
}
.previa-texto { font-size: 20px; font-weight: 900; letter-spacing: .06em; color: var(--suave); transition: color .2s; }
.previa-texto.ativo { color: var(--texto); text-shadow: 0 0 14px #ffffff66; }
.previa-texto.erro { color: var(--perigo); animation: treme .35s; }
.previa-texto.certo { color: var(--inicio); }
.tag-inicio { color: var(--inicio); }
.previa-botoes { display: flex; gap: 6px; }
.mini { width: 40px; height: 40px; border-radius: 12px; background: #ffffff18; font-size: 20px; font-weight: 900; }
.mini.ok { background: var(--inicio); color: #04110f; box-shadow: 0 0 18px #3cff9b88; }

/* tabuleiro */
.tabuleiro-wrap { position: relative; width: 100%; aspect-ratio: 1; }
.tabuleiro {
  position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.linhas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.linhas line { stroke-linecap: round; }

.casa {
  position: relative; border-radius: var(--raio); background: var(--tile); border: 1px solid var(--tile-borda);
  display: grid; place-items: center; font-size: clamp(17px, 5.4vw, 24px); font-weight: 900; letter-spacing: .02em;
  box-shadow: inset 0 -4px 0 #00000040, 0 6px 14px #00000040;
  transition: transform .14s ease, background .2s, box-shadow .2s, opacity .2s;
  animation: entra .5s backwards;
}
@keyframes entra { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
.casa .rot { position: absolute; top: 3px; font-size: 8px; letter-spacing: .1em; font-weight: 900; }
.casa.inicio { border: 2px solid var(--inicio); box-shadow: 0 0 22px #3cff9b88, inset 0 0 18px #3cff9b44; }
.casa.inicio .rot { color: var(--inicio); }
.casa.fim { border: 2px solid var(--fim); box-shadow: 0 0 22px #ffcc3388, inset 0 0 18px #ffcc3344; animation: entra .5s backwards, pulsa 1.6s ease-in-out infinite; }
.casa.fim .rot { color: var(--fim); }
@keyframes pulsa { 50% { box-shadow: 0 0 34px #ffcc33cc, inset 0 0 22px #ffcc3366; } }
.casa.cabeca { transform: scale(1.06); box-shadow: 0 0 0 3px #ffffff, 0 0 30px #ffffffaa; z-index: 2; }
.casa.usada { color: #04110f; border-color: transparent; }
.casa.no-traco { background: #ffffff; color: #0b1026; transform: scale(1.1); box-shadow: 0 0 26px #ffffffcc; z-index: 3; }
.casa.livre { border-color: #ffffff66; }
.casa.apagada { opacity: .35; }
.casa.dica { animation: dica .6s ease-in-out 2; }
@keyframes dica { 50% { background: var(--fim); color: #1a1200; transform: scale(1.12); } }
.casa.acerto { animation: acerto .5s ease; }
@keyframes acerto { 40% { transform: scale(1.22) rotate(4deg); } }
.tabuleiro.treme { animation: treme .35s; }
@keyframes treme { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* trilha */
.trilha { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.chip { padding: 5px 11px; border-radius: 999px; font-weight: 900; font-size: 13px; color: #04110f; animation: chip .35s backwards; }
@keyframes chip { from { transform: translateY(8px) scale(.6); opacity: 0; } }

/* controles */
.controles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ctrl { padding: 12px 0; border-radius: 14px; background: var(--tile); border: 1px solid var(--tile-borda); font-weight: 800; font-size: 14px; }
.ctrl:active { transform: scale(.96); }
.ctrl:disabled { opacity: .4; }

.rodape { margin-top: auto; text-align: center; font-size: 12px; color: var(--suave); }
.rodape a { color: var(--suave); }

/* aviso */
.toast {
  position: fixed; left: 50%; top: 18px; transform: translate(-50%, -140%); z-index: 40;
  background: #ffffff; color: #0b1026; font-weight: 800; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px #0008; transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); max-width: 92vw; text-align: center;
}
.toast.mostra { transform: translate(-50%, 0); }

.confete { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* janelas */
.dlg {
  width: min(420px, calc(100vw - 32px)); border: 1px solid var(--tile-borda); border-radius: 24px; padding: 22px;
  background: linear-gradient(180deg, #1d2160, #0f1238); color: var(--texto); box-shadow: 0 30px 80px #000a;
}
.dlg::backdrop { background: #04061280; backdrop-filter: blur(4px); }
.dlg[open] { animation: abre .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes abre { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.dlg h2 { margin: 0 0 12px; font-size: 24px; font-weight: 900; }
.dlg h3 { margin: 16px 0 8px; font-size: 14px; color: var(--suave); text-transform: uppercase; letter-spacing: .08em; }
.passos { padding: 0; margin: 0; list-style: none; display: grid; gap: 12px; }
.passos li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; line-height: 1.35; }
.ex { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; background: var(--tile); border: 1px solid var(--tile-borda); }
.ex.inicio { border: 2px solid var(--inicio); box-shadow: 0 0 14px #3cff9b66; }
.ex.fim { border: 2px solid var(--fim); box-shadow: 0 0 14px #ffcc3366; }
.nota { color: var(--suave); font-size: 13px; line-height: 1.4; }
.grande {
  width: 100%; margin-top: 14px; padding: 14px; border-radius: 16px; font-weight: 900; font-size: 17px; color: #04110f;
  background: linear-gradient(90deg, #3cff9b, #4dd7ff); box-shadow: 0 8px 26px #3cff9b55;
}
.grande:active { transform: scale(.98); }
.secundario { flex: 1; padding: 12px; border-radius: 14px; background: #ffffff14; font-weight: 800; }
.linha-botoes { display: flex; gap: 8px; margin-top: 10px; }

.vitoria { text-align: center; }
.selo { margin: 0; font-size: 28px; font-weight: 900; background: linear-gradient(90deg, var(--fim), #ff6ad5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.estrelas-grandes { font-size: 46px; margin: 8px 0; letter-spacing: 6px; }
.estrelas-grandes span { display: inline-block; animation: estrela .5s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.estrelas-grandes span.apagada { filter: grayscale(1) brightness(.4); }
@keyframes estrela { from { transform: scale(0) rotate(-120deg); } }
.vit-resumo { margin: 0; color: var(--suave); font-weight: 700; }
.vit-rota { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 0; }
.proximo { margin-top: 12px; color: var(--suave); font-size: 14px; }
.proximo b { color: var(--texto); font-variant-numeric: tabular-nums; }

.numeros { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; }
.numeros strong { display: block; font-size: 28px; font-weight: 900; }
.numeros span { font-size: 11px; color: var(--suave); text-transform: uppercase; font-weight: 800; }
.barras { display: grid; gap: 6px; }
.barra { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.barra i { display: block; height: 22px; min-width: 22px; border-radius: 8px; background: linear-gradient(90deg, #3cff9b, #4dd7ff); color: #04110f; font-style: normal; font-weight: 900; text-align: right; padding: 2px 8px; }

/* moedas e sequência */
.barra-topo { display: flex; justify-content: space-between; align-items: center; margin-top: -4px; }
.moedas {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-radius: 999px;
  background: linear-gradient(90deg, #3a2a00, #5a4100); border: 1px solid #ffcc3388; font-weight: 900; font-size: 16px;
  box-shadow: 0 0 16px #ffcc3333;
}
.moedas b { color: #ffe27a; font-variant-numeric: tabular-nums; min-width: 2ch; }
.moedas .mais { width: 22px; height: 22px; border-radius: 50%; background: #ffcc33; color: #2a1d00; display: grid; place-items: center; font-size: 15px; }
.moedas.fixo { padding: 6px 12px; }
.moedas.pula { animation: pula .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pula { 40% { transform: scale(1.25); box-shadow: 0 0 30px #ffcc33aa; } }
.seq { font-weight: 900; color: #ffb547; font-size: 15px; }
.moeda-voa { position: fixed; z-index: 50; font-size: 26px; pointer-events: none; transition: transform .8s cubic-bezier(.5, -0.3, .7, 1), opacity .8s; }

/* vidas e jornada */
.vidas { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 999px; background: #3a0d1c; border: 1px solid #ff5c7a88; font-weight: 900; }
.vidas b { color: #ffb3c1; }
.vidas small { color: var(--suave); font-weight: 800; font-variant-numeric: tabular-nums; }
.modos.tres { grid-template-columns: 1fr 1.2fr .8fr; }
.modos.tres .modo { font-size: 13px; }
.faixa-fase { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--suave); font-weight: 800; }
.mapa-btn { padding: 8px 12px; border-radius: 12px; background: #ffffff14; font-weight: 900; color: var(--texto); }
.casa.pedra { background: repeating-linear-gradient(45deg, #2a2e45, #2a2e45 6px, #22263a 6px, #22263a 12px); color: #6b7194; }
.casa.pedra::after { content: "🪨"; position: absolute; font-size: 26px; }
.casa .selo-moeda, .casa .selo-estrela { position: absolute; bottom: 2px; right: 4px; font-size: 13px; }
.casa.obrigatoria { box-shadow: 0 0 0 2px #ffcc33, 0 0 18px #ffcc3377; }
.estrelas-total { font-weight: 900; color: #ffe27a; }
.trilha-mapa { display: flex; flex-direction: column-reverse; gap: 6px; max-height: 60dvh; overflow-y: auto; padding: 8px 0; }
.no-fase {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 20px;
  background: var(--tile); border: 2px solid var(--tile-borda); position: relative; flex: none;
}
.linha-fase { display: flex; align-items: center; gap: 10px; }
.linha-fase:nth-child(4n+1) { padding-left: 8%; } .linha-fase:nth-child(4n+2) { padding-left: 34%; }
.linha-fase:nth-child(4n+3) { padding-left: 60%; } .linha-fase:nth-child(4n) { padding-left: 34%; }
.no-fase.feita { background: linear-gradient(180deg, #3cff9b, #1fae6a); color: #04110f; border-color: transparent; }
.no-fase.atual { background: linear-gradient(180deg, #ffcc33, #ff8a3d); color: #1a0b00; animation: pulsa 1.4s infinite; border-color: #fff; }
.no-fase.trancada { opacity: .4; }
.no-fase small { position: absolute; bottom: -14px; font-size: 11px; letter-spacing: -1px; }
.bau { font-size: 26px; }
.derrota-selo { background: linear-gradient(90deg, #ff5c7a, #ffb547); -webkit-background-clip: text; background-clip: text; }

/* loja paga */
.pacotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pacote {
  padding: 14px 10px; border-radius: 16px; text-align: center; background: linear-gradient(180deg, #3a2a00, #221800);
  border: 1px solid #ffcc3388; position: relative;
}
.pacote b { display: block; font-size: 22px; color: #ffe27a; }
.pacote span { display: block; font-size: 12px; color: var(--suave); font-weight: 800; margin: 2px 0 8px; }
.pacote i { font-style: normal; display: inline-block; padding: 6px 12px; border-radius: 10px; background: var(--inicio); color: #04110f; font-weight: 900; }
.pacote .fita { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: #ff5c7a; color: #fff; font-size: 10px; font-weight: 900; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tag-teste { font-size: 10px; background: #ff5c7a; color: #fff; padding: 2px 6px; border-radius: 6px; vertical-align: middle; }
.recuperar summary { cursor: pointer; color: var(--suave); font-weight: 800; font-size: 13px; margin-top: 8px; }
.recuperar input { flex: 2; padding: 10px; border-radius: 12px; border: 1px solid var(--tile-borda); background: #0006; color: var(--texto); font: inherit; text-transform: uppercase; }
.pagamento { max-height: 92dvh; overflow-y: auto; }
.pag-preco { color: #ffe27a; font-size: 20px; }
.pag-pix { text-align: center; }
.pag-pix img { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
.largo { width: 100%; margin-top: 10px; }

/* níveis */
.niveis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nivel { padding: 7px 0; border-radius: 12px; font-weight: 800; font-size: 13px; color: var(--suave); background: #ffffff0d; border: 1px solid transparent; }
.nivel.ativo { color: var(--texto); border-color: #ffffff55; background: #ffffff1a; }
.nivel[data-nivel="facil"].ativo { border-color: var(--inicio); }
.nivel[data-nivel="dificil"].ativo { border-color: #ff5c7a; }
.nivel i { font-style: normal; color: var(--inicio); }

.ctrl.destaque { background: linear-gradient(180deg, #4a3a00, #2c2200); border-color: #ffcc3388; }

/* casas apagadas pela ajuda e sugestão */
.casa.limpa { opacity: .12; transform: scale(.85); }
.casa.sugerida { box-shadow: 0 0 0 3px var(--fim), 0 0 24px #ffcc33aa; }

/* prêmio na vitória */
.premio { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.premio-valor { font-size: 28px; font-weight: 900; color: #ffe27a; text-shadow: 0 0 18px #ffcc3388; }
.video {
  padding: 10px 14px; border-radius: 14px; font-weight: 900; color: #1a0b00;
  background: linear-gradient(90deg, #ffcc33, #ff8a3d); box-shadow: 0 6px 20px #ff8a3d55; animation: chama 1.8s ease-in-out infinite;
}
.video:disabled { animation: none; filter: grayscale(1); opacity: .5; }
@keyframes chama { 50% { transform: scale(1.04); box-shadow: 0 6px 28px #ff8a3d99; } }
.grande-video { width: 100%; margin-top: 14px; padding: 14px; font-size: 17px; }

/* loja */
.loja { max-height: 88dvh; overflow-y: auto; }
.loja-topo { display: flex; justify-content: space-between; align-items: center; }
.loja-topo h2 { margin: 0; }
.itens { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: #ffffff0d; border-radius: 14px; padding: 10px; }
.item-icone { font-size: 24px; text-align: center; }
.item b { display: block; font-size: 15px; }
.item small { color: var(--suave); font-size: 12px; line-height: 1.3; display: block; }
.item-botoes { display: grid; gap: 6px; }
.comprar { padding: 8px 12px; border-radius: 12px; font-weight: 900; background: #ffcc3322; border: 1px solid #ffcc3388; color: #ffe27a; white-space: nowrap; }
.comprar:disabled { opacity: .4; }
.mini-video { padding: 6px 10px; font-size: 12px; }
.temas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tema { padding: 10px; border-radius: 14px; border: 2px solid transparent; text-align: left; font-weight: 800; background: #ffffff0d; }
.tema.ativo { border-color: var(--inicio); }
.tema .amostra { display: flex; gap: 4px; margin-bottom: 6px; }
.tema .amostra i { width: 18px; height: 18px; border-radius: 5px; }
.tema small { display: block; color: var(--suave); font-weight: 700; }

/* bônus */
.bonus-dia { margin: 4px 0 0; color: var(--suave); font-weight: 800; }
.bonus-valor { font-size: 52px; font-weight: 900; color: #ffe27a; text-shadow: 0 0 24px #ffcc3388; animation: estrela .6s cubic-bezier(.2, 1.6, .4, 1); }
.bonus-trilha { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.bonus-trilha span { padding: 6px 0; border-radius: 8px; background: #ffffff10; font-size: 11px; font-weight: 800; color: var(--suave); }
.bonus-trilha span.feito { background: #ffcc33; color: #2a1d00; }

/* anúncio simulado */
.anuncio-teste { position: fixed; inset: 0; z-index: 60; background: #000d; display: grid; place-items: center; padding: 16px; }
.anuncio-caixa { width: min(360px, 100%); background: #11131f; border: 1px dashed #ffcc33; border-radius: 20px; padding: 22px; text-align: center; }
.anuncio-tag { margin: 0; color: #ffcc33; font-weight: 900; letter-spacing: .12em; font-size: 12px; }
.anuncio-titulo { font-size: 22px; font-weight: 900; margin: 8px 0; }
.anuncio-nota { color: var(--suave); font-size: 13px; }
.anuncio-barra { height: 8px; border-radius: 8px; background: #ffffff1a; overflow: hidden; margin: 16px 0; }
.anuncio-barra i { display: block; height: 100%; width: 0; background: #ffcc33; transition: width 1s linear; }
.anuncio-fechar { padding: 10px 18px; border-radius: 12px; background: #ffffff1a; font-weight: 800; }
.anuncio-fechar.pronto { background: var(--inicio); color: #04110f; }

/* temas comprados */
body[data-tema="oceano"] { --tile: rgba(10, 70, 110, .75); --tile-borda: rgba(120, 220, 255, .3); background: radial-gradient(120% 80% at 50% 0%, #0a4f7a 0%, #04223a 55%, #010a14 100%); }
body[data-tema="pordosol"] { --tile: rgba(110, 30, 70, .72); --tile-borda: rgba(255, 160, 120, .3); background: radial-gradient(120% 80% at 50% 0%, #a83a3a 0%, #3a0f2e 55%, #12030c 100%); }
body[data-tema="ouro"] { --tile: rgba(70, 52, 10, .8); --tile-borda: rgba(255, 210, 90, .45); background: radial-gradient(120% 80% at 50% 0%, #6b5210 0%, #2a1f05 55%, #0c0802 100%); }
body[data-tema="ouro"] .casa { color: #ffe9a8; }

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