/* hud.css — in-game HUD: task bar, role, kill button, hints, death banner */

/* Creates the full-screen HUD layer above gameplay while letting clicks pass through by default. */
#hud {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 17;
}

/* Lets interactive interiors keep the normal city HUD menu and zoom controls above the room view. */
#hud.map-interior-hud {
  z-index: 25;
}

/* Keeps interactive interiors focused on room controls instead of city status. */
#hud.map-interior-hud #taskBar,
#hud.map-interior-hud #roleDisplay {
  display: none;
}

/* Avoids offering the city map command while already inside an interactive interior. */
#hud.map-interior-hud #mapBtn {
  display: none;
}

/* Task progress bar */
/* Anchors the crew task progress panel in the top-left corner. */
#taskBar {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 390px;
  padding: 8px 10px 10px;
  background: rgba(41, 28, 21, 0.76);
  border: 3px solid rgba(18, 9, 5, 0.9);
  box-shadow: inset 0 0 0 2px rgba(245, 228, 198, 0.18);
}
/* Styles the text label above the task progress meter. */
#taskBarLabel {
  color: #f5efe1;
  font-size: 12px;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65);
}
/* Frames the outer trough of the task progress bar. */
#taskBarOuter {
  height: 18px;
  background: rgba(54, 73, 47, 0.96);
  border: 2px solid rgba(17, 12, 8, 0.95);
  box-shadow: inset 0 0 0 2px rgba(229, 225, 188, 0.16);
  overflow: hidden;
}
/* Fills the task progress bar as total crew progress increases. */
#taskBarInner {
  height: 100%;
  background: linear-gradient(90deg, #a7d879 0%, #578642 100%);
  width: 0%;
  transition: width 0.4s;
}

/* Role badge */
/* Shows the human player's current role just below the task bar. */
#roleDisplay {
  position: absolute; top: 78px; left: 16px;
  font-size: 12px; font-weight: bold; padding: 6px 12px; border-radius: 999px;
  background: rgba(34, 22, 16, 0.76);
  border: 1px solid rgba(241, 220, 183, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

/* Interaction hint above task bar */
/* Displays the current contextual action prompt near the bottom-center of the screen. */
#actionHint {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  appearance: none;
  font-size: 13px; color: #fff4ba; background: rgba(35, 22, 16, 0.84);
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  border: 1px solid rgba(255, 232, 179, 0.22);
  pointer-events: all;
  touch-action: manipulation;
  cursor: pointer;
  font-family: inherit;
}

/* Enlarges the contextual action into a tap target when touch movement is active. */
@media (pointer: coarse) and (orientation: landscape) {
  #actionHint {
    bottom: max(20px, env(safe-area-inset-bottom));
    min-width: 118px;
    min-height: 46px;
    padding: 12px 18px;
    font-size: 14px;
    color: #fff7df;
    background: rgba(69, 44, 28, 0.92);
    border-color: rgba(255, 221, 157, 0.42);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      0 10px 28px rgba(0, 0, 0, 0.32);
  }
}

/* Anchors the HUD menu trigger and its dropdown in the top-right corner. */
#hudMenu {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: all;
}

/* Keeps the direct zoom button and menu trigger aligned in a single HUD row. */
#hudMenuControls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Anchors the temporary zoom popover to the zoom shortcut button. */
#zoomHud {
  position: relative;
  display: flex;
  align-items: center;
}

/* Styles the top-right menu trigger button. */
#zoomHudBtn,
#menuBtn {
  background: rgba(35, 22, 16, 0.84);
  color: #f4e6ca;
  border: 1px solid rgba(255, 228, 183, 0.22);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  border-radius: 999px;
}

#menuBtn {
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Sizes the direct zoom HUD button as a compact icon-only control. */
#zoomHudBtn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Highlights the menu button while the dropdown is open. */
#zoomHudBtn.active,
#menuBtn.active {
  background: rgba(71, 52, 32, 0.96);
  border-color: rgba(255, 226, 176, 0.4);
  color: #fff8ea;
}

/* Draws a magnifying-glass style zoom glyph for the direct HUD control. */
.zoom-icon {
  position: relative;
  width: 17px;
  height: 17px;
  display: inline-block;
}

/* Renders the zoom lens with a subtle warm highlight. */
.zoom-icon-lens {
  position: absolute;
  left: 1px;
  top: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(246, 234, 209, 0.92);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(111, 151, 183, 0.35);
}

/* Adds the handle so the glyph reads as a zoom tool at HUD size. */
.zoom-icon-handle {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 2px;
  background: rgba(246, 234, 209, 0.92);
  border-radius: 999px;
  transform: rotate(45deg);
  transform-origin: right center;
}

/* Stacks the debug and map controls inside a compact dropdown card. */
#hudMenuPanel {
  min-width: min(280px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: rgba(24, 14, 10, 0.94);
  border: 1px solid rgba(255, 233, 193, 0.18);
  border-radius: 18px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

/* Holds the temporary gameplay zoom slider beside the zoom shortcut button. */
#zoomControl {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(35, 22, 16, 0.78);
  border: 1px solid rgba(255, 233, 193, 0.18);
  border-radius: 999px;
  color: #e7d5b6;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
  transform: translateY(-50%);
}

/* Styles the text label inside the zoom control. */
#zoomControl label {
  letter-spacing: 1px;
}

/* Sets the width of the zoom range input. */
#zoomSlider {
  width: 110px;
}

/* Aligns and highlights the numeric zoom percentage readout. */
#zoomValue {
  min-width: 38px;
  text-align: right;
  color: #fff7ea;
}

/* Kill button (impostor only) */
/* Positions the impostor kill button container in the bottom-right corner. */
#killCooldown {
  position: absolute; bottom: 16px; right: 16px;
  display: none; pointer-events: all;
}
/* Styles the circular kill action button shown to impostors. */
#killBtn {
  width: 86px; height: 86px;
  background: radial-gradient(circle at 35% 30%, #d8614f 0%, #9e3125 52%, #591611 100%);
  border: 4px solid rgba(255, 213, 194, 0.52);
  border-radius: 50%; color: white; font-size: 13px; font-weight: bold;
  cursor: pointer; font-family: inherit;
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.28),
    inset 0 4px 10px rgba(255, 239, 228, 0.22);
}
/* Mutes the kill button while it is on cooldown. */
#killBtn:disabled { background: #441111; border-color: #664444; cursor: not-allowed; opacity: 0.55; }

/* HUD menu buttons */
/* Applies the shared pill-button styling for the dropdown utility controls. */
.hud-menu-button,
#pauseGameBtn,
#mapBtn,
#exitGameBtn,
#taskMarkerDebugBtn,
#walkableDebugBtn {
  background: rgba(35, 22, 16, 0.8);
  color: #f4e6ca;
  border: 1px solid rgba(255, 228, 183, 0.22);
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  border-radius: 999px;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Keeps the textual portion of HUD buttons aligned after icons are added. */
.hud-button-label {
  line-height: 1;
}

/* Reserves a compact square for CSS-drawn HUD glyphs. */
.hud-button-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-block;
  color: currentColor;
}

/* Draws the menu trigger as a stacked three-line toggle. */
.hud-icon-menu::before {
  content: '';
  position: absolute;
  inset: 2px 1px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 100% / 100% 2px no-repeat;
}

/* Uses two pause bars that read as a play-state toggle next to the label. */
.hud-icon-pause::before,
.hud-icon-pause::after {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 4px;
  border-radius: 999px;
  background: currentColor;
}

.hud-icon-pause::before {
  left: 3px;
}

.hud-icon-pause::after {
  right: 3px;
}

/* Suggests a folded overview map with a framed panel and vertical seams. */
.hud-icon-map::before {
  content: '';
  position: absolute;
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.hud-icon-map::after {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 5px;
  width: 2px;
  background: currentColor;
  box-shadow: 4px 0 0 currentColor;
}

/* Combines a door frame and outward arrow for the exit action. */
.hud-icon-exit::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 2px;
  width: 7px;
  height: 12px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 2px 0 0 2px;
}

.hud-icon-exit::after {
  content: '';
  position: absolute;
  right: 0;
  top: 5px;
  width: 9px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

/* Shows a small target-style marker cluster for task-marker debugging. */
.hud-icon-markers::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 1px;
  width: 5px;
  height: 5px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow:
    7px 1px 0 -1px currentColor,
    3px 8px 0 -1px currentColor;
}

.hud-icon-markers::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

/* Draws a tiny grid patch to signal the walkable-area overlay. */
.hud-icon-walkable::before {
  content: '';
  position: absolute;
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor, currentColor) 50% 0 / 2px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 2px no-repeat;
}

/* Colors the pause/resume action inside the HUD menu. */
#pauseGameBtn {
  color: #d9edff;
  border-color: rgba(164, 213, 255, 0.34);
}

/* Highlights the pause action while gameplay is frozen. */
#pauseGameBtn.active {
  background: rgba(54, 70, 120, 0.9);
  color: #f6fbff;
  border-color: rgba(191, 222, 255, 0.62);
}

/* Colors the exit-game action inside the HUD menu. */
#exitGameBtn {
  color: #ffd8cb;
  border-color: rgba(255, 158, 134, 0.34);
}

/* Highlights the exit-game action while the confirmation popup is open. */
#exitGameBtn.active {
  background: rgba(122, 38, 29, 0.92);
  color: #fff5f2;
  border-color: rgba(255, 195, 183, 0.62);
}

/* Highlights the map overview toggle when the full-map camera is active. */
#mapBtn.active {
  background: rgba(54, 70, 120, 0.9);
  color: #f6fbff;
  border-color: rgba(191, 222, 255, 0.62);
}

/* Highlights the direct HUD zoom shortcut while the temporary slider is open. */
#zoomHudBtn.active {
  background: rgba(54, 70, 120, 0.9);
  color: #f6fbff;
  border-color: rgba(191, 222, 255, 0.62);
}

@media (max-width: 720px) {
  #zoomControl {
    right: auto;
    left: 0;
    top: calc(100% + 10px);
    transform: none;
    max-width: min(280px, calc(100vw - 32px));
  }

  #zoomSlider {
    width: min(110px, 28vw);
  }
}

/* Colors the task marker debug toggle inside the HUD menu. */
#taskMarkerDebugBtn {
  color: #fff2b6;
  border-color: rgba(255, 226, 120, 0.34);
}

/* Highlights the task marker debug toggle when debug markers are enabled. */
#taskMarkerDebugBtn.active {
  background: rgba(124, 101, 18, 0.92);
  color: #fffcec;
  border-color: rgba(255, 241, 178, 0.72);
}

/* Colors the walkable-area debug toggle inside the HUD menu. */
#walkableDebugBtn {
  padding: 8px 16px;
  color: #d9f7d4;
  border-color: rgba(182, 255, 177, 0.28);
}

/* Highlights the walkable-area debug toggle when the overlay is enabled. */
#walkableDebugBtn.active {
  background: rgba(28, 74, 38, 0.88);
  color: #f3fff0;
  border-color: rgba(203, 255, 197, 0.6);
}

/* Anchors the mobile movement pad in the bottom-right corner during active play. */
#touchMovePad {
  --touch-pad-size: min(32vw, 176px);
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: var(--touch-pad-size);
  height: var(--touch-pad-size);
  border-radius: 50%;
  pointer-events: all;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Renders a low-contrast ring so the joystick stays readable without covering the game art. */
#touchMovePadRing {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 241, 218, 0.16);
  background:
    radial-gradient(circle at center, rgba(255, 214, 152, 0.03) 0 18%, rgba(12, 13, 20, 0.1) 19% 64%, rgba(12, 13, 20, 0.18) 65% 100%),
    linear-gradient(180deg, rgba(31, 18, 15, 0.12) 0%, rgba(11, 12, 18, 0.18) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Draws subtle cross guides through the movement pad. */
#touchMovePadRing::before,
#touchMovePadRing::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 241, 218, 0.08);
  transform: translate(-50%, -50%);
}

#touchMovePadRing::before {
  width: 1px;
  height: 74%;
}

#touchMovePadRing::after {
  width: 74%;
  height: 1px;
}

/* Marks the slow center zone so players can feather movement speed near the middle. */
#touchMovePadCenter {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 241, 218, 0.1);
  background: rgba(255, 241, 218, 0.02);
  box-shadow: inset 0 0 18px rgba(255, 241, 218, 0.04);
}

/* Shows the current stick position with a warm thumb cap. */
#touchMovePadThumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #f9d6a4 0%, #b77d43 56%, #6f4426 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.24),
    0 6px 18px rgba(0, 0, 0, 0.38);
}

@media (pointer: fine), (orientation: portrait) {
  #touchMovePad {
    display: none !important;
  }
}
