/* 맞춤 운세 모달 스타일 */
.fortune-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.fortune-modal-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.fortune-modal-container {
  position: relative;
  width: 669px;
  height: 453px;
  background-image: url('../images/br_msgbox.png');
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.4s ease-out;
  display: flex;
  flex-direction: column;
  padding: 60px 40px 40px 40px;
}

.fortune-modal-close {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.fortune-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);  
}

.fortune-modal-header {
  text-align: center; 
  margin:25px 0 0 0;
}

.fortune-modal-title {
  font-family: 'DnfTemperedBlade';  
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 5px rgba(66, 18, 21, 1);
  margin-bottom: 10px;
  letter-spacing: -1px;
}

.fortune-modal-subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
}

.fortune-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 0px;

}

.birth-input-group {
  width: 100%;
  max-width: 400px;
  margin-bottom: 10px;
}

.birth-label {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
  font-weight: 500;
  letter-spacing: 1px;
}

.birth-input-wrapper {
  position: relative;
}

.birth-input {
  font-family: 'DnfTemperedBlade';  
  width: 100%;
  height: 60px;
  background: #260c0c;
  border: 1px solid #752828;
  border-radius: 12px;
  padding: 0 20px;
  font-size: 24px;
  color: #fff;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  font-weight: 600;
}

.birth-input:focus {
  outline: none;
  background: #260c0c;
  border-color: #752828;  
}

.birth-input::placeholder {
  font-family: 'DnfTemperedBlade';
  color: #ae3737;
  font-weight: 400;
  letter-spacing: 1px;
}

.input-hint {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.fortune-submit-btn {
  width: 200px;
  height: 50px;
  background: #d19948;
  border: 1px solid #fcf6b6;
  border-radius: 25px;
  color: #fffdf4;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;  
  letter-spacing: 1px;
  text-shadow: 0 1px 0px rgba(144, 105, 49, 1);
  box-shadow: 0 5px 0px rgba(176, 108, 10, 1);

}

.fortune-submit-btn:hover {
  transform: translateY(-1px);  
  background: #f3bb6a;;
}

.fortune-submit-btn:active {
  transform: translateY(0);
}

/* 확인 모달 */
.confirm-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.confirm-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.confirm-box {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 30px;
  width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modalSlideUp 0.3s ease-out;
}

.confirm-message {
  font-size: 18px;
  color: #fff;
  margin-bottom: 25px;
  line-height: 1.6;
}

.confirm-birth-display {
  font-size: 24px;
  font-weight: 700;
  color: #60a5fa;
  margin: 15px 0;
  letter-spacing: 2px;
}

.confirm-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.confirm-btn {
  flex: 1;
  height: 45px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.confirm-btn-yes {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #fff;
}

.confirm-btn-yes:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-2px);
}

.confirm-btn-no {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.confirm-btn-no:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 로딩바 스타일 */
.ft-loading-wrapper {
    width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-left: 10px;
}

.ft-loading-bar {
    width: 0%;
    height: 100%;
    background: #ff3333;
    box-shadow: 0 0 10px #ff3333;
    transition: width 0.8s linear;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.ft-label {   
  font-size: 12px;
  color: #01ea7f;
  background: rgba(107, 107, 255, 0.1);
  padding: 4px 10px;
  border-radius: 10px;
  border:1px solid #232675; 
}

/* 숫자 나타날 때 효과 */
.number-ball.red .number-value {
    transition: all 0.2s;
}

.number-ball.red.final {
    animation: ft-pop 0.3s ease-out;
}

@keyframes ft-pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 애니메이션 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 결과 모달 전체 레이아웃 */
.ft-result-overlay {  
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important; /* 화면 높이에 딱 고정 */
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.9) !important;
    display: flex !important;
    align-items: center !important;    /* 수직 중앙 */
    justify-content: center !important;  /* 수평 중앙 */
    z-index: 10001 !important;
    overflow: hidden !important; /* 부모에게 스크롤이 생기는 걸 원천 차단 */
  
  /* 초기 상태: 숨김 */
  visibility: hidden;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* 활성화 상태 */
.ft-result-overlay.active {
  visibility: visible;
  opacity: 1;
}

/* 2. 컨테이너: 강제로 높이를 꺾어버리는 설정 */
.ft-result-container {
    box-sizing: border-box !important;
    background: #1a0505 !important;
    border: 2px solid #ff3333 !important;
    border-radius: 20px !important;
    width: 100% !important;
    max-width: 500px !important;    
    
    /* 🔥 화면의 80%만 차지하도록 강제 (이미지의 845px를 무시하게 됨) */
    height: auto !important;
    max-height: 90vh !important; 
    
    /* 🔥 내부 스크롤을 절대적으로 허용 */
    overflow-y: auto !important; 
    display: flex !important;
    flex-direction: column !important;
    
    padding:40px 30px;
    margin: 20px; /* 부모가 flex이므로 margin은 0 */    
    position: relative !important;
    
    /* 애니메이션 */
    transition: transform 0.4s ease, opacity 0.4s ease !important;
}

/* 3. 활성화 시점 (부모에 active 붙을 때) */
.ft-result-overlay.active .ft-result-container {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    visibility: visible !important;
}

.ft-result-container_backup{
  background: #1a0505 !important;
  border: 2px solid #ff3333 !important;
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  padding: 40px 30px;
  position: relative;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(255, 0, 0, 0.3);
  
  /* 부드러운 팝업 효과: 살짝 아래에서 위로 */
  transform: translateY(40px) scale(0.95);
  transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
}

/* 행운번호(Lucky Ball) 화려한 강조 */
.number-ball.red.ft-lucky-ball {
  background: radial-gradient(circle at 30% 30%, #ff0000, #660000) !important;
  border: 2px solid #fff !important;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8), inset 0 0 10px rgba(255,255,255,0.5) !important;
  transform: scale(1.15);
  animation: lucky-glow 1.5s infinite alternate;
}

@keyframes lucky-glow {
  from { box-shadow: 0 0 5px #fff; }
  to { box-shadow: 0 0 5px #ff3333, 0 0 5px #fff; }
}

/* 하단 버튼 디자인 */
.ft-footer-buttons {
  display: flex;
  gap: 12px;
  margin-top: 0px;
  padding: 0px;
}

.ft-btn {
  flex: 1;  
  border-radius: 12px;
  font-weight: 300;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}

.btn-retrys {
  background: #d19948;
  border:1px solid #fcf6b6;
  color: #fdf9f9;  
  text-shadow: 0px 2px 0px rgba(0, 0, 0, 0.9);
}

.btn-close {
  background: #2a0a0a;
  color: #ff8888;
  border: 1px solid #4a1a1a;
}

.ft-btn:hover {  
  filter: brightness(1.2);
}

/* X 버튼 위치 조정 */
.ft-close-btn {
  position: absolute;
  top: 15px; right: 20px;
  background: none; border: none;
  color: #666; font-size: 30px;
  cursor: pointer; z-index: 10;
}

/* 숫자 공들이 main.css 영향을 안 받게 강제 설정 */
.ft-result-container .number-ball.red {
  display: inline-flex !important;
  width: 40px !important;
  height: 40px !important;
  background: radial-gradient(circle at 30% 30%, #ff4d4d, #800000) !important;
  color: white !important;
  border-radius: 50% !important;
  justify-content: center !important;
  align-items: center !important;
  font-weight: bold !important;
  margin: 5px !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5) !important;
}

/* 추가요청 작업 */
/* 행운의 아이콘 (AI 아이콘의 운세 버전) */
.ft-icon {
  width: 40px; height: 40px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, #ff3333 0%, #4a0000 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'kbl'; font-size: 12px; color: #fff;
  position: relative;
  animation: ftPulse 2s ease-in-out infinite;
}

/* 아이콘 영역 (로딩 후 사라질 때 애니메이션용) */
.ft-icon {  
  transition: all 0.5s ease;
  opacity: 1;
  transform: scale(1);
}

/* 로딩 중 닫기 버튼 숨기기 */
.ft-close-btn {
  display: none; /* 기본적으로 숨김 */
}

.ft-pulse-ring {
  position: absolute;
  width: 100%; height: 100%;
  border: 2px solid #ff3333;
  border-radius: 50%;
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes ftPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 51, 51, 0.5); }
  50% { box-shadow: 0 0 40px rgba(255, 51, 51, 0.8); }
}

/* 로딩바 붉은색 테마 */
.ft-status-bar {
  width: 100%; height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 10px;
}

.ft-status-progress {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, #ff3333 0%, #aa0000 100%);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.5);
}

/* 로딩 문구가 바뀔 때 부드럽게 나타나는 효과 */
/* 보너스: 문구가 바뀔 때 신비롭게 나타나는 효과 */
.ft-status-text {
  font-family:"DnfTemperedBlade";
  text-align: center !important;
  color: #ff8888 !important; /* 연한 붉은색 */
  font-size: 18px !important;
  font-weight: 500 !important;
  min-height: 20px;
  margin-top: 0px;
  /* 애니메이션 적용 */
  animation: ftFadeIn 0.8s ease-in-out infinite alternate;
}

@keyframes ftFadeIn {
  0% { opacity: 0.5; transform: translateY(1px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 마지막 문구 강조 애니메이션 */
.ft-status-text.complete {
  color: #ffffff !important;
  font-weight: bold;
  text-shadow: 0 0 10px #ff3333, 0 0 20px #ff3333;
  animation: ftFinalGlow 1.5s infinite alternate;
}

@keyframes ftFinalGlow {
  from { opacity: 0.8; transform: scale(1); }
  to { opacity: 1; transform: scale(1); }
}

/* 상태바 영역 사라짐 효과 */
.ft-analysis-status {
  transition: opacity 0.5s ease;
  margin-bottom:20px;
}


/* 번호 공 크기 및 스타일 통일 (AI 모달과 일치) */
.ft-numbers-grid {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.ft-ball {
  width: 50px; height: 50px; /* AI 공 크기에 맞춤 */
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron'; font-size: 20px; font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ff4d4d 0%, #800000 100%);  
  opacity: 0; transform: scale(0.5);
  box-shadow:     
  animation: numberPop 0.3s ease-out;
  text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.6);  
}

/* 공이 등장할 때 커졌다가 작아지는 효과 */
@keyframes ballWave {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; } /* 1.3배까지 커졌다가 */
  100% { transform: scale(1); opacity: 1; }  /* 원래 크기로 */
}

.ft-ball.show-ball {
  animation: ballWave 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
  /*animation: ftNumberPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;*/
}

/* 번호 확정 시 살짝 반짝이는 효과 (선택사항) */
.ft-ball.final {
  transition: all 0.3s ease;
  transform: scale(1.05); /* 확정된 번호는 아주 살짝 크게 */
}

@keyframes ftNumberPop {
  to { opacity: 1; transform: scale(1); }
}

#ftGamesContainer {   
  display: flex;
  flex-direction: column;
  gap: 15px;  
  transition: all 0.5s ease-in-out;  
}

.ft-game-card {
  background: rgba(42, 10, 10, 0.6);
  border: 1px solid #551111;
  border-radius: 12px;
  padding: 0 20px;      /* 높이가 0일 땐 패딩도 세로값은 0으로 */
  opacity: 0;
  max-height: 0;        /* 높이 봉인 */
  overflow: hidden;     /* 내용물 봉인 */
  transform: translateY(20px); /* 아래에서 위로 올라오는 효과용 */
  transition: 
    max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
    padding 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 자바스크립트에서 클래스가 붙으면 활성화 (보임 상태) */
.ft-game-card.show-card {
  opacity: 1;
  max-height: 300px;    /* 넉넉하게 카드 높이 확보 */
  padding: 20px;       /* 원래 패딩 복구 */
  transform: translateY(0);
  margin-bottom: 5px;   /* 카드 사이 간격 보조 */
}

.ft-game-card_backup {
  background: rgba(42, 10, 10, 0.6) !important;
  border: 1px solid #551111 !important;
  border-radius: 15px !important;
  margin-bottom: 15px !important;
  opacity: 0;
  max-height: 0; /* 평소엔 0 */
  overflow: hidden;
  transform: translateY(20px);
  transition: all 0.8s ease-in-out;
  padding: 0 20px; /* 닫혔을 땐 세로 패딩 0 */
}

/* 등장 시 상태 */
.ft-game-card_backup.show-card {
  max-height: 600px !important; /* 충분히 크게! */
  opacity: 1 !important;
  padding: 20px !important;
  transform: translateY(0) !important;
}


/* 닫기 버튼 레이어 우선순위 */
.ft-close-btn {
  z-index: 2100 !important;
  cursor: pointer;
}

/* 닫기 및 하단 버튼 클릭 활성화 */
.ft-btn, .ft-close-btn {
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 2200 !important; /* 모달 컨테이너보다 위에 배치 */
  padding: 14px 0;
}

/* 푸터 버튼 서서히 나타나기 */
.ft-footer-buttons {
  display: flex;
  gap: 15px;
  margin-top: 2px;
  padding: 0;
  /*border-top: 1px solid rgba(255, 255, 255, 0.05);*/
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
}

.checkbox-input { margin-right:5px; }
.remember-checkbox { font-family:'Pretendard'; font-size:14px; color:#d19948; display:flex; justify-content:center; }

/* 반응형 */
@media (max-width: 768px) {
  .fortune-modal-container {
    width: 90%;
    height: auto;
    min-height: 400px;
    padding: 30px 20px;
  }

  .fortune-modal-title {
    font-size: 24px;
    letter-spacing:-1px;
  }

  .birth-input {
    font-size: 20px;
    height: 55px;
  }

  .confirm-box {
    width: 90%;
    padding: 25px;
  }

  .confirm-birth-display {
    font-size: 20px;
  }
  .ft-result-container {
    margin: 20px;
    padding: 30px 20px;
  }

  .ft-numbers-grid { gap: 8px; }

  .ft-ball{
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
}

/* 반응형 - 작은 모바일 */
@media (max-width: 480px) {
  .ft-numbers-grid { gap: 8px; }

  .ft-game-card.show-card {    
  padding: 10px;       /* 원래 패딩 복구 */
}

  .ft-ball{
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .ft-footer-buttons {
    gap: 10px;
  }
  .ft-btn { font-size: 14px;
        padding: 12px 0; }

  .ft-label {
  font-size: 10px;  
  }

  .fortune-modal-container {
  position: relative;
  width:100%;
  height: 400px;
  background-image: url('../images/br_msgbox_s.png');
  background-size: cover;
  background-position: center;  
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp 0.4s ease-out;
  display: flex;
  flex-direction: column;
  padding: 60px 40px 20px 40px;
}

}

/* 모달 컨테이너 스크롤바 */
/* 스크롤바 레드 테마 */
#aiModal .modal-container::-webkit-scrollbar-button {
  display: none; /* 위아래 화살표 제거 */
}

/* 2. 운세 결과 모달 (ft-result-container) - 심플한 붉은색 */
#fortuneResultModal .ft-result-container::-webkit-scrollbar {
  width: 6px;
}

#fortuneResultModal .ft-result-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

#fortuneResultModal .ft-result-container::-webkit-scrollbar-thumb {
  background: #c3202f; /* 심플한 붉은색 */
  border-radius: 10px;
}

#fortuneResultModal .ft-result-container::-webkit-scrollbar-button {
  display: none; /* 위아래 화살표 제거 */
}