/* ==========================================
   Design System & Custom Properties
   ========================================== */
:root {
  --color-bg-space: #070714;
  --color-navy-deep: #0a0b1e;
  --color-purple-dark: #150d2a;
  --color-purple-mid: #251845;
  --color-violet-glow: #8e44ad;
  --color-violet-light: #bb86fc;
  --color-gold: #ffd700;
  --color-gold-glow: rgba(255, 215, 0, 0.4);
  --color-text-primary: #ffffff;
  --color-text-secondary: #b3b3cc;
  --color-glass-bg: rgba(255, 255, 255, 0.05);
  --color-glass-border: rgba(255, 255, 255, 0.1);
  --font-family: 'Outfit', 'Noto Sans KR', sans-serif;
  --transition-speed: 0.3s;
}

/* ==========================================
   Reset & Base Styles
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-bg-space);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* ==========================================
   Ambient Celestial Background
   ========================================== */
.space-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.nebula-1 {
  position: absolute;
  top: -10%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(142, 68, 173, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(80px);
  animation: floatNebula 20s ease-in-out infinite alternate;
}

.nebula-2 {
  position: absolute;
  bottom: -10%;
  right: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(41, 128, 185, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(80px);
  animation: floatNebula 25s ease-in-out infinite alternate-reverse;
}

.stars {
  position: absolute;
  width: 100%;
  height: 100%;
}

.star {
  position: absolute;
  background-color: #ffffff;
  border-radius: 50%;
  animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {

  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes floatNebula {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(5%, 5%) scale(1.1);
  }
}

/* ==========================================
   Premium Mobile Device Frame Simulator
   ========================================== */
.phone-frame {
  position: relative;
  width: 390px;
  height: 844px;
  background-color: var(--color-navy-deep);
  border: 12px solid #1a1a2e;
  border-radius: 48px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(142, 68, 173, 0.25);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all var(--transition-speed) ease;
}

/* Status Bar & Notch */
.phone-status-bar {
  height: 44px;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.2px;
  z-index: 100;
  color: rgba(255, 255, 255, 0.8);
}

.phone-status-bar .notch {
  width: 110px;
  height: 28px;
  background-color: #1a1a2e;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

.status-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.status-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

/* Bottom Home Indicator */
.phone-home-indicator {
  height: 20px;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-home-indicator::after {
  content: '';
  width: 120px;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

/* Screen Wrapper */
.app-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--color-purple-dark) 0%, var(--color-navy-deep) 100%);
}

.app-screen-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(30px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  overflow-y: auto;
  scrollbar-width: none;
  /* Hide scrollbar for Firefox */
}

.app-screen-section::-webkit-scrollbar {
  display: none;
  /* Hide scrollbar for Chrome/Safari */
}

.app-screen-section.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Glassmorphism Panel base */
.glass-panel {
  background: var(--color-glass-bg);
  border: 1px solid var(--color-glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
}

/* ==========================================
   Screen 1: Home Dashboard Styles
   ========================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-violet-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Heart Counter */
.heart-counter {
  display: flex;
  align-items: center;
  background: rgba(142, 68, 173, 0.15);
  border: 1px solid rgba(142, 68, 173, 0.3);
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(142, 68, 173, 0.1);
  transition: all 0.2s ease;
}

.heart-counter:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(142, 68, 173, 0.3);
}

.heart-icon {
  font-size: 14px;
  animation: pulseHeart 1.5s infinite alternate;
}

@keyframes pulseHeart {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 2px rgba(187, 134, 252, 0.8));
  }
}

.heart-count {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-violet-light);
}

.btn-charge-plus {
  background: var(--color-violet-light);
  border: none;
  color: var(--color-purple-dark);
  font-size: 14px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  cursor: pointer;
}

/* Hero Section */
.home-hero {
  margin-bottom: 24px;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  background: linear-gradient(to right, #ffffff, var(--color-violet-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  font-weight: 300;
}

/* Menu Grid (Tarot Options Card Layout) */
.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.menu-card {
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-glass-border);
  border-radius: 18px;
  padding: 16px;
  color: var(--color-text-primary);
  text-align: left;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-violet-glow);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.menu-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(187, 134, 252, 0.3);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.menu-card:hover::before {
  opacity: 1;
}

.card-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(142, 68, 173, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  border: 1px solid rgba(142, 68, 173, 0.2);
}

.menu-icon {
  width: 22px;
  height: 22px;
  color: var(--color-violet-light);
}

.card-info {
  flex: 1;
}

.card-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-gold);
  font-weight: 600;
  margin-bottom: 2px;
  display: inline-block;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.card-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.card-arrow {
  color: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease, color 0.2s ease;
}

.menu-card:hover .card-arrow {
  transform: translateX(3px);
  color: var(--color-violet-light);
}

.app-footer-info {
  text-align: center;
  padding: 24px 0 8px 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.2);
  font-family: 'Outfit', sans-serif;
}

.app-footer-info a {
  display: inline-block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.app-footer-info a:hover {
  color: var(--color-gold);
}

/* ==========================================
   Screen 2: Tarot Card Spread Styles
   ========================================== */
.sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-back:hover {
  color: #ffffff;
}

.spread-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.heart-counter.mini {
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-glass-border);
}

.heart-counter.mini .heart-count-mini,
.heart-counter.mini .heart-count-result {
  font-size: 12px;
  color: #ffffff;
}

#screen-spread {
  overflow: hidden;
}

.spread-container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

.spread-scroll-area {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  /* Hide scrollbar for Firefox */
  padding-bottom: 180px;
  /* Leave enough room for the absolute fixed bottom panel */
}

.spread-scroll-area::-webkit-scrollbar {
  display: none;
  /* Hide scrollbar for Chrome/Safari */
}

.spread-fixed-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px 20px 25px 20px;
  z-index: 100;
}

.spread-fixed-bottom::after {
  content: "";
  /* 위에서 아래 방향으로 투명에서 짙은 네이비 배경색으로 가리는 페이드 마스크 오버레이 (아래 70%는 선명하게 가려짐) */
  background: linear-gradient(rgba(10, 11, 30, 0), var(--color-navy-deep) 30%, var(--color-navy-deep)) no-repeat;
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spread-fixed-bottom.active::after {
  opacity: 1;
}

.spread-instruction {
  text-align: center;
  margin-top: 10px;
  margin-bottom: 15px;
}

.instruction-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 12px;
}

.instruction-title span {
  color: var(--color-gold);
  text-shadow: 0 0 8px var(--color-gold-glow);
}

.instruction-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 300;
}

/* Cards Deck Area (78-Card Overlapping Rectangular Row Layout) */
.fan-deck-outer {
  width: 100%;
  position: relative;
  margin: 20px 0 0 0;
  height: 380px;
  overflow: visible;
}

.fan-deck-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  perspective: 1200px;
}

.fan-card {
  position: absolute;
  /* Center horizontally, offset vertically and horizontally via variables */
  bottom: 165px;
  left: calc(50% - 33px);
  width: 66px;
  height: 108px;
  border-radius: 8px;
  border: 1.5px solid var(--color-gold);
  background-color: var(--color-purple-dark);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  
  /* Compact cascade layouts values */
  transform: rotate(var(--rot)) translateY(var(--ty)) translateX(var(--tx));
  
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1.15), border-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  overflow: hidden;
  touch-action: manipulation;
}

.fan-card:hover {
  /* Lift cards upwards by 28px relative to its baseline row Y axis (maintaining rot=0) */
  transform: rotate(var(--rot)) translateY(calc(var(--ty) - 28px)) translateX(var(--tx)) scale(1.16) !important;
  z-index: 999 !important;
  border-color: var(--color-violet-light);
  box-shadow: 0 0 20px rgba(187, 134, 252, 0.8);
  filter: brightness(1.22);
}

.fan-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.spread-tip {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 10px;
  opacity: 0.7;
}

.mini-icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

/* ==========================================
   Fly-to-Center Animation Engine
   ========================================== */
.fly-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(7, 7, 20, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.fly-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.flying-card-clone {
  position: absolute;
  z-index: 200;
  pointer-events: none;
  perspective: 1000px;
  transition: none;
  /* Instant teleport initialization on mount */
}

.flying-card-clone.flying {
  /* Transition applies only during flight phase */
  transition: left 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    top 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    width 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    height 0.45s cubic-bezier(0.25, 1, 0.3, 1),
    transform 0.45s cubic-bezier(0.25, 1, 0.3, 1);
}

.flying-card-clone.active {
  left: 50% !important;
  top: 36% !important;
  width: 220px !important;
  height: 363px !important;
  transform: translate(-50%, -50%) scale(1.1);
}

.flying-card-clone .card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.25, 1, 0.3, 1);
}

.flying-card-clone.active .card-inner {
  transform: rotateY(180deg);
}

.flying-card-clone .card-front,
.flying-card-clone .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
}

.flying-card-clone .card-back {
  border: 2px solid var(--color-gold);
  background-color: var(--color-purple-dark);
}

.flying-card-clone .card-front {
  transform: rotateY(180deg);
  border: 2.5px solid var(--color-violet-light);
}

.flying-card-clone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================
   Screen 3: Result & Interpretation Styles
   ========================================== */
.result-scroll-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  z-index: 10;
}

.result-intro {
  text-align: center;
  margin-bottom: 20px;
}

.result-category {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-violet-light);
  margin-bottom: 4px;
}

.result-subtitle {
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* Cards Reveal container */
.cards-reveal-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  min-height: 380px;
  gap: 12px;
}

/* 3D Card Flip Structure */
.card-3d {
  width: 220px;
  height: 363px;
  perspective: 1000px;
  cursor: pointer;
  opacity: 0;
  /* Keep hidden. Clone will morph into this spot */
  transition: opacity 0.3s ease;
}

.card-3d.revealed {
  opacity: 1;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

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

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
}

.card-back {
  border: 2px solid var(--color-gold);
  background-color: var(--color-purple-dark);
}

.card-back img,
.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-front {
  transform: rotateY(180deg);
  border: 2px solid var(--color-violet-light);
  background-color: var(--color-purple-dark);
  background-image: url('assets/card_back.jpg');
  background-size: cover;
}

/* Card label overlay (past/present/future tag) */
.card-3d-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal-card-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-gold);
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Interpretation Details Panel */
.interpretation-card {
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.3, 1), transform 0.8s cubic-bezier(0.25, 1, 0.3, 1);
}

.interpretation-card.active {
  opacity: 1;
  transform: translateY(0);
}

.reading-meta {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.api-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

.api-status-badge.online {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: #2ecc71;
  text-shadow: 0 0 4px rgba(46, 204, 113, 0.4);
}

.api-status-badge.offline {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e74c3c;
  text-shadow: 0 0 4px rgba(231, 76, 60, 0.4);
}

.card-name-kor {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.keyword-container {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.keyword {
  font-size: 11px;
  font-weight: 500;
  background: rgba(142, 68, 173, 0.15);
  border: 1px solid rgba(142, 68, 173, 0.25);
  color: var(--color-violet-light);
  padding: 3px 8px;
  border-radius: 8px;
}

.divider {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  margin-bottom: 16px;
}

.interpretation-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  font-weight: 300;
  text-align: justify;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 24px;
  width: 100%;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.3, 1), transform 0.8s cubic-bezier(0.25, 1, 0.3, 1);
}

.result-actions.active {
  opacity: 1;
  transform: translateY(0);
}

.inline-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: text-bottom;
}

.icon-spin-hover:hover {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   Modals & Overlay Styles
   ========================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(7, 7, 20, 0.85);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  max-width: 330px;
  padding: 28px 24px;
  position: relative;
  border-color: rgba(142, 68, 173, 0.25);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(142, 68, 173, 0.15);
}

.btn-close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.btn-close-modal:hover {
  color: #ffffff;
}

.text-center {
  text-align: center;
}

.modal-icon-glow {
  width: 70px;
  height: 70px;
  background: rgba(142, 68, 173, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  border: 1px solid rgba(142, 68, 173, 0.25);
  box-shadow: 0 0 20px rgba(142, 68, 173, 0.15);
}

.large-heart {
  font-size: 32px;
  animation: heartbeat 1.2s infinite;
}

@keyframes heartbeat {
  0% {
    transform: scale(0.9);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(0.9);
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  font-weight: 300;
}

.heart-status {
  margin-bottom: 20px;
  font-size: 14px;
}

.heart-status span {
  color: var(--color-text-secondary);
}

.glow-text {
  color: var(--color-violet-light);
  font-size: 18px;
  text-shadow: 0 0 8px rgba(187, 134, 252, 0.6);
}

.btn-recharge-action {
  width: 100%;
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

.btn-recharge-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.5);
}

.ad-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 10px;
}

/* Modal scale animations */
.animate-scale-up {
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-overlay.active .animate-scale-up {
  transform: scale(1);
  opacity: 1;
}

/* Ad Simulation Overlay */
.ad-overlay {
  background-color: #05050f;
  z-index: 300;
}

.ad-simulation-container {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.ad-progress-bar {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 40px;
}

.ad-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, var(--color-violet-light), var(--color-gold));
  transition: width 3s linear;
}

.loader-star {
  font-size: 48px;
  color: var(--color-gold);
  margin-bottom: 24px;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.loader-star i {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
}

.ad-content h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.ad-content p {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.ad-timer {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--color-violet-light);
  display: block;
}

/* Premium Ad Container Styles */
.premium-ad-container {
  display: flex;
  flex-direction: column;
  background: rgba(10, 11, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: 340px;
  width: 90%;
  margin: 0 auto;
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ad-sponsor-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-close-ad {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.3s ease;
}

.btn-close-ad.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.05);
}

.btn-close-ad:not(.disabled) {
  background: var(--color-gold);
  color: #000;
  border-color: var(--color-gold);
  font-weight: 700;
}

.ad-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.ad-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  gap: 12px;
}

.ad-app-info {
  text-align: left;
  flex: 1;
}

.ad-app-info h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.ad-app-info p {
  font-size: 10px;
  color: var(--color-text-secondary);
  margin: 0;
}

.btn-ad-cta {
  background: linear-gradient(135deg, var(--color-violet-light), var(--color-violet));
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(155, 89, 182, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn-ad-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(155, 89, 182, 0.4);
}



/* Toast */
.toast {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(10, 11, 30, 0.95);
  border: 1px solid var(--color-violet-light);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
}

.toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================
   Luxury Button System & Animation
   ========================================== */
.btn-primary,
.btn-secondary,
.btn-disabled,
.btn-recharge-action {
  width: 100%;
  padding: 15px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #3f0959 0%, #17022b 50%, #4c076c 100%);
  border: 1.5px solid var(--color-gold);
  color: var(--color-gold);
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.25), 0 0 10px rgba(255, 215, 0, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(142, 68, 173, 0.45), 0 0 20px rgba(255, 215, 0, 0.35);
  border-color: #ffffff;
  color: #ffffff;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 10px rgba(142, 68, 173, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(187, 134, 252, 0.35);
  color: var(--color-violet-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: rgba(187, 134, 252, 0.09);
  border-color: var(--color-violet-light);
  box-shadow: 0 8px 20px rgba(187, 134, 252, 0.25);
  color: #ffffff;
}

.btn-secondary:active {
  transform: translateY(1px) scale(0.97);
}

.btn-disabled {
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.25);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-recharge-action {
  background: linear-gradient(135deg, #8e44ad 0%, #3f0959 100%);
  border: 1.5px solid var(--color-gold);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

.btn-recharge-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(142, 68, 173, 0.5);
}

/* ==========================================
   Card Slots System Styles
   ========================================== */
.slots-container {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 10px 0 10px 0;
  width: 100%;
  min-height: 125px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.slots-container.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.slot-placeholder {
  width: 68px;
  height: 110px;
  border: 1.5px dashed rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  background: rgba(21, 13, 42, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

.slot-placeholder.filled {
  border: 1.5px solid var(--color-gold);
  background: transparent;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
  cursor: pointer;
}

.slot-placeholder.filled:hover {
  transform: translateY(-2px) scale(0.96);
  border-color: #ff3366;
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.45);
}

.slot-placeholder.filled::after {
  content: '✕';
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff3366;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 8px;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.slot-placeholder.filled:hover::after {
  opacity: 1;
  transform: scale(1.1);
}

.slot-label {
  position: absolute;
  bottom: -20px;
  width: 100px;
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: -0.3px;
}

.slot-card-back {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  animation: scalePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Spread Confirm HUD */
.spread-confirm-hud {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 8px 0 4px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.spread-confirm-hud.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ==========================================
   Multi-Card Layout Scaling for Results
   ========================================== */
/* Dynamic card sizing based on number of cards inside the container */
.reveal-card-wrapper.multi-3 .card-3d {
  width: 100px !important;
  height: 165px !important;
}

.reveal-card-wrapper.multi-2 .card-3d {
  width: 150px !important;
  height: 248px !important;
}

.reveal-card-wrapper.multi-3 .reveal-card-label,
.reveal-card-wrapper.multi-2 .reveal-card-label {
  font-size: 9px;
  padding: 1px 6px;
}

.reveal-card-wrapper.multi-3,
.reveal-card-wrapper.multi-2 {
  gap: 16px;
}

/* ==========================================
   Responsive / Desktop Media Queries
   ========================================== */
@media (max-width: 450px) {
  body {
    background-color: var(--color-navy-deep);
    min-height: 100dvh;
  }

  .phone-frame {
    width: 100vw;
    height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom, 24px);
  }

  .phone-status-bar {
    display: none;
  }

  .phone-home-indicator {
    display: none;
  }
}