:root { --ouro: #f5c542; --ouro2: #ffdf7e; --sombra: 0 6px 18px rgba(0,0,0,.45); --fonte: "Baloo 2", "Nunito", "Trebuchet MS", system-ui, sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d2a3a; color: #fff8e7; font-family: var(--fonte); }
button { font-family: inherit; cursor: pointer; border: 0; }
img { user-select: none; -webkit-user-drag: none; }
.tela { position: fixed; inset: 0; display: none; }
.tela.ativa { display: flex; }
.fundo-menu { background: #0d2a3a url(../assets/img/capa.jpg) center/cover; }
.fundo-menu::before, .fundo-rio::before, .fundo-terra::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
.fundo-menu::before { background: radial-gradient(ellipse at 50% 45%, rgba(8,26,38,.25), rgba(8,26,38,.82)); }
.fundo-rio { background: linear-gradient(160deg, #0f4a63, #0a2d3e); } .fundo-terra { background: linear-gradient(160deg, #6b3a1c, #3b2010); }
.bt { background: linear-gradient(#ffe27a, #f2b420); color: #3a1d00; font-weight: 800; font-size: 1.05rem; padding: .65em 1.2em; border-radius: 999px; box-shadow: 0 4px 0 #b37a00, var(--sombra); transition: transform .12s; }
.bt:hover { transform: translateY(-2px); } .bt:active { transform: translateY(2px); }
.bt.sec { background: linear-gradient(#4f8fb0, #2b5f7a); color: #fff; box-shadow: 0 4px 0 #173a4c, var(--sombra); }
.bt.verm { background: linear-gradient(#ff8a7e, #dc3a2f); color: #fff; box-shadow: 0 4px 0 #8a1b14, var(--sombra); }
.bt.azul { background: linear-gradient(#7fe0ff, #1f9bd6); color: #00253f; box-shadow: 0 4px 0 #0f5a80, var(--sombra); }
.bt.ativo { outline: 4px solid #fff; animation: pulsa 1s infinite; }
.bt:disabled { filter: grayscale(.8) brightness(.7); cursor: default; transform: none; }
.bt.peq { font-size: .85rem; padding: .45em .8em; } .bt.largo { width: 100%; font-size: 1.2rem; }
.icone-bt { background: rgba(255,255,255,.14); color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 1.2rem; display: grid; place-items: center; flex: none; }
@keyframes pulsa { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
#tela-abertura { background: #000 url(../assets/img/capa.jpg) center/cover; align-items: flex-end; justify-content: center; padding-bottom: 7vh; }
#tela-abertura .bt { font-size: 1.4rem; animation: pulsa 1.4s ease-in-out infinite; }
.titulo-jogo { position: relative; text-align: center; font-size: clamp(2.2rem, 7vw, 4.6rem); font-weight: 900; color: var(--ouro2); line-height: .95; text-shadow: 0 4px 0 #0b4a66, 0 8px 24px #000; transform: rotate(-2deg); }
.titulo-jogo small { display: block; font-size: .42em; color: #fff; text-shadow: 0 3px 0 #0b4a66, 0 6px 16px #000; }
#tela-menu { flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; }
.menu-grade { position: relative; display: grid; grid-template-columns: repeat(2, minmax(220px, 290px)); gap: 12px; }
.menu-item { background: linear-gradient(160deg, rgba(15,74,99,.94), rgba(8,40,56,.94)); border: 2px solid rgba(245,197,66,.55); border-radius: 16px; padding: 14px; text-align: left; color: #fff; box-shadow: var(--sombra); display: flex; gap: 10px; align-items: center; transition: transform .15s; }
.menu-item:hover { transform: translateY(-3px) rotate(-.5deg); border-color: var(--ouro); }
.menu-item .ic { font-size: 2.1rem; } .menu-item b { display: block; font-size: 1.15rem; color: var(--ouro2); } .menu-item span { font-size: .82rem; opacity: .85; }
#tela-missoes { flex-direction: column; align-items: center; padding: 14px; overflow-y: auto; }
.topo { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.topo h2 { margin: 0; font-size: 1.45rem; color: var(--ouro2); text-shadow: 0 3px 0 #000; }
.lista-missoes { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; width: min(1100px, 100%); }
.missao { display: flex; gap: 12px; align-items: center; text-align: left; border: 2px solid rgba(245,197,66,.5); border-radius: 16px; padding: 10px; color: #fff; box-shadow: var(--sombra); transition: transform .15s; }
.missao.rio { background: linear-gradient(160deg, rgba(20,100,135,.95), rgba(8,40,56,.95)); } .missao.terra { background: linear-gradient(160deg, rgba(140,75,35,.95), rgba(60,30,12,.95)); }
.missao:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--ouro); } .missao:disabled { filter: grayscale(.9) brightness(.55); cursor: default; }
.missao img { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; background: #ffd29c; flex: none; }
.missao b { display: block; color: var(--ouro2); } .missao span { display: block; font-size: .82rem; opacity: .92; }
.estr { color: var(--ouro); letter-spacing: 2px; } .estr i { color: rgba(255,255,255,.25); font-style: normal; }
.caixa { background: linear-gradient(160deg, rgba(15,60,82,.95), rgba(8,30,42,.95)); border: 2px solid rgba(245,197,66,.45); border-radius: 16px; padding: 10px; box-shadow: var(--sombra); }
.caixa h4 { margin: 0 0 6px; color: var(--ouro2); }

/* grade */
.grade-box { display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.grade { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); aspect-ratio: 1; width: 100%; max-height: 100%; background-size: cover; background-position: center;
  border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 4px #f5c542, var(--sombra); }
.cel { position: relative; border: 1px solid rgba(255,255,255,.28); display: grid; place-items: center; cursor: crosshair; }
.grade.terra .cel { border-color: rgba(0,0,0,.18); }
.cel:hover { background: rgba(255,255,255,.15); }
.cel.fantasma.ok { background: rgba(80,255,120,.45); } .cel.fantasma.ruim { background: rgba(255,60,60,.45); }
.cel.mira { background: rgba(255,230,0,.35); box-shadow: inset 0 0 0 2px #ffe600; }
.cel.nega { animation: nega .4s; } @keyframes nega { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.cel.agua, .cel.fogo, .cel.mina { cursor: default; }
.cel .onda { width: 46%; aspect-ratio: 1; border-radius: 50%; border: 3px solid rgba(255,255,255,.85); animation: onda 1.2s ease-out; }
@keyframes onda { from { transform: scale(2.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cel .cratera { width: 50%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(#3b2414 30%, rgba(90,55,25,.7) 60%, transparent 70%); animation: onda .8s ease-out; }
.cel .chama { font-size: clamp(.9rem, 2.6vh, 1.6rem); animation: chama .5s ease-in-out infinite alternate; z-index: 3; filter: drop-shadow(0 0 6px #ff7b00); }
@keyframes chama { from { transform: scale(.9) rotate(-6deg); } to { transform: scale(1.15) rotate(6deg); } }
.cel.fogo { background: rgba(255,80,0,.25); } .cel.mina { background: rgba(0,0,0,.35); }
.mina-img { position: absolute; inset: 12%; width: 76%; height: 76%; object-fit: contain; }
.mina-img.minha { opacity: .85; } .mina-img.alerta { animation: pisca .8s infinite; } @keyframes pisca { 50% { opacity: .35; } }
.cel.varrido { background: rgba(79,211,255,.45); box-shadow: inset 0 0 0 2px #4fd3ff; }
.badge-radar { position: absolute; z-index: 4; background: #4fd3ff; color: #00253f; font-weight: 900; border-radius: 999px; padding: 0 6px; font-size: clamp(.6rem, 1.6vh, .9rem); }
.onda-radar { position: fixed; z-index: 26; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 4px solid #4fd3ff; pointer-events: none; animation: radar 1.3s ease-out forwards; }
@keyframes radar { to { transform: scale(14); opacity: 0; } }
.camada { position: absolute; inset: 0; pointer-events: none; }
.peca { position: absolute; padding: 2%; transition: transform .3s; }
.peca .rot { position: absolute; inset: 4%; }
.peca.v .rot { inset: auto; left: 50%; top: 50%; width: calc(var(--t) * 92%); height: calc(92% / var(--t)); transform: translate(-50%, -50%) rotate(90deg); }
.peca img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
.peca.afundada img { filter: grayscale(.7) brightness(.55) drop-shadow(0 3px 3px rgba(0,0,0,.55)); }
.peca.afundada.rio .rot { animation: afunda 1.4s ease-in forwards; } .peca.afundada.terra .rot { animation: quebra .8s forwards; }
.peca.afundada.v.rio .rot { animation: afundaV 1.4s ease-in forwards; } .peca.afundada.v.terra .rot { animation: quebraV .8s forwards; }
@keyframes afunda { 0% { transform: rotate(0); opacity: 1; } 60% { transform: rotate(-8deg) scale(.95); } 100% { transform: rotate(-5deg) scale(.85); opacity: .7; } }
@keyframes afundaV { 0% { transform: translate(-50%,-50%) rotate(90deg); } 100% { transform: translate(-50%,-50%) rotate(82deg) scale(.85); opacity: .7; } }
@keyframes quebra { 30% { transform: translateY(-14%) rotate(5deg); } 100% { transform: rotate(-3deg) scale(.95); } }
@keyframes quebraV { 30% { transform: translate(-50%,-60%) rotate(95deg); } 100% { transform: translate(-50%,-50%) rotate(87deg) scale(.95); } }
.peca.revelada { opacity: .7; animation: surgePeca .6s backwards; } @keyframes surgePeca { from { transform: scale(.3); opacity: 0; } }

/* posicionamento */
#tela-pos { flex-direction: column; padding: 10px 14px; }
.pos-area { position: relative; flex: 1; display: flex; gap: 14px; min-height: 0; }
.pos-area .grade-box { flex: 1; }
.pos-area .grade { width: min(100%, 80vh); }
.pos-painel { width: clamp(260px, 28vw, 360px); display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.lista-pecas { display: flex; flex-direction: column; gap: 6px; }
.item-peca { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 2px solid transparent; border-radius: 12px; padding: 4px 8px; color: #fff; text-align: left; }
.item-peca img { width: 70px; height: 34px; object-fit: contain; } .item-peca span { flex: 1; font-weight: 700; } .item-peca small { color: var(--ouro2); letter-spacing: -2px; }
.item-peca.sel { border-color: var(--ouro); background: rgba(245,197,66,.2); } .item-peca.posta { opacity: .55; } .item-peca.posta::after { content: "✔"; color: #6be08a; }
.linha { display: flex; gap: 6px; flex-wrap: wrap; }
.minas-pos { font-weight: 700; background: rgba(0,0,0,.25); padding: 6px 10px; border-radius: 10px; }
.dica { margin: 0; font-size: .9rem; opacity: .9; }

/* batalha */
#tela-jogo { flex-direction: column; }
.barra { position: relative; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: rgba(0,0,0,.35); }
.barra h2 { margin: 0; font-size: 1.1rem; color: var(--ouro2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contador { background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 12px; font-weight: 700; white-space: nowrap; } .contador b { color: var(--ouro2); }
.campo { position: relative; flex: 1; display: flex; gap: 14px; padding: 8px 14px 12px; min-height: 0; }
.lado { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; }
.lado.inimigo { flex: 1.45; } .lado.meu { flex: 1; }
.lado .grade-box { flex: 1; } .lado .grade { width: auto; height: 100%; max-width: 100%; }
.lado.inimigo.alvo .grade { box-shadow: 0 0 0 4px #ff6b5b, 0 0 24px #ff6b5b, var(--sombra); }
.cmd { position: relative; display: flex; align-items: center; gap: 10px; }
.cmd img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; object-position: top; border: 3px solid #fff; background: #ffd29c; flex: none; }
.cmd b { display: block; color: var(--ouro2); } .cmd small { opacity: .85; }
.cmd img.treme { animation: nega .4s 2; }
.fala-cmd { position: absolute; left: 66px; top: -6px; background: #fff8e7; color: #3a1d00; font-weight: 700; padding: 6px 10px; border-radius: 14px 14px 14px 2px; z-index: 5; opacity: 0; transform: scale(.8); transition: .2s; white-space: nowrap; box-shadow: var(--sombra); }
.fala-cmd.on { opacity: 1; transform: none; }
.poderes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .poderes .bt { font-size: .95rem; padding: .5em .9em; } .poderes p { margin: 0; font-size: .82rem; opacity: .85; flex-basis: 100%; }
.projetil { position: fixed; left: 0; top: 0; z-index: 25; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 35% 35%, #888, #111); box-shadow: 0 0 10px rgba(0,0,0,.6); }
.projetil.terra { background: radial-gradient(circle at 35% 35%, #d8ff6a, #6a8f12); }
.tremor { animation: tremor .5s; } @keyframes tremor { 20% { transform: translate(-10px, 4px); } 40% { transform: translate(9px, -4px); } 60% { transform: translate(-6px, 2px); } 80% { transform: translate(4px, 0); } }

#host { position: fixed; left: 10px; bottom: 10px; z-index: 30; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; max-width: min(520px, 80vw); }
#host .av { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--ouro); background: #9fd8ff; object-fit: cover; box-shadow: var(--sombra); flex: none; }
#host.falando .av { animation: fala .35s ease-in-out infinite alternate; } @keyframes fala { from { transform: rotate(-4deg); } to { transform: translateY(-5px) rotate(4deg); } }
#host .balao { background: #fff8e7; color: #0b3a52; border-radius: 18px 18px 18px 4px; padding: 10px 14px; font-weight: 700; box-shadow: var(--sombra); opacity: 0; transform: translateY(10px) scale(.9); transition: .25s; }
#host.visivel .balao { opacity: 1; transform: none; }
#fx { position: fixed; inset: 0; z-index: 27; pointer-events: none; }
#modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(4,14,20,.72); backdrop-filter: blur(3px); padding: 14px; }
#modal.on { display: flex; }
.janela { background: linear-gradient(160deg, #0f4a63, #082838); border: 3px solid var(--ouro); border-radius: 22px; padding: 18px 20px; width: min(600px, 100%); max-height: 94vh; overflow-y: auto; box-shadow: 0 20px 60px #000c; text-align: center; animation: entra .4s cubic-bezier(.2,1.5,.4,1); }
@keyframes entra { from { transform: scale(.6) translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.janela h2 { margin: 0 0 6px; color: var(--ouro2); font-size: 1.6rem; }
.fim-cmds { display: flex; justify-content: center; align-items: center; gap: 16px; font-size: 2.4rem; margin: 8px 0; }
.fim-cmds img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; object-position: top; border: 4px solid #fff; background: #ffd29c; }
.fim-cmds .pula { animation: pula .5s ease-in-out infinite alternate; } .fim-cmds .cai { filter: grayscale(.6); transform: rotate(-12deg); }
@keyframes pula { to { transform: translateY(-12px); } }
.estrelas-grandes { font-size: 2.8rem; letter-spacing: 6px; height: 1.3em; } .estrelas-grandes span { display: inline-block; color: rgba(255,255,255,.2); }
.estrelas-grandes span.ganha { color: var(--ouro); animation: estrela .6s cubic-bezier(.2,1.8,.4,1); text-shadow: 0 0 18px var(--ouro); }
@keyframes estrela { from { transform: scale(3) rotate(90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.linha-bts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.opcoes { display: grid; gap: 10px; text-align: left; } .opcoes label { display: block; font-weight: 700; margin-bottom: 4px; color: var(--ouro2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; } .seg button { background: rgba(255,255,255,.1); color: #fff; padding: 5px 11px; border-radius: 999px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; } .seg button.on { background: var(--ouro); color: #3a1d00; }
.seg button img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: top; background: #ffd29c; }
.texto-ajuda { text-align: left; line-height: 1.45; } .texto-ajuda li { margin-bottom: 4px; }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .menu-grade { grid-template-columns: 1fr 1fr; width: 94vw; } .menu-item span { display: none; }
  .campo { flex-direction: column; padding: 6px; gap: 6px; } .lado.inimigo { flex: 1.6; } .lado.meu { flex: 1; }
  .meu { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; gap: 6px; } .meu .cmd { grid-column: 1 / 3; } .meu .poderes { flex-direction: column; align-items: stretch; } .meu .poderes p { display: none; }
  .pos-area { flex-direction: column; } .pos-painel { width: 100%; max-height: 40vh; } .pos-area .grade { width: min(100%, 52vh); }
  #host { top: 52px; bottom: auto; } #host .av { width: 46px; height: 46px; border-width: 3px; } #host .balao { font-size: .85rem; padding: 7px 10px; }
  .barra h2 { font-size: .9rem; } .cmd img { width: 40px; height: 40px; }
}
@media (max-height: 520px) { .cmd img { width: 36px; height: 36px; } .barra { padding: 3px 10px; } .icone-bt { width: 34px; height: 34px; } #host .av { width: 42px; height: 42px; } .poderes .bt { font-size: .8rem; padding: .35em .6em; } .poderes p { display: none; } }
.cel.banco { cursor: not-allowed; background: rgba(0,0,0,.12); border-color: transparent; }
.cel.banco:hover { background: rgba(0,0,0,.2); }
.cmd img.ri { animation: pula .25s ease-in-out 4 alternate; }
