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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #dfe6f0;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #101014;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#level-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  min-width: 50px;
}

#timer-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  min-width: 55px;
  text-align: right;
}

#bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar {
  position: relative;
  width: 100%;
  height: 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  overflow: hidden;
}

#xp-bar { height: 8px; }

/* ---------- Boss HUD ---------- */
#boss-hud {
  position: fixed;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70vw);
  z-index: 15;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#boss-hud.hidden { display: none; }

#boss-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  color: #e05353;
  margin-bottom: 3px;
}

#boss-bar {
  height: 12px;
  border-color: rgba(224, 83, 83, 0.5);
}

#boss-fill {
  background: linear-gradient(90deg, #7a1f1f, #e05353);
  transition: width 0.15s ease-out;
}

.bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 100%;
  transition: width 0.15s ease-out;
}

#health-fill { background: linear-gradient(90deg, #b32d2d, #e05353); }
#xp-fill { background: linear-gradient(90deg, #2d8f4e, #4ecb71); }

.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
  z-index: 10;
}

.modal.hidden { display: none; }

.modal-panel {
  background: #17171c;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 28px 32px;
  min-width: 320px;
  max-width: 90vw;
  text-align: center;
}

.modal-panel h2 {
  font-size: 22px;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.death-title { color: #e05353; }

.modal-sub {
  opacity: 0.7;
  margin-bottom: 18px;
  font-size: 13px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.levelup-choice {
  background: #22222b;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 12px 16px;
  color: #dfe6f0;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  text-decoration: none; /* the pause menu's Archive link reuses this class alongside real <button>s */
  transition: background 0.1s, border-color 0.1s;
}

.levelup-choice:hover,
.levelup-choice:active {
  background: #2d2d3a;
  border-color: #f2c14e;
}

.choice-label { font-weight: 700; font-size: 14px; }
.choice-detail { font-size: 12px; opacity: 0.7; margin-top: 2px; }

.character-choice {
  background: #22222b;
  border: 1px solid var(--char-color, rgba(255,255,255,0.15));
  border-radius: 6px;
  padding: 12px 16px;
  color: #dfe6f0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, box-shadow 0.1s;
}

.character-choice:hover,
.character-choice:active {
  background: #2d2d3a;
  box-shadow: 0 0 0 1px var(--char-color, #f2c14e);
}

.char-name { font-weight: 700; font-size: 14px; color: var(--char-color, #dfe6f0); }
.char-weapon { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.6; margin-top: 2px; }
.char-tagline { font-size: 12px; opacity: 0.75; margin-top: 4px; }
.char-passive { font-size: 11px; color: #f2c14e; margin-top: 6px; }

.character-choice.area-locked {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(0.6);
}

.character-choice.area-locked:hover,
.character-choice.area-locked:active {
  background: #22222b;
  box-shadow: none;
}

.survived-title { color: #4ecb71; }

#death-stats {
  margin: 16px 0 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  opacity: 0.85;
}

#restart-btn {
  background: #b32d2d;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 28px;
  cursor: pointer;
}

#restart-btn:hover { background: #cc3636; }

#death-quit-btn {
  display: block;
  margin: 12px auto 0;
  background: #2a2a33;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #dfe6f0;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 10px 28px;
  cursor: pointer;
}

#death-quit-btn:hover { background: #34343f; border-color: #f2c14e; }

#area-survived-continue-btn {
  background: #2d8f4e;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 28px;
  cursor: pointer;
}

#area-survived-continue-btn:hover { background: #36ab5e; }

/* ---------- Shield badge ---------- */
#shield-badge {
  position: absolute;
  top: 56px;
  left: 16px;
  z-index: 15;
  background: rgba(16, 16, 20, 0.6);
  border: 1px solid rgba(143, 211, 255, 0.5);
  color: #8fd3ff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
}

#shield-badge.hidden { display: none; }

/* ---------- Weapon icons HUD ---------- */
#weapon-hud {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 15;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.weapon-icon {
  background: rgba(16, 16, 20, 0.65);
  border: 1px solid var(--weapon-color, rgba(255,255,255,0.3));
  border-radius: 6px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.weapon-icon-name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--weapon-color, #dfe6f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
}

.weapon-icon-level {
  font-size: 10px;
  font-weight: 700;
  color: #f2c14e;
}

.weapon-icon-disabled {
  opacity: 0.4;
  border-style: dashed;
}

/* ---------- Top-right buttons (menu, fullscreen) ---------- */
#top-right-buttons {
  position: absolute;
  top: 56px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

#menu-btn,
#mute-btn,
#fullscreen-btn {
  background: rgba(16, 16, 20, 0.6);
  border: 1px solid rgba(242, 193, 78, 0.35);
  color: #dfe6f0;
  font-family: inherit;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

#menu-btn:hover,
#mute-btn:hover,
#fullscreen-btn:hover { border-color: #f2c14e; }

#fullscreen-btn { display: none; }

@media (pointer: coarse) {
  #fullscreen-btn {
    display: inline-block;
  }
}

/* ---------- Rotate-to-landscape overlay ---------- */
#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(20, 12, 12, 0.97) 0%, rgba(4, 2, 2, 0.99) 80%);
  text-align: center;
  padding: 24px;
  cursor: pointer;
}

#rotate-overlay.hidden { display: none; }

.rotate-icon {
  font-size: 56px;
  animation: rotate-hint 1.6s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}

.rotate-title {
  font-size: 19px;
  letter-spacing: 2px;
  color: #f2c14e;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(242, 193, 78, 0.5);
}

.rotate-sub {
  font-size: 13px;
  color: rgba(223, 230, 240, 0.65);
  max-width: 280px;
  line-height: 1.5;
}

.rotate-retry-hint {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(242, 193, 78, 0.5);
  margin-top: 6px;
}
