/* ==========================================================================
   MYSTIC TAROT & DAILY FORTUNE - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-dark: #070913;
  --bg-gradient: radial-gradient(circle at 50% 20%, #1a103c 0%, #0d0822 50%, #05040a 100%);
  --surface-glass: rgba(18, 14, 42, 0.65);
  --surface-glass-border: rgba(212, 175, 55, 0.25);
  --surface-card: rgba(28, 20, 60, 0.85);
  
  --primary-gold: #f39c12;
  --gold-gradient: linear-gradient(135deg, #ffe57f 0%, #d4af37 50%, #996515 100%);
  --gold-glow: rgba(212, 175, 55, 0.4);
  
  --accent-purple: #9b51e0;
  --accent-violet: #6c5ce7;
  --purple-glow: rgba(155, 81, 224, 0.35);
  --accent-cyan: #00cec9;
  
  --text-main: #f8fafc;
  --text-muted: #a0aec0;
  --text-gold: #f6e05e;
  
  /* Fonts */
  --font-heading: 'Cinzel', serif;
  --font-serif: 'Cormorant Garamond', serif;
  --font-sans: 'Inter', sans-serif;
  
  /* Shadows & Effects */
  --shadow-glow: 0 0 25px rgba(212, 175, 55, 0.3);
  --shadow-card: 0 15px 35px rgba(0, 0, 0, 0.6);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background Canvas for Star particles */
#starsCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Main Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.8rem;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 2px;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--text-gold);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s var(--transition-smooth);
}

.icon-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--primary-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--gold-glow);
}

/* Hero Intro Section */
.hero-section {
  text-align: center;
  margin: 1rem 0 2.5rem;
}

.hero-subtitle {
  font-family: var(--font-heading);
  color: var(--text-gold);
  font-size: 0.95rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #ffe57f 60%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px var(--purple-glow);
}

.hero-desc {
  max-width: 680px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.4rem;
  background: rgba(10, 8, 25, 0.8);
  border: 1px solid var(--surface-glass-border);
  border-radius: 50px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.mode-tab-btn {
  padding: 0.65rem 1.4rem;
  border-radius: 40px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-tab-btn.active {
  background: var(--gold-gradient);
  color: #070913;
  font-weight: 700;
  box-shadow: 0 4px 20px var(--gold-glow);
}

.mode-tab-btn:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Card Deck Stage & Interactive Shuffling Area */
.stage-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 420px;
  margin-bottom: 2rem;
  perspective: 1200px;
}

/* Semi-circle Deck Spread */
.deck-spread {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Card 3D Component */
.card-wrapper {
  position: absolute;
  width: 160px;
  height: 270px;
  cursor: pointer;
  perspective: 1000px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.5s ease, top 0.5s ease;
  transform-style: preserve-3d;
}

@media (max-width: 600px) {
  .card-wrapper {
    width: 125px;
    height: 210px;
  }
  .deck-spread {
    height: 260px;
  }
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

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

/* Card Front & Back Faces */
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--primary-gold);
}

/* Card Back Side (Mystical Runes & Sacred Geometry) */
.card-back {
  background: linear-gradient(145deg, #1b1238 0%, #0d0822 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.card-back-pattern {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 10px;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.15) 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.05) 0, rgba(212, 175, 55, 0.05) 2px, transparent 0, transparent 8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-back-pattern::before {
  content: '✦';
  font-size: 2rem;
  color: var(--primary-gold);
  text-shadow: 0 0 10px var(--gold-glow);
}

/* Card Front Side (Illustration & Details) */
.card-front {
  background: #110d29;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  text-align: center;
}

.card-image-box {
  width: 100%;
  height: 75%;
  border-radius: 8px;
  overflow: hidden;
  background: #090618;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.card-image-box svg, .card-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-front-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--text-gold);
  margin-top: 6px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-front-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Action Control Buttons */
.action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.primary-btn {
  background: var(--gold-gradient);
  color: #070913;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 0.9rem 2.5rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 25px var(--gold-glow);
  transition: all 0.3s var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
}

.primary-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 35px rgba(212, 175, 55, 0.6);
}

.primary-btn:active {
  transform: translateY(1px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-gold);
  border: 1px solid var(--surface-glass-border);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.6rem;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
}

.secondary-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--primary-gold);
}

/* Reading Result Display Section */
.result-section {
  display: none;
  width: 100%;
  animation: fadeIn 0.8s ease forwards;
}

.result-header {
  text-align: center;
  margin-bottom: 2rem;
}

.result-tag {
  font-family: var(--font-heading);
  color: var(--accent-cyan);
  font-size: 0.9rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.result-main-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  color: var(--text-gold);
}

/* Grid layout for 3 cards or 1 card result */
.result-cards-grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.result-card-item {
  background: var(--surface-card);
  border: 1px solid var(--surface-glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease;
}

.result-card-item:hover {
  transform: translateY(-5px);
  border-color: var(--primary-gold);
}

.result-card-img-wrapper {
  width: 140px;
  height: 230px;
  border-radius: 12px;
  border: 2px solid var(--primary-gold);
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.2rem;
}

.result-card-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-gold);
  text-align: center;
  margin-bottom: 0.2rem;
}

.result-card-position {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

/* Reading Details Accordion / Tabs */
.reading-details-container {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}

.detail-block {
  margin-bottom: 1.8rem;
}

.detail-block:last-child {
  margin-bottom: 0;
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-gold);
  margin-bottom: 0.6rem;
}

.detail-icon {
  font-size: 1.3rem;
}

.detail-text {
  color: #e2e8f0;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Lucky Highlights Badges */
.lucky-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.lucky-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lucky-icon {
  font-size: 1.8rem;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lucky-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lucky-val {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
}

/* Share Action Bar */
.share-action-bar {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Modal Overlay Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 4, 12, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

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

.modal-content {
  background: var(--surface-card);
  border: 1px solid var(--surface-glass-border);
  border-radius: 24px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s var(--transition-smooth);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 1rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-gold);
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-modal-btn:hover {
  color: var(--text-main);
}

/* Input Fields & Forms */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-gold);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(10, 8, 25, 0.7);
  border: 1px solid var(--surface-glass-border);
  border-radius: 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-gold);
  box-shadow: 0 0 10px var(--gold-glow);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Social Share Image Canvas Modal */
.share-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#shareCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  border: 2px solid var(--primary-gold);
  box-shadow: var(--shadow-card);
}

/* Tarot Dictionary Grid */
.dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.dict-card-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dict-card-item:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--primary-gold);
  transform: translateY(-3px);
}

.dict-card-img {
  width: 100%;
  height: 120px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.dict-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-gold);
}

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px var(--gold-glow); }
  50% { box-shadow: 0 0 35px rgba(212, 175, 55, 0.7); }
}

/* Responsive Rules */
@media (max-width: 768px) {
  .navbar {
    padding: 0.8rem 1rem;
  }
  .brand-title {
    font-size: 1.1rem;
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .reading-details-container {
    padding: 1.25rem;
  }
  .mode-tab-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
  }
}
