/* 4AM MINI GAME MINIMAL PORTAL STYLES (고성능 모바일 최적화) */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: #080711;
  color: #ffffff;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* 앰비언트 배경 조명 (GPU 부하 제로 - radial-gradient 자체 페이드 + 하드웨어 가속) */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transform: translateZ(0);
  will-change: transform;
}

.glow-top {
  top: -120px;
  left: 20%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(243, 156, 18, 0.45) 0%, rgba(112, 161, 255, 0.2) 45%, transparent 70%);
}

.glow-bottom {
  bottom: -120px;
  right: 20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 71, 87, 0.4) 0%, rgba(238, 213, 52, 0.2) 45%, transparent 70%);
}

/* 메인 컨테이너 */
#portal-container {
  width: 100%;
  max-width: 880px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 30px 20px 120px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* 깔끔한 메인 타이틀 */
#portal-header {
  text-align: center;
  margin-bottom: 35px;
}

.portal-title {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #eed534 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 25px rgba(238, 213, 52, 0.25);
}

/* 캐릭터 스테이지 (완벽한 상하/좌우 정렬 그리드) */
#character-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 45px);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

/* 개별 캐릭터 아이템 (정사각형 고정 박스) */
.character-item {
  width: clamp(140px, 22vw, 190px);
  height: clamp(140px, 22vw, 190px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

/* 캐릭터 뒤 은은한 스포트라이트 조명 */
.character-spotlight {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  width: 105%;
  height: 105%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--theme-color, #eed534) 0%, transparent 70%);
  opacity: 0.18;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

/* 실제 캐릭터 얼굴 이미지 (완벽한 중앙 배치 및 핏) */
.character-face {
  max-width: 92%;
  max-height: 92%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  position: relative;
  z-index: 2;
  transition: filter 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: block;
}

/* ========================================================= */
/* [1] 오픈 완료 상태 (즉시 클릭 & 부드러운 호버) */
/* ========================================================= */
.character-item.unlocked {
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.character-item.unlocked:hover {
  transform: translateY(-6px) scale(1.05);
}

.character-item.unlocked .character-face {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  transform: translateZ(0);
}

.character-item.unlocked:hover .character-spotlight {
  opacity: 0.38;
  transform: translate(-50%, -50%) scale(1.15) translateZ(0);
}

.character-item.unlocked:hover .character-face {
  filter: drop-shadow(0 8px 18px var(--theme-glow, rgba(238, 213, 52, 0.45)));
}

.character-item.unlocked:active {
  transform: scale(0.97);
}

/* ========================================================= */
/* [2] 잠금 상태 (클릭 100% 차단 + 코난 실루엣) */
/* ========================================================= */
.character-item.locked {
  cursor: default;
  pointer-events: none;
}

.character-item.locked .character-spotlight {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0.15;
}

.character-item.locked .character-face {
  filter: brightness(0) invert(0.12) drop-shadow(0 4px 14px rgba(255, 255, 255, 0.25));
  opacity: 0.9;
  transform: scale(0.96) translateZ(0);
}

/* COMING SOON 영문 텍스트 */
.coming-soon-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  font-size: clamp(12.5px, 2.2vw, 15px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #f1f2f6;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.95);
}

/* 모바일 화면 조정 */
@media (max-width: 600px) {
  #character-stage {
    gap: 14px;
  }

  .character-item {
    width: 100px;
    height: 100px;
  }

  .coming-soon-badge {
    font-size: 8.5px;
    letter-spacing: 1.5px;
  }

  #portal-header {
    margin-bottom: 30px;
  }
}

/* ---------- 오픈 여부 판정 대기 (초경량 GPU 애니메이션) ---------- */
@keyframes silhouetteBreath {
  0%, 100% {
    opacity: 0.7;
    transform: scale(0.96) translateZ(0);
  }
  50% {
    opacity: 0.95;
    transform: scale(0.97) translateZ(0);
  }
}

.character-item.pending .character-face {
  filter: brightness(0) invert(0.12) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7));
  opacity: 0.85;
  transform: scale(0.96) translateZ(0);
  animation: silhouetteBreath 1.6s ease-in-out infinite;
  will-change: opacity, transform;
}
