* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  background: #1a120b;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

#game-wrap {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  /* sized by JS to keep 16:9 */
}

#game {
  display: block;
  width: 100%; height: 100%;
  cursor: crosshair;
  border-radius: 6px;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 2%; left: 2%; right: 2%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.village-panel { width: 32%; }
.village-panel.right { text-align: right; }

.village-name {
  color: #ffe9c2;
  font-weight: bold;
  font-size: clamp(10px, 1.6vw, 18px);
  text-shadow: 1px 2px 2px rgba(0,0,0,.7);
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.lifebar {
  height: clamp(12px, 2.2vh, 20px);
  background: rgba(0,0,0,.55);
  border: 2px solid #5b4123;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

.lifebar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width .45s ease;
}
.lifebar-fill.player { background: linear-gradient(#8ee06a, #3f9c2a); }
.lifebar-fill.enemy  { background: linear-gradient(#ff9d6a, #d43c2a); float: right; }

#stage-badge {
  text-align: center;
  color: #ffe9c2;
  text-shadow: 1px 2px 2px rgba(0,0,0,.8);
}
#stage-label { font-size: clamp(13px, 2vw, 22px); font-weight: bold; letter-spacing: 2px; }
#wind-label  { font-size: clamp(10px, 1.4vw, 15px); margin-top: 2px; opacity: .95; }
#turn-label  { font-size: clamp(10px, 1.4vw, 15px); margin-top: 2px; color: #ffd23e; font-weight: bold; }

/* ---------- Ammo bar ---------- */
#ammo-bar {
  position: absolute;
  bottom: 2.5%; left: 2%;
  display: flex;
  gap: 8px;
  pointer-events: none; /* don't block aiming drags on the canvas */
}
.ammo-slot { pointer-events: auto; }

.ammo-slot {
  width: clamp(44px, 6vw, 64px);
  height: clamp(44px, 6vw, 64px);
  border-radius: 10px;
  border: 2px solid #6b4d26;
  background: rgba(30,20,10,.75);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: #ffe9c2;
  font-size: clamp(16px, 2.6vw, 26px);
  transition: transform .12s ease, border-color .12s;
}
.ammo-slot small { font-size: clamp(7px, .9vw, 10px); letter-spacing: .5px; }
.ammo-slot.selected { border-color: #ffd23e; transform: scale(1.1); background: rgba(80,50,15,.85); }
.ammo-slot.locked { opacity: .38; cursor: not-allowed; filter: grayscale(.8); }

/* ---------- Overlay ---------- */
#overlay {
  position: absolute; inset: 0;
  background: rgba(10, 6, 2, .62);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
  border-radius: 6px;
}
#overlay.hidden { display: none; }
.hidden { display: none !important; }

#overlay-card {
  text-align: center;
  padding: 4vh 5vw;
  max-width: 620px;
}

#overlay-title {
  font-size: clamp(30px, 6vw, 64px);
  color: #ffd23e;
  letter-spacing: 4px;
  text-shadow: 3px 4px 0 #7a3b12, 5px 7px 12px rgba(0,0,0,.8);
  margin-bottom: 2vh;
}

#overlay-text {
  color: #ffe9c2;
  font-size: clamp(13px, 1.8vw, 19px);
  line-height: 1.55;
  margin-bottom: 3.2vh;
  text-shadow: 1px 1px 2px rgba(0,0,0,.8);
}

#overlay-btn, #overlay-btn2 {
  font-family: inherit;
  font-size: clamp(15px, 2.2vw, 24px);
  font-weight: bold;
  letter-spacing: 2px;
  color: #2b1500;
  background: linear-gradient(#ffd867, #e89b2b);
  border: 3px solid #7a4a12;
  border-radius: 14px;
  padding: .6em 1.6em;
  margin: 0 8px;
  cursor: pointer;
  box-shadow: 0 5px 0 #7a4a12, 0 9px 16px rgba(0,0,0,.55);
  transition: transform .1s;
}
#overlay-btn:hover, #overlay-btn2:hover { transform: translateY(-2px); }
#overlay-btn:active, #overlay-btn2:active { transform: translateY(3px); box-shadow: 0 2px 0 #7a4a12; }
