/* =============================================================
   CUBECRAFT ARENA  —  Craftnite-style browser FPS
   ============================================================= */

:root {
  --bg-0: #0b0f14;
  --bg-1: #141a22;
  --bg-2: #1c2430;
  --fg-0: #ffffff;
  --fg-1: #cbd5df;
  --fg-2: #90a0b0;
  --fg-3: #5a6672;
  --accent: #4fc84f;          /* grass green */
  --accent-2: #8ef08e;
  --accent-dark: #2e8a2e;
  --sky-1: #68b8ff;
  --sky-2: #a9d8ff;
  --sun: #ffd550;
  --red: #ff5c3a;
  --gold: #ffd43a;
  --line: rgba(255,255,255,0.1);
  --line-strong: rgba(255,255,255,0.22);
  --panel: rgba(14,20,28,0.92);
  --panel-solid: #121820;
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.55), 0 2px 0 rgba(255,255,255,0.05) inset;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg-0); }
body {
  font-family: 'Rajdhani', 'Segoe UI', Arial, sans-serif;
  color: var(--fg-0);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
#app { position: relative; width: 100vw; height: 100vh; }
#gameCanvas { position: absolute; inset: 0; display: block; outline: none; cursor: crosshair; }

.hidden { display: none !important; }

/* =============================================================
   MAIN MENU
   ============================================================= */
#menuScreen { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; overflow: hidden; }

.menuBg { position: absolute; inset: 0; overflow: hidden; }
.bgSky {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, #68b8ff 0%, #a9d8ff 55%, #e9f3ff 85%, #c9b58a 100%);
}
.bgBlocks {
  position: absolute; left: 0; right: 0; bottom: -10vh; height: 60vh;
  background-image:
    linear-gradient(45deg, #4fc84f 25%, transparent 25%),
    linear-gradient(-45deg, #3fa43f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #4fc84f 75%),
    linear-gradient(-45deg, transparent 75%, #3fa43f 75%);
  background-size: 60px 60px;
  background-position: 0 0, 0 30px, 30px -30px, -30px 0px;
  opacity: 0.85;
  mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
}
.menuBg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 55%, transparent 20%, rgba(0,0,0,0.55) 100%);
}

.menuWrap { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; }

.logoWrap { display: flex; flex-direction: column; align-items: center; }
/* Minecraft-style thick blocky white letters with heavy black outline */
.logo {
  position: relative;
  font-family: 'Russo One', 'Rajdhani', sans-serif;
  font-size: 92px; letter-spacing: 2px;
  color: #ffffff;
  padding: 4px 10px;
  line-height: 1;
  /* Thick black outline + stacked 3D shadow */
  text-shadow:
    -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 3px 3px 0 #000,
    -3px 0 0 #000, 3px 0 0 #000, 0 -3px 0 #000, 0 3px 0 #000,
    0 6px 0 #000,
    0 9px 0 #1a1a1a,
    0 12px 0 #0a0a0a,
    0 18px 24px rgba(0,0,0,0.6);
  transform: perspective(400px) rotateX(2deg);
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.15));
}
.tagline {
  margin-top: 4px;
  color: #fff; letter-spacing: 6px; font-size: 13px; font-weight: 700;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  padding: 6px 12px;
}

.menuCard {
  margin-top: 16px;
  background: var(--panel);
  border: 2px solid rgba(0,0,0,0.6);
  box-shadow: var(--shadow-xl), 0 0 0 2px rgba(255,255,255,0.08) inset;
  border-radius: 4px;
  width: 360px;
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 12px;
}
.menuCard h2, .menuCard button, .menuCard span { font-family: 'Rajdhani', sans-serif; }

.field { display: flex; flex-direction: column; gap: 7px; font-size: 11px; color: var(--fg-2); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.field input[type="text"], .field input:not([type]) {
  background: #0a0e14; border: 2px solid rgba(0,0,0,0.5); border-radius: 3px;
  padding: 11px 12px; color: #fff; font-size: 15px;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; outline: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,200,79,0.3); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.fieldInline { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--fg-1); }
.fieldInline input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Skin picker */
.skinPicker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.skinChip {
  width: 100%; aspect-ratio: 1;
  border: 2px solid rgba(0,0,0,0.5);
  cursor: pointer;
  border-radius: 2px;
  transition: transform .1s;
  position: relative;
}
.skinChip:hover { transform: translateY(-2px) scale(1.05); }
.skinChip.sel {
  border-color: var(--sun);
  box-shadow: 0 0 0 2px var(--sun), 0 0 12px rgba(255,212,58,0.5);
}

/* Buttons: Minecraft-style chunky */
.btnPrimary {
  background: linear-gradient(180deg, #5fe05f, #3aa33a);
  border: 2px solid rgba(0,0,0,0.6);
  color: #fff;
  padding: 14px;
  font-family: 'Russo One', sans-serif; letter-spacing: 3px; font-size: 15px;
  cursor: pointer;
  border-radius: 3px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  box-shadow: 0 4px 0 #1e6a1e, 0 0 0 1px rgba(255,255,255,0.3) inset;
  transition: transform .08s;
}
.btnPrimary:hover { filter: brightness(1.08); }
.btnPrimary:active { transform: translateY(2px); box-shadow: 0 2px 0 #1e6a1e, 0 0 0 1px rgba(255,255,255,0.3) inset; }

.btnSecondary {
  background: linear-gradient(180deg, #4a7fb8, #2b5a8a);
  border: 2px solid rgba(0,0,0,0.6);
  color: #fff;
  padding: 12px;
  font-family: 'Russo One', sans-serif; letter-spacing: 3px; font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  box-shadow: 0 3px 0 #1a3a60, 0 0 0 1px rgba(255,255,255,0.25) inset;
}
.btnSecondary:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a3a60, 0 0 0 1px rgba(255,255,255,0.25) inset; }

.btnGhost {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(0,0,0,0.4);
  color: var(--fg-1);
  padding: 9px 10px;
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; flex: 1;
  border-radius: 2px;
  transition: all .15s;
}
.btnGhost:hover { background: rgba(79,200,79,0.14); color: #fff; border-color: rgba(79,200,79,0.6); }

.menuRow { display: flex; gap: 10px; }
.menuError { color: #ff8a7a; font-size: 12px; text-align: center; letter-spacing: 1px; }
.serverStatus {
  text-align: center; font-size: 11px; color: var(--accent);
  letter-spacing: 3px; text-transform: uppercase; font-weight: 700;
  padding-top: 2px;
}
.serverStatus::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  margin-right: 8px; vertical-align: middle;
  animation: pulseDot 1.8s ease-in-out infinite;
}
.serverStatus.bad { color: var(--red); }
.serverStatus.bad::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulseDot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }
.serverInfo { text-align: center; font-size: 11px; color: var(--fg-3); letter-spacing: 2px; }
.menuFooter { margin-top: 14px; color: #fff; font-size: 11px; letter-spacing: 3px; text-shadow: 0 2px 6px rgba(0,0,0,0.7); font-family: 'JetBrains Mono', monospace; }

.btnPrimary.loading { color: transparent; cursor: wait; position: relative; }
.btnPrimary.loading::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Overlay panels */
.overlayPanel {
  position: absolute; z-index: 10; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--panel-solid);
  border: 2px solid rgba(0,0,0,0.7);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1) inset;
  padding: 24px 28px; width: 480px; max-height: 82vh; overflow-y: auto;
  border-radius: 3px;
}
.overlayPanel h2 {
  font-family: 'Russo One', sans-serif; letter-spacing: 4px;
  margin-bottom: 18px; font-size: 18px; color: #fff;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.howtoGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; font-size: 13px; color: var(--fg-1); margin-bottom: 14px; }
.howtoGrid div { padding: 4px 0; }
.howtoGrid b { display: inline-block; min-width: 90px; color: var(--sun); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; letter-spacing: 1px; }
.howtoText { font-size: 13px; line-height: 1.6; color: var(--fg-2); margin-bottom: 16px; }

/* =============================================================
   HUD
   ============================================================= */
#hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; font-family: 'Rajdhani', sans-serif; }

#crosshair { position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; }
#crosshair span { position: absolute; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,0.9); }
#crosshair span:nth-child(1), #crosshair span:nth-child(2) { width: 2px; height: 6px; left: -1px; }
#crosshair span:nth-child(3), #crosshair span:nth-child(4) { width: 6px; height: 2px; top: -1px; }
#crosshair span:nth-child(1) { top: -10px; }
#crosshair span:nth-child(2) { top: 4px; }
#crosshair span:nth-child(3) { left: -10px; }
#crosshair span:nth-child(4) { left: 4px; }

#hitmarker { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; opacity: 0; pointer-events: none; }
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; background: #ff5c3a; width: 2px; height: 10px; top: 5px; left: 9px; }
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.show { animation: hitpop 0.25s ease-out; }
#hitmarker.lethal::before, #hitmarker.lethal::after { background: var(--gold); height: 14px; }
@keyframes hitpop { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: scale(0.9); } }

/* Top bar: tiles */
#topBar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.topTile {
  background: rgba(10,15,20,0.75);
  border: 2px solid rgba(0,0,0,0.7);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  padding: 6px 14px;
  display: flex; flex-direction: column; align-items: center; min-width: 72px;
  border-radius: 2px;
}
.topTile .lbl { font-size: 9.5px; letter-spacing: 2.5px; color: var(--fg-2); font-weight: 700; }
.topTile .val { font-family: 'Russo One', sans-serif; font-size: 20px; color: #fff; }
#topScore .val { color: var(--sun); }
#topKills .val { color: var(--accent-2); }

/* Killfeed */
#killfeed { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; max-width: 360px; }
.killEntry {
  background: rgba(10,12,15,0.85);
  border-left: 3px solid var(--accent);
  padding: 5px 12px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
  animation: fadein 0.2s ease-out;
  border-radius: 2px;
}
.killEntry.you { border-left-color: var(--sun); background: rgba(60,45,10,0.85); }
@keyframes fadein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* Minimap */
#minimapWrap {
  position: absolute; top: 70px; right: 14px; width: 180px; height: 180px;
  background: rgba(6,10,14,0.85);
  border: 2px solid rgba(0,0,0,0.7);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  overflow: hidden;
  border-radius: 2px;
}

/* Bottom bar */
#bottomBar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 14px;
  min-width: 60%;
  justify-content: center;
}

/* Health */
#healthWrap {
  display: flex; flex-direction: column; gap: 6px; width: 180px;
  background: rgba(10,15,20,0.78);
  border: 2px solid rgba(0,0,0,0.7);
  padding: 8px 12px;
  border-radius: 2px;
}
#healthBarBg {
  height: 10px; background: rgba(255,255,255,0.08); overflow: hidden; border: 1px solid rgba(0,0,0,0.5);
}
#healthBarFill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #4fc84f, #8ef08e);
  transition: width 0.2s;
  box-shadow: 0 0 10px rgba(79,200,79,0.6);
}
#healthBarFill.low {
  background: linear-gradient(90deg, var(--red), #ff8a7a);
  animation: lowHp 1s ease-in-out infinite;
}
@keyframes lowHp { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.4); } }
#healthNum { font-size: 13px; color: #fff; font-family: 'JetBrains Mono', monospace; letter-spacing: 1px; }

/* Hotbar */
#hotbar { display: flex; gap: 6px; }
.hotSlot {
  position: relative;
  width: 56px; height: 56px;
  background: rgba(10,15,20,0.8);
  border: 2px solid rgba(0,0,0,0.7);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px;
  overflow: hidden;
}
.hotSlot.sel {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3) inset, 0 0 12px rgba(255,255,255,0.5);
}
.hotSlot .hotIcon { width: 36px; height: 36px; color: #fff; }
.hotSlot .hotIcon svg { width: 100%; height: 100%; display: block; }
.hotSlot .hotKey {
  position: absolute; top: 2px; left: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--fg-2);
  font-weight: 700;
}
.hotSlot .hotQty {
  position: absolute; bottom: 2px; right: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #fff;
  font-weight: 700; text-shadow: 0 0 3px #000;
}
.hotSlot[data-id="pickaxe"] .hotIcon { color: #c6a66a; }
.hotSlot[data-id="blaster"] .hotIcon { color: #4ac7ff; }
.hotSlot[data-id="longshot"] .hotIcon { color: #aa6cff; }
.hotSlot[data-id="bomb"]    .hotIcon { color: #ff7d4a; }
.hotSlot[data-id="blocks"]  .hotIcon { color: #9adb5d; }

/* Ammo tile */
#ammoWrap {
  display: flex; flex-direction: column; justify-content: flex-end; min-width: 150px;
  background: rgba(10,15,20,0.78);
  border: 2px solid rgba(0,0,0,0.7);
  padding: 8px 12px;
  border-radius: 2px;
  text-align: center;
}
#ammoCount {
  font-family: 'Russo One', sans-serif; font-size: 24px; color: #fff; line-height: 1.1;
}
#ammoCount .sep { color: var(--fg-3); margin: 0 2px; }
#ammoReserve { color: var(--fg-2); font-size: 16px; }
#itemName {
  font-size: 11px; color: var(--fg-2); letter-spacing: 2px; text-transform: uppercase; font-weight: 700;
  margin-top: 2px;
}

/* Block hint (while in build slot) */
#blockHint {
  position: absolute; bottom: 92px; right: 14px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(10,15,20,0.8);
  border: 2px solid rgba(0,0,0,0.7);
  padding: 6px 10px;
  border-radius: 2px;
  pointer-events: none;
}
.blockSwatch { width: 24px; height: 24px; border: 1px solid rgba(0,0,0,0.5); }
.blockLabel { display: flex; flex-direction: column; font-size: 12px; }
.blockLabel #blockName { font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #fff; }
.blockLabel #blockQty { font-family: 'JetBrains Mono', monospace; color: var(--fg-2); font-size: 11px; }
.blockKey { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--fg-3); margin-left: 6px; letter-spacing: 1px; }

/* Chat */
#chatLog {
  position: absolute; bottom: 110px; left: 20px; width: 360px; max-height: 150px;
  display: flex; flex-direction: column; gap: 3px; font-size: 13px; overflow: hidden;
}
#chatLog div {
  background: rgba(8,10,13,0.6); padding: 3px 10px;
  border-left: 2px solid var(--line-strong);
  border-radius: 2px;
}
#chatInputWrap { position: absolute; bottom: 90px; left: 20px; width: 360px; pointer-events: auto; }
#chatInputWrap input {
  width: 100%; background: rgba(8,10,13,0.92);
  border: 2px solid var(--accent);
  padding: 9px 12px; color: #fff; font-size: 13.5px;
  font-family: 'Rajdhani', sans-serif; font-weight: 500;
  outline: none; border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(79,200,79,0.15);
}

/* Scoreboard */
#scoreboard {
  position: absolute; top: 90px; left: 50%; transform: translateX(-50%);
  width: 560px; background: var(--panel-solid);
  border: 2px solid rgba(0,0,0,0.7);
  padding: 20px 26px; pointer-events: auto;
  border-radius: 3px;
  box-shadow: var(--shadow-xl);
}
#scoreboard h2 {
  text-align: center; font-family: 'Russo One', sans-serif;
  letter-spacing: 6px; margin-bottom: 14px; font-size: 16px; color: var(--fg-1);
}
.sbRows { display: flex; flex-direction: column; gap: 2px; }
.sbRow {
  display: grid; grid-template-columns: 2fr 60px 60px 60px;
  padding: 7px 10px; align-items: center;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid transparent;
  font-size: 13.5px;
}
.sbRow.me { border-left-color: var(--sun); background: rgba(60,45,10,0.3); }
.sbRow.dead { opacity: 0.4; }
.sbRow .sbName { font-weight: 600; letter-spacing: 0.5px; color: #fff; }
.sbRow .sbStat { text-align: center; font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--fg-1); }

/* Banners */
#bigBanner {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%,-50%); text-align: center;
  font-family: 'Russo One', sans-serif;
  font-size: 44px; letter-spacing: 6px;
  text-shadow: 0 4px 0 #1e6a1e, 0 8px 20px rgba(0,0,0,0.7);
  animation: bannerIn 0.3s ease-out;
}
@keyframes bannerIn { from { opacity: 0; letter-spacing: 20px; } to { opacity: 1; letter-spacing: 6px; } }
#bigBanner .sub { font-family: 'Rajdhani', sans-serif; font-size: 16px; letter-spacing: 3px; color: var(--fg-1); margin-top: 10px; text-transform: uppercase; text-shadow: none; }

#deathScreen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(80,10,10,0.4) 0%, rgba(5,6,10,0.75) 70%);
}
#deathText {
  font-family: 'Russo One', sans-serif;
  font-size: 54px; letter-spacing: 10px; color: var(--red);
  text-shadow: 0 4px 0 #6a1818, 0 0 50px rgba(255,92,58,0.4);
}
#deathSub { margin-top: 12px; color: #e0c4c0; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; }
#respawnBar { margin-top: 18px; width: 240px; height: 8px; background: rgba(255,255,255,0.1); border: 1px solid rgba(0,0,0,0.6); }
#respawnFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.1s linear; }

#pauseMenu {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(10,15,20,0.75) 0%, rgba(5,6,10,0.92) 70%);
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#pauseMenu .menuCard { gap: 10px; }

/* Toast */
#toast {
  position: absolute; bottom: 160px; left: 50%; transform: translateX(-50%);
  background: var(--panel-solid);
  border: 2px solid var(--accent);
  padding: 10px 22px; font-size: 13px; z-index: 60;
  letter-spacing: 2px; font-weight: 600; text-transform: uppercase;
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Damage vignette */
#damageVignette {
  position: absolute; inset: 0; z-index: 25;
  pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,30,20,0.55) 100%);
  mix-blend-mode: screen;
}
#damageVignette.hit { animation: dmgFlash 0.5s ease-out; }
@keyframes dmgFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
body.lowHp #damageVignette { opacity: 0.6; animation: lowHpPulse 1.4s ease-in-out infinite; }
@keyframes lowHpPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.7; } }

/* =============================================================
   Compass bar (top center)
   ============================================================= */
#compassWrap {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%);
  background: rgba(10,15,20,0.6);
  border: 2px solid rgba(0,0,0,0.6);
  padding: 4px 6px;
  pointer-events: none;
  border-radius: 2px;
}
#compass { display: block; }

/* =============================================================
   Damage direction indicators (red arcs around crosshair)
   ============================================================= */
#damageDirs {
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  pointer-events: none;
}
.dd {
  position: absolute; left: -45px; top: -112px;
  width: 90px; height: 24px;
  background: linear-gradient(180deg, rgba(255,80,60,0.95), rgba(200,40,20,0.0));
  clip-path: polygon(10% 0%, 90% 0%, 70% 100%, 30% 100%);
  transform-origin: 50% 112px;
  opacity: 0;
}
.dd.hit { animation: ddFade 0.9s ease-out forwards; }
@keyframes ddFade { 0% { opacity: 1; } 100% { opacity: 0; } }
.dd[data-dir="n"]  { transform: rotate(0deg); }
.dd[data-dir="ne"] { transform: rotate(45deg); }
.dd[data-dir="e"]  { transform: rotate(90deg); }
.dd[data-dir="se"] { transform: rotate(135deg); }
.dd[data-dir="s"]  { transform: rotate(180deg); }
.dd[data-dir="sw"] { transform: rotate(225deg); }
.dd[data-dir="w"]  { transform: rotate(270deg); }
.dd[data-dir="nw"] { transform: rotate(315deg); }

/* =============================================================
   Floating damage numbers
   ============================================================= */
#dmgNumbers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dmgNum {
  position: absolute;
  font-family: 'Russo One', sans-serif;
  font-size: 24px;
  color: #ffd43a;
  text-shadow: 0 3px 0 #000, 0 0 8px rgba(0,0,0,0.9);
  pointer-events: none;
  animation: dmgPop 1s ease-out forwards;
}
.dmgNum.crit { color: #ff5c3a; font-size: 32px; }
.dmgNum.heal { color: #8ef08e; }
@keyframes dmgPop {
  0%   { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
  15%  { transform: translate(-50%, -8px) scale(1.3); opacity: 1; }
  60%  { transform: translate(-50%, -30px) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -55px) scale(0.9); opacity: 0; }
}

/* =============================================================
   Pickup log (bottom-right notifications)
   ============================================================= */
#pickupLog {
  position: absolute; bottom: 110px; right: 20px;
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: none;
}
.pickupItem {
  background: rgba(10,15,20,0.85);
  border: 2px solid rgba(0,0,0,0.6);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
  padding: 6px 12px;
  font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
  animation: pickupSlide 0.25s ease-out;
  border-radius: 2px;
}
.pickupItem .pSw {
  width: 16px; height: 16px;
  border: 1px solid rgba(0,0,0,0.5);
}
.pickupItem .pQty { color: var(--sun); font-family: 'JetBrains Mono', monospace; }
@keyframes pickupSlide {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* =============================================================
   WebGL fallback error page
   ============================================================= */
#webglError {
  position: absolute; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at center, #1a2232 0%, #05070b 70%);
  font-family: 'Rajdhani', sans-serif;
}
.webglErrorCard {
  background: var(--panel-solid);
  border: 2px solid var(--red);
  padding: 36px 44px; width: 520px; max-width: 92vw;
  color: #fff; text-align: center;
  border-radius: 3px;
  box-shadow: 0 20px 60px rgba(255,30,20,0.3);
}
.webglErrorCard h2 {
  font-family: 'Russo One', sans-serif; letter-spacing: 4px;
  margin: 12px 0 16px; font-size: 22px; color: var(--red);
}
.webglErrorCard p { font-size: 14px; line-height: 1.6; color: var(--fg-1); margin-bottom: 12px; }
.webglErrorCard code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 2px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.webglHint { font-size: 12.5px; color: var(--fg-2); text-align: left; }
.webglIcon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-family: 'Russo One', sans-serif; font-size: 36px;
  box-shadow: 0 0 24px rgba(255,92,58,0.6);
  margin-bottom: 4px;
}
.webglLink {
  display: inline-block; margin-top: 16px;
  background: linear-gradient(180deg, #5fe05f, #3aa33a);
  color: #fff; text-decoration: none;
  padding: 10px 20px; border-radius: 3px;
  font-family: 'Russo One', sans-serif; letter-spacing: 2px; font-size: 13px;
  border: 2px solid rgba(0,0,0,0.6);
  box-shadow: 0 3px 0 #1e6a1e;
}

/* WebGL badge in menu */
.webglBadge {
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  color: var(--sky-1); text-align: center;
}
.webglBadge .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--sky-1); margin-right: 6px; vertical-align: middle;
  box-shadow: 0 0 8px var(--sky-1);
  animation: pulseDot 1.8s ease-in-out infinite;
}

/* =============================================================
   Scrollbar
   ============================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: rgba(79, 200, 79, 0.45); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 200, 79, 0.7); }
