/* 플레이어 스탯 UI 스타일 */
#player-portrait {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e94560;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 10px;
  border: 2px solid #fff;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

#player-portrait:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(233, 69, 96, 0.8);
}

#player-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#player-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
}

#player-stats-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#player-stats-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.player-stats-container {
  background-color: #16213e;
  border: 2px solid #e94560;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  max-height: 80%;
  overflow-y: auto;
  padding: 20px;
  color: white;
  position: relative;
}

.player-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #e94560;
  padding-bottom: 10px;
}

.player-stats-header h2 {
  margin: 0;
  color: #e94560;
}

.close-stats-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.player-level-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background-color: rgba(233, 69, 96, 0.2);
  padding: 10px;
  border-radius: 5px;
}

.player-level {
  font-size: 1.2rem;
  font-weight: bold;
}

.player-exp-bar {
  width: 100%;
  height: 10px;
  background-color: #0f3460;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 5px;
}

.player-exp-fill {
  height: 100%;
  background-color: #e94560;
  transition: width 0.3s ease;
}

.player-stats-list {
  margin-bottom: 20px;
}

.player-stat-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 5px;
  border-radius: 3px;
}

.player-stat-item:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.05);
}

.player-equipment {
  margin-top: 20px;
}

.player-equipment h3 {
  color: #e94560;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
}

.equipment-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.equipment-slot:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.equipment-slot-name {
  font-weight: bold;
  color: #aaa;
}

.equipment-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.equipment-item-name {
  font-weight: bold;
}

.equipment-item-stats {
  font-size: 0.8rem;
  color: #aaa;
}

/* 희귀도별 색상 */
.rarity-common {
  color: #aaaaaa;
}

.rarity-uncommon {
  color: #1a9c1a;
}

.rarity-rare {
  color: #0070dd;
}

.rarity-legendary {
  color: #ff8000;
}

/* 크리티컬 히트 효과 */
.critical-hit {
  color: #ff0000;
  font-weight: bold;
  font-size: 1.5em;
  animation: criticalPulse 0.5s ease-out;
}

@keyframes criticalPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 레벨업 효과 */
.level-up-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(233, 69, 96, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 1000;
  animation: levelUpPulse 1.5s ease-out forwards;
}

.level-up-text {
  font-size: 2rem;
  font-weight: bold;
  color: #e94560;
  text-shadow: 0 0 10px rgba(233, 69, 96, 0.8);
  animation: levelUpText 1.5s ease-out forwards;
}

@keyframes levelUpPulse {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes levelUpText {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  20% {
    transform: scale(1.2);
    opacity: 1;
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* HP 바 컨테이너의 높이를 증가시키고 상대 위치로 설정 */
.hp-bar-container {
  width: 100%;
  height: 16px; /* 8px에서 16px로 증가 */
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
  position: relative; /* 자식 요소의 절대 위치 기준점 */
}

/* HP 텍스트를 절대 위치로 설정하여 HP 바 위에 겹치게 표시 */
.hp-text {
  font-size: 0.9rem;
  font-weight: bold;
  position: absolute; /* 절대 위치로 설정 */
  top: 50%; /* 컨테이너의 중앙에 위치 */
  left: 0;
  width: 100%;
  transform: translateY(-50%); /* 정확한 수직 중앙 정렬 */
  text-align: center;
  z-index: 5; /* 상위 레이어에 표시 */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* 가독성을 위한 텍스트 그림자 */
  color: white; /* 텍스트 색상 */
}

/* HP 바 스타일 유지 */
#hp-bar {
  height: 100%;
  background: linear-gradient(to right, #f44336, #e94560);
  transition: width 0.3s ease;
}

.player-stats-summary {
  display: flex;
  flex-direction: column;
  width: calc(100% - 50px);
}

#hp-container {
  margin-bottom: 2px;
  position: relative; /* 자식 요소의 절대 위치 기준점 */
}

/* 플레이어 정보 컨테이너 구조 수정 */
.player-info-container {
  display: flex;
  align-items: center;
  width: 100%;
}
