:root {
  --fundo: #0B0B10;
  --azul: #0A5CFF;
  --azul-claro: #8FB4FF;
  --branco: #FFFFFF;
  --amarelo: #FFD23F;
  --cinza: #23232E;
  --texto-suave: #C9CCD8;
  --vh: 1vh;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fundo);
  color: var(--branco);
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 16px;
  overscroll-behavior: none;
}

body {
  background-color: var(--fundo);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.04), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(10,92,255,0.08), transparent 45%);
}

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--fundo);
}

@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px #1c1c26, 0 20px 60px rgba(0,0,0,0.6); }
}

.tela {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tela.ativa { display: flex; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* papel rasgado nos cantos */
.rasgo-topo {
  position: absolute; top: 0; right: 0; width: 140px; height: 70px;
  background: var(--azul);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 88% 82%, 76% 96%, 62% 74%, 48% 86%, 34% 60%, 20% 66%, 8% 30%);
  pointer-events: none;
}
.rasgo-topo::after {
  content: ''; position: absolute; inset: 0 0 14px 22px; background: #F4F1EA;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 84% 66%, 70% 84%, 54% 58%, 40% 70%, 26% 44%, 12% 50%);
}

.logo-wrap { margin-top: 0; min-height: 44px; display: flex; align-items: center; }
#logo { max-width: 180px; max-height: 64px; }
.logo-texto {
  font-family: 'Anton', Impact, sans-serif; font-size: 28px; letter-spacing: 1px;
  color: var(--branco);
}
.logo-texto span { color: var(--azul); font-size: 20px; margin-left: 4px; }

.titulo {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1.05;
  text-transform: uppercase;
  text-align: center;
  margin: 8px 0 2px;
  letter-spacing: 0.5px;
}
h2.titulo { font-size: 36px; }

.circulado {
  position: relative;
  color: var(--branco);
  display: inline-block;
  padding: 0 6px;
}
.circulado::before {
  content: ''; position: absolute; inset: -4px -8px -2px -6px;
  border: 4px solid var(--azul);
  border-radius: 50% 45% 55% 48% / 55% 50% 45% 50%;
  transform: rotate(-3deg);
}

.subtitulo {
  font-family: 'Caveat Brush', cursive;
  font-size: 20px;
  color: var(--azul-claro);
  text-align: center;
  margin: 2px 0 10px;
}

form { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }

input[type=text] {
  width: 100%;
  height: 54px;
  border-radius: 12px;
  border: 2px solid #3A3A4A;
  background: #15151D;
  color: var(--branco);
  font: 600 18px 'Montserrat', sans-serif;
  padding: 0 16px;
  outline: none;
}
input[type=text]:focus { border-color: var(--azul); }
input::placeholder { color: #8A8DA0; }

.ajuda { margin: -2px 2px 2px; font-size: 16px; color: var(--texto-suave); }
.pergunta-destino { margin: 2px 2px 0; font-weight: 700; font-size: 18px; }

.destinos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.destino {
  min-height: 54px;
  border-radius: 14px;
  border: 2px solid #3A3A4A;
  background: #15151D;
  color: var(--branco);
  font: 700 16px 'Montserrat', sans-serif;
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 6px 10px; text-align: left; line-height: 1.15;
  cursor: pointer;
}
.destino svg { flex: 0 0 22px; width: 22px; height: 22px; stroke: var(--azul-claro); }
.destino[aria-checked=true] { border-color: var(--azul); background: var(--azul); }
.destino[aria-checked=true] svg { stroke: var(--branco); }

.erro {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,210,63,0.12); color: var(--amarelo); font-weight: 700; font-size: 16px;
}

.btn {
  min-height: 54px;
  border-radius: 14px;
  border: 0;
  font: 800 18px 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px;
  text-decoration: none;
  width: 100%;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn-primario { background: var(--azul); color: var(--branco); box-shadow: 0 4px 0 #0640B5; margin-top: 6px; }
.btn-secundario { background: transparent; color: var(--branco); border: 2px solid #4A4A5C; }
.btn-amarelo { background: var(--amarelo); color: var(--fundo); }
.btn-link { background: none; color: var(--azul-claro); min-height: 48px; text-transform: none; font-weight: 700; font-size: 16px; }

/* como jogar */
#tela-como-jogar { justify-content: center; gap: 8px; }
.demo {
  position: relative; width: 100%; max-width: 320px; height: 190px; margin: 10px 0 14px;
  border-radius: 16px; background: #13131B; border: 2px dashed #2E2E3C; overflow: hidden;
}
.demo-aviao {
  position: absolute; left: 60px; top: 80px; width: 46px; height: 30px;
  background: var(--branco);
  clip-path: polygon(100% 50%, 0 0, 22% 52%, 6% 100%);
  animation: sobe-desce 2.4s ease-in-out infinite;
}
.demo-dedo {
  position: absolute; left: 18px; bottom: 16px; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--amarelo);
  animation: toque 2.4s ease-in-out infinite;
}
.demo-portal {
  position: absolute; right: 28px; top: 0; bottom: 0; width: 70px;
  display: flex; flex-direction: column; justify-content: space-around; align-items: center;
  border-left: 10px solid #F4F1EA; border-right: 10px solid #F4F1EA;
  background: repeating-linear-gradient(transparent 0 40%, rgba(244,241,234,0.0) 40% 60%);
}
.demo-portal span {
  font: 800 16px 'Montserrat', sans-serif; background: var(--azul); padding: 4px 8px; border-radius: 8px;
}
@keyframes sobe-desce {
  0%, 100% { transform: translateY(40px) rotate(8deg); }
  45% { transform: translateY(-50px) rotate(-12deg); }
}
@keyframes toque {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  10%, 45% { transform: scale(0.75); opacity: 1; background: rgba(255,210,63,0.3); }
  50% { transform: scale(1); opacity: 0.4; background: transparent; }
}
.instrucao { font-size: 20px; font-weight: 700; text-align: center; margin: 4px 0; }
.instrucao.suave { font-size: 16px; font-weight: 500; color: var(--texto-suave); margin-bottom: 16px; }

/* jogo */
#tela-jogo { padding: 0; justify-content: center; background: var(--fundo); overflow: hidden; }
#canvas {
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.btn-som {
  position: absolute; width: 48px; height: 48px; border-radius: 12px;
  border: 0; background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.btn-som svg { width: 24px; height: 24px; stroke: var(--branco); }

/* chegada */
#tela-chegada { gap: 6px; }
#cena-destino { width: 100%; max-width: 360px; height: auto; border-radius: 16px; }
.placar-final { text-align: center; margin-top: 4px; }
.numero { font-family: 'Anton', Impact, sans-serif; font-size: 60px; line-height: 1; color: var(--amarelo); }
.rotulo { font-weight: 700; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 1px; }
.recorde { font-family: 'Caveat Brush', cursive; font-size: 26px; color: var(--amarelo); margin-top: 4px; }
.conquistas-novas { width: 100%; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.conquistas-novas h3 { margin: 0; font-size: 16px; text-transform: uppercase; letter-spacing: 1px; color: var(--texto-suave); }
.selo-item {
  display: flex; align-items: center; gap: 12px;
  background: #15151D; border: 2px solid #2E2E3C; border-radius: 12px; padding: 8px 12px;
  opacity: 0; transform: translateY(8px); animation: entra 0.4s forwards;
}
.selo-item .selo-ico {
  flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--azul);
  border: 3px dashed var(--branco); display: flex; align-items: center; justify-content: center;
}
.selo-item .selo-ico svg { width: 20px; height: 20px; stroke: var(--amarelo); }
.selo-item b { display: block; font-size: 16px; }
.selo-item small { font-size: 16px; color: var(--texto-suave); }
@keyframes entra { to { opacity: 1; transform: none; } }
.ranking-msg { text-align: center; font-weight: 700; font-size: 18px; margin: 4px 0 8px; min-height: 24px; }
.ranking-msg.suave { font-weight: 500; font-size: 16px; color: var(--texto-suave); }
.botoes { width: 100%; display: flex; flex-direction: column; gap: 10px; }

/* ranking */
.abas { display: flex; gap: 6px; width: 100%; margin: 6px 0 12px; }
.aba {
  flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid #3A3A4A; background: transparent;
  color: var(--branco); font: 700 16px 'Montserrat', sans-serif;
}
.aba.ativa { background: var(--azul); border-color: var(--azul); }
.ranking-conteudo { width: 100%; flex: 1; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.linha-rank {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #15151D;
  font-size: 16px;
}
.linha-rank .pos { font-family: 'Anton', sans-serif; font-size: 22px; width: 32px; text-align: center; color: var(--azul-claro); }
.linha-rank .nome { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linha-rank .pts { font-family: 'Anton', sans-serif; font-size: 20px; color: var(--amarelo); }
.linha-rank.eu { outline: 2px solid var(--azul); }
.linha-rank.top1 .pos, .linha-rank.top2 .pos, .linha-rank.top3 .pos { color: var(--amarelo); }
.cartao-voce { text-align: center; background: #15151D; border-radius: 16px; padding: 18px; }
.cartao-voce .numero { font-size: 56px; }
.cartao-voce p { margin: 6px 0; font-size: 16px; }
.barra-destino { background: #15151D; border-radius: 12px; padding: 10px 12px; }
.barra-destino .topo { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; }
.barra-destino .trilho { height: 12px; background: #262633; border-radius: 6px; margin-top: 8px; overflow: hidden; }
.barra-destino .enchido { height: 100%; background: var(--azul); border-radius: 6px; transition: width 0.8s; }
.barra-destino.meu .enchido { background: var(--amarelo); }
.nota { color: var(--texto-suave); font-size: 16px; text-align: center; margin: 4px 0; }

/* modal de compartilhamento */
.modal {
  position: absolute; inset: 0; background: rgba(0,0,0,0.85); z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-caixa { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.modal-caixa img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; }

/* seletor de visual */
.visuais { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.visual {
  min-height: 54px; border-radius: 14px; border: 2px solid #3A3A4A; background: #15151D; color: var(--branco);
  font: 700 16px 'Montserrat', sans-serif; display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  text-align: left; line-height: 1.15; cursor: pointer;
}
.visual svg { flex: 0 0 22px; width: 22px; height: 22px; stroke: var(--azul-claro); }
.visual[aria-checked=true] { border-color: var(--amarelo); background: rgba(255,210,63,0.12); }
.visual.bloqueado { opacity: 0.75; cursor: default; }
.visual small { display: block; font-weight: 500; font-size: 16px; color: var(--texto-suave); }

/* coleção */
.colecao { width: 100%; margin: 4px 0; }
.colecao p { margin: 0 0 6px; font-size: 16px; font-weight: 700; text-align: center; }
.colecao .trilho { height: 10px; background: #262633; border-radius: 5px; overflow: hidden; }
.colecao .enchido { height: 100%; background: var(--azul); border-radius: 5px; transition: width 0.8s; }
.colecao .novas { color: var(--amarelo); }

/* troféus */
.trofeu-ico { width: 32px; height: 32px; flex: 0 0 32px; display: flex; align-items: center; justify-content: center; }
.trofeu-ico img, .trofeu-ico svg { width: 32px; height: 32px; object-fit: contain; }
.linha-rank.top1 { background: rgba(255,210,63,0.16); border: 1px solid rgba(255,210,63,0.5); }
.linha-rank.top2 { background: rgba(201,206,216,0.12); border: 1px solid rgba(201,206,216,0.4); }
.linha-rank.top3 { background: rgba(214,140,69,0.12); border: 1px solid rgba(214,140,69,0.45); }
.premios { text-align: center; font-family: 'Caveat Brush', cursive; font-size: 20px; color: var(--amarelo); margin: 0 0 4px; }
.trofeu-chegada { display: flex; align-items: center; gap: 12px; justify-content: center; background: rgba(255,210,63,0.12);
  border: 2px solid var(--amarelo); border-radius: 14px; padding: 10px 14px; font-weight: 800; font-size: 18px; width: 100%; }
.trofeu-chegada .trofeu-ico, .trofeu-chegada .trofeu-ico img, .trofeu-chegada .trofeu-ico svg { width: 48px; height: 48px; flex-basis: 48px; }
.visual-liberado { width: 100%; text-align: center; border: 2px dashed var(--amarelo); border-radius: 14px; padding: 10px; }
.visual-liberado p { margin: 0 0 8px; font-weight: 800; font-size: 18px; color: var(--amarelo); }

/* pausa */
.pausa { position: absolute; inset: 0; z-index: 5; background: rgba(11,11,16,0.88); display: flex; align-items: center; justify-content: center; padding: 20px; }
.pausa[hidden] { display: none; }
.pausa-caixa { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pausa-contagem { font-family: 'Anton', Impact, sans-serif; font-size: 96px; line-height: 1; color: var(--amarelo); margin: 0; }
