/* Cosmic Tarot - Design System & Modern CSS Stylesheet */

/* 1. 디자인 시스템 변수 선언 */
:root {
  --bg-space: #07050f;
  --bg-card: rgba(18, 14, 35, 0.8);
  --bg-card-front: rgba(22, 17, 43, 0.95);
  --color-primary: #d4af37;        /* 신비로운 황금빛 (Metallic Gold) */
  --color-primary-rgb: 212, 175, 55;
  --color-secondary: #7f39fb;      /* 깊은 바이올렛 */
  --color-accent: #00f2fe;         /* 코스믹 사이언 (Glow Accent) */
  --color-accent-purple: #bf39fa;  /* 신비로운 마젠타 */
  --text-color: #f1ecff;
  --text-muted: #9f97b5;
  
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Outfit', sans-serif;
  
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-slow: 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-bg: rgba(11, 7, 24, 0.65);
  --gold-glow: 0 0 15px rgba(212, 175, 55, 0.35);
  --card-glow: 0 0 25px rgba(127, 57, 251, 0.3);
}

/* 2. 전역 스타일 및 레이아웃 초기화 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-space);
  color: var(--text-color);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 스크롤바 디자인 */
::-webkit-scrollbar {
  width: 8px;
}
.hidden {
  display: none !important;
}
::-webkit-scrollbar-track {
  background: rgba(7, 5, 15, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.6);
}

/* 3. 배경 효과 (별자리 및 성운 효과) */
.stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

/* 반짝이는 별 레이아웃 */
.star {
  position: absolute;
  background-color: #fff;
  border-radius: 50%;
  animation: twinkle infinite ease-in-out;
  opacity: 0;
  will-change: transform, opacity; /* 하드웨어 가속 컴포지팅 최적화 */
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

.nebula-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: 
    radial-gradient(circle at 10% 20%, rgba(127, 57, 251, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(191, 57, 250, 0.08) 0%, transparent 60%);
  filter: blur(80px);
}

/* 4. 공통 UI 컴포넌트 */

/* 컨트롤 패널 (헤더 아래 중앙 정렬) */
.top-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px auto 10px;
  z-index: 10;
  width: max-content;
  position: relative;
}

.icon-button {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 8px 16px;
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-smooth);
  /* Identity transforms */
  translate: 0px 0px;
  scale: 1;
}

.icon-button:hover {
  border-color: var(--color-primary);
  box-shadow: var(--gold-glow);
  scale: 1.05;
}

.icon-button:active {
  scale: 0.95;
}

.icon-button.sound-muted {
  opacity: 0.5;
  border-color: rgba(255, 255, 255, 0.1);
}

/* 신비로운 버튼 (Mystic Button) */
.mystic-button {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #561ebc 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 12px 32px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(127, 57, 251, 0.4);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  /* Identity transforms */
  translate: 0px 0px;
  scale: 1;
}

.mystic-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.mystic-button:hover::before {
  left: 100%;
}

.mystic-button:hover {
  box-shadow: 0 6px 20px rgba(127, 57, 251, 0.6), 0 0 10px rgba(0, 242, 254, 0.3);
  scale: 1.05;
  border-color: var(--color-accent);
}

.mystic-button:active {
  scale: 0.98;
}

.mystic-button.outline {
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  box-shadow: none;
}

.mystic-button.outline:hover {
  background: rgba(212, 175, 55, 0.1);
  box-shadow: var(--gold-glow);
  color: #fff;
}

.mystic-button.danger {
  background: linear-gradient(135deg, #c0392b 0%, #962d22 100%);
  box-shadow: 0 4px 15px rgba(192, 57, 43, 0.4);
}
.mystic-button.danger:hover {
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.6);
  border-color: #ff7675;
}

.text-button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.text-button:hover {
  color: #fff;
  text-shadow: var(--gold-glow);
}

/* 5. 앱 레이아웃 컨테이너 */
.app-container {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* 헤더 스타일 */
.app-header {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 40px;
}

.logo-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #fff 30%, var(--color-primary) 70%, #fff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(212, 175, 55, 0.3));
  margin-bottom: 8px;
}

.logo-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  font-weight: 300;
}

/* 6. 스프레드 종류 선택 섹션 (1단계) */
.spread-section {
  width: 100%;
  max-width: 900px;
  margin: auto;
  opacity: 1;
  transition: opacity 0.4s var(--transition-smooth);
}

.selection-card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  justify-content: center;
}

.spread-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px 30px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Identity transforms */
  translate: 0px 0px;
  scale: 1;
  rotate: 0deg;
}

.spread-card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% -20%, rgba(127, 57, 251, 0.4), transparent 70%);
  opacity: 0.4;
  transition: var(--transition-smooth);
}

.spread-card-icon {
  font-size: 3.5rem;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px rgba(127, 57, 251, 0.5));
  transition: var(--transition-smooth);
}

.spread-card-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 1px;
  transition: var(--transition-smooth);
}

.spread-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-weight: 300;
}

.spread-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--card-glow), var(--gold-glow);
  translate: 0 -10px;
}

.spread-card:hover .spread-card-icon {
  transform: scale(1.15) rotate(5deg);
}

.spread-card:hover .spread-card-title {
  color: var(--color-primary);
  text-shadow: var(--gold-glow);
}

.spread-card:hover .spread-card-glow {
  opacity: 0.8;
  background: radial-gradient(circle at 50% -20%, rgba(0, 242, 254, 0.4), transparent 70%);
}

/* 7. 메인 타로 보드 (2단계) */
.tarot-board {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  animation: fadeIn 0.6s ease-out;
}

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

.board-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.board-instruction {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-primary);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
  margin-top: 10px;
}

.action-bar {
  margin-bottom: 70px;
  position: relative;
  z-index: 100; /* 카드가 버튼 위로 올라와 덮는 것을 방지 */
}

/* 카드 덱 영역 */
.deck-wrapper {
  position: relative;
  width: 100%;
  min-height: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tarot-deck {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 900px;
  height: 280px;
  position: relative;
  transition: var(--transition-smooth);
}

/* 8. 3D 타로 카드 스타일 */
.tarot-card {
  width: 150px;
  height: 260px;
  position: absolute;
  cursor: pointer;
  border-radius: 12px;
  /* Identity transforms for hover states */
  translate: 0px 0px;
  scale: 1;
  rotate: 0deg;
  perspective: 1000px;
  transition: 
    translate 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
    rotate 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
    scale 0.3s ease,
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d; /* 상시 3D 활성화로 모바일 WebKit 동적 컴포지팅 씹힘 방지 */
  transition: transform var(--transition-slow), box-shadow 0.3s ease;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  /* Identity transforms */
  transform: rotateY(0deg);
  will-change: transform;
}

.tarot-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  backface-visibility: hidden !important; /* 상시 뒷면 감춤 적용으로 WebKit 하위 호환 확보 */
  -webkit-backface-visibility: hidden !important; /* 상시 뒷면 감춤 적용으로 WebKit 하위 호환 확보 */
}

/* 평소 뒤집히지 않았을 때는 앞면을 숨겨 뒷면이 2D 평면 위에 완벽히 노출되도록 제어 */
.tarot-card:not(.selected):not(.flipped) .card-front {
  display: none !important;
}

/* 카드 뒷면 */
.card-back {
  background: #0b0718 url('./assets/tarot_card_back.jpg') no-repeat center center;
  background-size: cover;
  border: 2px solid var(--color-primary);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.1), transparent 85%);
  pointer-events: none;
}

/* 카드 뒷면 */
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(0deg) translateZ(0px); /* 3D 공간 연산 정상 반영을 위해 기본 축 명시 */
  border-radius: 12px;
  overflow: hidden;
  background: #0b0718 url('./assets/tarot_card_back.jpg') no-repeat center center;
  background-size: cover;
  border: 2px solid var(--color-primary);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.1), transparent 85%);
  pointer-events: none;
}

/* 카드 앞면 (3D 카드 회전을 위해 overflow: hidden 및 masking 처리 원복) */
.card-front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg) translateZ(1px); /* translateZ(1px)로 Z축 우선 배치 보증 */
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card-front);
  border: 2px solid var(--color-primary);
  display: block;
}

/* 카드 내부 테두리 데코레이션 */
.card-border-deco {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
}

/* SVG 및 이미지 일러스트 컨테이너 (카드 크기에 맞게 100% 꽉 채움) */
.card-artwork {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 1;
}

.card-artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   카드 하단 정보 영역 (.card-info-under) 
   ========================================================================== */

/* 카드 정보 영역 (카드가 뒤집혔을 때만 서서히 노출) */
.card-info-under {
  position: absolute;
  bottom: -100px; /* 카드 바깥 아래쪽 영역 */
  left: 0;
  width: 100%;
  height: 90px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
}

/* 카드가 selected 되었거나 flipped 되었을 때만 설명 텍스트 노출 */
.tarot-card.flipped .card-info-under,
.tarot-card.selected .card-info-under {
  opacity: 1;
  pointer-events: auto;
}

/* 로마 숫자 */
.card-numeral {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* 한국어 카드 이름 */
.card-name-ko {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.5px;
  text-align: center;
}

/* 영어 카드 이름 */
.card-name-en {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

/* 방향 뱃지 */
.card-direction-badge {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--color-primary);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--color-primary);
  white-space: nowrap;
}

.card-direction-badge.reversed {
  background: rgba(191, 57, 250, 0.15);
  border-color: var(--color-accent-purple);
  color: #e585ff;
}

/* 카드 상호작용 상태 정의 */

/* 셔플 시 가운데로 모으는 레이아웃 정의 */
.tarot-deck.shuffling .tarot-card {
  left: 50% !important;
  translate: -50% 0px !important;
  rotate: 0deg !important;
  z-index: 1;
}

/* 셔플 애니메이션 4n 최적화 (전체 카드의 50%를 징검다리식으로 섞어 렉을 없애면서 전체가 섞이는 비주얼 유지) */
.tarot-deck.shuffling .tarot-card:nth-child(4n+1) {
  animation: shuffle-riffle-up 0.65s ease-in-out infinite;
}

.tarot-deck.shuffling .tarot-card:nth-child(4n+3) {
  animation: shuffle-riffle-down 0.65s ease-in-out infinite;
}

@keyframes shuffle-riffle-up {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(-15px, -80px, 40px) rotate(-4deg);
    z-index: 100;
  }
}

@keyframes shuffle-riffle-down {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(15px, 80px, -40px) rotate(4deg);
    z-index: -100;
  }
}

/* 마우스 호버 시 카드 들뜨는 효과 */
.tarot-card::after {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -40px; /* 카드가 위로 들려 올라갈 때 마우스 커서 영역을 잡고 있도록 연장 */
  background: transparent;
  pointer-events: auto;
  z-index: -1;
}

/* 마우스 호버를 지원하는 데스크톱 환경에서만 카드 솟구침 호버 효과 적용 */
@media (hover: hover) {
  .tarot-deck .tarot-card:not(.selected):not(.inactive):hover {
    transform: translateY(-40px) !important;
    rotate: 0deg !important;
    scale: 1.15 !important;
    z-index: 1000 !important;
  }

  .tarot-card:hover .card-inner {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), var(--gold-glow);
  }
}

/* 모바일 터치 드래그 훑어보기용 호버 스타일 */
.tarot-deck .tarot-card.mobile-hover {
  transform: translateY(-40px) !important;
  rotate: 0deg !important;
  scale: 1.15 !important;
  z-index: 1000 !important;
}
.tarot-card.mobile-hover .card-inner {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), var(--gold-glow);
}

/* 비활성화된 카드 (선택이 끝난 후 선택되지 않은 카드들) */
.tarot-card.inactive {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(40%);
}

/* 선택된 카드 */
.tarot-card.selected {
  scale: 1.05;
  z-index: 50 !important;
}
.tarot-card.selected .card-inner {
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.6), var(--gold-glow);
}

/* 9. 스프레드 슬롯 가이드 (3카드 점을 볼 때 위치) */
.spread-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-top: 30px;
  margin-bottom: 110px; /* 카드 바깥 아래쪽 텍스트를 위한 공간 확보 */
  width: 100%;
  max-width: 900px;
  animation: fadeIn 0.5s ease-out;
}

.spread-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 154px;
}

.slot-label {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 1px;
}

.slot-placeholder {
  width: 150px;
  height: 260px;
  border: 2px dashed rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
}

.slot-placeholder.active {
  border-color: var(--color-primary);
  background: rgba(212, 175, 55, 0.05);
  box-shadow: inset 0 0 15px rgba(212, 175, 55, 0.1);
}

.slot-connector {
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.4), rgba(212, 175, 55, 0.1));
  flex-grow: 1;
  max-width: 80px;
  margin-top: 130px;
}

/* 10. 해석 결과 패널 (Glassmorphism - 3단계) */
.reading-result-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  
  /* @starting-style 및 allow-discrete 애니메이션 */
  display: flex;
  opacity: 1;
  transition: 
    display 0.5s, 
    opacity 0.5s ease-out, 
    overlay 0.5s;
  transition-behavior: allow-discrete;
}

/* 진입 시작 상태 */
@starting-style {
  .reading-result-panel {
    opacity: 0;
  }
  .reading-result-panel .panel-content-wrapper {
    scale: 0.9;
    translate: 0 30px;
  }
}

/* 퇴장 및 숨김 상태 */
.reading-result-panel.hidden {
  display: none;
  opacity: 0;
}
.reading-result-panel.hidden .panel-content-wrapper {
  scale: 0.9;
  translate: 0 30px;
}

.panel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 3, 10, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel-content-wrapper {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px 30px;
  z-index: 10;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), var(--card-glow);
  display: flex;
  flex-direction: column;
  gap: 25px;
  
  /* 개별 트랜지션 바인딩 */
  scale: 1;
  translate: 0px 0px;
  transition: scale 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), translate 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.close-panel-btn {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.close-panel-btn:hover {
  color: #fff;
  transform: rotate(90deg);
}

.result-header {
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 15px;
}

.result-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--color-primary);
  letter-spacing: 2px;
  font-weight: 700;
}

.result-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* 카드별 상세 해석 레이아웃 */
.result-cards-display {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin: 15px 0;
}

.result-card-detail {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 24px;
  gap: 24px;
  align-items: center;
  transition: var(--transition-smooth);
}

.result-card-detail:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(212, 175, 55, 0.2);
}

/* 결과창 내 카드 미니어처 */
.result-card-preview {
  flex-shrink: 0;
  width: 120px;
  height: 208px;
  perspective: 1000px;
  margin-bottom: 75px; /* 하단 텍스트 공간 확보를 위해 여백 확보 */
}

.result-card-preview .tarot-card {
  position: relative;
  width: 100%;
  height: 100%;
  left: auto !important;
  translate: none !important;
  rotate: none !important;
  cursor: default;
  pointer-events: none;
}


/* 결과 프리뷰용 카드 하단 정보 영역 오프셋 튜닝 */
.result-card-preview .card-info-under {
  bottom: -80px !important;
  height: 75px !important;
  gap: 2px !important;
}

.result-card-preview .card-numeral {
  font-size: 0.65rem !important;
}

.result-card-preview .card-direction-badge {
  font-size: 0.55rem !important;
  padding: 2px 6px !important;
}

.result-card-preview .card-name-ko {
  font-size: 0.75rem !important;
}

.result-card-preview .card-name-en {
  font-size: 0.55rem !important;
}

/* 해석 텍스트 콘텐츠 */
.result-card-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-badge {
  align-self: flex-start;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-primary);
  background: rgba(212, 175, 55, 0.1);
  padding: 4px 12px;
  border-radius: 4px;
  border-left: 3px solid var(--color-primary);
  letter-spacing: 0.5px;
}

.card-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.card-full-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.card-keywords {
  font-size: 0.9rem;
  color: var(--color-accent);
  font-weight: 500;
}

.card-interpretation {
  font-size: 0.98rem;
  color: #e2dcf2;
  line-height: 1.7;
  font-weight: 300;
  margin-top: 5px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
}

/* 11. 기록 보관함 모달 패널 (4단계) */
.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  
  /* @starting-style 및 allow-discrete 애니메이션 */
  display: flex;
  opacity: 1;
  transition: 
    display 0.4s, 
    opacity 0.4s ease-out, 
    overlay 0.4s;
  transition-behavior: allow-discrete;
}

@starting-style {
  .history-panel {
    opacity: 0;
  }
  .history-panel .history-content-wrapper {
    translate: 100% 0px;
  }
}

.history-panel.hidden {
  display: none;
  opacity: 0;
}

.history-panel.hidden .history-content-wrapper {
  translate: 100% 0px;
}

.history-content-wrapper {
  position: relative;
  background: var(--glass-bg);
  border-left: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  max-width: 480px;
  height: 100%;
  padding: 40px 30px;
  z-index: 10;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 25px;
  
  /* Identity transforms */
  translate: 0px 0px;
  transition: translate 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.history-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--color-primary);
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 15px;
  margin-top: 15px;
  font-weight: 700;
}

.history-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-right: 5px;
}

.empty-history-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 40px;
  line-height: 1.6;
  font-weight: 300;
}

/* 저장 내역 카드 */
.history-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(212, 175, 55, 0.2);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-item-type {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 600;
}

.history-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-item-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.history-card-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.history-card-chip.gold-badge {
  border-color: rgba(212, 175, 55, 0.3);
  color: #ffeaa7;
}

.btn-delete-item {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  opacity: 0;
}

.history-item:hover .btn-delete-item {
  opacity: 1;
}

.btn-delete-item:hover {
  color: #ff7675;
}

.history-footer-actions {
  display: flex;
  justify-content: center;
}

/* 12. 푸터 스타일 */
.app-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  width: 100%;
}

.app-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-note {
  font-weight: 300;
  font-style: italic;
  font-size: 0.75rem !important;
}

/* 13. 반응형 미디어 쿼리 (반응형 최적화) */
/* 태블릿 및 일반 모바일 기기 (max-width: 768px) */
@media (max-width: 768px) {
  .top-controls {
    margin-top: 15px;
    margin-bottom: 5px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 10px;
  }

  .app-container {
    padding-top: 15px;
  }

  .logo-title {
    font-size: 2.2rem;
  }
  
  .logo-subtitle {
    font-size: 0.9rem;
  }

  /* 스프레드 선택 그리드 세로 1열 개편 */
  #spread-selection .selection-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    max-width: 320px;
    margin: 0 auto;
  }

  .spread-card {
    padding: 20px 15px;
  }

  /* 고민 주제 선택 그리드 가로 2열 개편 */
  #topic-selection .selection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
  }

  .topic-card {
    padding: 20px 10px;
  }

  .topic-card .spread-card-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  .topic-card .spread-card-title {
    font-size: 1rem;
  }

  /* 타로 보드 모바일 레이아웃 */
  .tarot-board {
    padding: 10px;
    gap: 20px;
  }

  .tarot-deck {
    height: 190px;
    margin-bottom: 10px;
  }

  /* 모바일용 셔플 애니메이션 진폭 축소 대응 (4n 패턴으로 50% 카드를 교차 셔플하여 렉 예방 및 전체 셔플 비주얼 유지) */
  .tarot-deck.shuffling .tarot-card:nth-child(4n+1) {
    animation: shuffle-riffle-up-mobile 0.65s ease-in-out infinite !important;
  }

  .tarot-deck.shuffling .tarot-card:nth-child(4n+3) {
    animation: shuffle-riffle-down-mobile 0.65s ease-in-out infinite !important;
  }

  .tarot-card {
    width: 100px;
    height: 173px;
  }

  /* 카드 내부 메타데이터 텍스트 스케일 조율 (모바일용 하단 간격 최적화) */
  .card-name-ko {
    font-size: 0.75rem !important;
    bottom: -56px !important;
  }

  .card-name-en {
    font-size: 0.55rem !important;
    bottom: -70px !important;
  }

  .card-numeral {
    font-size: 0.65rem !important;
    bottom: -20px !important;
  }

  .card-direction-badge {
    font-size: 0.55rem !important;
    padding: 2px 6px !important;
    bottom: -38px !important;
  }

  /* 슬롯 가로 3열 유지 및 폭 세이브 (모바일용 하단 여백 추가) */
  .spread-slots-container {
    gap: 12px;
    padding: 10px;
    margin-bottom: 90px;
  }

  .spread-slot {
    width: 105px;
  }

  .slot-placeholder {
    width: 100px;
    height: 173px;
  }

  .slot-label {
    font-size: 0.75rem;
  }

  /* 화살표 가로 연결선 숨겨서 슬롯 공간 극대화 확보 */
  .slot-connector {
    display: none !important;
  }

  /* 모달 리포트 본문 모바일화 */
  .modal-content {
    width: 95% !important;
    max-height: 90vh;
    padding: 20px 15px;
  }

  .modal-header h2 {
    font-size: 1.4rem;
  }

  .result-card-detail {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px;
  }

  .result-card-preview {
    margin: 0 auto 75px auto;
  }

  .result-card-text {
    width: 100%;
    align-items: center;
  }

  .card-full-name {
    font-size: 1.15rem;
    text-align: center;
  }

  .card-keywords {
    font-size: 0.75rem;
    text-align: center;
  }

  .premium-report-container {
    padding: 12px !important;
  }

  .report-sub-title {
    font-size: 0.95rem !important;
  }

  .report-text {
    font-size: 0.88rem !important;
    line-height: 1.65;
  }

  .report-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .result-actions {
    flex-direction: column;
    gap: 10px;
  }

  .panel-content-wrapper {
    padding: 25px 15px;
  }

  .result-title {
    font-size: 1.6rem;
  }

  /* 모바일 Riffle 셔플 키프레임 정의 */
  @keyframes shuffle-riffle-up-mobile {
    0%, 100% {
      transform: translate3d(0, 0, 0) rotate(0deg);
    }
    50% {
      transform: translate3d(-10px, -45px, 20px) rotate(-4deg);
      z-index: 100;
    }
  }

  @keyframes shuffle-riffle-down-mobile {
    0%, 100% {
      transform: translate3d(0, 0, 0) rotate(0deg);
    }
    50% {
      transform: translate3d(10px, 45px, -20px) rotate(4deg);
      z-index: -100;
    }
  }
}

/* 초소형 스마트폰 대응 (max-width: 480px) */
@media (max-width: 480px) {
  .logo-title {
    font-size: 1.8rem;
  }

  .logo-subtitle {
    font-size: 0.8rem;
  }

  /* 초소형 전용 카드 및 슬롯 미세화 */
  .tarot-deck {
    height: 160px;
  }

  .tarot-card {
    width: 85px;
    height: 147px;
  }

  .spread-slot {
    width: 90px;
  }

  .slot-placeholder {
    width: 85px;
    height: 147px;
  }

  .slot-label {
    font-size: 0.7rem;
  }

  /* 리포트 모달 너비 확보 */
  .modal-content {
    width: 98% !important;
    padding: 15px 10px;
  }

  .card-full-name {
    font-size: 1.05rem;
  }

  .report-text {
    font-size: 0.85rem !important;
  }
}

/* 사용자 접근성 (움직임 최소화 설정 반영) */
@media (prefers-reduced-motion: reduce) {
  .tarot-card {
    transition-duration: 0.1s !important;
    animation: none !important;
  }
  
  .spread-card:hover {
    translate: none !important;
  }

  .icon-button:hover, .mystic-button:hover {
    scale: 1 !important;
  }

  .card-inner {
    transition-duration: 0.1s !important;
  }

  .panel-content-wrapper, .history-content-wrapper {
    translate: none !important;
    scale: 1 !important;
    transition-duration: 0.1s !important;
  }
}

/* 14. 고민 주제 선택 카드 (Topic Card) 스타일 */
.topic-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 35px 25px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Reset default button styling */
  color: var(--text-color);
  font-family: var(--font-sans);
  scale: 1;
}

.topic-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--card-glow), var(--gold-glow);
  transform: translateY(-8px) !important;
}

.topic-card:hover .spread-card-icon {
  transform: scale(1.18) rotate(6deg);
}

.topic-card:hover .spread-card-title {
  color: var(--color-primary);
  text-shadow: var(--gold-glow);
}

/* 14.5. 선택 활성화 상태 스타일 (Active State) */
.spread-card.active, .topic-card.active {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 35px rgba(212, 175, 55, 0.6), var(--card-glow) !important;
  scale: 1.05 !important;
  background: rgba(212, 175, 55, 0.08) !important;
  transition: all 0.2s ease-out !important;
}

.spread-card.active .spread-card-title, .topic-card.active .spread-card-title {
  color: var(--color-primary) !important;
  text-shadow: var(--gold-glow) !important;
}

.spread-card.active .spread-card-icon, .topic-card.active .spread-card-icon {
  transform: scale(1.22) rotate(8deg) !important;
}

/* 15. 천기문 Flat-rate Premium Report 스타일 */
.premium-report-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(212, 175, 55, 0.03);
  border: 1px dashed rgba(212, 175, 55, 0.25);
  border-radius: 18px;
  padding: 24px;
  margin-top: 15px;
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.05);
}

.report-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 15px;
}

.report-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.report-sub-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-text {
  font-size: 0.96rem;
  color: #e2dcf2;
  line-height: 1.7;
  font-weight: 300;
  text-align: left;
}

.report-core-meaning {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
  text-align: left;
  border-left: 2px solid rgba(212, 175, 55, 0.3);
  padding-left: 8px;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.report-badge-gold {
  background: linear-gradient(135deg, #d4af37 0%, #aa8412 100%);
  color: #07050f;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: var(--gold-glow);
}

.report-keywords-line {
  font-size: 0.82rem;
  color: var(--color-accent);
  font-weight: 500;
}

/* ==========================================================================
   16. 모바일 전용 카드 포커스 및 확정 플로팅 버튼 스타일
   ========================================================================== */

/* 모바일 카드 선택 탭 시 솟구치는 포커스 스타일 */
.tarot-card.focused {
  transform: translateY(-90px) rotate(0deg) scale(1.22) !important;
  z-index: 1000 !important;
  box-shadow: 0 0 45px rgba(212, 175, 55, 0.95), var(--gold-glow) !important;
}

/* 모바일 전용 카드 선택 확정 플로팅 버튼 */
.btn-confirm-card {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #07050f;
  border: none;
  padding: 14px 35px;
  border-radius: 40px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.6), var(--gold-glow);
  cursor: pointer;
  z-index: 2000;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  animation: pulseConfirm 1.8s infinite;
}

.btn-confirm-card.hidden {
  display: none !important;
}

.btn-confirm-card:active {
  scale: 0.95 !important;
}

@keyframes pulseConfirm {
  0%, 100% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6), var(--gold-glow);
  }
  50% {
    transform: translateX(-50%) scale(1.06);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.95), var(--gold-glow);
  }
}

/* ==========================================================================
   17. 별자리/점성술 (Astrology/Horoscope) 전용 스타일
   ========================================================================== */

/* 폼 컨테이너 내 입력 필드 스타일 */
.mystic-form-container input,
.mystic-form-container select {
  transition: all 0.3s ease;
}
.mystic-form-container input:focus,
.mystic-form-container select:focus {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4), var(--gold-glow) !important;
  background: #191435 !important;
}

/* 네이탈 차트 SVG 스타일 및 링 회전 */
.chart-wheel-svg {
  width: 100%;
  height: 100%;
  max-width: 280px;
  max-height: 280px;
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.15));
}

.chart-ring-rotate {
  transform-origin: 150px 150px;
  animation: rotateZodiac 2.5s cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

@keyframes rotateZodiac {
  from {
    transform: rotate(180deg);
    opacity: 0.3;
  }
  to {
    transform: rotate(0deg);
    opacity: 1;
  }
}

/* 행성 마커 라인 그리기 페이드인 */
.chart-line-draw {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawLine 2s ease-out 1.2s forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

.chart-fade-in {
  opacity: 0;
  animation: fadeInSlow 1.2s ease-out 2s forwards;
}

@keyframes fadeInSlow {
  to {
    opacity: 1;
  }
}

/* 성운 게이지 진행 바 */
.energy-bar-group {
  display: flex;
  flex-direction: column;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 별자리 대시보드 구조 반응형 분기 */
@media (min-width: 769px) {
  .astro-row-main {
    flex-direction: row !important;
  }
  .astro-dashboard-wrapper {
    max-width: 900px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .astro-row-main {
    flex-direction: column !important;
    gap: 20px !important;
  }
  .chart-wheel-container,
  .astro-signs-summary {
    width: 100%;
  }
  .astro-safeguards {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .mystic-form-container {
    padding: 20px 15px !important;
  }
}

/* 다국어 카드 명칭 렌더링 분기 대응 */
body.lang-en .card-name-ko {
  display: none !important;
}

body.lang-en .card-name-en {
  display: block !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  margin-top: 4px;
  text-align: center !important;
}

body.lang-ko .card-name-en {
  /* 한국어 모드일 때는 영어를 서브로 작게 노출 */
  font-size: 0.7rem;
  color: var(--color-primary);
  text-align: center;
}


/* ==========================================================================
   15. 수익화 결제 유도 시스템 (Paywall & Interactive Blur)
   ========================================================================== */

/* 결과 텍스트 블러 및 그라데이션 가림 처리 */
.report-text-blur-wrapper {
  position: relative;
  max-height: 250px;
  overflow: hidden;
  transition: max-height 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
  mask-image: linear-gradient(to bottom, black 25%, rgba(0, 0, 0, 0.9) 45%, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, black 25%, rgba(0, 0, 0, 0.9) 45%, transparent 95%);
}

/* 잠금 해제 완료 시 Wrapper 높이 제한 해제 및 마스킹 제거 */
.report-text-blur-wrapper.unlocked {
  max-height: 2000px !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
}

.report-text.locked {
  filter: blur(5px);
  opacity: 0.35;
  user-select: none;
  pointer-events: none;
  transition: filter 0.8s ease, opacity 0.8s ease;
}

.report-text.unlocked {
  filter: blur(0px) !important;
  opacity: 1 !important;
  user-select: auto !important;
  pointer-events: auto !important;
}

/* 자물쇠 인터랙티브 컨테이너 */
.lock-container {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.5s ease, transform 0.3s ease;
}

.lock-container.unlocked {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate(-50%, -60%) scale(0.8) !important;
}

.lock-icon {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, #1a1333 30%, #0d0a1b 90%);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4), var(--gold-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lock-container:hover .lock-icon {
  transform: scale(1.08);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.6), var(--gold-glow);
}

.lock-label {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
  background: rgba(13, 10, 27, 0.85);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* 자물쇠 진동 애니메이션 */
@keyframes shakeLock {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  15% { transform: translate(-54%, -48%) rotate(-5deg); }
  30% { transform: translate(-46%, -52%) rotate(5deg); }
  45% { transform: translate(-53%, -51%) rotate(-3deg); }
  60% { transform: translate(-47%, -49%) rotate(3deg); }
  75% { transform: translate(-51%, -50%) rotate(-1deg); }
  90% { transform: translate(-49%, -50%) rotate(1deg); }
  100% { transform: translate(-50%, -50%) rotate(0deg); }
}

.lock-container.shake {
  animation: shakeLock 0.4s ease-in-out;
}

/* 결제 모달 팝업 오버레이 */
.paywall-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.paywall-panel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 5, 15, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.paywall-card {
  position: relative;
  width: 90%;
  max-width: 520px;
  background: linear-gradient(135deg, rgba(23, 17, 45, 0.85) 0%, rgba(13, 9, 27, 0.95) 100%);
  border: 2px solid rgba(212, 175, 55, 0.35);
  border-radius: 28px;
  padding: 35px 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 175, 55, 0.15);
  z-index: 10;
  text-align: center;
  animation: scaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}

/* 닫기 버튼 */
.paywall-close {
  position: absolute;
  top: 20px;
  right: 22px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s;
  line-height: 1;
}

.paywall-close:hover {
  color: #fff;
  transform: rotate(90deg);
}

/* 페이월 헤더 */
.paywall-badge {
  display: inline-block;
  background: linear-gradient(90deg, #d4af37, #f3e5ab, #d4af37);
  background-size: 200% auto;
  color: #07050f;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.68rem;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 1.5px;
  margin-bottom: 15px;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
  animation: shimmerSweep 3s linear infinite;
}

.paywall-card h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.paywall-subtitle {
  font-size: 0.9rem;
  color: #ffeaa7;
  line-height: 1.5;
  margin-bottom: 25px;
}

.paywall-options-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

/* 구독 카드 (Primary CTA - 고대비 골드 3D 디자인) */
.paywall-premium-option {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.9) 0%, rgba(184, 134, 11, 0.95) 100%);
  border: none;
  border-radius: 20px;
  padding: 22px 24px;
  color: #07050f;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(212, 175, 55, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.25s ease;
}

.paywall-premium-option:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 15px 30px rgba(212, 175, 55, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.option-glow-glow {
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: shineSweep 4s infinite linear;
}

@keyframes shineSweep {
  0% { left: -150%; }
  35% { left: 150%; }
  100% { left: 150%; }
}

.option-meta {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #573e00;
  margin-bottom: 4px;
}

.option-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.option-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.2px;
}

.option-price {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.25rem;
  border-left: 1px solid rgba(87, 62, 0, 0.2);
  padding-left: 12px;
}

.option-desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: #2b1f00;
  font-weight: 500;
}

/* 단일 결제 옵션 (Secondary CTA - 저대비 고스트 디자인) */
.paywall-single-option {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 15px 20px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-align: left;
}

.paywall-single-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(212, 175, 55, 0.3);
  color: #fff;
}

.single-title {
  font-size: 0.85rem;
  font-weight: 500;
}

.single-price {
  font-size: 0.9rem;
  font-weight: 700;
}

/* 페이월 푸터 */
.paywall-footer-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 15px;
}

/* 골드 쉬머 스위프 애니메이션 */
@keyframes shimmerSweep {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 로딩 인디케이터 연출 */
.paywall-loading {
  pointer-events: none;
  opacity: 0.7;
}

.paywall-loading .paywall-premium-option {
  background: #b8860b !important;
}

/* 리텐션 훅 알림 배너 스타일 */
.retention-hook-banner {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(0, 242, 254, 0.05) 100%);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  padding: 16px;
  margin-top: 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  animation: fadeInUp 0.6s ease-out;
  text-align: left;
}

.retention-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.5));
}

.retention-body {
  flex-grow: 1;
}

.retention-title {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--color-primary);
  font-weight: 700;
  margin-bottom: 2px;
}

.retention-desc {
  font-size: 0.78rem;
  color: #ffeaa7;
  line-height: 1.4;
}

/* ==========================================================================
   16. 모바일 대응 반응형 페이월
   ========================================================================== */
@media (max-width: 768px) {
  .paywall-card {
    padding: 30px 20px;
    width: 92%;
  }

  .paywall-card h2 {
    font-size: 1.35rem;
  }

  .paywall-subtitle {
    font-size: 0.8rem;
    margin-bottom: 20px;
  }

  .paywall-premium-option {
    padding: 16px 18px;
  }

  .option-title {
    font-size: 1rem;
  }

  .option-price {
    font-size: 1.05rem;
    padding-left: 8px;
  }

  .option-desc {
    font-size: 0.72rem;
  }

  .paywall-single-option {
    padding: 12px 15px;
  }

  .single-title {
    font-size: 0.78rem;
  }

  .single-price {
    font-size: 0.82rem;
  }
}

/* --- 9. 회원가입 및 결제/별가루 시스템 관련 신규 스타일 --- */
.user-stars {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.user-stars.hidden {
  display: none !important;
}

.tab-btn {
  transition: color 0.3s ease, border-color 0.3s ease;
}

.tab-btn:hover {
  color: #fff !important;
}

.auth-form-container {
  animation: fadeIn 0.4s ease;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.7;
  }
}

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

.auth-tabs button.active {
  color: #fff !important;
  border-bottom: 2px solid var(--color-primary) !important;
}

.auth-tabs button:not(.active) {
  color: var(--text-muted) !important;
  border-bottom: 2px solid transparent !important;
}

/* 모바일 전용 top-controls 스택 튜닝 */
@media (max-width: 600px) {
  .top-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .user-stars {
    order: -1; /* 모바일에서 별가루 개수를 최상단 중앙에 잘 보이도록 순서 조절 */
    width: 100%;
    justify-content: center;
  }
}

