/* Almirantes - base: cores, letras e pecas.
   Casco (petroleo) para a ponte de comando; carta (papel) para o que se le como documento; latao para escolha e vez;
   vermelhao so para agir; magenta e a tinta das anotacoes da carta nautica. */
@font-face { font-family: Casco; src: url(/assets/fonts/casco2.woff2) format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: Ponte; src: url(/assets/fonts/ponte.woff2) format("woff2"); font-weight: 1 1000; font-display: swap; }
:root {
  --abismo: #06232C; --casco: #0C3A46; --casco2: #14505F; --aco: #2F7B8D; --nevoa: #B4D3D6; --espuma: #EEF8F4; --branco: #FFFDF4;
  --latao: #F0B847; --latao2: #B27F1E; --verm: #CF3820; --verm2: #8E200E; --sinal: #FF6A4D; --carta: #F5EBCF; --areia: #E2CD94; --tinta: #0B2730; --magenta: #A3206B; --boia: #2FB380; --boia2: #0E6B49;
  --ponte: Ponte, "Arial Narrow", "Helvetica Neue", sans-serif; --casco-letra: Casco, Impact, "Arial Narrow", sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --r: 9px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--abismo); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; background: var(--abismo); color: var(--espuma); font: 500 18px/1.3 var(--ponte); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; -webkit-user-select: none; user-select: none; overflow: hidden; position: fixed; inset: 0; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: var(--latao); }
.ic { width: 24px; height: 24px; flex: none; display: block; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--latao); outline-offset: 3px; }
.papel :focus-visible, .papel:focus-visible { outline-color: var(--magenta); }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#mar { position: fixed; inset: 0; touch-action: none; z-index: 0; }
#mar canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mar canvas.novo { visibility: hidden; }
/* a capa pintada: fundo enquanto a cena 3D carrega e, no modo 2D, das telas fora da partida */
#capa { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility 0s .9s; background: linear-gradient(rgba(6, 35, 44, .30), rgba(6, 35, 44, 0) 34%, rgba(6, 35, 44, 0) 66%, rgba(6, 35, 44, .40)), url(/assets/arte/capa.webp) 64% 50% / cover no-repeat; }
body.capa.mar-menu:not(.com-cena) #capa { opacity: 1; visibility: visible; transition: opacity .2s; }
@media (orientation: portrait) { #capa { background-position: center, 76% 50%; } }
@media (prefers-reduced-motion: reduce) { #capa { transition: none; } }
#tela { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.tela { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; }
.tela > * { pointer-events: auto; }
h1 { font: 900 30px/1 var(--casco-letra); letter-spacing: .01em; }
h2 { font: 800 22px/1.1 var(--ponte); }
h3 { font: 800 18px/1.2 var(--ponte); }
small { font-size: 15.500px; }
.nota { font-size: 16px; color: var(--nevoa); }
.papel .nota { color: #3D5560; }

/* botoes */
.btn { --f: var(--casco2); --e: var(--aco); display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; padding: 4px 18px 7px; border-radius: var(--r); corner-shape: bevel; background: var(--f); color: var(--branco); font-weight: 750; font-size: 19px; line-height: 1.1; text-align: center; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .28), inset 0 0 0 2px var(--e); transition: transform .08s, filter .12s; }
.btn:active:not(:disabled) { transform: translateY(2px); filter: brightness(.94); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .28), inset 0 0 0 2px var(--e); }
.btn.btn:disabled { --f: #17434F; --e: #2A5F6C; color: #A9C4C8; box-shadow: inset 0 0 0 2px var(--e); }
.papel .btn.btn:disabled { --f: #DCCFA9; --e: #B9AB82; color: #5A4E2C; }
.btn.fogo { --f: var(--verm); --e: #E8604A; }
.btn.latao { --f: var(--latao); --e: #FFDE93; color: var(--tinta); }
.btn.tinta { --f: transparent; --e: var(--tinta); color: var(--tinta); box-shadow: inset 0 0 0 2.500px var(--tinta); }
.btn.grande { min-height: 62px; font-size: 23px; padding: 4px 26px 8px; font-weight: 800; }
.btn.fina { min-height: 44px; font-size: 17px; padding: 2px 14px 4px; }
.btn.cheio { width: 100%; }
.redondo { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--casco); box-shadow: inset 0 0 0 2px var(--aco); color: var(--branco); flex: none; }
.redondo:active { filter: brightness(1.2); }
.redondo.lig { background: var(--boia2); box-shadow: inset 0 0 0 2px var(--boia); }
.redondo.desl { background: var(--verm2); box-shadow: inset 0 0 0 2px var(--sinal); }
.redondo.mini { width: 44px; height: 44px; }
.redondo.mini .ic { width: 20px; height: 20px; }
.papel .redondo { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 2px var(--tinta); }
.botoes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.botoes.linha > * { flex: 1 1 170px; }
.botoes.coluna { flex-direction: column; align-items: stretch; }
.ferramentas { display: flex; gap: 8px; flex: none; }

/* campos */
.campo { width: 100%; min-height: 52px; border: 0; border-radius: var(--r); background: var(--abismo); box-shadow: inset 0 0 0 2px var(--aco); padding: 8px 14px; font-size: 20px; font-weight: 650; color: var(--branco); -webkit-user-select: text; user-select: text; }
.campo::placeholder { color: #86A9AF; }
.campo:focus { box-shadow: inset 0 0 0 3px var(--latao); }
.campo.falta { box-shadow: inset 0 0 0 3px var(--sinal); }
.papel .campo { background: #fff; color: var(--tinta); box-shadow: inset 0 0 0 2px var(--tinta); }
.papel .campo::placeholder { color: #5B727A; }
textarea.campo { resize: none; font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }

/* escolha entre poucas opcoes */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 750; font-size: 17px; margin-bottom: 6px; }
.seg .opcoes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-radius: var(--r); background: var(--abismo); box-shadow: inset 0 0 0 2px var(--aco); overflow: hidden; }
.seg label { position: relative; display: grid; }
.seg input, .modos input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { min-height: 46px; display: grid; place-items: center; padding: 4px 6px; font-size: 17px; font-weight: 650; text-align: center; line-height: 1.05; color: var(--nevoa); border-left: 1px solid var(--casco2); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--latao); color: var(--tinta); font-weight: 800; }
.seg input:disabled + span { opacity: .38; }
.seg input:focus-visible + span { outline: 3px solid var(--branco); outline-offset: -4px; }
.seg.alta .opcoes { grid-auto-flow: row; }
.seg.alta span { border-left: 0; border-top: 1px solid var(--casco2); }
.chave { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; font-weight: 700; cursor: pointer; position: relative; }
.chave small { display: block; font-weight: 500; color: var(--nevoa); }
.chave input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.trilho { flex: none; width: 58px; height: 32px; border-radius: 16px; background: var(--abismo); box-shadow: inset 0 0 0 2px var(--aco); position: relative; transition: background .15s; }
.trilho::after { content: ""; position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; border-radius: 50%; background: var(--nevoa); transition: transform .15s; }
.chave input:checked + .trilho { background: var(--latao); box-shadow: inset 0 0 0 2px #FFDE93; }
.chave input:checked + .trilho::after { transform: translateX(26px); background: var(--tinta); }
.chave input:focus-visible + .trilho { outline: 3px solid var(--branco); outline-offset: 3px; }
.faixav { display: grid; grid-template-columns: 90px 1fr; align-items: center; min-height: 46px; font-weight: 700; }
input[type=range] { width: 100%; height: 44px; accent-color: var(--latao); margin: 0; }

/* papel: carta nautica, com a escala de latitude na borda */
.papel { color: var(--tinta); background-color: var(--carta); --ne: repeating-linear-gradient(90deg, var(--tinta) 0 16px, var(--carta) 16px 32px); --nv: repeating-linear-gradient(0deg, var(--tinta) 0 16px, var(--carta) 16px 32px); background-image: var(--ne), var(--ne), var(--nv), var(--nv); background-size: 100% 5px, 100% 5px, 5px 100%, 5px 100%; background-position: 0 0, 0 100%, 0 0, 100% 0; background-repeat: no-repeat; padding: 20px 18px; box-shadow: 0 0 0 1.500px var(--tinta), 0 10px 0 -4px rgba(0, 0, 0, .3); }

/* vigia: o rosto da pessoa na moldura da bandeira dela */
.vigia { --d: 48px; position: relative; display: inline-block; flex: none; width: var(--d); height: var(--d); padding: calc(var(--d) * .105); border-radius: 50%; background: var(--band, var(--aco)) center / cover; box-shadow: 0 0 0 2px var(--tinta), 0 2px 5px 2px rgba(0, 0, 0, .35); transition: transform .28s cubic-bezier(.3, 1.5, .5, 1); }
.vigia .miolo { display: block; position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px var(--tinta); background: var(--raso, #9ADBD8); }
.vigia .bicho { display: block; width: 100%; height: 100%; }
.retrato { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: inherit; }
.retrato .bicho { display: block; width: 100%; height: 100%; }
.retrato .foto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); -webkit-user-drag: none; }
.vigia video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.vigia.minha video { transform: scaleX(-1); }
.vigia.peq { --d: 38px; } .vigia.grande { --d: 68px; } .vigia.enorme { --d: 132px; }
.vigia.fala { box-shadow: 0 0 0 2px var(--tinta), 0 0 0 5px var(--latao), 0 0 18px 5px rgba(240, 184, 71, .7); }
.vigia.ligando .miolo::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 4px dashed #fff; opacity: .9; animation: roda 2s linear infinite; }
.vigia.semvoz::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 36%; min-width: 16px; max-width: 26px; aspect-ratio: 1; border-radius: 50%; background: var(--verm) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Crect x='9' y='4' width='6' height='10' rx='3'/%3E%3Cpath d='M12 18v3M4 4l16 16'/%3E%3C/svg%3E") center / 74% no-repeat; box-shadow: 0 0 0 2px var(--tinta); }

/* bandeiras icadas na adrica */
.adrica { position: relative; display: inline-flex; gap: .16em; padding-top: .3em; font-size: 30px; }
.adrica::before { content: ""; position: absolute; left: -.5em; right: -.5em; top: -.08em; height: .66em; border-bottom: 2px solid currentColor; border-radius: 0 0 50% 50% / 0 0 100% 100%; opacity: .75; }
.bandeira { --q: calc(2 * var(--i) / (var(--n) - 1) - 1); position: relative; display: grid; justify-items: center; gap: .14em; width: 1.500em; transform: translateY(calc((1 - var(--q) * var(--q)) * .28em)); }
.bandeira svg { width: 1.500em; height: 1.500em; display: block; overflow: visible; transform-origin: 0 0; animation: tremula 2.600s ease-in-out calc(var(--i) * -.37s) infinite alternate; }
.bandeira b { font: 900 1.120em/1 var(--casco-letra); }
@keyframes tremula { from { transform: skewY(-3deg) scaleX(1); } 50% { transform: skewY(2deg) scaleX(.96); } to { transform: skewY(4deg) scaleX(.99); } }

/* etiquetas */
.etiq { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 1px 8px; border-radius: 5px; background: var(--abismo); color: var(--nevoa); font-size: 15px; font-weight: 650; white-space: nowrap; }
.etiq .ic { width: 16px; height: 16px; }
.etiq.band svg { width: 16px; height: 16px; }
.etiq.ouro { background: var(--latao); color: var(--tinta); } .etiq.ruim { background: var(--verm2); color: #fff; } .etiq.verde { background: var(--boia2); color: #fff; }
.etiq.t0 { background: var(--verm2); color: #fff; } .etiq.t1 { background: var(--boia2); color: #fff; }

/* caixa */
dialog.caixa { border: 0; padding: 0; margin: auto; color: var(--espuma); background: var(--casco); border-radius: 14px; corner-shape: bevel; box-shadow: inset 0 0 0 2px var(--aco), 0 20px 60px rgba(0, 0, 0, .5); width: min(520px, calc(100vw - 24px - var(--sl) - var(--sr))); max-height: calc(100dvh - 24px - var(--st) - var(--sb)); overflow: hidden; flex-direction: column; }
dialog.caixa[open] { display: flex; animation: sobe .2s ease-out; }
dialog.larga { width: min(680px, calc(100vw - 24px)); } dialog.estreita { width: min(400px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(3, 16, 21, .72); }
.caixa > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 8px 18px; flex: none; }
.caixa .corpo { padding: 4px 18px 18px; overflow: auto; display: grid; gap: 12px; -webkit-overflow-scrolling: touch; }
.caixa > footer { display: flex; gap: 10px; padding: 10px 18px 18px; flex: none; }
.caixa > footer > * { flex: 1; }
dialog.papel { border-radius: 0; color: var(--tinta); background-color: var(--carta); padding: 8px; box-shadow: 0 0 0 2px var(--tinta), 0 20px 60px rgba(0, 0, 0, .5); }
dialog.cheia { width: min(980px, calc(100vw - 16px)); }
.lista li { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; } .lista .ic { color: var(--latao); margin-top: 1px; }
.passos { counter-reset: p; display: grid; gap: 12px; } .passos li { counter-increment: p; padding-left: 40px; position: relative; } .passos li::before { content: counter(p); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--latao); color: var(--tinta); display: grid; place-items: center; font-weight: 800; } .passos .ic { display: inline-block; vertical-align: -5px; }
.passo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--magenta); color: #fff; font: 900 20px/1 var(--casco-letra); margin-right: 10px; flex: none; }

/* avisos */
#avisos { position: fixed; left: 50%; bottom: calc(var(--sb) + 18px); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(92vw, 460px); }
[data-tela=batalha] > #avisos, [data-tela=posicionar] > #avisos { bottom: auto; top: 38%; }
.aviso { background: var(--branco); color: var(--tinta); font-weight: 700; padding: 10px 16px; border-radius: var(--r); box-shadow: 0 0 0 2px var(--tinta), 0 8px 20px rgba(0, 0, 0, .4); text-align: center; animation: sobe .2s ease-out; }
.aviso.ruim { background: var(--verm2); color: #fff; }
.aviso.vai { opacity: 0; transition: opacity .25s; }
#faixa { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); top: calc(var(--st) + 64px); background: var(--latao); color: var(--tinta); padding: 8px 16px; border-radius: var(--r); display: flex; gap: 10px; align-items: center; box-shadow: 0 0 0 2px var(--tinta); }
#plateia { position: fixed; z-index: 20; right: calc(var(--sr) + 10px); bottom: calc(var(--sb) + 8px); background: rgba(6, 35, 44, .88); color: var(--nevoa); padding: 3px 10px; border-radius: 14px; display: flex; gap: 6px; align-items: center; font-size: 15px; pointer-events: none; }
[data-tela=batalha] #plateia, [data-tela=posicionar] #plateia { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 3px); }
@media (orientation: landscape), (min-width: 1000px) { [data-tela=batalha] #plateia, [data-tela=posicionar] #plateia { left: calc(var(--sl) + 12px); transform: none; bottom: calc(var(--sb) + 10px); } }
#plateia .ic { width: 18px; height: 18px; }
#ouvir, #chamar { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--sb) + 150px); white-space: nowrap; }
#chamar { bottom: auto; top: calc(var(--st) + 64px); max-width: 92vw; }
.roda { width: 26px; height: 26px; border-radius: 50%; border: 4px solid currentColor; border-right-color: transparent; animation: roda 1s linear infinite; display: inline-block; }
.voa { position: fixed; z-index: 45; width: 72px; height: 72px; margin: -36px 0 0 -36px; pointer-events: none; animation: voa 2.200s cubic-bezier(.2, .8, .3, 1) forwards; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
@keyframes voa { 0% { transform: translateY(0) scale(.2) rotate(-18deg); opacity: 0; } 14% { transform: translateY(0) scale(1.300) rotate(8deg); opacity: 1; } 26% { transform: scale(1) rotate(-4deg); } 100% { transform: translateY(var(--sobe, -120px)) scale(.85) rotate(6deg); opacity: 0; } 78% { opacity: 1; } }
@keyframes roda { to { transform: rotate(360deg); } }
@keyframes sobe { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; } .voa { animation: none !important; } .roda { border-right-color: currentColor; opacity: .6; } }
