/* =============================================================
   CRAFTNITE UI — nach Referenzbildern
   1: Hauptmenue   2: Skin-Auswahl   3: HUD   4: Inventar
   ============================================================= */

body { font-family: 'Exo 2', 'Rajdhani', sans-serif; }

/* ---------------------------------------------------------------
   1) HAUPTMENUE
   --------------------------------------------------------------- */
#menuScreen { background: #060606; }
.menuBg { background: #0b0b0c; }
.bgSky, .bgBlocks { display: none; }
#menuBgCanvas {
  position: absolute; left: -40px; top: -40px;
  width: calc(100% + 80px); height: calc(100% + 80px);
  image-rendering: pixelated;
  filter: blur(8px) brightness(0.42) saturate(0.7);
}
.menuBg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 38%, rgba(0,0,0,0.0) 25%, rgba(0,0,0,0.72) 100%);
}

.menuWrap { gap: 0; }
.logo {
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 900;
  font-size: 78px; letter-spacing: 1px; line-height: 1;
  color: #fff; padding: 0 10px;
  -webkit-text-stroke: 9px #000; paint-order: stroke fill;
  text-shadow: 0 6px 0 #000, 0 10px 18px rgba(0,0,0,0.55);
  transform: skewX(-4deg); filter: none;
}
.tagline {
  margin: 8px 0 12px; padding: 0;
  font-style: italic; font-weight: 800; font-size: 14px; letter-spacing: 4px;
  color: #fff; text-shadow: 0 2px 4px #000, 0 0 8px #000;
}
.tagline i { color: #ffc61a; font-style: normal; margin: 0 4px; }

.menuCard {
  width: 272px; margin-top: 0; padding: 16px 16px 14px;
  gap: 10px; border-radius: 5px;
  background: rgba(19,21,27,0.93);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 18px 50px rgba(0,0,0,0.6);
}

.skinPreviewWrap {
  position: relative; display: block; height: 214px; width: 100%;
  margin: 0; border: none; border-radius: 3px; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 88%, rgba(150,120,50,0.38) 0%, rgba(30,26,18,0.0) 55%),
    linear-gradient(180deg, #1b1a17 0%, #14130f 100%);
}
#skinPreviewContainer { position: absolute; inset: 0; }
#skinPreviewContainer canvas { display: block; width: 100% !important; height: 100% !important; }
.arrowBtn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 48px; border-radius: 3px;
  background: rgba(10,10,12,0.78); color: #fff;
  font-family: 'Exo 2', sans-serif; font-weight: 900; font-size: 30px; line-height: 1;
  border: none; cursor: pointer; padding: 0 0 4px;
  display: flex; align-items: center; justify-content: center;
}
#skinPrevBtn { left: 0; border-radius: 0 3px 3px 0; }
#skinNextBtn { right: 0; border-radius: 3px 0 0 3px; }
.arrowBtn:hover { background: rgba(40,40,46,0.95); color: #fff; }

.skinDropdown {
  position: relative; justify-content: center;
  height: 46px; padding: 0 30px;
  background: #101218; border: 1px solid rgba(255,255,255,0.07); border-radius: 4px;
  font-style: italic; font-weight: 900; font-size: 20px; letter-spacing: 0.3px;
  text-transform: none; color: #fff;
}
.skinDropdown:hover { background: #151821; border-color: rgba(255,255,255,0.18); }
.skinDropdown .arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #ffc61a; font-size: 13px; }

#nameInput {
  height: 48px; padding: 0 10px; text-align: center;
  background: #fff; color: #2a2a2a;
  border: none; border-bottom: 4px solid #c9c9c9; border-radius: 4px;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 900; font-size: 22px; letter-spacing: 0;
}
#nameInput::placeholder { color: #8a8a8a; font-style: italic; font-weight: 900; }
#nameInput:focus { border-bottom-color: #3be03b; }

.btnPlay {
  height: 60px; margin: 2px 0 0; padding: 0;
  background: linear-gradient(180deg, #2fe02f 0%, #19b319 100%);
  border: none; border-bottom: 6px solid #0c780c; border-radius: 5px;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 900; font-size: 36px; letter-spacing: 2px;
  color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,0.38);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35);
}
.btnPlay:hover { filter: brightness(1.07); }
.btnPlay:active { transform: translateY(3px); border-bottom-width: 3px; }
.quickPlayText {
  margin: 2px 0 0; text-align: center;
  font-style: italic; font-weight: 800; font-size: 13px; color: #aeb6c4;
}

.menuUnder { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; width: 272px; }
.menuUnder .menuRow { width: 100%; gap: 6px; }
.menuUnder .btnGhost {
  background: rgba(10,10,12,0.72); border: 1px solid rgba(255,255,255,0.12); border-radius: 3px;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 800; font-size: 12px; letter-spacing: 1px;
}
.menuUnder .btnGhost:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.35); }
.menuUnder .serverStatus, .menuUnder .serverInfo { text-shadow: 0 1px 3px #000; }
.webglBadge, .menuFooter { opacity: 0.7; }

/* ---------------------------------------------------------------
   2) SKIN-AUSWAHL
   --------------------------------------------------------------- */
.largeOverlay {
  width: 760px; max-width: 96vw; max-height: 92vh;
  padding: 18px 20px 16px; gap: 14px;
  background: rgba(23,27,38,0.98) !important;
  border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.chooserHeader { border: none; padding: 0; }
.chooserHeader h2, .largeOverlay h2 {
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 900;
  font-size: 36px; letter-spacing: 0; text-transform: none; color: #fff;
}
.closeXBtn { color: #cfd5e0; font-size: 40px; font-weight: 300; line-height: 1; padding: 0 4px; }
.closeXBtn:hover { color: #fff; }
#skinSearchInput {
  height: 48px; padding: 0 14px; border: none; border-radius: 4px;
  background: #fff; color: #2a2a2a;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 900; font-size: 20px;
}
#skinSearchInput::placeholder { color: #8e8e8e; font-style: italic; font-weight: 900; }
#skinSearchInput:focus { outline: 2px solid #3be03b; }
.skinGrid {
  grid-template-columns: repeat(7, 1fr); gap: 8px; max-height: 58vh; padding: 0 6px 0 0;
}
.skinGridItem {
  height: 94px; padding: 8px 4px 6px; gap: 4px;
  background: #1a1e2b; border: 1px solid #272d3f; border-radius: 6px;
}
.skinGridItem:hover { background: #222838; border-color: #3a4260; transform: none; }
.skinGridItem.selected { background: #232b3d; border-color: #3be03b; box-shadow: none; }
.skinIconCanvas { width: 52px; height: 52px; border-radius: 0; background: transparent; }
.skinGridItem .skinLabel {
  font-style: italic; font-weight: 900; font-size: 13px; color: #e6eaf2; letter-spacing: 0;
}
.skinGrid::-webkit-scrollbar { width: 7px; }
.skinGrid::-webkit-scrollbar-track { background: #151925; border-radius: 4px; }
.skinGrid::-webkit-scrollbar-thumb { background: #4a5164; border-radius: 4px; }

/* ---------------------------------------------------------------
   3) HUD
   --------------------------------------------------------------- */
#hud { font-family: 'Orbitron', 'Exo 2', sans-serif; text-transform: uppercase; }
#topBar, #compassWrap, #minimapWrap, #ammoWrap { display: none !important; }
#crosshair span { background: #fff; }

#matchTimer {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  font-weight: 900; font-size: 40px; letter-spacing: 3px; color: #fff;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.45), 0 0 8px rgba(0,0,0,0.35);
  font-variant-numeric: tabular-nums;
}

#leaderboard {
  position: absolute; top: 4px; right: 0; width: 222px; padding: 6px 0 6px;
  background: rgba(8,64,92,0.84);
}
.lbRow {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1px 10px 1px 8px; height: 24px;
  font-weight: 700; font-size: 15px; letter-spacing: 1px; color: #ff4a1c;
}
.lbRow .lbName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbRow .lbScore { color: #fff; margin-left: 8px; }
.lbRow.me { color: #fff; }

#killfeed {
  top: 6px; left: 12px; right: auto; align-items: flex-start; max-width: 360px; gap: 0;
}
.killEntry {
  background: none; border: none; padding: 0; border-radius: 0; animation: none;
  font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 1px;
  color: #ff4a1c; text-shadow: 1px 1px 0 rgba(0,0,0,0.6);
}
.killEntry b { color: #ff4a1c; font-weight: 700; }
.killEntry.you, .killEntry.you b { color: #fff; background: none; }

/* Chat unten links */
#chatHint {
  position: absolute; left: 0; bottom: 76px; width: 344px; height: 54px;
  display: flex; align-items: center; padding-left: 8px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 800; font-size: 22px; text-transform: none;
}
#chatInputWrap { left: 0; bottom: 76px; width: 344px; }
#chatInputWrap input {
  height: 54px; border: none; border-radius: 0; box-shadow: none;
  background: rgba(0,0,0,0.72); color: #fff; padding: 0 10px;
  font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 800; font-size: 20px;
}
#chatLog { left: 0; bottom: 134px; width: 344px; font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 700; font-size: 15px; text-transform: none; }
#chatLog div { background: rgba(0,0,0,0.45); border: none; border-radius: 0; padding: 2px 8px; }

/* Gesundheit */
#bottomBar { left: 0; right: 0; bottom: 0; transform: none; min-width: 0; display: block; pointer-events: none; }
#healthWrap {
  position: absolute; left: 0; bottom: 8px; width: 252px !important; height: 58px;
  padding: 0 !important; background: #14301a !important; border: none !important; border-radius: 0 !important;
  box-shadow: none !important; display: block;
}
#healthBarBg { position: absolute; inset: 0; height: auto !important; border: none !important; background: transparent; }
#healthBarFill {
  height: 100%; background: linear-gradient(180deg, #43e84a 0%, #2bc833 100%) !important;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18), inset 0 3px 0 rgba(255,255,255,0.28) !important;
}
#healthBarFill.low { background: linear-gradient(180deg, #ff6a4a, #d92f1c) !important; }
#healthNum {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-family: 'Orbitron', sans-serif !important; font-weight: 900; font-size: 36px !important;
  color: #fff !important; letter-spacing: 1px; text-shadow: 3px 3px 0 rgba(0,0,0,0.38) !important;
}

/* Hotbar (mittig unten, helle Slots) */
#hotbar { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; z-index: 40; }
.hotSlot {
  width: 84px; height: 84px; border-radius: 0; overflow: hidden;
  background: rgba(255,255,255,0.3); border: 3px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}
.hotSlot.sel { background: rgba(255,255,255,0.72); border-color: rgba(255,255,255,0.95); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12); }
.hotSlot .hotIcon { width: 60px; height: 60px; image-rendering: pixelated; }
.hotSlot .hotKey { top: 3px; left: 5px; font-family: 'Orbitron', sans-serif; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.6); }
.hotSlot .hotQty { right: 5px; bottom: 3px; font-family: 'Orbitron', sans-serif; font-size: 15px; font-weight: 900; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,0.65); }
.hotSlot.sel .hotKey, .hotSlot.sel .hotQty { color: #fff; }

#blockHint { bottom: 102px; right: auto; left: 50%; transform: translateX(-50%); border-radius: 0; background: rgba(0,0,0,0.55); border: none; font-family: 'Orbitron', sans-serif; }

/* "CLICK TO LOCK POINTER" */
#pointerLockBanner {
  top: 42%; width: 440px; padding: 0; height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.62); border: none; border-radius: 0; box-shadow: none; animation: none;
  font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 27px; letter-spacing: 3px; color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

/* ---------------------------------------------------------------
   4) INVENTAR
   --------------------------------------------------------------- */
#inventory {
  position: absolute; left: 44px; right: 0; top: 14px; bottom: 6px; z-index: 30;
  background: rgba(0,0,0,0.78); pointer-events: auto;
}
#invGrid { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: repeat(auto-fill, 84px); gap: 0; width: 100%; }
.invSlot {
  position: relative; width: 84px; height: 84px; cursor: pointer;
  background: rgba(255,255,255,0.3); border: 3px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
}
.invSlot:hover { background: rgba(255,255,255,0.5); }
.invSlot.sel { background: rgba(255,255,255,0.72); border-color: #fff; }
.invSlot canvas { width: 60px; height: 60px; image-rendering: pixelated; }
.invSlot .invQty { position: absolute; right: 5px; bottom: 3px; font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 15px; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,0.65); }
.invSlot .invName { position: absolute; left: 0; right: 0; top: 3px; text-align: center; font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 800; font-size: 11px; color: #fff; text-shadow: 1px 1px 0 #000; text-transform: none; }
#invHint { position: absolute; left: 50%; top: 44%; transform: translateX(-50%); font-family: 'Exo 2', sans-serif; font-style: italic; font-weight: 800; font-size: 16px; color: rgba(255,255,255,0.35); text-transform: none; pointer-events: none; }

/* ---------------------------------------------------------------
   Struktur-Regeln (Layout) fuer die neuen Komponenten
   --------------------------------------------------------------- */
.skinDropdown { display: flex; align-items: center; cursor: pointer; user-select: none; }
.skinDropdown #activeSkinName { text-align: center; }
.btnPlay { display: block; width: 100%; cursor: pointer; position: relative; }
.btnPlay.loading { color: transparent; cursor: wait; }
.btnPlay.loading::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 3px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.75s linear infinite;
}
#nameInput { display: block; width: 100%; outline: none; }
.largeOverlay { display: flex; flex-direction: column; }
.chooserHeader { display: flex; align-items: center; justify-content: space-between; }
.chooserHeader h2 { margin: 0; padding: 0; border: none; }
.closeXBtn { background: none; border: none; cursor: pointer; }
#skinSearchInput { display: block; width: 100%; outline: none; }
.skinGrid { display: grid; overflow-y: auto; }
.skinGridItem { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.skinGridItem .skinLabel { width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skinIconCanvas { image-rendering: pixelated; }
#pointerLockBanner {
  position: absolute; left: 50%; transform: translate(-50%, 0); cursor: pointer; pointer-events: auto; z-index: 100;
}
.skinGrid { grid-template-columns: repeat(7, minmax(0, 1fr)); overflow-x: hidden; }
.skinGridItem { min-width: 0; }
.skinGridItem .skinLabel { font-size: 12px; padding: 0 2px; }
#pointerLockBanner { width: auto; min-width: 440px; padding: 0 36px; height: 78px; white-space: nowrap; font-size: 24px; letter-spacing: 2px; }

/* ---------------------------------------------------------------
   Zielsystem: dynamisches Fadenkreuz + Scope
   --------------------------------------------------------------- */
#crosshair { --g: 5px; transition: opacity .1s; }
#crosshair span { background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.55); transition: top .07s ease-out, left .07s ease-out; }
#crosshair span:nth-child(1) { top: calc(-6px - var(--g)); }
#crosshair span:nth-child(2) { top: var(--g); }
#crosshair span:nth-child(3) { left: calc(-6px - var(--g)); }
#crosshair span:nth-child(4) { left: var(--g); }
#crosshair::after { content: ''; position: absolute; left: -1px; top: -1px; width: 2px; height: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.55); }

#scopeOverlay {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .12s ease-out; z-index: 24;
  background:
    linear-gradient(#000, #000) center / 2px 70vh no-repeat,
    linear-gradient(#000, #000) center / 70vh 2px no-repeat,
    radial-gradient(circle at center, transparent 0, transparent 33vh, rgba(0,0,0,0.92) 33.4vh, #000 36vh);
}
#scopeOverlay.on { opacity: 1; }
