html, body {
  margin: 0;
  padding: 0;
  background: #06080f;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  font-family: "Courier New", monospace;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#ui { position: fixed; inset: 0; pointer-events: none; color: #eef3f8; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 10px; left: 0; right: 0; }
#hearts { position: absolute; left: 14px; top: 0; font-size: 24px; letter-spacing: 2px; }
.heart { color: #e23b4e; text-shadow: 1px 1px 0 #10141c; }
.heart.half {
  background: linear-gradient(90deg, #e23b4e 50%, #363c45 50%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}
.heart.empty { color: #363c45; text-shadow: none; }
#frags { position: absolute; right: 14px; top: 2px; font-size: 22px; letter-spacing: 4px; }
#objective {
  position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  background: rgba(6, 10, 18, 0.6); padding: 4px 12px; font-size: 12px;
  border-radius: 4px; white-space: nowrap; max-width: 86vw; overflow: hidden; text-overflow: ellipsis;
  color: #cfe3f5;
}

/* ---------- barra de chefe ---------- */
#bossbar { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); width: 340px; text-align: center; }
#bossname { font-size: 12px; font-weight: bold; color: #ffd2d2; text-shadow: 1px 1px 0 #10141c; margin-bottom: 3px; }
#bosshp { height: 10px; background: #3a3f46; border: 2px solid #10141c; }
#bosshpfill { height: 100%; width: 100%; background: #e23b4e; transition: width 0.15s; }

/* ---------- toasts ---------- */
#toasts { position: absolute; left: 12px; bottom: 160px; display: flex; flex-direction: column-reverse; gap: 5px; max-width: 70vw; }
.toast {
  background: rgba(6, 10, 18, 0.75); padding: 5px 10px; font-size: 13px;
  border-left: 3px solid #27e0a6; opacity: 1; transition: opacity 0.5s;
}

/* ---------- diálogo ---------- */
#dlg {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(680px, 94vw); min-height: 96px; box-sizing: border-box;
  background: rgba(8, 16, 33, 0.94); border: 2px solid #cfe3f5; padding: 14px 18px 12px;
}
#dlgwho {
  position: absolute; top: -12px; left: 12px; background: #0b2e59; border: 2px solid #cfe3f5;
  color: #ffd23f; font-size: 12px; font-weight: bold; padding: 2px 10px;
}
#dlgtext { font-size: 14px; line-height: 1.45; white-space: pre-wrap; min-height: 42px; }
#dlgopts { margin-top: 6px; font-size: 14px; }
#dlgopts div { padding: 1px 0; color: #9fb3c8; }
#dlgopts div.sel { color: #ffd23f; }
#dlgmore { position: absolute; right: 12px; bottom: 4px; color: #ffd23f; animation: blink 0.9s infinite; font-size: 12px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- telas (título, intro, pausa...) ---------- */
#screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.panel { text-align: center; max-width: 92vw; }
.title-big {
  font-size: clamp(34px, 7vw, 60px); font-weight: bold; color: #27e0a6;
  text-shadow: 3px 3px 0 #0b2e59; letter-spacing: 2px;
}
.title-sub { font-size: clamp(15px, 3vw, 20px); color: #ffd23f; font-weight: bold; margin-top: 6px; }
.menu { margin-top: 36px; font-size: 17px; font-weight: bold; }
.menu div { padding: 5px; color: #9fb3c8; }
.menu div.sel { color: #ffd23f; }
.help { margin-top: 30px; font-size: 12px; color: #93a7bc; }
.disclaimer { margin-top: 18px; font-size: 11px; color: #8fa3b8; line-height: 1.6; }
.pagebox {
  background: rgba(4, 10, 22, 0.88); border: 2px solid #1d2c44; padding: 28px 34px;
  font-size: 15px; line-height: 1.6; max-width: 560px; text-align: left; white-space: pre-wrap;
}
.pagefoot { margin-top: 18px; color: #ffd23f; font-size: 13px; text-align: center; }
.overlay-dark { position: absolute; inset: 0; background: rgba(4, 6, 12, 0.78); }
.gameover-t { font-size: clamp(22px, 5vw, 34px); color: #e23b4e; font-weight: bold; }
.credits-wrap { position: absolute; inset: 0; overflow: hidden; }
.credits-band {
  position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(600px, 92vw);
  background: linear-gradient(180deg, rgba(4, 8, 16, 0.75), rgba(4, 8, 16, 0.42) 28%, rgba(4, 8, 16, 0.42) 72%, rgba(4, 8, 16, 0.75));
}
.credits-col {
  position: absolute; left: 0; right: 0; text-align: center; font-size: 15px; line-height: 1.7;
  color: #eef3f8; text-shadow: 0 2px 6px #000, 0 0 3px #000;
}
.credits-col .h { color: #ffd23f; font-weight: bold; letter-spacing: 1px; }
.credits-col .t {
  color: #27e0a6; font-weight: bold; font-size: 32px;
  text-shadow: 0 0 18px rgba(39, 224, 166, 0.7), 0 2px 6px #000;
}
.inv-list { text-align: left; font-size: 14px; line-height: 2; }
.inv-off { color: #5a6470; }

#fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.24s; pointer-events: none; }

/* ---------- toque ---------- */
#touch { display: none; position: fixed; inset: 0; pointer-events: none; z-index: 10; }
@media (hover: none) and (pointer: coarse) {
  #touch { display: block; }
  /* sobe o diálogo e os toasts para nunca caírem atrás dos controles */
  #dlg { bottom: 150px; width: min(680px, 96vw); }
  #toasts { bottom: 240px; }
  #bossbar { top: 44px; }
}
/* joystick analógico: base + manípulo, permite diagonais */
#stick {
  pointer-events: auto; position: absolute; left: 24px; bottom: 28px;
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(20, 30, 50, 0.4); border: 2px solid rgba(255, 255, 255, 0.28);
  touch-action: none;
}
#stickknob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(120, 160, 210, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.5); transition: background 0.1s;
}
#stick.on #stickknob { background: rgba(39, 224, 166, 0.6); }
.tb {
  pointer-events: auto; position: absolute; width: 62px; height: 62px; border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(20, 30, 50, 0.45);
  color: rgba(255, 255, 255, 0.8); font-size: 22px; font-family: monospace;
  -webkit-tap-highlight-color: transparent;
}
.tb:active { background: rgba(39, 224, 166, 0.4); }
#acts .tb[data-k="a"] { right: 26px; bottom: 40px; }
#acts .tb[data-k="b"] { right: 100px; bottom: 70px; }
.act { border-radius: 50% !important; font-weight: bold; width: 66px; height: 66px; }
