/* ============================================================================
   Shadow Keeper 3D — style.css
   3D-oyun HUD stilləri: nişangah, can çubuğu, inventar, boss çubuğu,
   məqsəd mətni, pointer-lock bildiriş overlay-i, oyun-sonu + qələbə modalları.
   Bütün rənglər CSS sətirləri kimidir (CONFIG-dəki 0xRRGGBB nömrələri YALNIZ
   THREE üçündür — bura qarışdırılmır). Xarici fayl/şəkil yoxdur (file://).
   ============================================================================ */

/* --- Qlobal sıfırlama: scroll olmasın, tam ekran ------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;            /* heç vaxt scroll yaranmasın */
  background: #0b0d12;         /* COLOR_BG ilə uyğun tünd fon */
  /* Retro/monospace şrift seçimi (xarici asılılıq yoxdur) */
  font-family: "Courier New", "Consolas", "Lucida Console", monospace;
  color: #e6e9f0;
  user-select: none;           /* mətnin təsadüfən seçilməsinin qarşısını al */
  cursor: default;
}

/* --- Köməkçi: gizlətmə sinfi (JS display:none yerinə bunu da işlədə bilər) */
.hidden {
  display: none !important;
}

/* ============================================================================
   RENDER KANVASI
   ============================================================================ */
#game {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;              /* inline-boşluğu aradan qaldırır */
  background: #0b0d12;
  z-index: 0;                  /* bütün HUD altında qalır */
}

/* ============================================================================
   HUD — tam ekran üst qat (klikləri ötürür: pointer-events:none)
   ============================================================================ */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;        /* HUD-un üstündən kliklər kanvasa keçsin */
  z-index: 10;
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* --- Mərtəbə sayğacı (sol üst) ------------------------------------------- */
#floor-counter {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 6px 12px;
  background: rgba(11, 13, 18, 0.6);
  border: 1px solid rgba(123, 92, 255, 0.5);   /* COLOR_EXIT bənövşəyi vurğu */
  border-radius: 4px;
  color: #b9a8ff;
  font-size: 15px;
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(123, 92, 255, 0.6);
}

/* --- Can (HP) çubuğu (sol alt) ------------------------------------------- */
#hp-bar {
  position: absolute;
  bottom: 24px;
  left: 16px;
  width: 280px;
  height: 22px;
  background: rgba(11, 13, 18, 0.75);
  border: 2px solid #2b2f3a;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

/* Doldurma — eni JS tərəfindən % ilə təyin olunur, rəngi də JS dəyişə bilər */
#hp-fill {
  width: 100%;                 /* başlanğıc; JS canı %-lə yeniləyir */
  height: 100%;
  background: linear-gradient(90deg, #2fae5a, #52d469); /* yaşıl (tam can) */
  transition: width 0.15s linear, background-color 0.2s linear;
}

/* Can rəqəmləri (HP çubuğunun üstündə) */
#hp-text {
  position: absolute;
  bottom: 24px;
  left: 16px;
  width: 280px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;  /* hər fonda oxunaqlı */
}

/* --- İnventar siyahısı (sol alt, can çubuğunun üstündə) ------------------ */
#inventory {
  position: absolute;
  bottom: 56px;
  left: 16px;
  width: 280px;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#inventory li {
  padding: 4px 8px;
  background: rgba(20, 22, 28, 0.85);
  border: 1px solid #3a3f4b;
  border-radius: 3px;
  font-size: 12px;
  text-transform: uppercase;
  color: #cdd2dc;
}

/* İnventar element tipinə görə rəng ipucu (sinif JS tərəfindən əlavə edilə bilər) */
#inventory li.item-sword  { color: #d9d9e0; border-color: #d9d9e0; }
#inventory li.item-shield { color: #8fb4ec; border-color: #5a8fd6; }
#inventory li.item-potion { color: #7ee093; border-color: #52d469; }

/* --- Məqsəd mətni (yuxarı orta) ----------------------------------------- */
#objective {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(11, 13, 18, 0.5);
  border-radius: 4px;
  color: #d7c98a;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* ============================================================================
   NİŞANGAH (ekranın tam mərkəzi — kiçik artı "+")
   ============================================================================ */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 11;
}

/* "+" işarəsini iki psevdo-element xətti ilə qururuq */
#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}

/* Şaquli xətt */
#crosshair::before {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

/* Üfüqi xətt */
#crosshair::after {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

/* ============================================================================
   BOSS ÇUBUĞU (yuxarı orta, qırmızı dolma) — default gizli
   game.js .hidden / display ilə göstərir
   ============================================================================ */
#boss-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 60vw;
  max-width: 640px;
  min-width: 320px;
  height: 26px;
  background: rgba(11, 13, 18, 0.85);
  border: 2px solid #8b1a2b;     /* COLOR_BOSS tünd qırmızı çərçivə */
  border-radius: 4px;
  overflow: hidden;
  z-index: 12;
  pointer-events: none;
  box-shadow: 0 0 14px rgba(139, 26, 43, 0.6);
  display: none;                 /* default gizli (JS göstərir) */
}

/* Boss canı dolması — eni JS %-lə təyin edir */
#boss-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #6e0f1c, #e0233f, #ff4d63);
  transition: width 0.15s linear;
}

/* Boss adı — çubuğun üstündə mərkəzdə */
#boss-name {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 4px #000, 0 0 6px #8b1a2b;
}

/* ============================================================================
   POINTER-LOCK BİLDİRİŞİ — tam ekran tünd overlay, böyük mərkəzi mətn
   Kilid aktiv olmayanda göstərilir. Kliki qəbul edir (pointer-events:auto),
   beləcə klik pointer lock-u tələb edir.
   ============================================================================ */
#pointer-lock-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 24px;
  background: rgba(7, 9, 13, 0.82);
  backdrop-filter: blur(2px);
  /* pointer-events:none — overlay heç bir kliki tutmasın; klik altdakı
     canvas-a düşsün ki, engine.js-dəki canvas 'click' dinləyicisi
     requestPointerLock() çağıra bilsin. Overlay-də klikləncək element yoxdur. */
  pointer-events: none;
  cursor: pointer;
  z-index: 30;
  color: #e6e9f0;
}

/* Overlay daxili başlıq və izah mətni üçün ümumi forma */
#pointer-lock-prompt h1,
#pointer-lock-prompt .plp-title {
  font-size: 42px;
  font-weight: bold;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #b9a8ff;
  text-shadow: 0 0 16px rgba(123, 92, 255, 0.7);
}

#pointer-lock-prompt p,
#pointer-lock-prompt .plp-sub {
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 1px;
  max-width: 560px;
  color: #aab0bd;
}

/* "Oynamaq üçün klikləyin" tipli vurğu sətri üçün yumşaq yanıb-sönmə */
#pointer-lock-prompt .plp-blink {
  animation: plp-pulse 1.4s ease-in-out infinite;
}

@keyframes plp-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ============================================================================
   MODALLAR — oyun-sonu (qırmızı) + qələbə (qızıl/yaşıl)
   default gizli; tünd backdrop üzərində mərkəzləşmiş kart
   ============================================================================ */
#game-over-modal,
#victory-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: none;                 /* default gizli; JS flex ilə göstərir */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  padding: 40px;
  background: rgba(5, 6, 9, 0.88);   /* tünd backdrop */
  backdrop-filter: blur(3px);
  pointer-events: auto;          /* modal düymələri klik qəbul etsin */
  z-index: 40;
}

/* Modalın "kart" görünüşü üçün başlıq/mətn/düymə ümumi çərçivə effekti.
   Strukturda kart konteyneri yoxdursa, başlıq+mətn birbaşa overlay üzərində
   düzgün görünəcək; aşağıdakı stillər hər iki halı dəstəkləyir. */

/* --- Oyun-sonu (qırmızı tema) ------------------------------------------- */
#game-over-modal h1 {
  font-size: 64px;
  font-weight: bold;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #ff4d63;
  text-shadow: 0 0 20px rgba(224, 35, 63, 0.8);
}

#game-over-modal p {
  font-size: 18px;
  letter-spacing: 1px;
  color: #d6b3b8;
}

#final-floor {
  color: #ffffff;
  font-weight: bold;
}

/* --- Qələbə (qızıl/yaşıl tema) ------------------------------------------ */
#victory-modal h1 {
  font-size: 64px;
  font-weight: bold;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #ffd86b;
  text-shadow: 0 0 22px rgba(201, 162, 39, 0.85);
}

#victory-modal p {
  font-size: 18px;
  letter-spacing: 1px;
  color: #bfe9c6;
}

/* ============================================================================
   YENİDƏN-BAŞLA DÜYMƏLƏRİ (#restart-btn, #restart-btn-win)
   ============================================================================ */
#restart-btn,
#restart-btn-win {
  pointer-events: auto;          /* mütləq klik qəbul etsin */
  cursor: pointer;
  margin-top: 12px;
  padding: 14px 34px;
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #0b0d12;
  border: none;
  border-radius: 6px;
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.15s ease;
}

/* Oyun-sonu düyməsi — qırmızı aksent */
#restart-btn {
  background: linear-gradient(180deg, #ff5e72, #d0223a);
  box-shadow: 0 0 16px rgba(224, 35, 63, 0.6);
}

/* Qələbə düyməsi — qızıl aksent */
#restart-btn-win {
  background: linear-gradient(180deg, #ffe08a, #d2a627);
  box-shadow: 0 0 16px rgba(201, 162, 39, 0.6);
}

#restart-btn:hover,
#restart-btn-win:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

#restart-btn:active,
#restart-btn-win:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

/* ============================================================================
   KİÇİK EKRANLAR ÜÇÜN UYĞUNLAŞMA
   ============================================================================ */
@media (max-width: 640px) {
  #hp-bar,
  #hp-text,
  #inventory {
    width: 200px;
  }

  #boss-bar {
    width: 88vw;
    min-width: 0;
  }

  #pointer-lock-prompt h1,
  #pointer-lock-prompt .plp-title {
    font-size: 30px;
  }

  #game-over-modal h1,
  #victory-modal h1 {
    font-size: 40px;
  }

  #objective {
    font-size: 13px;
  }
}
