:root {
  --ink: #e9edf2;
  --panel: rgba(14, 18, 23, 0.76);
  --edge: rgba(255, 255, 255, 0.12);
  --calm: #6fd48a;
  --suspicious: #ffc53d;
  --hunting: #ff5347;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1116;
  color: var(--ink);
  font: 13px/1.45 "Inter", "Helvetica Neue", system-ui, sans-serif;
  user-select: none;
}

#scene {
  display: block; width: 100%; height: 100%; cursor: default;
  /* The canvas owns every touch. Without this the browser treats a drag as a
     scroll and a double tap as a zoom, and cancels the pointer mid-gesture. */
  touch-action: none;
}

section, #weapons, #help, #toast, #banner {
  position: fixed;
  z-index: 2;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

/* --- health, stance, alert --- */

#status { left: 16px; bottom: 16px; padding: 12px 14px; width: 244px; }
#status .row { display: flex; align-items: center; gap: 10px; }
#status .meta { margin-top: 8px; justify-content: space-between; font-size: 11px; }

#health {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
#health i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3f9d55, #6fd48a);
  transition: width 0.16s ease-out;
}
#health i.low { background: linear-gradient(90deg, #a32a20, #ff5347); }
#health-value { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

#stance {
  font: inherit; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink); opacity: 0.65; cursor: pointer;
  padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.06);
}
#stance:hover { opacity: 0.9; }
#stance.sneak { opacity: 1; color: #9fd8ff; border-color: rgba(159, 216, 255, 0.5); }

#alert { font-weight: 600; letter-spacing: 0.04em; }
#alert.calm { color: var(--calm); }
#alert.suspicious { color: var(--suspicious); }
#alert.hunting { color: var(--hunting); }

/* --- objective --- */

#objective {
  top: 16px; left: 50%; transform: translateX(-50%);
  padding: 8px 18px;
  display: flex; align-items: baseline; gap: 8px;
}
#objective b { font-size: 17px; font-variant-numeric: tabular-nums; }
#objective span { opacity: 0.6; }
#objective i {
  font-style: normal; opacity: 0.45; margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

/* --- weapons --- */

#weapons {
  right: 16px; bottom: 16px;
  margin: 0; padding: 8px;
  list-style: none;
  width: 210px;
}
#weapons li {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 7px;
  opacity: 0.5; cursor: pointer;
}
#weapons li:hover { opacity: 0.85; background: rgba(255, 255, 255, 0.06); }
#weapons li span { flex: 1; }
#weapons li b { font-variant-numeric: tabular-nums; opacity: 0.75; }
#weapons li.active { opacity: 1; background: rgba(255, 255, 255, 0.1); }
#weapons li.empty b { color: var(--hunting); }

kbd {
  display: inline-block;
  min-width: 19px; padding: 1px 5px;
  border: 1px solid var(--edge); border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  font: inherit; font-size: 11px; text-align: center;
}

/* --- help --- */

#help { left: 16px; top: 16px; padding: 10px 14px; max-width: 260px; }
#help summary { cursor: pointer; opacity: 0.7; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
#help ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
#help li { display: flex; align-items: center; gap: 5px; opacity: 0.8; }
#help p { margin: 10px 0 0; opacity: 0.55; font-size: 11px; }

/* --- getting bitten --- */

#hurt {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center,
    rgba(180, 20, 12, 0) 42%, rgba(180, 20, 12, 0.75) 100%);
}

/* --- toast and banner --- */

#toast {
  top: 66px; left: 50%; transform: translateX(-50%) translateY(-6px);
  padding: 6px 14px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#banner {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  padding: 26px 34px; text-align: center; min-width: 300px;
}
#banner h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: 0.02em; }
#banner.cleared h2 { color: var(--calm); }
#banner.dead h2 { color: var(--hunting); }
#banner p { margin: 4px 0; opacity: 0.75; }
#banner .hint { margin-top: 14px; opacity: 0.5; font-size: 12px; }

/* --- loading --- */

#loading {
  position: fixed; inset: 0; z-index: 9;
  display: grid; place-content: center; gap: 14px;
  background: #0d1116;
  transition: opacity 0.4s;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading-text { opacity: 0.7; letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
#loading-bar { width: 220px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
#loading-bar i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--calm); }
