/* Aethra: interface */
:root { --tx: #fff8ea; --painel: rgba(22, 30, 48, .92); --painel2: #26324d; --linha: rgba(255, 255, 255, .14); --ouro: #ffcf3a; --verde: #5ad17a; --mau: #ff6b6b; color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #123a66; color: var(--tx); font-family: system-ui, -apple-system, Roboto, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
canvas#mundo { position: fixed; inset: 0; display: block; width: 100%; height: 100%; outline: none; }
.ic { width: 34px; height: 34px; } .ic-s { width: 18px; height: 18px; vertical-align: middle; } .ic-g { width: 64px; height: 64px; }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(8px + env(safe-area-inset-top)) 10px 0; pointer-events: none; z-index: 5; }
#hud > div > * { pointer-events: auto; }
.hud-esq { display: flex; flex-direction: column; gap: 6px; }
.perfil { display: flex; align-items: center; gap: 8px; background: var(--painel); padding: 6px 10px 6px 6px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.nivel { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, #f0b83a, #d9762b); color: #3a2000; }
.barras { display: flex; flex-direction: column; gap: 4px; width: 140px; }
.barra { position: relative; height: 12px; border-radius: 6px; background: rgba(0, 0, 0, .45); overflow: hidden; }
.barra i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; transition: width .2s; }
.barra.pv i { background: linear-gradient(90deg, #e04545, #ff7b6b); }
.barra.xp { height: 6px; } .barra.xp i { background: linear-gradient(90deg, #3ac0ff, #9b7bff); }
.barra span { position: absolute; inset: 0; font-size: 9px; font-weight: 800; text-align: center; line-height: 12px; text-shadow: 0 1px 2px #000; }
.ouro { align-self: flex-start; display: flex; align-items: center; gap: 5px; background: var(--painel); padding: 4px 10px 4px 6px; border-radius: 99px; font-weight: 800; }
.pacote-ind { align-self: flex-start; display: flex; align-items: center; gap: 6px; background: var(--painel); padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pacote-ind i { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid #5a3d22; }
.hud-dir { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#miniMapa { width: 104px; height: 104px; border-radius: 14px; border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); background: #123a66; }
.relogio { background: var(--painel); padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.redondo { width: 40px; height: 40px; border-radius: 12px; background: var(--painel); font-size: 20px; }
#ganhos { position: fixed; left: 10px; top: calc(118px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 5; }
.ganho { display: flex; align-items: center; gap: 5px; background: rgba(22, 30, 48, .8); padding: 3px 9px 3px 5px; border-radius: 99px; font-size: 12px; animation: entra .25s; transition: opacity .4s, transform .4s; }
.ganho b { color: var(--verde); } .ganho.sai { opacity: 0; transform: translateX(-10px); }
#avisos { position: fixed; left: 0; right: 0; top: calc(64px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; }
.aviso { background: rgba(22, 30, 48, .95); border: 1px solid var(--linha); padding: 9px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; max-width: 86vw; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); animation: entra .25s; transition: opacity .4s; }
.aviso.bom { border-color: var(--verde); } .aviso.sai { opacity: 0; }
#dica { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(200px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .6); padding: 6px 12px; border-radius: 10px; font-size: 13px; pointer-events: none; z-index: 5; }
#dica[hidden] { display: none; }
body.dano::after { content: ''; position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 80px rgba(255, 0, 0, .55); animation: some .45s forwards; z-index: 4; }

/* joystick */
#joy { position: fixed; left: 0; bottom: 0; width: 50%; height: 62%; z-index: 3; touch-action: none; }
#joy .base { position: fixed; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .25); left: 26px; bottom: calc(92px + env(safe-area-inset-bottom)); display: grid; place-items: center; opacity: .55; transition: opacity .15s; pointer-events: none; }
#joy .base:not(.on) { top: auto !important; left: 26px !important; }
#joy .base.on { opacity: 1; bottom: auto; }
#joy .manete { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }

/* botões de ação */
#acoes { position: fixed; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 190px; height: 190px; z-index: 6; }
#acoes[hidden] { display: none; }
#acoes button { position: absolute; border-radius: 50%; box-shadow: 0 5px 0 rgba(0, 0, 0, .3), 0 8px 18px rgba(0, 0, 0, .35); display: grid; place-items: center; font-weight: 900; overflow: hidden; }
#acoes button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.b-acao { right: 0; bottom: 0; width: 96px; height: 96px; background: radial-gradient(circle at 35% 30%, #ffe08a, #f0a92e); color: #3a2400; font-size: 14px; text-align: center; padding: 6px; line-height: 1.1; }
.b-atacar { right: 104px; bottom: 6px; width: 68px; height: 68px; background: radial-gradient(circle at 35% 30%, #ff8d7b, #d83a2c); font-size: 28px; }
.b-skill { width: 56px; height: 56px; background: radial-gradient(circle at 35% 30%, #8fc7ff, #3a6fd6); font-size: 22px; }
.b-skill:nth-of-type(3) { right: 112px; bottom: 86px; } .b-skill:nth-of-type(4) { right: 50px; bottom: 112px; background: radial-gradient(circle at 35% 30%, #9ff0a8, #2fa652); }
.b-skill i { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .55); }
.b-comer { right: 0; bottom: 112px; width: 46px; height: 46px; background: var(--painel2); }
.b-comer b { position: absolute; right: 4px; bottom: 2px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.b-comer .ic { width: 28px; height: 28px; }
#acoes .off { opacity: .45; filter: grayscale(.6); }
#construirBar { position: fixed; left: 0; right: 0; bottom: calc(80px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; z-index: 6; padding: 0 10px; }
#construirBar[hidden] { display: none; }
#construirMsg { width: 100%; text-align: center; font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px #000; }
#menuBaixo { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 6px; background: var(--painel); padding: 6px; border-radius: 16px; z-index: 6; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
#menuBaixo button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 10px; min-width: 62px; }
#menuBaixo button:active { background: rgba(255, 255, 255, .1); }
#menuBaixo .ic-s, .ic-txt { width: 22px; height: 22px; font-size: 18px; line-height: 22px; text-align: center; }

/* janelas */
.fundo { position: fixed; inset: 0; z-index: 40; background: rgba(5, 10, 25, .55); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; touch-action: auto; }
.fundo.on { opacity: 1; }
.folha { position: relative; width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: linear-gradient(180deg, #2a3756, #1b2540); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 10px; user-select: text; }
.folha.larga { max-width: 680px; }
.folha h2 { margin: 0 34px 0 0; font-size: 20px; } .folha h3 { margin: 6px 0 0; font-size: 15px; color: #cdd6f0; } .folha h3 small { font-weight: 500; color: #9aa6c8; }
.folha p { margin: 0; line-height: 1.45; color: #dfe5f5; } .folha ol { margin: 0; padding-left: 20px; line-height: 1.5; color: #dfe5f5; }
.fechar { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.nota { color: #9aa6c8 !important; font-size: 13px; }
.aviso-in { background: rgba(255, 207, 58, .12); border: 1px solid rgba(255, 207, 58, .4); padding: 10px; border-radius: 12px; font-size: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 800; background: linear-gradient(180deg, #ffcf5a, #e8962a); color: #3a2400; box-shadow: 0 4px 0 #9a5a12; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #9a5a12; }
.btn.sec { background: var(--painel2); color: var(--tx); box-shadow: 0 4px 0 #111827; }
.btn.perigo { background: linear-gradient(180deg, #ff7b6b, #d83a2c); color: #fff; box-shadow: 0 4px 0 #7a1a10; }
.btn.peq { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.off { opacity: .45; }
.grelha { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; background: rgba(255, 255, 255, .06); border: 1px solid var(--linha); border-radius: 12px; padding: 6px 4px; }
.slot b { position: absolute; top: 3px; right: 6px; font-size: 12px; }
.slot span { font-size: 10px; text-align: center; line-height: 1.15; color: #cdd6f0; }
.receitas { display: flex; flex-direction: column; gap: 6px; }
.receita { display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(255, 255, 255, .06); border: 1px solid var(--linha); border-radius: 14px; padding: 8px 10px; }
.receita > div { flex: 1; } .receita b { font-size: 14px; }
.receita.off { opacity: .55; }
.custos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.custo { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, .25); padding: 2px 7px 2px 3px; border-radius: 99px; }
.custo.falta { color: var(--mau); }
.ic.pk { border-radius: 6px; border: 2px solid #5a3d22; display: inline-grid; place-items: center; }
.ic.pk.barco { background: #3a8fc4; font-size: 20px; border-color: #1b4f8f; }
.ic.con { display: inline-grid; place-items: center; border-radius: 8px; background: #6b4a2b; font-size: 12px; font-weight: 900; }
.vbtns { display: flex; gap: 4px; }
.item-det { display: flex; align-items: center; gap: 12px; }
.abas { display: flex; gap: 6px; } .abas button { flex: 1; padding: 9px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-weight: 800; } .abas .on { background: #e8962a; color: #3a2400; }
.npc-cab small { color: var(--ouro); font-weight: 700; }
.preco-g { font-size: 28px; font-weight: 900; color: var(--ouro) !important; display: flex; align-items: center; gap: 6px; } .preco-g .ic-s { width: 28px; height: 28px; }
.tarefas { display: flex; flex-direction: column; gap: 8px; }
.tarefa { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 10px; }
.tarefa > div { flex: 1; } .tarefa small { color: #9aa6c8; display: inline-flex; align-items: center; gap: 4px; }
.prog { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .35); margin: 6px 0 4px; overflow: hidden; } .prog i { display: block; height: 100%; background: var(--verde); }
#mapaG { width: 100%; height: auto; border-radius: 14px; image-rendering: pixelated; }
.legenda, .ilhas { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #cdd6f0; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; } .legenda i.q { border-radius: 2px; border: 2px solid #ffe58a; }
.opcao { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linha); font-weight: 700; }
.opcao input { width: 22px; height: 22px; }
.i18n-sel { color: var(--tx); }
.intro, .morte { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 10px 0; }
.intro h1 { margin: 0; font-size: 44px; letter-spacing: .14em; background: linear-gradient(100deg, #ffcf5a, #ff8a5a 50%, #7cc7ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro .sub { letter-spacing: .3em; text-transform: uppercase; font-size: 12px; color: #9aa6c8; }
.intro .btn, .morte .btn { width: 100%; max-width: 320px; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
@keyframes some { to { opacity: 0; } }
/* joystick escondido só em computadores com rato (telemóveis deitados podem ter mais de 900 px) */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) { #joy { display: none; } }

/* sobreposição do 3D: números e barras de vida */
#sobre3d { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
#sobre3d > div { position: absolute; left: 0; top: 0; will-change: transform; }
#sobre3d .num3d { font: 700 15px system-ui, sans-serif; text-shadow: 0 0 3px #000, 0 1px 2px #000; white-space: nowrap; }
#sobre3d .pv3d { width: 38px; height: 5px; background: rgba(0, 0, 0, .6); border-radius: 3px; overflow: hidden; }
#sobre3d .pv3d i { display: block; height: 100%; background: #ff4d4d; }
