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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d131d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  color: #f4f6fb;
}

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

.lobby-detail { margin: 6px 0 12px; color: #a9b8d0; font-size: 12px; }
.lobby-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.lobby-controls label { font-size: 12px; color: #a9b8d0; }
#player-name { min-width: 0; width: 130px; padding: 8px 10px; border: 1px solid #475569; border-radius: 6px; background: #101a28; color: #f4f6fb; font: inherit; font-size: 12px; user-select: text; }
#player-name:focus-visible { outline: 2px solid #64c9ff; outline-offset: 2px; }
#lobby-players { list-style: none; max-height: 132px; overflow-y: auto; margin-bottom: 16px; }
#lobby-players li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; }
#lobby-players i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
#lobby-players small { margin-left: auto; color: #94a3b8; }
#player-labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.player-nametag { position: absolute; top: 0; left: 0; padding: 4px 8px; border-bottom: 2px solid var(--player-color); border-radius: 3px; background: #0a1019b8; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.player-nametag.spawn-protected::after { content: ' · Protected'; color: #f9d588; }

.hidden {
  display: none !important;
}

#play-prompt {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(6, 10, 18, 0.4);
}

#btn-play {
  padding: 14px 42px;
  border: 1px solid #f5b935;
  border-radius: 8px;
  background: #f5b935;
  color: #0d131d;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#btn-play:focus-visible {
  outline: 3px solid white;
  outline-offset: 4px;
}

#play-status {
  max-width: 90vw;
  text-align: center;
  font-size: 14px;
  text-shadow: 0 1px 4px #000;
}

#play-prompt.unlocked-look {
  inset: 16px 12px auto;
  gap: 6px;
  background: transparent;
  pointer-events: none;
}

.unlocked-look #btn-play {
  padding: 7px 14px;
  font-size: 13px;
  pointer-events: auto;
}

/* Loading Screen */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 30% 20%, #1d2d46, #0a1019 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-card {
  width: 420px;
  max-width: 90vw;
  background: rgba(12, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 28px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.loading-logo {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.loading-logo span {
  color: #f5b935;
}

.loading-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #a9b8d0;
}

.loading-bar-wrap {
  margin-top: 18px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#loading-bar {
  width: 12%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #f5b935);
  transition: width 0.25s ease;
}

#loading-status {
  margin-top: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

/* Minimal GTA V HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Bottom-Left Radar + Stamina */
body.hud-expanded {
  --expanded-radar-width: min(370px, calc(100vw - 36px), 85vh);
  --expanded-radar-height: calc(var(--expanded-radar-width) * .69);
}

#hud-bottom-left {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.ragdoll-badge {
  background: rgba(220, 38, 38, 0.9);
  border: 1px solid rgba(254, 202, 202, 0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

#fps-pill {
  font-variant-numeric: tabular-nums;
  color: #86efac;
  font-weight: 800;
}

#minimap-wrap {
  width: 248px;
  background: rgba(14, 18, 24, 0.92);
  border: 2px solid rgba(22, 26, 32, 0.96);
  outline: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  position: relative;
}

#minimap {
  display: block;
  width: 100%;
  height: auto;
}

.hud-expanded #minimap-wrap {
  width: var(--expanded-radar-width);
}

.hud-expanded #phone-notification {
  bottom: max(245px, calc(var(--expanded-radar-height) + 54px));
}

.gta-status-bars {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3px;
  height: 7px;
  padding: 2px 2px;
  background: rgba(8, 10, 14, 0.98);
  border-top: 1px solid rgba(0, 0, 0, 0.9);
}

.gta-bar-slot {
  height: 100%;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.gta-bar-fill {
  height: 100%;
  transition: width 0.08s linear;
}

.health-slot .gta-bar-fill {
  background: #56b868;
}

.armor-slot .gta-bar-fill {
  background: #3fa9f5;
}

.stamina-slot .gta-bar-fill {
  background: #f2c94c;
}

#minimap-label {
  display: none;
}

#minimap-label {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #cbd5e1;
  background: rgba(15, 23, 36, 0.92);
}

/* Bottom-Center Strip */
#hud-bottom-center {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: min(620px, calc(100vw - 410px));
}

@media (max-width: 1400px) {
  .hud-expanded #hud-bottom-center {
    left: calc(var(--expanded-radar-width) + 32px);
    right: 76px;
    max-width: none;
    transform: none;
  }

  .hud-expanded #dialogue-box {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .hud-expanded #hud-bottom-center {
    inset: auto 18px calc(var(--expanded-radar-height) + 66px);
  }
}

@media (max-width: 460px) {
  .hud-expanded #phone-toggle {
    bottom: calc(var(--expanded-radar-height) + 34px);
  }

  .hud-expanded #hud-bottom-center {
    bottom: calc(var(--expanded-radar-height) + 76px);
  }
}

.objective-strip {
  background: rgba(18, 22, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#interact-prompt {
  background: rgba(12, 18, 30, 0.92);
  border: 1px solid #f5b935;
  color: #fde68a;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

#vehicle-hud {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 8px;
  background: rgba(12, 18, 30, 0.90);
  border: 1px solid rgba(96, 165, 250, 0.45);
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

#veh-name,
#veh-speed {
  white-space: nowrap;
}

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

#vehicle-hud .sep {
  margin: 0 2px;
  color: rgba(255, 255, 255, 0.35);
}

.veh-gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.veh-rpm-wrap {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

#veh-rpm-fill {
  display: block;
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f59e0b 78%, #ef4444);
  transition: width 60ms linear;
}

.veh-hint {
  color: rgba(226, 232, 240, 0.82);
  font-weight: 600;
  font-size: 11px;
}

#dialogue-box {
  width: 520px;
  max-width: 82vw;
  background: rgba(10, 15, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 4px solid #f5b935;
  border-radius: 12px;
  padding: 13px 16px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65);
}

#dialogue-speaker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f5b935;
}

#dialogue-text {
  margin-top: 5px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #f8fafc;
}

.dialogue-hint {
  margin-top: 6px;
  font-size: 10.5px;
  color: #94a3b8;
  text-align: right;
}

/* Collapsible [Tab] Quick Menu */
#quick-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 10, 18, 0.62);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.quick-card {
  width: 680px;
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  background: rgba(12, 18, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.72);
}

.quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.quick-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #f5b935;
}

.quick-head h2 {
  font-size: 17px;
  font-weight: 800;
  margin-top: 2px;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.quick-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  margin-top: 14px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #93c5fd;
  margin-bottom: 8px;
}

.menu-btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.qm-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.qm-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.qm-btn.active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #fff;
}

#mission-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

#mission-steps li {
  color: #94a3b8;
  line-height: 1.35;
}

#mission-steps li.active {
  color: #fde68a;
  font-weight: 700;
}

#mission-steps li.done {
  color: #6ee7b7;
  text-decoration: line-through;
  opacity: 0.85;
}

.controls-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.controls-table > div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
}

.controls-table kbd {
  min-width: 58px;
  text-align: center;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #f5b935;
}

.freecam-banner {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.90);
  border: 1px solid rgba(56, 189, 248, 0.65);
  color: #bae6fd;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* Death and recovery */
#spawn-protection {
  padding: 4px 9px;
  border-left: 2px solid #f1be63;
  border-radius: 3px;
  background: #151d29eb;
  color: #ffe3a7;
  font-size: 12px;
  font-weight: 650;
}

#respawn-fade {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: #111a29;
  opacity: 0;
}

body.wasted-hit #hud,
body.wasted #hud {
  opacity: 0.38;
  transition: opacity 0.35s ease;
}

#wasted-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.28s ease;
}

#wasted-overlay.active {
  opacity: 1;
}

.wasted-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(12, 15, 23, 0.48) 100%),
    radial-gradient(ellipse at center, transparent 46%, rgba(90, 20, 27, 0.24) 100%);
}

.wasted-strip {
  position: relative;
  width: 100%;
  padding: 34px 24px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(
    180deg,
    rgba(6, 8, 12, 0) 0%,
    rgba(10, 14, 23, 0.67) 24%,
    rgba(10, 14, 23, 0.76) 50%,
    rgba(10, 14, 23, 0.67) 76%,
    rgba(6, 8, 12, 0) 100%
  );
  opacity: 0;
  transform: scaleY(0.88);
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

#wasted-overlay.banner .wasted-strip {
  opacity: 1;
  transform: scaleY(1);
}

.wasted-title {
  font-family: "Impact", "Haettenschweiler", "Arial Narrow Bold", "Arial Black", sans-serif;
  font-size: clamp(58px, 9vw, 102px);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 0.94;
  text-transform: uppercase;
  color: #dc2b2b;
  text-shadow:
    -2px -2px 0 #140404,
     2px -2px 0 #140404,
    -2px  2px 0 #140404,
     2px  3px 0 #140404,
     0   10px 30px rgba(0, 0, 0, 0.9),
     0    0   36px rgba(220, 43, 43, 0.42);
  opacity: 0;
  transform: scale(1.36);
  filter: blur(5px);
}

#wasted-overlay.banner .wasted-title {
  animation: gta-wasted-slam 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#wasted-overlay.reduced-motion .wasted-strip {
  transform: none;
  transition: opacity 0.22s ease;
}

#wasted-overlay.reduced-motion.banner .wasted-title {
  opacity: 1;
  transform: none;
  filter: none;
  animation: none;
}

@keyframes gta-wasted-slam {
  0% {
    opacity: 0;
    transform: scale(1.38);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.wasted-sub {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #e5e7eb;
  text-shadow: 0 2px 8px #000;
}

.wasted-bill {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fca5a5;
  text-shadow: 0 2px 6px #000;
}

.wasted-hint {
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
  transition: opacity 0.35s ease;
}

#wasted-overlay.can-respawn .wasted-hint {
  opacity: 1;
}

/* Unarmed Lock-On Reticle & Contextual Melee Prompts */
#melee-lock {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 42;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

#melee-lock[hidden] {
  display: none;
}

.melee-lock-ring {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.75);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

#melee-lock.windup .melee-lock-ring {
  border-color: #f59e0b;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.9);
  transform: scale(1.22);
}

.melee-lock-hp {
  width: 44px;
  height: 4px;
  background: rgba(8, 10, 14, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
}

.melee-lock-hp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f87171);
  transition: width 0.08s linear;
}

#melee-prompt {
  position: fixed;
  left: 50%;
  bottom: 132px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 43;
  color: #fff;
  background: rgba(12, 18, 30, 0.9);
  border: 1px solid #f5b935;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

#melee-prompt[hidden] {
  display: none;
}

#melee-prompt.counter {
  border-color: #38bdf8;
  color: #e0f2fe;
}

#melee-prompt.stomp {
  border-color: #ef4444;
  color: #fee2e2;
}

#melee-prompt.stealth {
  border-color: #a855f7;
  color: #f3e8ff;
}

#hit-feedback { position: fixed; inset: 0; pointer-events: none; z-index: 35; opacity: 0; box-shadow: inset 0 0 90px 35px #bb2525; }
#player-stats, #player-achievements { margin: 6px 0 14px; color: #d7dfeb; font-size: 12px; line-height: 1.5; }
