@font-face { font-family: 'Pixelify Sans'; src: url('./fonts/PixelifySans.ttf') format('truetype'); font-weight: 400 700; font-display: swap; }
:root {
  --fundo: #2a2048; --painel: rgba(30, 24, 56, .93); --painel2: rgba(16, 12, 34, .93); --borda: #ecc978; --texto: #fff4de; --suave: #c9c0e6;
  --verde: #8fe0b4; --ouro: #ffd36a; --coral: #ff8a6a; --perigo: #ffcf4a;
  --seguro-t: env(safe-area-inset-top, 0px); --seguro-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto); overflow: hidden; }
body { font-family: 'Pixelify Sans', 'Trebuchet MS', system-ui, sans-serif; font-size: 16px; line-height: 1.4; -webkit-user-select: none; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
#jogo { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }
kbd { font-family: inherit; display: inline-block; min-width: 1.6em; padding: 0 .35em; border: 2px solid var(--borda); border-bottom-width: 4px; border-radius: 4px; background: #3a3060; color: var(--texto); font-size: .9em; text-align: center; }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 0; right: 0; top: 0; pointer-events: none; padding: calc(10px + var(--seguro-t)) 12px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-bloco { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 6px; background: linear-gradient(var(--painel), var(--painel2)); border: 2px solid var(--borda); border-radius: 6px; box-shadow: 0 0 0 2px #0006, 0 6px 16px #0005; }
#retrato { width: 51px; height: 60px; background: #5a4a8a; border-radius: 4px; border: 2px solid #0005; }
.hud-num { display: flex; flex-direction: column; min-width: 58px; }
.hud-num .rot { font-size: 11px; color: var(--suave); letter-spacing: .04em; text-transform: uppercase; }
.hud-num b { font-size: 20px; font-weight: 700; line-height: 1.1; }
.hud-num b.pop { animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: scale(1.35); color: var(--ouro); } 100% { transform: scale(1); } }
.ic-ficha { display: inline-block; width: 12px; height: 12px; margin-right: 4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff4c4 0 25%, #f7d466 26% 60%, #d9a232 61%); box-shadow: 0 0 0 2px #5a3a12; vertical-align: -1px; }
.hud-poderes { display: flex; gap: 6px; }
.poder { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 5px; background: var(--painel); border: 2px solid; font-size: 14px; }
.poder.escudo { border-color: #7af0d8; } .poder.ima { border-color: #ff8a9a; }
.poder .barra { width: 44px; height: 6px; background: #0006; border-radius: 2px; overflow: hidden; }
.poder .barra i { display: block; height: 100%; background: currentColor; }
.poder.escudo { color: #a8ffec; } .poder.ima { color: #ffb0ba; }
.hud-missao { font-size: 13px; padding: 3px 9px; background: #0007; border-radius: 4px; color: var(--suave); max-width: 70vw; }
.hud-missao b { color: var(--texto); }
#botoes-topo { position: fixed; top: calc(10px + var(--seguro-t)); right: 12px; display: flex; gap: 8px; z-index: 5; }
.bt-icone { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--borda); background: linear-gradient(var(--painel), var(--painel2)); color: var(--texto); display: grid; place-items: center; cursor: pointer; padding: 0; }
.bt-icone svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.bt-icone.mudo .onda { display: none; }
.bt-icone:focus-visible, .bt:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }

/* avisos de avião de papel (borda direita) */
#avisos { position: fixed; inset: 0; pointer-events: none; }
.aviso { position: absolute; right: 10px; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; border-radius: 8px; background: #2a1020ee; border: 3px solid var(--perigo); color: var(--perigo); font-weight: 700; font-size: 20px; box-shadow: 0 0 0 3px #0006, 0 0 18px #ffcf4a88; }
.aviso::before { content: '!'; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--perigo); color: #2a1020; font-size: 24px; }
.aviso .aviao { width: 36px; height: 22px; background: linear-gradient(170deg, transparent 38%, #fbf7ee 40% 55%, #d9d4c8 56% 70%, transparent 72%); }
.aviso.pisca { animation: pisca .22s steps(2) infinite; }
@keyframes pisca { 50% { opacity: .35; } }
.aviso-linha { position: absolute; left: 30%; right: 60px; height: 0; border-top: 3px dashed #ffcf4a88; transform: translateY(-50%); }

#flutuantes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.flutua { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 18px; color: var(--texto); text-shadow: 2px 2px 0 #2a1020, -1px -1px 0 #2a1020; animation: flutua 0.9s ease-out forwards; white-space: nowrap; }
.flutua.ouro { color: var(--ouro); } .flutua.verde { color: var(--verde); }
@keyframes flutua { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

/* tutorial ancorado */
.dica { position: fixed; left: 0; top: 0; max-width: min(340px, 80vw); padding: 10px 14px; background: linear-gradient(var(--painel), var(--painel2)); border: 2px solid var(--borda); border-radius: 8px; font-size: 17px; pointer-events: none; box-shadow: 0 6px 18px #0006; z-index: 4; transition: opacity .2s; }
.dica::after { content: ''; position: absolute; left: 18px; bottom: -10px; border: 8px solid transparent; border-top-color: var(--borda); border-bottom: 0; }
.dica.ok { border-color: var(--verde); }
.dica .gesto { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; margin: 0 2px; border: 2px solid var(--texto); border-radius: 50% 50% 45% 45%; position: relative; }
.dica .gesto::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--verde); animation: toque 1s ease-in-out infinite; }
@keyframes toque { 50% { transform: scale(.55); opacity: .6; } }
.alvo-anel { position: fixed; width: 90px; height: 90px; margin: -45px 0 0 -45px; border: 3px dashed var(--verde); border-radius: 50%; pointer-events: none; animation: gira 3s linear infinite; z-index: 3; }
@keyframes gira { to { transform: rotate(360deg); } }
#bt-pular { position: fixed; right: 12px; bottom: calc(14px + var(--seguro-b)); z-index: 6; }
.dica-toque { position: fixed; left: 50%; bottom: calc(18px + var(--seguro-b)); transform: translateX(-50%); padding: 6px 12px; border-radius: 20px; background: #0008; color: var(--suave); font-size: 14px; pointer-events: none; }

.faixa-zona { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%); pointer-events: none; font-size: clamp(22px, 5vw, 40px); font-weight: 700; text-align: center; color: var(--texto); text-shadow: 3px 3px 0 #2a1020; opacity: 0; }
.faixa-zona small { display: block; font-size: .45em; color: var(--ouro); letter-spacing: .12em; text-transform: uppercase; }
.faixa-zona.mostra { animation: faixa 2.4s ease-out forwards; }
@keyframes faixa { 0% { opacity: 0; transform: translate(-50%, -30%); } 12%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -70%); } }
.toast { position: fixed; left: 50%; top: calc(86px + var(--seguro-t)); transform: translateX(-50%); padding: 6px 14px; border-radius: 6px; background: linear-gradient(var(--painel), var(--painel2)); border: 2px solid var(--verde); font-size: 16px; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: 90vw; text-align: center; z-index: 4; }
.toast.mostra { opacity: 1; }

/* ---------- telas ---------- */
.tela { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 10; background: #140c2466; overflow-y: auto; touch-action: pan-y; }
.tela-abertura { background: linear-gradient(90deg, #140c24cc 0%, #140c2466 45%, transparent 70%); justify-items: start; padding-left: max(16px, 5vw); }
.caixa { width: min(560px, 100%); padding: 20px 22px; background: linear-gradient(var(--painel), var(--painel2)); border: 2px solid var(--borda); border-radius: 10px; box-shadow: 0 0 0 3px #0006, 0 14px 40px #0008; -webkit-user-select: text; user-select: text; }
.abertura { position: relative; }
.retrato-grande { position: absolute; top: -10px; right: -208px; width: 192px; height: 216px; background: #3a3070; border: 3px solid var(--borda); border-radius: 8px; box-shadow: 0 0 0 3px #0006, 0 10px 24px #0007; }
.caixa h1 { font-size: clamp(44px, 8vw, 72px); line-height: .95; margin: 4px 0 2px; color: var(--ouro); text-shadow: 4px 4px 0 #6a2a3a, 8px 8px 0 #0005; }
.caixa h2 { font-size: 26px; margin: 2px 0 12px; color: var(--ouro); }
.selo { margin: 0; font-size: 12px; color: var(--suave); letter-spacing: .06em; text-transform: uppercase; }
.sub { margin: 0 0 8px; font-size: 20px; } .sub b { color: var(--verde); }
.texto { color: var(--suave); margin: 6px 0 14px; }
.recorde { margin: 12px 0 0; color: var(--suave); font-size: 14px; } .recorde b { color: var(--ouro); }
.botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.botoes.coluna { flex-direction: column; }
.bt { font-family: inherit; font-size: 18px; font-weight: 700; min-height: 46px; padding: 8px 18px; border-radius: 6px; border: 2px solid #2a1020; cursor: pointer; background: linear-gradient(#ffe38a, #f4b646); color: #2a1020; box-shadow: 0 4px 0 #8a5a1a, 0 6px 10px #0006; }
.bt:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a5a1a; }
.bt.sec { background: linear-gradient(#4a3e7a, #372c60); color: var(--texto); border-color: #1a1030; box-shadow: 0 4px 0 #1a1030, 0 6px 10px #0005; }
.bt.sec[aria-checked="true"] { background: linear-gradient(#4aa07a, #2e7a5a); }
.bt.pequeno { font-size: 15px; min-height: 44px; padding: 6px 12px; }
.nota { font-size: 13px; color: var(--suave); margin: 10px 0 0; }
.nota a { color: var(--verde); }
.opcao { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #ffffff18; flex-wrap: wrap; }
.opcao .grupo { display: flex; gap: 6px; flex-wrap: wrap; }
input[type=range] { width: 180px; accent-color: var(--verde); height: 30px; }
.lista-missoes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lista-missoes li { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; background: #ffffff0c; }
.lista-missoes li .marca { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--suave); font-weight: 700; }
.lista-missoes li.feita .marca { background: var(--verde); border-color: var(--verde); color: #10301e; }
.lista-missoes li small { display: block; color: var(--suave); }
.sobre-cols { display: flex; gap: 14px; align-items: flex-start; }
.sobre-figuras { display: flex; flex-direction: column; gap: 6px; flex: none; }
.sobre-figuras canvas { width: 96px; height: 108px; background: #3a3070; border-radius: 6px; }
#sobre-sprite { height: 112px; }
.sobre p { margin: 0 0 8px; font-size: 15px; }
.guia .cartao { min-height: 240px; display: grid; gap: 6px; justify-items: start; }
.guia .cartao .clipe { width: 100%; }
.clipe { position: relative; margin: 0; }
.clipe video { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: min(300px, 38vh); object-fit: contain; background: #2a2048; border-radius: 6px; image-rendering: pixelated; }
.clipe .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.clipe .alt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ctl { white-space: nowrap; }
.ic-mouse { display: inline-block; width: 14px; height: 20px; border: 2px solid var(--texto); border-radius: 7px; vertical-align: -4px; position: relative; }
.ic-mouse::after { content: ''; position: absolute; left: 4px; top: 3px; width: 2px; height: 5px; background: var(--verde); }
.cartao .gesto { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; margin: 0 2px; border: 2px solid var(--texto); border-radius: 50% 50% 45% 45%; position: relative; }
.cartao .gesto::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--verde); animation: toque 1s ease-in-out infinite; }
.cartao h3 { margin: 0; font-size: 21px; color: var(--verde); }
.cartao p { margin: 0; }
.guia-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.resultado { text-align: center; }
.r-figuras { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
#r-retrato { width: 128px; height: 144px; background: #3a3070; border: 2px solid var(--borda); border-radius: 6px; }
#r-sprite { width: 96px; height: 112px; }
.r-pontos { font-size: 18px; color: var(--suave); } .r-pontos b { font-size: 44px; color: var(--ouro); }
.r-stats { display: flex; justify-content: center; gap: 22px; margin: 8px 0; }
.r-stats div { display: flex; flex-direction: column; } .r-stats b { font-size: 22px; } .r-stats span { font-size: 12px; color: var(--suave); }
.r-missoes { color: var(--verde); min-height: 1.4em; }
.resultado .botoes { justify-content: center; }
.pisca { animation: pisca 1s steps(2) infinite; }

@media (max-width: 900px) { .retrato-grande { width: 96px; height: 108px; top: -60px; right: 12px; } }
/* tela estreita */
@media (max-width: 640px) {
  #hud { padding-left: 8px; gap: 4px; }
  .hud-bloco { gap: 8px; padding: 4px 8px 4px 4px; }
  #retrato { width: 34px; height: 40px; }
  .retrato-grande { width: 96px; height: 108px; top: -64px; right: 12px; }
  .abertura .selo { padding-right: 100px; }
  .hud-num { min-width: 44px; } .hud-num b { font-size: 17px; } .hud-num .rot { font-size: 10px; }
  .bt-icone { width: 44px; height: 44px; }
  .tela-abertura { justify-items: center; align-items: end; padding: 12px 12px calc(16px + var(--seguro-b)); background: linear-gradient(0deg, #140c24ee 0%, #140c2488 55%, transparent 80%); }
  .tela-abertura .caixa { padding: 14px 16px; }
  .caixa h1 { font-size: 46px; }
  .texto { font-size: 14px; margin: 4px 0 6px; }
  .botoes { gap: 6px; } .bt { font-size: 16px; padding: 6px 12px; }
  .sobre-cols { flex-direction: column; align-items: center; }
  .toast { top: calc(120px + var(--seguro-t)); }
}
@media (max-height: 520px) { .caixa h1 { font-size: 40px; } .texto { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition: none !important; } }
