* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #91c5e8;
  color: #fff;
}
#game-wrap { position: relative; width: 100vw; height: 100vh; }
#gameCanvas { display: block; width: 100%; height: 100%; outline: none; }
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  width: min(520px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(20,35,50,.72), rgba(20,35,50,.42));
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 42px rgba(0,0,0,.18);
  user-select: none;
}
.hud-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.hud-top strong { display: block; font-size: 18px; letter-spacing: .3px; }
#levelName { display: block; margin-top: 2px; opacity: .9; font-size: 13px; }
#restartBtn, #playAgainBtn, #mapButton, #closeMap {
  border: 0;
  border-radius: 999px;
  padding: 8px 13px;
  background: rgba(255,255,255,.9);
  color: #183044;
  font-weight: 700;
  cursor: pointer;
}
#restartBtn:hover, #playAgainBtn:hover, #mapButton:hover { background: white; transform: translateY(-1px); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stats span, .artifact {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255,255,255,.16);
  font-size: 13px;
}
.artifacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.artifact { opacity: .55; }
.artifact.collected { opacity: 1; background: rgba(255,215,88,.92); color: #402900; }
#help {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: min(430px, calc(100vw - 28px));
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 18px;
  background: rgba(9,20,31,.58);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 42px rgba(0,0,0,.18);
}
#help h1 { margin: 0 0 6px; font-size: 22px; }
#help p { margin: 6px 0; line-height: 1.4; font-size: 14px; }
#message { color: #ffe082; font-weight: 700; }
#loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(0,0,0,.62);
  box-shadow: 0 12px 35px rgba(0,0,0,.28);
}
.hidden { display: none !important; }
#endScreen {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(4,13,25,.72);
  backdrop-filter: blur(6px);
  z-index: 10;
}
#endScreen h2 { font-size: clamp(34px, 7vw, 76px); margin: 0 0 12px; }
#endScreen p { font-size: 20px; margin: 0 0 22px; }
#mapButton {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(255,255,255,.86);
}
#mapPanel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(940px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 18px;
  border-radius: 22px;
  background: rgba(20, 26, 33, .88);
  backdrop-filter: blur(10px);
  z-index: 9;
  box-shadow: 0 20px 80px rgba(0,0,0,.44);
}
#mapPanel h2 { margin: 0 0 12px; }
#mapPanel img { width: 100%; border-radius: 14px; display: block; }
#closeMap { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; font-size: 22px; }
@media (max-width: 720px) {
  #hud { font-size: 12px; }
  #help { display: none; }
}
