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

body {
  background: #1a1a1a;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #ddd;
  user-select: none;
}

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

/* ─── HUD ─────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; }

/* Crosshair */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
}
.ch-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 3px; height: 3px;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}
#crosshair::before, #crosshair::after {
  content:''; position:absolute;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(0,0,0,0.4);
}
#crosshair::before { top:50%; left:0; right:0; height:1px; transform:translateY(-50%); }
#crosshair::after  { top:0; bottom:0; left:50%; width:1px; transform:translateX(-50%); }

/* HUD Bottom Bar */
#hud-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 52px;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
}
.hud-section { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.hud-section.hud-right { margin-left: auto; align-items: flex-end; }
.hud-label { font-size: 10px; text-transform: uppercase; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; }
.hud-val   { font-size: 22px; font-weight: 700; color: #dde; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-hp    { color: #88ff88; }
.hud-weapon-name { font-size: 13px; color: #aaccff; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hud-tool-name { font-size: 11px; color: #88cc88; margin-bottom: 2px; }
.hud-ammo  { font-size: 20px; font-weight: 700; color: #eee; font-variant-numeric: tabular-nums; }
.hud-ammo-clip { color: #ffffff; }
.hud-ammo-sep  { color: rgba(255,255,255,0.3); font-size: 14px; }
.hud-ammo-res  { color: rgba(255,255,255,0.55); font-size: 16px; }
.hud-spacer { flex: 1; }

/* Hint bar */
#hud-hint-bar {
  position: absolute;
  bottom: 58px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 13px;
  color: #fff;
  pointer-events: none;
  max-width: 600px;
  text-align: center;
  white-space: nowrap;
}
#hud-hint:empty + *, #hud-hint:empty { display: none; }
#hud-hint-bar:has(#hud-hint:empty) { display: none; }

/* ─── Menu Overlays ───────────────────────────────────────────── */
.menu-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.menu-overlay.active { display: flex; }

/* Main Menu */
#main-menu { background: rgba(0,0,0,0.0); }
.menu-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  pointer-events: none;
}
.menu-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 60px 70px;
  gap: 8px;
  margin-left: 0;
  align-self: center;
}
.menu-logo { margin-bottom: 32px; }
.logo-line1 {
  font-size: 56px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 2px 3px 8px rgba(0,0,0,0.8);
}
.logo-line2 {
  font-size: 72px;
  font-weight: 900;
  color: #88cc44;
  letter-spacing: -0.03em;
  line-height: 0.9;
  text-shadow: 3px 4px 10px rgba(0,0,0,0.9), 0 0 30px rgba(136,204,68,0.3);
}
.logo-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 6px;
}
.menu-buttons { display: flex; flex-direction: column; gap: 8px; }

.gmod-btn {
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #dde;
  background: rgba(40,50,60,0.85);
  border: 1px solid rgba(100,130,160,0.4);
  border-radius: 3px;
  cursor: pointer;
  min-width: 200px;
  text-align: left;
  letter-spacing: 0.02em;
  transition: background 0.12s, border-color 0.12s;
}
.gmod-btn:hover { background: rgba(60,80,100,0.95); border-color: rgba(120,180,240,0.7); color: #fff; }
.gmod-btn-main  { color: #88ee44; border-color: rgba(80,150,40,0.6); }
.gmod-btn-main:hover { background: rgba(40,70,20,0.9); border-color: rgba(100,200,50,0.9); }

.menu-controls-hint {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
}

/* Pause Menu */
#pause-menu {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}
.pause-panel {
  background: rgba(18,24,32,0.95);
  border: 1px solid rgba(80,100,120,0.5);
  border-radius: 6px;
  padding: 30px 36px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pause-title {
  font-size: 24px; font-weight: 700; color: #cce;
  text-align: center; margin-bottom: 8px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.pause-section-title {
  font-size: 11px; text-transform: uppercase; color: rgba(200,220,255,0.5);
  letter-spacing: 0.1em; margin-top: 6px; margin-bottom: 2px;
}
.tool-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tool-btn {
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #88cc88;
  background: rgba(30,50,30,0.8);
  border: 1px solid rgba(80,140,80,0.4);
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s, border-color 0.1s;
}
.tool-btn:hover { background: rgba(50,80,50,0.9); border-color: rgba(120,200,120,0.7); color: #fff; }

/* Options */
#opts-menu { background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); }
.opts-panel {
  background: rgba(18,24,32,0.95);
  border: 1px solid rgba(80,100,120,0.5);
  border-radius: 6px;
  padding: 30px 36px;
  min-width: 340px;
  display: flex; flex-direction: column; gap: 14px;
}
.opts-title { font-size: 20px; font-weight: 700; color: #cce; margin-bottom: 6px; }
.opts-row { display: flex; align-items: center; gap: 12px; }
.opts-row label { min-width: 110px; font-size: 13px; color: rgba(255,255,255,0.7); }
.opts-row input[type=range] { flex: 1; accent-color: #88cc44; }
.opts-row span { min-width: 44px; font-size: 13px; color: #aaf; text-align: right; }

/* ─── Spawn Menu ──────────────────────────────────────────────── */
.spawn-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.sm-panel {
  width: min(820px, 92vw);
  height: min(600px, 88vh);
  background: rgba(14,20,28,0.97);
  border: 1px solid rgba(80,110,140,0.6);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sm-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(20,30,45,0.95);
  border-bottom: 1px solid rgba(60,80,100,0.5);
}
.sm-title { font-size: 15px; font-weight: 700; color: #88cc44; letter-spacing: 0.05em; }
.sm-search {
  flex: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(80,100,120,0.5);
  border-radius: 3px;
  color: #dde;
  padding: 4px 10px;
  font-size: 13px;
  outline: none;
}
.sm-search:focus { border-color: rgba(120,180,240,0.7); }
.sm-body { display: flex; flex: 1; overflow: hidden; }
.sm-cats {
  width: 130px;
  background: rgba(10,14,20,0.9);
  border-right: 1px solid rgba(60,80,100,0.4);
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  overflow-y: auto;
}
.sm-cat-btn {
  padding: 10px 14px;
  font-size: 13px;
  color: rgba(200,220,255,0.65);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s;
}
.sm-cat-btn:hover { background: rgba(40,60,80,0.6); color: #dde; }
.sm-cat-btn.active { background: rgba(30,50,70,0.8); color: #88ee44; border-left-color: #88ee44; }
.sm-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}
.sm-item-cat {
  font-size: 10px;
  text-transform: uppercase;
  color: rgba(180,200,220,0.4);
  letter-spacing: 0.12em;
  padding: 6px 4px 3px;
  border-bottom: 1px solid rgba(60,80,100,0.3);
  margin-bottom: 3px;
}
.sm-item {
  padding: 7px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(200,220,255,0.8);
  transition: background 0.08s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sm-item:hover  { background: rgba(40,60,80,0.7); color: #eef; }
.sm-item.selected { background: rgba(30,70,40,0.8); color: #88ee44; }
.sm-footer {
  border-top: 1px solid rgba(60,80,100,0.4);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14,20,28,0.95);
}
.sm-info { flex: 1; font-size: 12px; color: rgba(200,220,255,0.5); }
.sm-actions { display: flex; gap: 8px; }
.sm-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #cce;
  background: rgba(30,40,55,0.9);
  border: 1px solid rgba(80,110,140,0.5);
  border-radius: 3px;
  cursor: pointer;
}
.sm-btn:hover       { background: rgba(50,70,100,0.9); border-color: rgba(120,170,220,0.8); }
.sm-btn-green       { color: #88ee44; border-color: rgba(80,150,40,0.6); }
.sm-btn-green:hover { background: rgba(30,60,20,0.9); border-color: rgba(100,200,50,0.9); }
.sm-btn-red         { color: #ff8888; border-color: rgba(150,40,40,0.6); }
.sm-btn-red:hover   { background: rgba(60,20,20,0.9); border-color: rgba(220,80,80,0.9); }

/* ─── Loading Screen ──────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 200;
  transition: opacity 0.5s;
}
.load-logo {
  font-size: 28px;
  font-weight: 700;
  color: #88cc44;
  letter-spacing: 0.06em;
}
.load-bar {
  width: 300px; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.load-fill {
  height: 100%;
  background: #88cc44;
  border-radius: 2px;
  width: 0;
  transition: width 0.3s;
  animation: loadAnim 1.5s ease-in-out infinite;
}
@keyframes loadAnim { 0%{width:0%} 50%{width:70%} 100%{width:100%} }

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(100,130,160,0.5); border-radius: 3px; }
