/* HUD do jogador: posições e porquê em docs/UI-JOGADOR.md.
   Visual de sobrevivência feito só com cor: chapa de metal com rebites, papel de rádio com fita adesiva, letra de estêncil.
   LEVE (regra dura): nada de blur, filtro, sombra animada ou imagem; degradês e sombras são parados. */
@font-face { font-family: 'Estencil'; src: url('/fonts/black-ops-one-latin.woff2') format('woff2'); font-display: swap; } /* Black Ops One, OFL */
:root {
  --h-estencil: 'Estencil', Impact, 'Arial Black', sans-serif;
  --h-leitura: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --h-metal-a: rgba(46, 40, 33, 0.94); --h-metal-b: rgba(26, 23, 19, 0.94); --h-borda: #5a4a33; --h-rebite: #9a8259;
  --h-ambar: #e0a63a; --h-ambar-vivo: #ffc861; --h-ambar-escuro: #8a5f17;
  --h-alerta: #c8352d; --h-alerta-vivo: #ff6a52;
  --h-texto: #ece2c8; --h-apagado: #a89878;
  --h-papel: #e2d3ab; --h-tinta: #2b2218;
}

/* ---------- chapa de metal (todas as placas do HUD) ---------- */
#hud, #missao, #barra, #cidade, #controles, #minimapa, #mochila, #menu-abre, #msg {
  box-sizing: border-box; border: 1px solid var(--h-borda); border-radius: 3px; color: var(--h-texto);
  background:
    radial-gradient(circle at 5px 5px, var(--h-rebite) 0 1.5px, #0000 2.5px),
    radial-gradient(circle at calc(100% - 5px) 5px, var(--h-rebite) 0 1.5px, #0000 2.5px),
    radial-gradient(circle at 5px calc(100% - 5px), var(--h-rebite) 0 1.5px, #0000 2.5px),
    radial-gradient(circle at calc(100% - 5px) calc(100% - 5px), var(--h-rebite) 0 1.5px, #0000 2.5px),
    linear-gradient(180deg, var(--h-metal-a), var(--h-metal-b));
  box-shadow: inset 0 1px 0 rgba(255, 228, 176, 0.09), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 2px 0 rgba(0, 0, 0, 0.5);
}
/* botão de metal (menus, ajustes) e botão âmbar (ação) */
#barra button, #cidade button, #controles button, #menu-abre, #como-jogar button {
  box-sizing: border-box; min-height: 30px; padding: 5px 10px; border: 1px solid #0b0907; border-radius: 2px; cursor: pointer;
  background: linear-gradient(180deg, #3d352b, #27221c); color: var(--h-texto); box-shadow: inset 0 1px 0 rgba(255, 228, 176, 0.1);
  font: 13px var(--h-leitura); letter-spacing: 0.3px; text-align: left; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
#barra button:hover, #cidade button:hover, #controles button:hover, #menu-abre:hover { border-color: var(--h-ambar); color: #fff; }
#barra button.ativo, #cidade button.ativo, #corpo button, #como-jogar button {
  background: linear-gradient(180deg, var(--h-ambar), #a8741f); color: #1a1208; border-color: #0b0907;
}
#barra button.ativo:hover, #corpo button:hover { background: linear-gradient(180deg, var(--h-ambar-vivo), var(--h-ambar)); color: #1a1208; }

/* ---------- coluna da esquerda: vida e rádio ---------- */
#col-esq { position: fixed; top: 12px; left: 12px; width: 268px; z-index: 8; display: flex; flex-direction: column; gap: 14px; pointer-events: none; }
#col-esq > * { pointer-events: auto; }
#hud { position: static; max-width: none; padding: 10px 12px 10px; }
.hud-linha { display: flex; align-items: center; gap: 10px; }
#nivel { flex: none; width: 42px; height: 42px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center;
         border: 2px solid var(--h-ambar); border-radius: 3px; background: #2e200b; color: var(--h-ambar-vivo); font-family: var(--h-estencil); line-height: 1; }
#nivel[hidden] { display: none; }
#nivel small { font-size: 9px; letter-spacing: 1px; color: var(--h-ambar); }
#nivel b { font-size: 19px; font-weight: normal; }
.hud-vida { flex: 1; min-width: 0; position: relative; }
.hud-vida .rot { display: block; font: 10px var(--h-estencil); letter-spacing: 2px; text-transform: uppercase; color: var(--h-ambar); margin-bottom: 3px; }
#vida { position: relative; width: auto; height: 16px; margin: 0; background: #140d0c; border: 1px solid #000; box-shadow: 0 0 0 1px var(--h-borda); overflow: hidden; }
#vida i { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #d4473b, #8b1c1b); transition: width .2s; }
#vida::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, #0000 0 11px, rgba(0, 0, 0, 0.35) 11px 12px); }
#vida span { position: absolute; inset: 0; z-index: 1; padding-right: 6px; text-align: right; font: 12px/16px var(--h-estencil); color: #fff; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
#vida.baixa { box-shadow: 0 0 0 1px var(--h-alerta-vivo); }
#vida.baixa i { background: linear-gradient(180deg, var(--h-alerta-vivo), #9c1a14); }
#xp { position: relative; width: auto; height: 4px; margin-top: 4px; background: #120e0a; display: flex; }
#xp[hidden] { display: none; }
#xp i { display: block; height: 100%; background: var(--h-ambar); }
#xp b { display: block; height: 100%; background: #fff3cf; opacity: 0.75; }
#xp span { position: absolute; top: 7px; left: 0; white-space: nowrap; font: 11px var(--h-leitura); color: var(--h-ambar-vivo); }
#xp:has(span:not(:empty)) { margin-bottom: 17px; }
#vidatxt { margin-top: 6px; font: 11px var(--h-leitura); color: var(--h-apagado); }
#vidatxt:empty, #vidatxt[hidden] { display: none; }
#corpo { margin-top: 9px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; pointer-events: auto; }
#corpo:empty { display: none; }
#corpo span { font: 10px var(--h-estencil); letter-spacing: 1px; text-transform: uppercase; padding: 4px 7px; border: 1px solid var(--h-borda); border-radius: 2px; background: #15110d; color: var(--h-texto); }
#corpo span.ruim { border-color: var(--h-alerta); color: #ffd6cc; background: #4a1210; animation: pulsa 1.2s infinite; }
#corpo button { font: 11px var(--h-estencil); letter-spacing: 1px; text-transform: uppercase; padding: 5px 10px; min-height: 28px; cursor: pointer; margin-left: auto; }
@keyframes pulsa { 50% { background: #7a1712; } }

/* rádio do tutorial: papel creme com fita adesiva (era um quadro solto no canto de baixo) */
#radio-tut { position: relative; left: auto; bottom: auto; width: auto; margin: 6px 4px 0; padding: 16px 14px 12px; box-sizing: border-box;
  background: repeating-linear-gradient(180deg, #0000 0 21px, rgba(90, 64, 30, 0.13) 21px 22px), var(--h-papel);
  color: var(--h-tinta); border: 0; border-left: 4px solid var(--h-alerta); border-radius: 1px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); transform: rotate(-0.7deg); font: 14px/1.4 var(--h-leitura); }
#radio-tut::before { content: ''; position: absolute; top: -9px; left: 50%; width: 78px; height: 18px; margin-left: -39px; transform: rotate(-4deg);
  background: rgba(236, 226, 190, 0.78); border-left: 2px dotted rgba(140, 120, 80, 0.5); border-right: 2px dotted rgba(140, 120, 80, 0.5); }
#radio-tut b { display: block; font: 11px var(--h-estencil); letter-spacing: 2px; text-transform: uppercase; color: #8e1d1d; }
#radio-tut p { margin: 5px 0 3px; }
#radio-tut small { display: block; color: #5d4b33; font-size: 12px; }
#radio-tut small:empty { display: none; }
#radio-tut button { margin-top: 8px; font: 12px var(--h-leitura); padding: 4px 10px; background: transparent; color: #5d4b33; border: 1px solid #9a8259; border-radius: 2px; cursor: pointer; }
#radio-tut button:hover { background: rgba(90, 64, 30, 0.12); }
#radio-tut[hidden], body.tela-titulo #radio-tut, body.painel-aberto #radio-tut { display: none; }

/* ---------- placa do gerador (rua): relógio + objetivos numa peça só, no alto do meio ---------- */
#missao { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7; display: flex; align-items: stretch; width: 540px; max-width: calc(100vw - 600px); min-width: 420px; pointer-events: none; }
#missao:not(:has(> :not([hidden]))) { display: none; }
#relogio { position: static; transform: none; flex: none; width: 150px; padding: 10px 8px 9px; text-align: center; pointer-events: none; border-right: 1px dashed var(--h-borda); }
#relogio[hidden] { display: none; }
#relogio small { display: block; font: 9px var(--h-estencil); letter-spacing: 1.5px; color: var(--h-apagado); text-transform: uppercase; }
#relogio b { display: block; margin: 2px 0; font: 34px/1 var(--h-estencil); font-weight: normal; letter-spacing: 2px; color: var(--h-ambar-vivo); text-shadow: 0 2px 0 #000; }
#relogio i { display: block; font-style: normal; font: 10px var(--h-leitura); letter-spacing: 1px; color: var(--h-texto); text-transform: uppercase; }
#relogio i.lua { color: var(--h-alerta-vivo); }
#relogio.horda { background: repeating-linear-gradient(-45deg, rgba(224, 166, 58, 0.22) 0 9px, #0000 9px 18px); }
#relogio.horda b { color: var(--h-alerta-vivo); animation: pulsa2 .9s infinite; }
#relogio.fim b { color: var(--h-apagado); }
@keyframes pulsa2 { 50% { opacity: .55; } }
#objetivos { position: static; flex: 1; width: auto; min-width: 0; padding: 9px 12px 8px; background: none; border: 0; font: 13px var(--h-leitura); pointer-events: none; }
#objetivos[hidden] { display: none; }
#objetivos h4 { margin: 0 0 5px; font: 11px var(--h-estencil); letter-spacing: 2px; font-weight: normal; color: var(--h-alerta-vivo); text-transform: uppercase; }
.obj { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.obj .caixa { width: 11px; height: 11px; border: 1px solid var(--h-ambar); border-radius: 2px; flex: none; background: #120e0a; }
.obj.ok .caixa { background: var(--h-ambar); box-shadow: inset 0 0 0 2px #120e0a; }
.obj.ok .nome { color: var(--h-apagado); text-decoration: line-through; }
.obj .nome { flex: 1; }
.obj .onde { color: var(--h-apagado); font-size: 12px; white-space: nowrap; }
.obj:last-child .onde { white-space: normal; font-size: 11px; font-style: italic; }
.seta { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 10px solid var(--h-ambar); display: inline-block; vertical-align: middle; margin-left: 4px; }

/* avisos rápidos: no meio, abaixo da placa do gerador (perto do olhar, sem tapar o boneco) */
#msg { position: fixed; top: 132px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 8px 18px; z-index: 9;
       font: 14px/1.35 var(--h-leitura); text-align: center; color: var(--h-ambar-vivo); opacity: 0; transition: opacity .3s; pointer-events: none; }
#msg.ver { opacity: 1; }
body.painel-aberto #msg { display: none; }

/* ---------- coluna dos menus (abrigo) e placa da cidade (rua): direita, em grupos ---------- */
#barra, #cidade { position: fixed; top: 12px; right: 12px; bottom: auto; left: auto; width: 178px; z-index: 62; display: flex; flex-direction: column; gap: 9px; padding: 10px 10px 10px; }
#cidade { z-index: 8; gap: 5px; font-size: 12px; }
#cidade[hidden] { display: none; }
#barra .grupo { display: flex; flex-direction: column; gap: 4px; }
#barra h6 { margin: 0 0 1px; padding-bottom: 3px; font: 10px var(--h-estencil); font-weight: normal; letter-spacing: 2px; text-transform: uppercase; color: var(--h-ambar); border-bottom: 1px dashed var(--h-borda); }
#barra .grupo.rodape { flex-direction: row; padding-top: 7px; border-top: 1px solid #0b0907; box-shadow: 0 -1px 0 rgba(255, 228, 176, 0.06); }
#barra .grupo.rodape button { flex: 1; text-align: center; padding: 5px 4px; font-size: 12px; }
#barra button, #cidade button { width: 100%; }
#cidade span { display: block; padding: 0 2px 4px; font: 11px/1.35 var(--h-leitura); color: var(--h-apagado); border-bottom: 1px dashed var(--h-borda); margin-bottom: 2px; }
#cidade button.ajuda, #barra button.ajuda { text-align: center; }
body.tela-titulo #barra, body.tela-titulo #cidade, body.tela-titulo #menu-abre, body.tela-titulo #col-esq, body.tela-titulo #missao { display: none !important; }
#menu-abre { display: none; }

/* "Como jogar": bilhete de papel ao lado dos menus */
#como-jogar { position: fixed; top: 12px; right: 204px; z-index: 63; width: 300px; box-sizing: border-box; padding: 18px 16px 14px;
  background: var(--h-papel); color: var(--h-tinta); border-left: 4px solid var(--h-ambar-escuro); border-radius: 1px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  transform: rotate(0.6deg); font: 14px/1.45 var(--h-leitura); }
#como-jogar[hidden] { display: none; }
#como-jogar::before { content: ''; position: absolute; top: -9px; left: 40%; width: 70px; height: 18px; transform: rotate(3deg); background: rgba(236, 226, 190, 0.78);
  border-left: 2px dotted rgba(140, 120, 80, 0.5); border-right: 2px dotted rgba(140, 120, 80, 0.5); }
#como-jogar > b { display: block; margin-bottom: 6px; font: 14px var(--h-estencil); font-weight: normal; letter-spacing: 2px; text-transform: uppercase; color: #8e1d1d; }
#como-jogar ul { margin: 0 0 10px; padding: 0; list-style: none; }
#como-jogar li { padding: 4px 0; border-bottom: 1px dashed rgba(90, 64, 30, 0.3); }
#como-jogar li strong { font-weight: bold; }
#como-jogar button { text-align: center; font: 12px var(--h-estencil); letter-spacing: 1px; text-transform: uppercase; }
body.painel-aberto #como-jogar { display: none; }

/* ---------- ajustes raros juntos: girar câmera, música e gráficos (embaixo à esquerda) ---------- */
#controles { position: fixed; left: 12px; bottom: 12px; z-index: 62; display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
#controles .giro-cam { position: static; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; text-align: center; font: 20px/1 Georgia, serif; color: var(--h-ambar-vivo); opacity: 1; }
#controles #botao-musica, #controles .q-botao { position: static; min-height: 34px; padding: 6px 10px; text-align: center; font: 11px var(--h-estencil); letter-spacing: 1.5px; text-transform: uppercase; color: var(--h-ambar); opacity: 1; }
#controles #botao-musica.desligada { color: var(--h-apagado); }
#qualidade { position: relative; left: auto; bottom: auto; z-index: auto; }
#qualidade .q-painel { bottom: 44px; left: -8px; }
#qualidade .q-lista button { text-align: center; }
body.tela-titulo #controles { z-index: 55; }
body.painel-aberto #controles .giro-cam, body.tela-titulo #controles .giro-cam, body.painel-aberto #botao-musica, body.tela-titulo #qualidade { display: none; }

/* ---------- barra de itens: bandeja de metal no rodapé do meio ---------- */
#mochila { bottom: 10px; padding: 6px; gap: 4px; max-width: calc(100vw - 12px); }
#mochila:empty { display: none; }
.slot { border: 1px solid #4a3d2b; border-radius: 3px; background: radial-gradient(ellipse at 50% 40%, #2a241d 0%, #110e0b 100%);
        box-shadow: inset 0 0 0 1px #000, inset 0 2px 6px rgba(0, 0, 0, 0.7); }
.slot:hover { border-color: var(--h-ambar); }
.slot .n { font-family: var(--h-estencil); font-size: 10px; color: var(--h-ambar); opacity: 0.8; }
.slot .q { font-family: var(--h-estencil); }
.slot.mao { border: 2px solid var(--h-ambar); background: radial-gradient(ellipse at 50% 40%, #4a3412 0%, #1d1408 100%); box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000; }
.slot.mao .n { opacity: 1; color: var(--h-ambar-vivo); }
.slot.ativo { border-color: var(--h-ambar-vivo); box-shadow: inset 0 0 0 1px var(--h-ambar-vivo); }
.slot.missao { border-color: #b08a2a; }
.slot .legenda { font: 12px var(--h-leitura); border: 1px solid var(--h-borda); border-radius: 2px; background: #1b1814; color: var(--h-ambar-vivo); }
.slot .dur i { background: var(--h-ambar); }

/* ---------- minimapa: canto de baixo à direita, mesma chapa ---------- */
#minimapa { right: 12px; bottom: 12px; padding: 6px 6px 4px; }
#minimapa small { font: 9px var(--h-estencil); letter-spacing: 1px; color: var(--h-ambar); margin-top: 4px; }
#minimapa[data-modo="geral"] { border-color: var(--h-alerta); }

/* explosivo e cargas do Gladiador: ação → logo acima da barra de itens */
#detonar { right: auto; left: 50%; bottom: 92px; transform: translateX(-50%); }
#gl-cargas, body.com-barra #gl-cargas { bottom: 92px; }
#arm-hab, body.com-barra #arm-hab { bottom: 144px; }

/* ---------- telas médias: a placa do gerador encolhe ---------- */
@media (max-width: 1100px) and (min-width: 641px) {
  #missao { min-width: 0; max-width: calc(100vw - 520px); width: auto; }
  #missao #objetivos { display: none; }
  #col-esq { width: 240px; }
}

/* ---------- celular (em pé) ---------- */
@media (max-width: 640px) {
  #col-esq { top: 8px; left: 8px; width: calc(100vw - 96px); gap: 12px; }
  body.na-rua #col-esq { top: 72px; width: calc(100vw - 16px); }
  #hud { padding: 7px 9px; display: flex; align-items: center; gap: 8px; }
  #hud .hud-linha { flex: 1; min-width: 0; }
  #corpo { margin-top: 0; flex: 0 1 auto; max-width: 48%; justify-content: flex-end; }
  #corpo button { margin-left: 0; min-height: 34px; padding: 4px 8px; }
  #nivel { width: 34px; height: 34px; } #nivel b { font-size: 16px; }
  #radio-tut { font-size: 12.5px; line-height: 1.35; padding: 12px 10px 8px; }
  #radio-tut p { margin: 3px 0 2px; }
  #radio-tut button { min-height: 32px; margin-top: 4px; }

  #menu-abre { display: block; position: fixed; top: 8px; right: 8px; z-index: 64; width: 76px; min-height: 44px; padding: 5px 4px; text-align: center; font: 13px var(--h-estencil); letter-spacing: 1.5px; text-transform: uppercase; color: var(--h-ambar-vivo); }
  body.painel-aberto #menu-abre { display: none; }
  #barra, #cidade { display: none; }
  body.menu-aberto #barra, body.menu-aberto #cidade:not([hidden]) { display: grid; position: fixed; top: 60px; left: 8px; right: 8px; width: auto; z-index: 64; padding: 12px; }
  body.menu-aberto #barra { grid-template-columns: 1fr 1fr; gap: 12px 10px; }
  #barra .grupo.rodape { grid-column: 1 / -1; }
  #barra button, #cidade button, #barra .grupo.rodape button { min-height: 44px; font-size: 15px; }
  #barra h6 { font-size: 11px; }
  #cidade span { display: block; font-size: 12px; }
  #como-jogar { top: 60px; left: 8px; right: 8px; width: auto; transform: none; }
  #como-jogar button { min-height: 44px; width: 100%; }

  #missao { top: 8px; left: 8px; right: 92px; width: auto; min-width: 0; max-width: none; transform: none; height: 56px; }
  #relogio { width: 84px; padding: 6px 4px; }
  #relogio small { font-size: 6.5px; letter-spacing: 0; white-space: nowrap; overflow: hidden; }
  #relogio b { font-size: 22px; margin: 1px 0; }
  #relogio i { font-size: 8px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #objetivos { padding: 5px 8px; font-size: 11px; display: flex; flex-wrap: wrap; align-content: center; gap: 2px 10px; }
  #objetivos h4, #objetivos .obj:last-child { display: none; }
  #objetivos .obj { margin: 0; gap: 4px; }
  #objetivos .obj .onde { font-size: 10px; }
  #objetivos .obj .caixa { width: 9px; height: 9px; }

  #msg { top: auto; bottom: 200px; font-size: 13px; }
  #mochila { bottom: 6px; padding: 4px; gap: 3px; }
  #controles { left: 8px; bottom: 70px; padding: 5px; gap: 5px; }
  #controles .giro-cam { width: 42px; height: 42px; }
  #controles #botao-musica, #controles .q-botao { min-height: 42px; padding: 6px 8px; font-size: 10px; letter-spacing: 1px; }
  #minimapa { right: 8px; top: auto; bottom: 70px; padding: 4px 4px 3px; }
  #minimapa small { font-size: 7px; letter-spacing: 0; }
  #detonar { bottom: 70px; }
  #gl-cargas, body.com-barra #gl-cargas { bottom: 70px; }
  #arm-hab, body.com-barra #arm-hab { bottom: 122px; }
  body.com-barra #mochila, body.com-barra #objetivos { bottom: auto; }
  body.com-barra #mochila { bottom: 6px; }
  #painel .moldura { height: 100%; }
}
