:root {
  --azul: #16204a;
  --azul-2: #22306b;
  --amarelo: #ffd23f;
  --amarelo-2: #ffb800;
  --verde: #1fa463;
  --branco: #fff;
  --texto: #fff;
  --sombra: 0 4px 0 rgba(0,0,0,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--azul); color: var(--texto); font-family: Nunito, system-ui, sans-serif; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

#jogo { position: fixed; inset: 0; overflow: hidden; }
#tela { display: block; width: 100%; height: 100%; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
.hud-esq { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hud-dir { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; align-items: center; gap: 10px; }
.pilula {
  display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 12px; border-radius: 14px;
  background: rgba(22,32,74,.72); border: 2px solid rgba(255,255,255,.18); backdrop-filter: blur(4px);
  font-family: "Lilita One", sans-serif; font-size: 24px; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.placar { font-size: 30px; min-width: 120px; }
.placar span.dobro { background: #ff8a3d; }
.placar span { background: var(--verde); border-radius: 8px; padding: 0 7px; font-size: 18px; }
.moeda { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, var(--amarelo) 45%, var(--amarelo-2)); box-shadow: inset 0 -2px 0 #c98b00; display: inline-block; }
.vidas { display: flex; gap: 4px; font-size: 26px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.vidas .vazia { opacity: .25; filter: grayscale(1); }
.redondo { pointer-events: auto; width: 44px; height: 44px; border-radius: 12px; background: var(--amarelo); color: var(--azul); display: grid; place-items: center; box-shadow: var(--sombra); }
.redondo svg { width: 20px; height: 20px; fill: currentColor; }
#poderes { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 100px); left: 12px; display: flex; flex-direction: column; gap: 6px; }
.poder { font-family: "Lilita One", sans-serif; font-size: 14px; padding: 4px 10px; border-radius: 10px; color: #fff; box-shadow: var(--sombra); position: relative; overflow: hidden; }
.poder i { position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.85); }

#faixa-fase {
  position: absolute; top: 22%; left: 50%; transform: translate(-50%, -20px) scale(.9); opacity: 0;
  text-align: center; pointer-events: none; transition: opacity .35s, transform .35s;
}
#faixa-fase.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
#faixa-fase small { display: block; font-family: "Lilita One"; font-size: 18px; color: var(--amarelo); letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
#faixa-fase b { display: block; font-family: "Lilita One"; font-weight: 400; font-size: clamp(34px, 9vw, 64px); line-height: 1; -webkit-text-stroke: 2px var(--azul); text-shadow: 0 5px 0 var(--azul); }

#dica, #toast {
  position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; text-align: center;
  font-weight: 900; border-radius: 14px; padding: 8px 14px; max-width: 88%; opacity: 0; transition: opacity .25s;
}
#bt-album { background: linear-gradient(135deg, #f0a500, #ffd84a); color: var(--azul); box-shadow: 0 4px 0 #b86e00; }
#dica { top: 36%; background: rgba(22,32,74,.85); font-size: 17px; }
#toast { bottom: max(70px, calc(env(safe-area-inset-bottom) + 60px)); font-size: 15px; color: #fff; }
#toast small { display: block; font-weight: 600; font-size: 11px; opacity: .85; margin-top: 2px; }
#dica.on, #toast.on { opacity: 1; }

.selo-ia {
  position: absolute; left: 10px; bottom: max(8px, env(safe-area-inset-bottom)); font-size: 10px; font-weight: 800;
  background: rgba(0,0,0,.45); padding: 3px 8px; border-radius: 8px; pointer-events: none; letter-spacing: .02em;
}

/* ---------- menus ---------- */
.menu {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(34,48,107,.82), rgba(10,15,40,.94));
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  touch-action: pan-y;
}
.menu-corpo { width: min(100%, 380px); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin: auto; }
.logo { font-family: "Lilita One", sans-serif; font-weight: 400; line-height: .86; display: flex; flex-direction: column; transform: rotate(-4deg); margin-top: 4px; }
.logo span { font-size: clamp(58px, 18vw, 92px); color: var(--amarelo); -webkit-text-stroke: 3px var(--azul); text-shadow: 0 6px 0 var(--azul), 0 10px 18px rgba(0,0,0,.35); }
.logo span + span { color: #fff; margin-left: 30px; }
.heroi { height: min(34vh, 300px); width: auto; filter: drop-shadow(0 12px 16px rgba(0,0,0,.4)); margin: -6px 0 -4px; }
.heroi.pequeno { height: min(20vh, 170px); }
.bt {
  font-family: "Lilita One", sans-serif; font-size: 20px; letter-spacing: .04em;
  background: var(--amarelo); color: var(--azul); padding: 10px 22px; border-radius: 16px;
  box-shadow: 0 5px 0 #c98b00, 0 10px 18px rgba(0,0,0,.25); transition: transform .06s;
}
.bt:active { transform: translateY(4px); box-shadow: 0 1px 0 #c98b00; }
.bt.grande { width: 100%; font-size: 28px; padding: 13px; }
.bt.secundario { width: 100%; background: rgba(255,255,255,.12); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.3); font-size: 18px; }
.como { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 13px; font-weight: 800; margin-top: 4px; }
.como span { background: rgba(255,255,255,.1); padding: 4px 10px; border-radius: 10px; }
.como b { color: var(--amarelo); }
.miudo { font-size: 12px; opacity: .8; font-weight: 600; line-height: 1.4; }
.assinatura { opacity: .6; }
.titulo-menu { font-family: "Lilita One"; font-weight: 400; font-size: 42px; color: var(--amarelo); -webkit-text-stroke: 2px var(--azul); text-shadow: 0 4px 0 var(--azul); }
.fim-texto { font-weight: 800; font-size: 16px; }
.fim-pontos { display: flex; flex-direction: column; align-items: center; }
.fim-pontos small { font-weight: 800; font-size: 12px; opacity: .75; letter-spacing: .1em; }
.fim-pontos b { font-family: "Lilita One"; font-weight: 400; font-size: 54px; line-height: 1; }
.form-ranking { display: flex; gap: 8px; width: 100%; }
.form-ranking input {
  flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 18px; padding: 10px 14px; border-radius: 14px;
  border: 3px solid var(--amarelo); background: #fff; color: var(--azul); outline: none; user-select: text; -webkit-user-select: text;
}
.links { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.links a { color: var(--amarelo); font-weight: 800; font-size: 14px; }

.lista-ranking { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow-y: auto; }
.lista-ranking li { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); padding: 8px 12px; border-radius: 12px; font-weight: 800; }
.lista-ranking li .pos { font-family: "Lilita One"; width: 28px; color: var(--amarelo); font-size: 20px; }
.lista-ranking li .nome { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-ranking li .pts { font-family: "Lilita One"; font-size: 20px; }
.lista-ranking li.eu { background: rgba(255,210,63,.25); outline: 2px solid var(--amarelo); }
.lista-ranking .carregando { justify-content: center; opacity: .7; }

/* ---------- cartão ---------- */
.cartao { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(10,15,40,.55); }
.cartao-corpo {
  width: min(100%, 400px); background: #fff; color: var(--azul); border-radius: 22px; padding: 22px 20px 18px;
  box-shadow: 0 10px 0 #0b1233, 0 24px 40px rgba(0,0,0,.4); text-align: left; animation: entra .28s cubic-bezier(.2,1.4,.4,1);
}
@keyframes entra { from { transform: scale(.7) rotate(-3deg); opacity: 0; } }
.cartao-rotulo { display: inline-block; font-family: "Lilita One"; font-size: 15px; letter-spacing: .04em; background: var(--azul); color: var(--amarelo); padding: 4px 10px; border-radius: 9px; }
.cartao h2 { font-family: "Lilita One"; font-weight: 400; font-size: 30px; line-height: 1.05; margin: 10px 0 8px; }
.cartao p { font-weight: 700; font-size: 17px; line-height: 1.38; }
.fontes { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.fontes a { color: #3a55c9; font-size: 12px; font-weight: 800; }
.cartao-vidas { margin-top: 10px; font-size: 14px !important; color: #6a7092; }
.cartao .bt { width: 100%; margin-top: 12px; }

/* ---------- modo gravação ---------- */
body.gravar .selo-ia { font-size: 13px; }
body.gravar .cartao { background: rgba(10,15,40,.35); }
body.gravar .cartao-corpo { width: min(92%, 640px); padding: 30px 30px 26px; }
body.gravar .cartao h2 { font-size: clamp(34px, 6vw, 52px); }
body.gravar .cartao p { font-size: clamp(20px, 3.4vw, 30px); }
body.gravar .cartao .bt, body.gravar .cartao-vidas { display: none; }
body.gravar .fontes a { font-size: clamp(13px, 2vw, 18px); }

@media (min-width: 900px) {
  .pilula { font-size: 28px; }
  .placar { font-size: 36px; }
}

/* ---------- extras ---------- */
.dupla { display: flex; gap: 8px; width: 100%; }
.dupla .bt { flex: 1; font-size: 16px; padding: 10px 8px; }
.contagem { font-family: "Lilita One"; font-size: 17px; background: #1fa463; padding: 4px 14px; border-radius: 12px; box-shadow: var(--sombra); transform: rotate(-2deg); }
.top3 { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 4px; }
.top3 li { display: flex; gap: 8px; align-items: center; font-weight: 800; font-size: 14px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 5px 10px; }
.top3 li b { font-family: "Lilita One"; font-weight: 400; color: var(--amarelo); }
.top3 li span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-corpo.largo { width: min(100%, 460px); }
.figurinhas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.figurinha {
  aspect-ratio: 3 / 4; border-radius: 12px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: var(--azul); box-shadow: 0 4px 0 #0b1233; font-weight: 900; font-size: 12px; text-align: center; line-height: 1.15;
}
.figurinha .rot { font-family: "Lilita One"; font-weight: 400; font-size: 13px; background: var(--azul); color: var(--amarelo); padding: 3px 6px; border-radius: 7px; }
.figurinha.trancada { background: rgba(255,255,255,.1); color: rgba(255,255,255,.5); box-shadow: none; border: 2px dashed rgba(255,255,255,.25); }
.figurinha.trancada .rot { background: rgba(255,255,255,.15); color: rgba(255,255,255,.6); }
.figurinha.medalha { grid-column: 1 / -1; aspect-ratio: auto; background: var(--amarelo); font-family: "Lilita One"; font-weight: 400; font-size: 18px; padding: 10px; }

.secao-album { grid-column: 1 / -1; font-family: "Lilita One"; font-weight: 400; font-size: 18px; text-align: left; margin-top: 6px; }
.secao-album.ouro { color: var(--amarelo); }
.figurinha .icone { font-size: 30px; line-height: 1; }
.figurinha.dourada { background: radial-gradient(circle at 35% 30%, #fff7c2, #ffd84a 45%, #f0a500); color: #5a3a00; box-shadow: 0 4px 0 #b86e00, 0 0 18px rgba(255,210,60,.55); }
.cartao.dourado .cartao-corpo { background: radial-gradient(circle at 30% 20%, #fffbe0, #ffe48a 60%, #ffd23f); }
.cartao.dourado .cartao-rotulo { background: #b86e00; color: #fff; }

.palco { position: relative; width: min(62vw, 230px); aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; margin: 0; box-shadow: 0 0 0 3px var(--amarelo), 0 0 26px rgba(255,210,60,.55); background: #0b1233; }
.palco.grande { width: min(82vw, 340px); }
.palco video { width: 100%; height: 100%; object-fit: cover; display: block; }
.palco figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0,0,0,.7)); display: flex; flex-direction: column; align-items: center; }
.palco figcaption b { font-family: "Lilita One"; font-weight: 400; font-size: 20px; color: var(--amarelo); }
.palco figcaption small { font-size: 10px; font-weight: 800; opacity: .85; }
.figurinha.danca { padding: 0; overflow: hidden; position: relative; background: #0b1233; color: #fff; box-shadow: 0 4px 0 #0b1233, 0 0 12px rgba(255,210,60,.4); }
.figurinha.danca img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.figurinha.danca span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 4px 5px; background: linear-gradient(transparent, rgba(0,0,0,.75)); font-family: "Lilita One"; font-weight: 400; font-size: 13px; }
.redondo.som { font-size: 20px; background: rgba(22,32,74,.72); border: 2px solid rgba(255,255,255,.2); }

/* ---------- grave seu react ---------- */
.bt.react { background: linear-gradient(135deg, #7b2ff7, #f107a3); color: #fff; box-shadow: 0 4px 0 #4a148c; }
body.react #tela { height: 50% !important; }
body.react .cartao { display: none !important; }
body.react .selo-ia { bottom: calc(50% + 8px); z-index: 2; }
body.react:has(#react-fim:not([hidden])) .selo-ia { display: none; } /* na tela final o selo já está na prévia */
#react-jogo { position: fixed; left: 0; right: 0; top: 0; width: 100%; height: 50%; object-fit: cover; background: #000; }
#react-baixo { position: fixed; left: 0; right: 0; top: 50%; bottom: 0; background: #000; overflow: hidden; border-top: 4px solid var(--amarelo); }
#react-baixo video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#react-baixo.verde { background: #00b140; }
#react-baixo.verde video { display: none; }
#react-contagem { position: fixed; inset: 0; display: grid; place-items: center; font-family: "Lilita One"; font-size: 160px; color: var(--amarelo); -webkit-text-stroke: 4px var(--azul); text-shadow: 0 8px 0 var(--azul); pointer-events: none; z-index: 20; }
#react-rec { position: fixed; left: 12px; right: 12px; top: calc(50% + 14px); display: flex; align-items: center; gap: 10px; z-index: 20; }
#react-rec .rec { font-weight: 900; color: #fff; background: #e53935; padding: 4px 10px; border-radius: 10px; animation: piscaRec 1s steps(2) infinite; }
@keyframes piscaRec { 50% { opacity: .4; } }
#react-rec b { font-family: "Lilita One"; font-weight: 400; font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.trilho-rec { flex: 1; height: 8px; background: rgba(255,255,255,.3); border-radius: 8px; overflow: hidden; }
.trilho-rec i { display: block; height: 100%; width: 0; background: var(--amarelo); }
#react-rec .bt { font-size: 15px; padding: 8px 14px; }
.previa { width: min(60vw, 240px); aspect-ratio: 9 / 16; border-radius: 16px; background: #000; box-shadow: 0 0 0 3px var(--amarelo); }
.react-erro { background: #fff; color: #b3261e; font-weight: 800; font-size: 14px; line-height: 1.4; padding: 12px 14px; border-radius: 14px; text-align: left; box-shadow: 0 4px 0 #0b1233; }
.duracoes { display: flex; gap: 6px; width: 100%; background: rgba(255,255,255,.1); padding: 5px; border-radius: 14px; }
.duracoes button { flex: 1; font-family: "Lilita One"; font-size: 18px; padding: 8px; border-radius: 10px; color: #fff; }
.duracoes button.ativo { background: var(--amarelo); color: var(--azul); }
#react-som button, #react-estilo button { font-size: 15px; }
#react-piloto button { font-size: 13px; padding: 8px 4px; }

/* Cutscene da chegada na rampa */
#chegada { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; }
#chegada video { width: 100%; height: 100%; object-fit: contain; }
#chegada .chegada-ia { position: absolute; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); font-size: 10px; font-weight: 800; color: #fff; opacity: .8; }
#bt-pular-chegada { position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top)); width: auto; padding: 8px 14px; font-size: 14px; }
#bt-som-chegada { position: absolute; left: 0; right: 0; margin: 0 auto; bottom: calc(44px + env(safe-area-inset-bottom)); width: fit-content; padding: 10px 18px; font-size: 18px; }
