/* ============================================================
   BM World - Game Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0a0a0f;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ===================== LOGIN SCREEN ===================== */
#game-login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1a1a3e 0%, #0a0a0f 70%);
  z-index: 200;
}

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 340px;
}

.login-box h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: #4a9eff;
  text-shadow: 0 0 30px rgba(74,158,255,0.6);
  letter-spacing: 2px;
}

.login-subtitle {
  color: #888;
  font-size: 13px;
  text-align: center;
}

#game-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

#game-login-form input {
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
#game-login-form input:focus { border-color: #4a9eff; }
#game-login-form input::placeholder { color: #555; }

#game-login-submit {
  padding: 13px;
  background: linear-gradient(135deg, #4a9eff, #2e7de9);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.5px;
}
#game-login-submit:hover { opacity: 0.9; }
#game-login-submit:active { transform: scale(0.98); }

#game-login-error {
  color: #e74c3c;
  font-size: 12px;
  text-align: center;
  min-height: 16px;
}

#game-login-form a {
  color: #4a9eff;
  text-decoration: none;
  font-size: 12px;
  text-align: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}
#game-login-form a:hover { opacity: 1; }

#game-autologin-bar {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 4px;
  font-size: 0.82rem;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#game-signout-link {
  color: #ff6b6b;
  text-decoration: none;
  font-weight: 700;
}
#game-signout-link:hover { text-decoration: underline; }

.login-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.key-row {
  font-size: 11px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}
kbd {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  color: #aaa;
  font-family: inherit;
}

/* ===================== CHARACTER CREATE ===================== */
/* ── Character Select Screen ───────────────────────────────────────────────── */
#character-select-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #0d1b2a 0%, #0a0a0f 70%);
  z-index: 200;
}
.charsel-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(520px, 92vw);
}
.charsel-box h2 {
  font-size: 1.8rem;
  color: #00e676;
  font-weight: 800;
  margin: 0;
}
.charsel-slot-info {
  font-size: 0.82rem;
  color: #aaa;
  background: rgba(255,255,255,0.05);
  padding: 6px 14px;
  border-radius: 20px;
}
.charsel-slot-info span { color: #00e676; font-weight: 700; }
.charsel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
}
.charsel-card {
  appearance: none;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
  position: relative;
  color: #fff;
  font: inherit;
}
.charsel-card:hover {
  border-color: #00e676;
  background: rgba(0,230,118,0.08);
}
.charsel-card:focus-visible {
  outline: none;
  border-color: #00e676;
  box-shadow: 0 0 0 3px rgba(0,230,118,0.22);
}
.charsel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 8px auto;
  border: 3px solid rgba(255,255,255,0.2);
}
.charsel-card-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 4px;
}
.charsel-card-level {
  font-size: 0.75rem;
  color: #aaa;
}
.charsel-card-delete {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.7rem;
  color: #ff4444;
  cursor: pointer;
  opacity: 0.5;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
.charsel-card-delete:hover { opacity: 1; }
.charsel-new-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00e676, #00bcd4);
  color: #111;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: opacity 0.18s;
}
.charsel-new-btn:hover   { opacity: 0.85; }
.charsel-new-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.charsel-error   { color: #ff6b6b; font-size: 0.82rem; min-height: 18px; }
.charsel-footer {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: center;
}
.charsel-dashboard-btn {
  color: #4a9eff;
  font-size: 0.82rem;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.18s;
}
.charsel-dashboard-btn:hover { opacity: 1; }
.charsel-signout { color: #aaa; font-size: 0.8rem; text-decoration: none; }
.charsel-signout:hover { color: #ff6b6b; }

#character-create-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1a1a3e 0%, #0a0a0f 70%);
  z-index: 200;
}

.create-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 340px;
}

.create-box h2 {
  font-size: 2rem;
  color: #4a9eff;
  font-weight: 800;
}

.create-box p { color: #888; font-size: 13px; }

#char-name {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  outline: none;
  text-align: center;
  letter-spacing: 1px;
}
#char-name:focus { border-color: #4a9eff; }

.appearance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #888;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.color-btn:hover { transform: scale(1.15); }
.color-btn.active { border-color: #fff; transform: scale(1.15); }
.color-btn[data-color="#4a9eff"] { background: #4a9eff; }
.color-btn[data-color="#e74c3c"] { background: #e74c3c; }
.color-btn[data-color="#2ecc71"] { background: #2ecc71; }
.color-btn[data-color="#f39c12"] { background: #f39c12; }
.color-btn[data-color="#9b59b6"] { background: #9b59b6; }
.color-btn[data-color="#e91e63"] { background: #e91e63; }

#create-char-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
#create-char-btn:hover { opacity: 0.9; }

#create-char-back {
  width: 100%;
  padding: 11px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: #bfc7d5;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
#create-char-back:hover {
  color: #fff;
  border-color: rgba(74,158,255,0.7);
  background: rgba(74,158,255,0.14);
}

#create-char-error {
  color: #e74c3c;
  font-size: 12px;
  text-align: center;
  min-height: 16px;
}

/* ===================== GAME CANVAS ===================== */
#game-canvas {
  position: fixed;
  inset: 0;
  cursor: crosshair;
  display: block;
}

/* ===================== HUD ===================== */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#hud > * { pointer-events: all; }

/* Top centre: player profile */
#player-info {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 8px 12px;
  backdrop-filter: blur(6px);
  min-width: 260px;
}
#player-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.player-avatar-wrap {
  position: relative;
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
}
#player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  background: radial-gradient(circle at 28% 24%, rgba(255,255,255,0.34) 0%, #4a9eff 64%);
  box-shadow: 0 3px 16px rgba(0,0,0,0.45);
}
.skill-badge {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(10,14,24,0.92);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.badge-attack {
  top: -8px;
  left: -6px;
}
.badge-defence {
  top: -8px;
  right: -6px;
}
.badge-constitution {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
}
.badge-icon {
  font-size: 10px;
  margin-bottom: 1px;
}
.badge-level {
  font-size: 10px;
  color: #f0c040;
  font-weight: 800;
}
.player-meta {
  display: flex;
  flex-direction: column;
  min-width: 170px;
}
#player-name-display { color: #4a9eff; font-weight: 700; font-size: 14px; }
#player-level-display { color: #f0c040; font-size: 12px; }
#player-health-text {
  color: #c8d0de;
  font-size: 10px;
  text-align: right;
}
.player-health-bar {
  position: relative;
  height: 10px;
  width: 100%;
  margin: 4px 0 2px;
  background: rgba(0,0,0,0.58);
  border: 1px solid rgba(255,80,80,0.35);
  border-radius: 999px;
  overflow: hidden;
}
.player-health-fill {
  position: relative;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff5f5f 0%, #ff3b3b 48%, #ff7648 100%);
  box-shadow: 0 0 10px rgba(255,80,80,0.35);
  transition: width 0.48s cubic-bezier(0.22, 1, 0.36, 1), filter 0.25s ease;
}
.player-health-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -35%;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.45) 50%, rgba(255,255,255,0) 100%);
  animation: healthSweep 1.5s linear infinite;
}
.player-health-bar.is-mid .player-health-fill {
  background: linear-gradient(90deg, #f39c12 0%, #f1c40f 100%);
  box-shadow: 0 0 10px rgba(241,196,15,0.3);
}
.player-health-bar.is-low {
  border-color: rgba(255,90,90,0.8);
  box-shadow: 0 0 12px rgba(231,76,60,0.35);
}
.player-health-bar.is-low .player-health-fill {
  background: linear-gradient(90deg, #ff2d2d 0%, #e74c3c 100%);
  animation: healthPulse 0.85s ease-in-out infinite;
}
@keyframes healthSweep {
  0% { left: -35%; }
  100% { left: 120%; }
}
@keyframes healthPulse {
  0%, 100% { filter: brightness(0.9); }
  50% { filter: brightness(1.2); }
}

/* ── Top-left wrapper ── */
#hud-top-left {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 20;
}

/* Top left: action buttons */
#hud-buttons {
  display: flex;
  gap: 5px;
}
#hud-buttons button {
  padding: 6px 12px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.2s;
  white-space: nowrap;
}
#hud-buttons button:hover { background: rgba(74,158,255,0.3); }
#back-btn { color: #ff6b6b !important; }
#back-btn:hover { background: rgba(231,76,60,0.3) !important; }

/* Skills panel */
#skills-panel {
  position: absolute;
  top: 240px;
  left: 12px;
  width: 260px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  background: rgba(10,10,20,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 30;
}

/* Inventory panel */
#inventory-panel {
  position: absolute;
  top: 240px;
  left: 12px;
  width: 480px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  background: rgba(10,10,20,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding-bottom: 12px;
  z-index: 30;
}

/* Panel header — with close button */
.panel-header {
  padding: 10px 14px 8px;
  font-size: 13px;
  font-weight: 700;
  color: #4a9eff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-close {
  background: none;
  border: none;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.panel-close:hover { color: #e74c3c; }

/* ── Two-column inventory layout ── */
#inv-main-layout {
  display: flex;
  gap: 0;
}
#equip-body-panel {
  width: 160px;
  min-width: 160px;
  padding: 10px 10px 8px;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.equip-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #555;
  margin-bottom: 8px;
}
.equip-slot-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}
.equip-slot-lbl {
  font-size: 10px;
  color: #666;
  margin-bottom: 2px;
}
#inv-grid-column { flex: 1; }
#equip-weight-bar {
  margin-top: 10px;
  font-size: 10px;
  color: #888;
}
.wt-label { margin-bottom: 3px; }
.wt-track { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.wt-fill  { height: 100%; border-radius: 2px; transition: width 0.3s; }

/* ── Equipped slots ── */
.equipped-slot {
  width: 100%;
  min-height: 30px;
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 3px 6px;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  color: #555;
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
}
.equipped-slot.has-weapon {
  border-color: rgba(240,192,64,0.45);
  color: #f0c040;
  background: rgba(240,192,64,0.07);
}
.equipped-slot.has-weapon:hover { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.45); }
.equipped-slot.has-armor { border-color: rgba(79,195,247,0.45); color: #4fc3f7; background: rgba(79,195,247,0.07); }
.equipped-slot.has-armor:hover  { background: rgba(231,76,60,0.12); border-color: rgba(231,76,60,0.45); }
.eq-icon  { font-size: 15px; }
.eq-name  { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-ammo  { font-size: 9px; color: #888; }
.eq-empty { font-size: 10px; font-style: italic; }

/* run indicator in stamina bar (shown when toggle is ON) */
#stamina-fill.running { box-shadow: 0 0 6px #00bcd4; }

#skills-list { padding: 4px 0; }

.skill-row {
  display: grid;
  grid-template-columns: 1fr 38px 80px;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.skill-row:hover { background: rgba(255,255,255,0.03); }

.skill-name {
  font-size: 12px;
  color: #bbb;
  text-transform: capitalize;
}
.skill-level {
  font-size: 14px;
  font-weight: 700;
  color: #f0c040;
  text-align: center;
}
.skill-xp-bar {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  height: 5px;
  overflow: hidden;
}
.skill-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a9eff, #2e7de9);
  border-radius: 3px;
  transition: width 0.4s ease;
}

#inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 10px;
}
.inv-slot {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s;
}
.inv-slot:hover { background: rgba(255,255,255,0.1); }
.inv-slot.has-item { border-color: rgba(74,158,255,0.3); position: relative; }
.inv-qty {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 9px;
  color: #f0c040;
  font-weight: 700;
  pointer-events: none;
}

/* ── Inventory right-click context menu ── */
.inv-ctx-menu {
  position: fixed;
  z-index: 200;
  background: rgba(8,8,20,0.97);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 170px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.7);
}
.inv-ctx-opt {
  display: block;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: #ddd;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.inv-ctx-opt:hover { background: rgba(74,158,255,0.18); color: #fff; }
.inv-ctx-cancel { color: #555; }
.inv-ctx-cancel:hover { background: rgba(231,76,60,0.18); color: #e74c3c; }

#loot-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 360px;
  max-height: 72vh;
  background: rgba(10, 10, 22, 0.96);
  border: 1px solid rgba(90, 200, 255, 0.4);
  border-radius: 12px;
  z-index: 88;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
#loot-panel .panel-header {
  color: #8dd8ff;
  border-bottom-color: rgba(90, 200, 255, 0.3);
}
.loot-cash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 6px;
  font-size: 13px;
  color: #9db7c6;
}
#loot-cash-amount {
  color: #ffd66b;
  font-weight: 800;
}
.loot-cash-controls {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 6px;
  padding: 0 12px 10px;
}
.loot-cash-controls input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  color: #fff;
  padding: 7px 8px;
  font-size: 12px;
}
.loot-cash-controls button {
  background: rgba(90, 200, 255, 0.16);
  border: 1px solid rgba(90, 200, 255, 0.42);
  border-radius: 6px;
  color: #9fe2ff;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.loot-cash-controls button:hover {
  background: rgba(90, 200, 255, 0.28);
}
#loot-item-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.loot-item-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.loot-item-icon {
  font-size: 17px;
  text-align: center;
}
.loot-item-name {
  color: #e6edf4;
  font-size: 12px;
  font-weight: 700;
}
.loot-item-qty {
  color: #ffd66b;
  font-size: 11px;
  font-weight: 700;
}
.loot-take-item-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
}
.loot-take-item-btn:hover {
  border-color: rgba(90, 200, 255, 0.4);
}
.loot-empty {
  color: #89a0af;
  font-size: 12px;
  padding: 14px 12px;
  text-align: center;
}
#loot-close-btn {
  margin: 10px 12px 12px;
  padding: 8px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: #98a8b5;
  cursor: pointer;
}
#loot-close-btn:hover {
  color: #fff;
}

/* Bottom centre: stat bars */
#hud-stats {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.stat-bar {
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 100px;
  backdrop-filter: blur(6px);
}

.stat-bar-sm {
  min-width: 60px;
  text-align: center;
}

.stat-bar label {
  display: block;
  font-size: 9px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-track {
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
  margin-bottom: 3px;
}

.stat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease, background-color 0.35s ease;
}

.stat-val {
  font-size: 10px;
  color: #aaa;
  display: block;
  text-align: right;
}

/* Minimap */
#minimap {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  background: #000;
  display: block;
}
#minimap-label {
  position: absolute;
  top: 176px;
  right: 12px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-align: center;
  width: 160px;
}

/* Vehicle HUD */
#vehicle-hud {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 8px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  backdrop-filter: blur(6px);
  font-size: 13px;
}
#vehicle-name { color: #f39c12; font-weight: 700; }
#vehicle-speed { color: #fff; font-size: 16px; font-weight: 700; }
#vehicle-hint { color: #aaa; font-size: 11px; }

/* Chat — top-left, below hud-top-left */
#chat-box {
  position: absolute;
  top: 108px;
  left: 12px;
  width: 280px;
  z-index: 19;
}
#chat-messages {
  max-height: 130px;
  overflow-y: auto;
  padding: 8px 10px;
  background: rgba(0,0,0,0.6);
  border-radius: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chat-msg { font-size: 12px; color: #ccc; word-break: break-word; line-height: 1.4; }
.chat-name { color: #4a9eff; font-weight: 700; }
.chat-system { color: #888; font-style: italic; }

#chat-input {
  width: 100%;
  padding: 7px 12px;
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  border-top: none;
  border-radius: 0 0 8px 8px;
  color: #fff;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: #4a9eff; }
#chat-input::placeholder { color: #444; }

/* Key hints */
#key-hints {
  position: absolute;
  bottom: 14px;
  right: 12px;
  text-align: right;
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
  line-height: 1.8;
}
#key-hints kbd {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
}

#interact-hint {
  position: fixed;
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  background: rgba(0,0,0,0.74);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 8px 10px 10px;
  z-index: 65;
  pointer-events: none;
}
#interact-hint-text {
  font-size: 12px;
  color: #d7e6ef;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
}
.interact-progress {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
}
#interact-hint-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #37d67a, #5bc0ff);
  transition: width 0.06s linear;
}

/* Level up notification */
.levelup-notif {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #f0c040, #e67e22);
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 24px rgba(240,192,64,0.5);
  z-index: 50;
  pointer-events: none;
  animation: levelupPop 3s ease forwards;
}
@keyframes levelupPop {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  80%  { opacity: 1; transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(0.95); }
}

/* Damage numbers */
.dmg-number {
  position: fixed;
  font-size: 20px;
  font-weight: 900;
  pointer-events: none;
  z-index: 30;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  animation: dmgFloat 1s ease forwards;
}
.dmg-hit   { color: #e74c3c; }
.dmg-miss  { color: #aaa; }
.dmg-crit  { color: #ffd700; font-size: 26px; }
@keyframes dmgFloat {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-50px); }
}

/* XP gain text */
.xp-gain {
  position: fixed;
  font-size: 12px;
  font-weight: 700;
  color: #a8f090;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  animation: xpFloat 1.6s ease forwards;
}
@keyframes xpFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  20%  { opacity: 1; transform: translateY(-10px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-40px) scale(0.9); }
}

/* Cash gain text */
.cash-gain {
  position: fixed;
  font-size: 14px;
  font-weight: 800;
  color: #ffd700;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 12px rgba(255,215,0,0.5);
  animation: cashFloat 1.8s ease forwards;
}
@keyframes cashFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1.1); }
  15%  { opacity: 1; transform: translateY(-14px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-50px) scale(0.9); }
}

/* ── 3D Entity overlay (name tags / HP bars rendered as DOM) ── */
.entity-overlay {
  position: fixed;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 18;
  text-align: center;
  white-space: nowrap;
}
.entity-name {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.8);
  letter-spacing: 0.3px;
}
.entity-hp-bar {
  width: 34px;
  height: 4px;
  background: rgba(0,0,0,0.55);
  border-radius: 2px;
  overflow: hidden;
  margin: 2px auto 0;
}
.entity-hp-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.15s;
}

/* ── Money HUD (inline inside #hud-top-left) ─────────────── */
#money-hud {
  display: inline-flex;
  align-self: flex-start;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,215,0,0.25);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #ffd700;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ── Bank / ATM Panel ──────────────────────────────────────── */
#bank-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  background: rgba(10, 10, 24, 0.96);
  border: 1px solid rgba(0, 200, 100, 0.4);
  border-radius: 12px;
  padding: 0 0 16px;
  z-index: 80;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 30px rgba(0,200,80,0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
#bank-panel .panel-header {
  background: linear-gradient(90deg, #00aa44, #00cc66);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 12px 12px 0 0;
}
.bank-balance-section {
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  padding: 8px 12px;
}
.bank-label {
  font-size: 12px;
  color: #aaa;
  font-weight: 600;
}
.bank-amount {
  font-size: 16px;
  font-weight: 800;
  color: #ffd700;
}
.bank-input-row {
  padding: 0 16px 8px;
}
.bank-input-row input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  padding: 8px 12px;
  box-sizing: border-box;
  outline: none;
}
.bank-input-row input:focus { border-color: rgba(0,200,100,0.5); }
.bank-btn-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
}
.bank-btn-row button {
  flex: 1;
  background: rgba(0,180,80,0.18);
  border: 1px solid rgba(0,200,100,0.35);
  color: #00cc66;
  border-radius: 6px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}
.bank-btn-row button:hover {
  background: rgba(0,180,80,0.38);
  border-color: rgba(0,200,100,0.6);
}
#bank-close-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #888;
  border-radius: 6px;
  padding: 7px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: 0.2s;
}
#bank-close-btn:hover { color: #fff; border-color: rgba(255,255,255,0.25); }

/* ── Ammo Display ──────────────────────────────────────────── */
#ammo-display {
  position: fixed;
  bottom: 100px;
  right: 16px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,200,50,0.35);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #ffd700;
  z-index: 20;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ── Weapon Shop Panel ─────────────────────────────────────── */
#weapon-shop-panel {
  --shop-accent: #ff9800;
  --shop-accent-soft: rgba(255, 140, 0, 0.2);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  max-height: 70vh;
  background: rgba(10, 10, 20, 0.97);
  border: 1px solid var(--shop-accent);
  border-radius: 14px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
#weapon-shop-panel .panel-header {
  background: var(--shop-accent-soft);
  border-bottom: 1px solid var(--shop-accent);
}
.ws-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ws-tab {
  flex: 1;
  background: none;
  border: none;
  color: #888;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
}
.ws-tab.active {
  color: var(--shop-accent);
  border-bottom-color: var(--shop-accent);
}
.ws-tab.hidden { display: none; }
#weapon-shop-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.ws-empty {
  color: #8e95a5;
  font-size: 12px;
  padding: 14px 12px;
  text-align: center;
}
.ws-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}
.ws-item:hover { background: rgba(255,255,255,0.04); }
.ws-icon { font-size: 18px; text-align: center; }
.ws-name { font-size: 13px; font-weight: 700; color: #eee; }
.ws-desc { font-size: 10px; color: #666; }
.ws-price { font-size: 12px; color: #ffd700; font-weight: 700; white-space: nowrap; }
.ws-buy-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--shop-accent);
  color: var(--shop-accent);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.2s;
}
.ws-buy-btn:hover { background: rgba(255,255,255,0.14); }
.ws-cant-afford { opacity: 0.4; cursor: not-allowed; }
.ws-equipped-bar {
  padding: 6px 10px;
  color: #aaa;
  font-size: 11px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
#weapon-shop-close-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: #888;
  border-radius: 7px;
  padding: 7px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
}
#weapon-shop-close-btn:hover { color: #fff; border-color: rgba(255,255,255,0.25); }

@media (max-width: 720px) {
  #player-info {
    top: 8px;
    padding: 7px 10px;
    min-width: 0;
    width: min(94vw, 340px);
  }
  #player-profile { gap: 9px; }
  .player-avatar-wrap {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }
  .skill-badge {
    width: 28px;
    height: 28px;
  }
  #player-avatar { font-size: 20px; }
  #player-name-display { font-size: 13px; }
  #player-level-display { font-size: 11px; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ══════════════════════════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════════════════════════ */
.admin-panel {
  position: fixed;
  top: 60px;
  right: 12px;
  width: 380px;
  min-width: 280px;
  min-height: 200px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 18, 0.97);
  border: 1px solid rgba(255, 152, 0, 0.4);
  border-radius: 12px;
  z-index: 90;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8), 0 0 30px rgba(255,152,0,0.08);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  resize: both;
  font-size: 12px;
  -webkit-user-select: none;
  user-select: none;
}

/* Header */
.ap-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  background: rgba(255,152,0,0.08);
  border-bottom: 1px solid rgba(255,152,0,0.2);
  flex-shrink: 0;
}
.ap-title {
  font-size: 11px;
  font-weight: 900;
  color: #ff9800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex: 1;
}
.ap-role-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
  letter-spacing: 1px;
}
.ap-header-btns {
  display: flex;
  gap: 4px;
}
.ap-icon-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #aaa;
  font-size: 12px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.ap-icon-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ap-icon-btn.ap-close:hover { background: rgba(231,76,60,0.3); border-color: rgba(231,76,60,0.5); color: #ff6b6b; }

/* Tabs */
.ap-tabs {
  display: flex;
  flex-shrink: 0;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  scrollbar-width: none;
}
.ap-tabs::-webkit-scrollbar { display: none; }
.ap-tab {
  flex: 0 0 auto;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  font-size: 10px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.3px;
}
.ap-tab:hover { color: #bbb; }
.ap-tab.active { color: #ff9800; border-bottom-color: #ff9800; }

/* Body */
.ap-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 8px;
  min-height: 0; /* critical — lets flex child shrink so overflow-y triggers */
}

/* Sections */
.ap-section {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.ap-section:last-child { border-bottom: none; }
.ap-section-title {
  font-size: 9px;
  font-weight: 900;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 7px;
}

/* Inputs */
.ap-input {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 5px;
  color: #ddd;
  font-size: 11px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.ap-input:focus { border-color: rgba(255,152,0,0.5); }
.ap-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 5px;
  color: #ddd;
  font-size: 11px;
  padding: 5px 6px;
  outline: none;
  cursor: pointer;
}
.ap-select option { background: #111; }
.ap-textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  color: #ddd;
  font-size: 11px;
  padding: 6px 8px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}
.ap-textarea:focus { border-color: rgba(255,152,0,0.4); }
.ap-label {
  font-size: 10px;
  color: #888;
  display: inline-block;
}

/* Buttons */
.ap-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  color: #ccc;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.ap-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ap-btn.ap-btn-sm { padding: 4px 8px; font-size: 10px; }
.ap-btn.ap-btn-xs { padding: 3px 6px; font-size: 10px; }
.ap-btn.ap-full { width: 100%; text-align: center; display: block; }
.ap-btn.ap-danger, button.ap-danger {
  background: rgba(231,76,60,0.12);
  border-color: rgba(231,76,60,0.35);
  color: #ff6b6b;
}
.ap-btn.ap-danger:hover { background: rgba(231,76,60,0.25); }
.ap-btn.ap-on {
  background: rgba(255,152,0,0.18) !important;
  border-color: rgba(255,152,0,0.5) !important;
  color: #ff9800 !important;
}

/* Row / wrap layouts */
.ap-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ap-btn-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Toggle buttons */
.ap-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ap-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  color: #aaa;
  transition: 0.15s;
}
.ap-toggle:hover { background: rgba(255,255,255,0.1); color: #ddd; }
.ap-toggle.ap-on {
  background: rgba(255,152,0,0.14);
  border-color: rgba(255,152,0,0.4);
  color: #ff9800;
}
.ap-state {
  font-size: 9px;
  font-weight: 900;
  color: inherit;
  letter-spacing: 0.5px;
}

/* Player list */
.ap-player-list {
  max-height: 200px;
  overflow-y: auto;
}
.ap-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px;
  border-radius: 6px;
  transition: background 0.1s;
}
.ap-player-row:hover { background: rgba(255,255,255,0.05); }
.ap-player-info { display: flex; flex-direction: column; gap: 1px; }
.ap-player-name { font-size: 11px; color: #e0e0ff; font-weight: 700; }
.ap-player-pos  { font-size: 9px; color: #555; }
.ap-player-actions { display: flex; gap: 3px; }

/* Debug text */
.ap-debug-text {
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: #7ec8a0;
  line-height: 1.6;
  background: rgba(0,0,0,0.3);
  border-radius: 5px;
  padding: 7px 9px;
}

/* Console */
.ap-console {
  max-height: 130px;
  overflow-y: auto;
  background: rgba(0,0,0,0.4);
  border-radius: 5px;
  padding: 4px 6px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  color: #8fdfb0;
  margin-bottom: 5px;
}
.ap-console-line { margin-bottom: 4px; line-height: 1.4; }
.ap-console-cmd  { color: #aaa; }
.ap-console-err  { color: #ff6b6b; }

/* Mod panel: green accent */
.admin-panel[data-role="mod"],
.admin-panel[data-role="jmod"],
.admin-panel[data-role="jadmin"] {
  border-color: rgba(0,230,118,0.4);
  box-shadow: 0 8px 48px rgba(0,0,0,0.8), 0 0 30px rgba(0,230,118,0.06);
}
.admin-panel[data-role="mod"] .ap-header,
.admin-panel[data-role="jmod"] .ap-header,
.admin-panel[data-role="jadmin"] .ap-header {
  background: rgba(0,230,118,0.07);
  border-bottom-color: rgba(0,230,118,0.2);
}
.admin-panel[data-role="mod"] .ap-title,
.admin-panel[data-role="jmod"] .ap-title,
.admin-panel[data-role="jadmin"] .ap-title { color: #00e676; }
.admin-panel[data-role="mod"] .ap-tab.active,
.admin-panel[data-role="jmod"] .ap-tab.active,
.admin-panel[data-role="jadmin"] .ap-tab.active { color: #00e676; border-bottom-color: #00e676; }

/* ── Admin button in HUD ─────────────────────────────── */
#admin-panel-btn {
  background: rgba(255,152,0,0.15) !important;
  border-color: rgba(255,152,0,0.4) !important;
  color: #ff9800 !important;
  font-weight: 900 !important;
}
#admin-panel-btn:hover { background: rgba(255,152,0,0.3) !important; }

/* ══════════════════════════════════════════════════════════
   RS3-STYLE CONTEXT MENU
   ══════════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  min-width: 180px;
  background: rgba(5, 5, 15, 0.97);
  border: 1px solid rgba(255,200,80,0.55);
  border-radius: 6px;
  z-index: 200;
  overflow: hidden;
  box-shadow: 2px 4px 24px rgba(0,0,0,0.9), 0 0 20px rgba(255,200,80,0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: ctxIn 0.08s ease;
}
@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.ctx-header {
  background: rgba(255,200,80,0.12);
  color: #ffd700;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255,200,80,0.2);
}
.ctx-option {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  padding: 6px 10px;
  font-size: 12px;
  color: #d4c080;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
  font-family: inherit;
}
.ctx-option:hover {
  background: rgba(255,200,80,0.15);
  color: #fff;
}
.ctx-option:last-child { border-bottom: none; }
.ctx-action { flex: 1; font-weight: 700; }
.ctx-target { color: #7ec0d8; font-size: 11px; }
.ctx-option.ctx-attack .ctx-action { color: #ff6b6b; }
.ctx-option.ctx-admin  .ctx-action { color: #ff9800; font-style: italic; }
.ctx-option.ctx-cancel { color: #666; font-style: italic; }
.ctx-option.ctx-cancel:hover { color: #ff6b6b; background: rgba(231,76,60,0.1); }

/* ══════════════════════════════════════════════════════════
   HOVER TOOLTIP
   ══════════════════════════════════════════════════════════ */
.hover-tooltip {
  position: fixed;
  transform: translateX(-50%);
  background: rgba(5, 8, 18, 0.92);
  border: 1px solid rgba(255,220,80,0.45);
  border-radius: 6px;
  padding: 4px 10px;
  pointer-events: none;
  z-index: 25;
  white-space: nowrap;
  text-align: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: tooltipIn 0.1s ease;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.hover-name {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #ffd700;
  letter-spacing: 0.3px;
}
.hover-hint {
  display: block;
  font-size: 9px;
  color: #6a8090;
  margin-top: 1px;
}

/* ══════════════════════════════════════════════════════════
   DEBUG HUD OVERLAY
   ══════════════════════════════════════════════════════════ */
#debug-hud {
  position: fixed;
  top: 200px;
  right: 12px;
  min-width: 190px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(100,255,150,0.2);
  border-radius: 7px;
  padding: 8px 12px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: #7ec8a0;
  line-height: 1.7;
  z-index: 18;
  pointer-events: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ══════════════════════════════════════════════════════════
   KEYBINDS PANEL
   ══════════════════════════════════════════════════════════ */
.keybinds-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 18, 0.97);
  border: 1px solid rgba(74,158,255,0.4);
  border-radius: 12px;
  z-index: 95;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow: hidden;
  font-size: 12px;
}
.keybinds-panel .ap-header {
  background: rgba(74,158,255,0.08);
  border-bottom-color: rgba(74,158,255,0.2);
}
.keybinds-panel .ap-title { color: #4a9eff; }
.kb-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.kb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.kb-row:hover { background: rgba(255,255,255,0.03); }
.kb-action { font-size: 12px; color: #bbb; }
.kb-key {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11px;
  color: #e0e0ff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  min-width: 70px;
  text-align: center;
}
.kb-key:hover { background: rgba(74,158,255,0.2); border-color: rgba(74,158,255,0.5); }
.kb-key.kb-listening {
  background: rgba(255,152,0,0.2);
  border-color: rgba(255,152,0,0.6);
  color: #ff9800;
  animation: kbPulse 0.6s ease infinite alternate;
}
@keyframes kbPulse { from { opacity: 0.6; } to { opacity: 1; } }

/* ══════════════════════════════════════════════════════════
   ANNOUNCE BANNER
   ══════════════════════════════════════════════════════════ */
.announce-banner {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255,152,0,0.9), rgba(255,87,34,0.9));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 12px 28px;
  border-radius: 10px;
  z-index: 300;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  box-shadow: 0 4px 24px rgba(255,100,0,0.4);
  letter-spacing: 0.5px;
  animation: announcePop 5s ease forwards;
}
@keyframes announcePop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.9); }
  8%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.04); }
  15%  { transform: translateX(-50%) translateY(0) scale(1); }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}


/* ══════════════════════════════════════════════════════════
   NEW HUD LAYOUT: Player Card, Stat Bars, Hotbar, Mobile
   ══════════════════════════════════════════════════════════ */

/* ── Bottom-left: Player card ── */
#player-card {
  position: absolute;
  bottom: 76px;
  left: 12px;
  width: 282px;
  background: rgba(8,8,20,0.88);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 12px 8px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 20;
}
#player-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.player-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}
#player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  background: radial-gradient(circle at 28% 24%, rgba(255,255,255,0.34) 0%, #4a9eff 64%);
  box-shadow: 0 3px 12px rgba(0,0,0,0.45);
}
.skill-badge {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(10,14,24,0.92);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.badge-attack      { top: -6px; left: -4px; }
.badge-defence     { top: -6px; right: -4px; }
.badge-constitution{ bottom: -8px; left: 50%; transform: translateX(-50%); }
.badge-icon   { font-size: 8px; margin-bottom: 0; }
.badge-level  { font-size: 9px; color: #f0c040; font-weight: 800; }

.player-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#player-name-display  { color: #4a9eff; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player-level-display { color: #f0c040; font-size: 11px; }
#armour-badge {
  font-size: 11px;
  color: #6cf;
  display: none;
}
#armour-badge.is-armoured { display: inline; }
#armour-val { font-weight: 700; }

/* ── Stat bars ── */
#stat-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sbar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sbar-lbl {
  font-size: 12px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.sbar-track {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  overflow: hidden;
}
.sbar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease, background-color 0.35s ease;
}
.sbar-val {
  font-size: 10px;
  color: #888;
  min-width: 48px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Bottom-center: Hotbar ── */
#hotbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 20;
}
#hotbar-slots {
  display: flex;
  gap: 5px;
}
.hb-slot {
  width: 52px;
  height: 52px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hb-slot:hover { background: rgba(255,255,255,0.08); }
.hb-slot.hb-occupied {
  border-color: rgba(74,158,255,0.5);
  background: rgba(74,158,255,0.08);
}
.hb-slot kbd {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 8px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 0 3px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}
.hb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 20px;
}
.hb-item-icon { pointer-events: none; }
.hb-qty {
  position: absolute;
  top: -4px;
  right: -6px;
  font-size: 9px;
  color: #f0c040;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  pointer-events: none;
}
#ammo-display {
  font-size: 11px;
  color: #aaa;
  font-weight: 700;
  background: rgba(0,0,0,0.6);
  border-radius: 5px;
  padding: 2px 8px;
}

/* Interact hint sits above hotbar */
#interact-hint {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  background: rgba(0,0,0,0.74);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 8px 10px 10px;
  z-index: 65;
  pointer-events: none;
}

/* ── Run orb (OSRS-style) ── */
#run-orb {
  position: absolute;
  top: 192px;
  right: 12px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,0,0,0.8);
  border: 2px solid rgba(0,188,212,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#run-orb:active { border-color: rgba(0,188,212,0.9); }
#run-orb.run-active {
  border-color: rgba(0,188,212,0.9);
  box-shadow: 0 0 10px rgba(0,188,212,0.45);
}
#run-orb svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#run-orb-icon {
  position: relative;
  font-size: 18px;
  z-index: 1;
  line-height: 1;
  pointer-events: none;
}

/* ── Mobile controls ── */
#mobile-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 150px;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  z-index: 50;
  padding-bottom: 10px;
}
#mobile-controls > * { pointer-events: all; }

/* Joystick touch zone (transparent, left ~40%) */
#joy-zone {
  width: 42%;
  height: 150px;
  align-self: stretch;
  flex-shrink: 0;
  position: relative;
  /* invisible, captures touch events */
}

/* Shortcut column (sits above joy zone, absolutely positioned) */
#mob-shortcuts {
  position: fixed;
  left: 8px;
  bottom: 162px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 51;
  pointer-events: all;
}
#mob-shortcuts button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.1s;
}
#mob-shortcuts button:active { background: rgba(74,158,255,0.3); }

/* Pocket row (center flex-grow) */
#mob-pockets {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  padding: 0 4px;
}
.mob-pocket {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.1s, border-color 0.15s;
}
.mob-pocket.mob-pocket-full {
  border-color: rgba(74,158,255,0.5);
  color: #fff;
}
.mob-pocket:active { background: rgba(74,158,255,0.3); }

/* Action cluster 2×2 (right side) */
#mob-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 5px;
  padding: 0 10px 0 6px;
  flex-shrink: 0;
}
.mob-act-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0,0,0,0.78);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.1s;
}
.mob-act-btn:active { background: rgba(74,158,255,0.35); }
#mob-attack { border-color: rgba(231,76,60,0.5); }
#mob-attack:active { background: rgba(231,76,60,0.35); }
#mob-interact { border-color: rgba(46,204,113,0.5); }
#mob-interact:active { background: rgba(46,204,113,0.3); }
#mob-escape { font-size: 11px; border-color: rgba(255,255,255,0.15); }

/* Floating joystick visual (positioned by JS) */
#joy-base {
  position: fixed;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  border: 2px solid rgba(255,255,255,0.22);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 52;
  transform: translate(-50%, -50%);
}
#joy-stick {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(74,158,255,0.72);
  border: 2px solid rgba(74,158,255,0.95);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: none;
}

/* ── Key hints (bottom-right) ── */
#key-hints {
  position: absolute;
  bottom: 14px;
  right: 12px;
  text-align: right;
  font-size: 10px;
  color: rgba(255,255,255,0.22);
  pointer-events: none;
  line-height: 1.9;
}

/* ── Responsive tweaks ── */
@media (max-width: 720px) {
  #player-card  { width: 220px; }
  #hud-top-left { gap: 3px; }
  #hud-buttons button { padding: 5px 8px; font-size: 10px; }
  #chat-box     { width: 200px; font-size: 11px; }
  #hotbar       { bottom: 158px; } /* above mobile controls */
  #hotbar-slots { gap: 4px; }
  .hb-slot      { width: 44px; height: 44px; }
  #key-hints    { display: none; }
  #skills-panel     { width: calc(100vw - 24px); left: 12px; right: 12px; top: 100px; }
  #inventory-panel  { width: calc(100vw - 24px); left: 12px; right: 12px; top: 100px; max-height: 55vh; }
  .apt-panel        { max-width: calc(100vw - 24px); max-height: 70vh; overflow-y: auto; }
  #minimap          { width: 120px !important; height: 120px !important; }
  #minimap-label    { top: 136px; width: 120px; }
  #run-orb          { top: 152px; }
}

@media (max-width: 480px) {
  #hud-buttons button { padding: 5px 6px; font-size: 9px; }
  #player-card { width: 180px; }
  #chat-box { width: 170px; }
}

/* ── Inventory drag and drop ── */
.inv-slot.inv-dragging   { opacity: 0.4; transform: scale(0.95); }
.inv-slot.inv-drag-over  { border-color: #f0c040 !important; background: rgba(240,192,64,0.18) !important; box-shadow: inset 0 0 8px rgba(240,192,64,0.3); }

/* ═══════════════════════════════════════════════════════
   NEW SYSTEMS: Wanted, Status Effects, Armor, Gang,
                Bounty minimap blips, Trade Window
   ═══════════════════════════════════════════════════════ */

/* ── Wanted Stars ── */
#wanted-stars {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-top: 4px;
}
#wanted-stars.hidden { display: none; }
.wanted-star {
  font-size: 18px;
  color: #444;
  text-shadow: none;
  line-height: 1;
  transition: color 0.2s, text-shadow 0.2s;
}
.wanted-star.wanted-on {
  color: #ffd700;
  text-shadow: 0 0 8px #ffaa00, 0 0 2px #fff;
}

/* ── Status Effects Bar ── */
#status-effects-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
#status-effects-bar.hidden { display: none; }
.status-icon {
  font-size: 20px;
  cursor: default;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.4));
  animation: status-pulse 1.8s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ── Armor Equipped Slot ── */
#equipped-armor-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(0,0,0,0.45);
  border: 1px solid #3a4a6a;
  border-radius: 6px;
  cursor: pointer;
  min-width: 100px;
  margin-top: 4px;
  transition: border-color 0.15s, background 0.15s;
}
#equipped-armor-slot:hover         { border-color: #6af; background: rgba(100,170,255,0.12); }
#equipped-armor-slot.has-armor     { border-color: #4fc3f7; background: rgba(79,195,247,0.1); }
#equipped-armor-slot .eq-icon      { font-size: 18px; }
#equipped-armor-slot .eq-name      { font-size: 11px; color: #c0d8f0; }
#equipped-armor-slot .eq-empty     { font-size: 11px; color: #555; font-style: italic; }

/* ── Gang Tag in Player Card ── */
#player-gang-tag {
  display: none;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  margin-top: 2px;
}

/* ── Trade Window ── */
#trade-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9000;
  background: rgba(12,16,26,0.97);
  border: 1px solid #2a3a5a;
  border-radius: 12px;
  padding: 0;
  width: min(600px, 96vw);
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  font-family: 'Segoe UI', sans-serif;
  color: #d0ddf5;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.trade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 10px;
  border-bottom: 1px solid #1e2d45;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
}
.trade-close-btn {
  background: rgba(255,60,60,0.15);
  border: 1px solid #ff4444;
  color: #ff8888;
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 12px;
}
.trade-close-btn:hover { background: rgba(255,60,60,0.3); }
.trade-body {
  display: flex;
  gap: 0;
  padding: 14px;
}
.trade-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.trade-side-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7a8fbb;
}
.trade-items {
  min-height: 60px;
  background: rgba(255,255,255,0.04);
  border: 1px solid #1e2d45;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}
.trade-item {
  background: rgba(100,140,255,0.1);
  border: 1px solid #2a3a6a;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 12px;
}
.trade-cash-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9fe9b4;
}
.trade-cash-input {
  width: 90px;
  background: rgba(0,0,0,0.4);
  border: 1px solid #2a3a5a;
  border-radius: 6px;
  padding: 4px 8px;
  color: #9fe9b4;
  font-size: 13px;
}
.trade-accepted { font-size: 12px; color: #9bb1c6; }
.trade-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 22px;
  color: #3a5a8a;
}
.trade-footer {
  padding: 10px 14px 14px;
  display: flex;
  justify-content: center;
}
.trade-accept-btn {
  background: linear-gradient(135deg, #1a6633, #2ecc71);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 36px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: opacity 0.15s;
}
.trade-accept-btn:hover { opacity: 0.85; }


/* ====================================================
   RESPAWN OVERLAY
   ==================================================== */
.respawn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeInOverlay 0.4s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.respawn-box {
  background: rgba(8, 8, 18, 0.97);
  border: 1px solid rgba(231, 76, 60, 0.5);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.9), 0 0 40px rgba(231,76,60,0.15);
  animation: respawnPop 0.3s ease;
}
@keyframes respawnPop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.respawn-skull  { font-size: 52px; margin-bottom: 8px; }
.respawn-title  { font-size: 28px; font-weight: 900; color: #e74c3c; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 8px; }
.respawn-timer  { font-size: 48px; font-weight: 900; color: #fff; line-height: 1; margin: 8px 0; }
.respawn-subtitle { font-size: 12px; color: #888; margin-bottom: 20px; }
.respawn-actions { display: flex; flex-direction: column; gap: 8px; }
.respawn-pay-btn {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.respawn-pay-btn:hover { opacity: 0.85; }

/* ====================================================
   STASH PANEL
   ==================================================== */
.stash-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 18, 0.97);
  border: 1px solid rgba(100, 68, 34, 0.7);
  border-radius: 12px;
  z-index: 80;
  box-shadow: 0 8px 48px rgba(0,0,0,0.85);
  overflow: hidden;
}
.stash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(100, 68, 34, 0.2);
  border-bottom: 1px solid rgba(100, 68, 34, 0.4);
  font-weight: 700;
  color: #c8944a;
  font-size: 13px;
  flex-shrink: 0;
}
.stash-close-btn { background: none; border: none; color: #888; cursor: pointer; font-size: 14px; }
.stash-close-btn:hover { color: #e74c3c; }
.stash-items { flex: 1; overflow-y: auto; padding: 6px 0; min-height: 0; }
.stash-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12px; color: #ddd;
}
.stash-item:last-child { border-bottom: none; }
.stash-withdraw-btn {
  background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.35);
  border-radius: 5px; color: #2ecc71; font-size: 11px; padding: 3px 8px; cursor: pointer;
}
.stash-withdraw-btn:hover { background: rgba(46,204,113,0.3); }
.stash-deposit-btn {
  background: rgba(52,152,219,0.15); border: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  border-radius: 0 0 12px 12px; color: #3498db;
  font-size: 12px; font-weight: 700; padding: 10px; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.stash-deposit-btn:hover { background: rgba(52,152,219,0.3); }

/* ====================================================
   PHONE OVERLAY
   ==================================================== */
.phone-hidden  { display: none !important; }
.phone-visible { display: flex !important; }
#phone-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  align-items: center; justify-content: center;
  z-index: 150; display: none;
}
.phone-frame {
  width: 280px; height: 520px;
  background: #0a0a14;
  border: 2px solid #2a2a3a;
  border-radius: 32px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 80px rgba(0,0,0,0.95), 0 0 0 6px #111;
  position: relative;
  animation: phoneSlide 0.25s ease;
}
@keyframes phoneSlide {
  from { transform: translateY(30px) scale(0.9); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}
.phone-status-bar {
  display: flex; justify-content: space-between;
  padding: 8px 16px 4px; font-size: 10px; color: #aaa;
  background: #0a0a14; flex-shrink: 0;
}
.phone-screen {
  flex: 1; overflow-y: auto; min-height: 0;
  background: #0d0d1a; color: #ddd; font-size: 12px;
}
.phone-app-header {
  padding: 10px 14px 8px; font-size: 13px; font-weight: 900; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.07); background: #111120;
}
.phone-dock {
  display: flex; justify-content: space-around; padding: 8px 12px 12px;
  background: #0a0a14; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}
.phone-app-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; width: 44px; height: 44px; font-size: 18px; cursor: pointer;
  transition: background 0.15s; display: flex; align-items: center; justify-content: center;
}
.phone-app-btn:hover  { background: rgba(255,255,255,0.12); }
.phone-app-btn.active { background: rgba(138,43,226,0.3); border-color: rgba(138,43,226,0.6); }
.phone-close-btn {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: #555; font-size: 14px; cursor: pointer;
}
.phone-close-btn:hover { color: #e74c3c; }
.phone-contact-list { padding: 4px 0; }
.phone-contact {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.phone-contact-icon { font-size: 20px; }
.phone-contact-name { flex: 1; font-size: 12px; color: #ddd; }
.phone-contact-call {
  background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.35);
  border-radius: 6px; color: #2ecc71; font-size: 11px; padding: 4px 8px; cursor: pointer;
}
.phone-contact-call:hover { background: rgba(46,204,113,0.3); }
.phone-call-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; gap: 10px; padding: 20px;
}
.phone-calling-icon  { font-size: 52px; }
.phone-calling-name  { font-size: 16px; font-weight: 700; color: #fff; }
.phone-calling-status { font-size: 12px; color: #888; }
.phone-call-msg { font-size: 12px; color: #bbb; text-align: center; font-style: italic; padding: 0 10px; }
.phone-hangup-btn {
  background: rgba(231,76,60,0.2); border: 1px solid rgba(231,76,60,0.5);
  border-radius: 8px; color: #e74c3c; font-size: 12px; padding: 8px 18px;
  cursor: pointer; margin-top: 12px;
}
.phone-stats-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.phone-stat-key { padding: 6px 14px; color: #888; }
.phone-stat-val { padding: 6px 14px; color: #ddd; text-align: right; font-weight: 700; }
.phone-stats-table tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
.phone-crew-gang { padding: 10px 14px; font-size: 14px; font-weight: 900; border-bottom: 1px solid rgba(255,255,255,0.07); }
.phone-crew-list { padding: 4px 0; }
.phone-crew-member {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px; color: #ddd;
}
.phone-empty { color: #555; font-size: 12px; text-align: center; padding: 20px 14px; }
#phone-hud-btn {
  background: rgba(138,43,226,0.15) !important;
  border-color: rgba(138,43,226,0.4) !important;
  color: #b06cf0 !important;
  font-size: 13px !important;
}
#phone-hud-btn:hover { background: rgba(138,43,226,0.3) !important; }

/* ══════════════════════════════════════════════════════════
   DRUG SELL POPUP
   ══════════════════════════════════════════════════════════ */
.drug-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(8,4,20,0.97); border: 1px solid rgba(160,80,255,0.5);
  border-radius: 10px; padding: 18px 22px; min-width: 290px; max-width: 340px;
  color: #ddd; font-family: inherit; z-index: 9500;
  box-shadow: 0 0 40px rgba(120,40,200,0.4);
}
.dp-header { font-size: 15px; font-weight: 900; color: #b06cf0; margin-bottom: 8px; }
.dp-drug { font-size: 13px; color: #eee; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 8px; }
.dp-npc-says { font-size: 12px; color: #aaa; font-style: italic; margin-bottom: 10px; }
.dp-risk { font-size: 11px; color: #ff9800; margin-bottom: 8px; }
.dp-offer-row, .dp-counter-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.dp-offer-amt { color: #2ecc71; font-size: 15px; }
.dp-counter-row input { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; color: #fff; padding: 3px 6px; font-size: 13px; }
.dp-btns { display: flex; gap: 8px; margin-top: 12px; }
.dp-btn { flex: 1; padding: 7px 4px; border-radius: 6px; border: none; cursor: pointer; font-size: 11px; font-weight: 700; font-family: inherit; }
.dp-accept { background: rgba(46,204,113,0.2); color: #2ecc71; border: 1px solid rgba(46,204,113,0.4); }
.dp-accept:hover { background: rgba(46,204,113,0.35); }
.dp-counter { background: rgba(255,152,0,0.2); color: #ff9800; border: 1px solid rgba(255,152,0,0.4); }
.dp-counter:hover { background: rgba(255,152,0,0.35); }
.dp-cancel { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.dp-cancel:hover { background: rgba(231,76,60,0.3); }

/* ══════════════════════════════════════════════════════════
   STAMINA BAR
   ══════════════════════════════════════════════════════════ */
#stamina-bar-wrap {
  position: fixed; bottom: 68px; left: 50%; transform: translateX(-50%);
  width: 180px; background: rgba(0,0,0,0.55); border-radius: 4px;
  height: 8px; overflow: hidden; pointer-events: none;
}
#stamina-bar-fill {
  height: 100%; background: #00e676; border-radius: 4px;
  transition: width 0.2s, background 0.3s;
}

/* ══════════════════════════════════════════════════════════
   HIDEOUT BROWSE PANEL
   ══════════════════════════════════════════════════════════ */
.hideout-browse {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(8,5,18,0.97); border: 1px solid rgba(80,160,255,0.4);
  border-radius: 10px; padding: 18px 20px; width: 340px; max-height: 80vh;
  overflow-y: auto; color: #ddd; font-family: inherit; z-index: 9400;
  box-shadow: 0 0 40px rgba(30,80,200,0.3);
}
.hb-header { font-size: 15px; font-weight: 900; color: #4fc3f7; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center; }
.hb-bank { font-size: 12px; color: #2ecc71; font-weight: 700; }
.hb-row { display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06); }
.hb-row.hb-rented { background: rgba(46,204,113,0.06); border-radius: 6px; padding: 8px 6px; }
.hb-icon { font-size: 22px; width: 28px; text-align: center; }
.hb-info { flex: 1; }
.hb-name { font-size: 13px; font-weight: 700; }
.hb-tier { font-size: 10px; color: #f39c12; }
.hb-rent { font-size: 11px; color: #888; }
.hb-btn { padding: 5px 10px; border-radius: 5px; border: none; cursor: pointer;
  font-size: 11px; font-weight: 700; font-family: inherit; }
.hb-btn-rent { background: rgba(79,195,247,0.2); color: #4fc3f7; border: 1px solid rgba(79,195,247,0.4); }
.hb-btn-rent:hover { background: rgba(79,195,247,0.35); }
.hb-btn-owned { background: rgba(46,204,113,0.2); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.hb-btn-broke { background: rgba(100,100,100,0.1); color: #555; border: 1px solid rgba(100,100,100,0.2); }
.hb-footer { font-size: 10px; color: #555; margin-top: 10px; }
.hb-close { margin-top: 10px; width: 100%; background: rgba(231,76,60,0.15);
  color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); border-radius: 6px;
  padding: 7px; cursor: pointer; font-family: inherit; font-weight: 700; }
.hb-close:hover { background: rgba(231,76,60,0.3); }

/* ══════════════════════════════════════════════════════════
   JAIL OVERLAY
   ══════════════════════════════════════════════════════════ */
.jail-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 11000; backdrop-filter: blur(3px);
}
.jail-box {
  background: rgba(10,6,20,0.98); border: 2px solid rgba(231,76,60,0.5);
  border-radius: 14px; padding: 30px 36px; text-align: center;
  color: #ddd; font-family: inherit; max-width: 360px; width: 90%;
  box-shadow: 0 0 60px rgba(231,76,60,0.3);
}
.jail-icon { font-size: 48px; margin-bottom: 8px; }
.jail-title { font-size: 28px; font-weight: 900; color: #e74c3c;
  letter-spacing: 4px; margin: 0 0 14px; text-shadow: 0 0 20px rgba(231,76,60,0.7); }
.jail-charges { font-size: 12px; color: #aaa; margin-bottom: 6px; line-height: 1.5; }
.jail-sentence { font-size: 11px; color: #e74c3c; opacity: 0.8; margin-bottom: 14px; }
.jail-time-label { font-size: 11px; color: #666; text-transform: uppercase;
  letter-spacing: 2px; margin-bottom: 6px; }
.jail-timer { font-size: 42px; font-weight: 900; color: #ff6b6b;
  font-family: monospace; margin-bottom: 16px;
  text-shadow: 0 0 16px rgba(255,107,107,0.6); }
.jail-hint { font-size: 11px; color: #555; font-style: italic; }

/* ══════════════════════════════════════════════════════════
   DRUG / HIGH-STRESS VIGNETTE
   ══════════════════════════════════════════════════════════ */
#drug-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 8000;
  border-radius: 0;
  transition: opacity 0.4s ease;
  /* radial vignette — colour set via CSS var */
  background: radial-gradient(ellipse at center,
    transparent 40%,
    var(--vignette-color, rgba(120,0,200,0.0)) 100%);
}
#drug-vignette.active {
  animation: drug-pulse 2s ease-in-out infinite;
}
@keyframes drug-pulse {
  0%,100% { filter: hue-rotate(0deg)   saturate(1);   opacity: 0.85; }
  50%      { filter: hue-rotate(40deg) saturate(2.2); opacity: 1;    }
}

/* ══════════════════════════════════════════════════════════
   APARTMENT PANELS
   ══════════════════════════════════════════════════════════ */
.apt-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(8,5,18,0.97); border: 1px solid rgba(120,80,255,0.4);
  border-radius: 10px; padding: 18px 20px; width: 380px; max-height: 82vh;
  overflow-y: auto; color: #ddd; font-family: inherit; z-index: 9500;
  box-shadow: 0 0 50px rgba(100,50,200,0.3);
}
.apt-header { font-size: 15px; font-weight: 900; color: #ce93d8; margin-bottom: 6px; }
.apt-bank { font-size: 12px; color: #2ecc71; margin-bottom: 12px; }
.apt-floor { margin-bottom: 12px; }
.apt-floor-label { font-size: 11px; color: #aaa; margin-bottom: 5px; }
.apt-floor-rooms { display: flex; flex-wrap: wrap; gap: 4px; }
.apt-room-btn { padding: 4px 7px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05); color: #bbb; cursor: pointer; font-size: 11px;
  font-family: inherit; }
.apt-room-btn:hover { background: rgba(206,147,216,0.2); color: #ce93d8; border-color: rgba(206,147,216,0.4); }
.apt-room-mine { background: rgba(46,204,113,0.12); color: #2ecc71; border-color: rgba(46,204,113,0.3); }
.apt-visit-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; }
.apt-visit-row input { padding: 4px 6px; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; color: #ddd; font-family: inherit; }
.apt-visit-row button { padding: 4px 10px; background: rgba(206,147,216,0.2); color: #ce93d8;
  border: 1px solid rgba(206,147,216,0.4); border-radius: 4px; cursor: pointer; font-family: inherit; }
.apt-close-btn { margin-top: 12px; width: 100%; background: rgba(231,76,60,0.15);
  color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); border-radius: 6px;
  padding: 7px; cursor: pointer; font-family: inherit; font-weight: 700; }
/* Room panel specifics */
.apt-locked-badge { color: #e74c3c; font-size: 13px; margin-bottom: 8px; }
.apt-section-label { font-size: 11px; color: #888; text-transform: uppercase;
  letter-spacing: 1px; margin: 10px 0 5px; }
.apt-stash-item { display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 12px; }
.apt-withdraw-btn, .apt-deposit-btn { padding: 3px 8px; background: rgba(79,195,247,0.15);
  color: #4fc3f7; border: 1px solid rgba(79,195,247,0.3); border-radius: 4px;
  cursor: pointer; font-size: 11px; font-family: inherit; }
.apt-stash-empty, .apt-inv-empty { font-size: 11px; color: #555; font-style: italic; }
.apt-lock-row { display: flex; gap: 6px; align-items: center; }
.apt-lock-row input { flex: 1; padding: 4px 6px; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; color: #ddd; font-family: inherit; }
.apt-lock-row button { padding: 4px 10px; background: rgba(243,156,18,0.2); color: #f39c12;
  border: 1px solid rgba(243,156,18,0.4); border-radius: 4px; cursor: pointer; font-family: inherit; }
.apt-lockpick-btn { width: 100%; padding: 8px; margin-top: 6px;
  background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3);
  border-radius: 6px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; }
.apt-lockpick-btn:hover { background: rgba(231,76,60,0.3); }
.apt-deposit-btn { display: block; width: 100%; margin: 3px 0; text-align: left; }
/* Floor picker + door menu buttons */
.apt-floor-btn { display: block; width: 100%; margin: 4px 0; padding: 8px 12px;
  background: rgba(100,100,200,0.12); color: #aac4ff;
  border: 1px solid rgba(100,100,200,0.35); border-radius: 6px;
  cursor: pointer; font-family: inherit; font-size: 13px; text-align: left; }
.apt-floor-btn:hover { background: rgba(100,100,200,0.28); border-color: rgba(100,100,200,0.6); }
#apt-door-menu button:not(.apt-close-btn) { display: block; width: 100%; margin: 4px 0;
  padding: 8px 12px; background: rgba(255,255,255,0.06); color: #ddd;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
  cursor: pointer; font-family: inherit; font-size: 13px; text-align: left; }
#apt-door-menu button:not(.apt-close-btn):hover { background: rgba(255,255,255,0.14); }
