/* ==========================================================================
   Harmony's Path — Public Styles
   Vibrant, psychedelic, meditative design
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  /* Core palette — vibrant, premium, glowing */
  --color-bg: #05070a;
  --color-bg-light: #090c12;
  --color-surface: rgba(15, 20, 30, 0.4);
  --color-surface-elevated: rgba(25, 30, 45, 0.6);

  /* HSL Vibrant Jewel Tones */
  --color-magenta: hsl(290, 70%, 65%);
  --color-magenta-deep: hsl(290, 80%, 40%);
  --color-orange: hsl(25, 90%, 65%);
  --color-yellow: hsl(45, 90%, 60%);
  --color-purple: hsl(260, 60%, 65%);
  --color-purple-deep: hsl(260, 70%, 25%);
  --color-lime: hsl(80, 60%, 65%);
  --color-lime-soft: hsl(80, 50%, 75%);

  --color-text: #ffffff;
  --color-text-muted: #b8c2d1;
  --color-text-dim: #7c8a99;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-magenta), var(--color-orange), var(--color-yellow));
  --gradient-accent: linear-gradient(135deg, var(--color-purple), var(--color-magenta));
  --gradient-card-border: linear-gradient(135deg, hsla(290, 70%, 65%, 0.4) 0%, hsla(260, 60%, 65%, 0.4) 100%);
  --gradient-card-back: linear-gradient(160deg, var(--color-purple-deep), rgba(10, 15, 25, 0.8), var(--color-purple-deep));

  /* Typography */
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 200ms var(--ease-out);
  --transition-normal: 400ms var(--ease-out);
  --transition-slow: 600ms var(--ease-out);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

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

/* ---------- Page Layout ---------- */
.page-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--space-lg);
}

/* ---------- Navigation ---------- */
.site-nav {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  margin: 0 auto var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  padding: 0.4rem 1.4rem;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.6s var(--ease-out) both;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: var(--space-xs) var(--space-sm);
  position: relative;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  color: var(--color-magenta);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 16px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

/* ---------- Header ---------- */
.site-header {
  text-align: center;
  padding: var(--space-lg) 0 var(--space-md);
  animation: fadeInDown 0.8s var(--ease-out) both;
}

.logo-mark {
  font-size: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
  animation: rotateSlow 12s linear infinite;
  display: inline-block;
}

.site-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  text-shadow: 0 0 30px hsla(290, 70%, 65%, 0.4);
}

.site-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  color: rgba(255, 255, 255, 0.85);
  font-style: italic;
  font-weight: 400;
  margin-top: var(--space-xs);
  letter-spacing: 0.08em;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ---------- Draw Section ---------- */
.draw-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl) 0;
  animation: fadeIn 1s var(--ease-out) 0.3s both;
}

.draw-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.draw-tagline {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  color: var(--color-text);
  font-style: italic;
  max-width: 28ch;
  line-height: 1.5;
}

/* ---------- Draw Button ---------- */
.draw-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-2xl);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-normal);
  animation: pulseGlow 3s ease-in-out infinite;
  outline: none;
  letter-spacing: 0.03em;
}

.draw-button::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius-xl) + 3px);
  background: var(--gradient-primary);
  z-index: -1;
  filter: blur(16px);
  opacity: 0.5;
  transition: opacity var(--transition-normal);
}

.draw-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(255, 45, 138, 0.4), 0 0 80px rgba(255, 107, 0, 0.2);
}

.draw-button:hover::before {
  opacity: 0.8;
}

.draw-button:active {
  transform: scale(0.98);
}

.draw-button:focus-visible {
  outline: 2px solid var(--color-lime);
  outline-offset: 4px;
}

.draw-button-icon {
  font-size: 1.1em;
  display: inline-block;
  animation: rotateSlow 8s linear infinite;
}

.draw-hint {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--color-text-dim);
  letter-spacing: 0.05em;
  font-style: italic;
}

/* ---------- Hero Mandala Decoration ---------- */
.hero-mandala {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.mandala-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
}

.mandala-ring-1 {
  width: 160px;
  height: 160px;
  border-color: rgba(255, 45, 138, 0.15);
  animation: rotateSlow 30s linear infinite;
}

.mandala-ring-2 {
  width: 120px;
  height: 120px;
  border-color: rgba(255, 107, 0, 0.2);
  border-style: dashed;
  animation: rotateSlow 20s linear infinite reverse;
}

.mandala-ring-3 {
  width: 80px;
  height: 80px;
  border-color: rgba(255, 180, 0, 0.25);
  animation: rotateSlow 12s linear infinite;
}

.mandala-symbol {
  font-size: 2.2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(255, 180, 0, 0.4));
  animation: rotateSlow 8s linear infinite reverse;
  z-index: 1;
}

/* ---------- Card Section ---------- */
.card-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
  padding: var(--space-lg) 0 var(--space-3xl);
  opacity: 0;
  transform: scale(0.92) translateY(15px);
  will-change: opacity, transform;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  /* Override flex centering — always pin to top */
  margin-top: 0;
  margin-bottom: auto;
}

.card-section.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ---------- Card Flip ---------- */
.card-flip-container {
  perspective: 1200px;
  width: 100%;
  max-width: 480px;
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  will-change: transform;
  transition: transform 0.2s ease-out;
}

.card-inner {
  position: relative;
  width: 100%;
  min-height: 600px;
  transition: transform 0.8s var(--ease-out);
  transform-style: preserve-3d;
  will-change: transform;
}

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

/* Toggle face visibility halfway through the 0.8s transition to prevent Chrome rendering leaks */
.card-inner.is-flipped .card-back {
  visibility: hidden;
  transition: visibility 0s linear 0.4s;
}
.card-inner:not(.is-flipped) .card-back {
  visibility: visible;
  transition: visibility 0s linear 0s;
}

.card-inner:not(.is-flipped) .card-front {
  visibility: hidden;
  transition: visibility 0s linear 0.4s;
}
.card-inner.is-flipped .card-front {
  visibility: visible;
  transition: visibility 0s linear 0s;
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: flat;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-back {
  border: 1.5px solid hsla(290, 70%, 65%, 0.3);
  box-shadow:
    inset 0 0 30px hsla(290, 70%, 65%, 0.1),
    0 20px 40px rgba(0, 0, 0, 0.6),
    0 0 25px hsla(260, 60%, 65%, 0.2);
  transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: absolute;
  transform: rotateY(0deg);
}

.card-back:hover {
  box-shadow:
    inset 0 0 35px rgba(200, 162, 200, 0.16),
    0 25px 50px rgba(0, 0, 0, 0.75),
    0 0 35px rgba(144, 161, 192, 0.12);
}

/* Double-lined Celestial Gold Frame for Picked Card Back */
.card-back::before {
  content: '';
  position: absolute;
  inset: 16px;
  border: 1.5px solid rgba(255, 180, 0, 0.35);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 15px rgba(200, 162, 200, 0.12);
}

.card-back::after {
  content: '';
  position: absolute;
  inset: 22px;
  border: 1px dashed rgba(255, 180, 0, 0.25);
  border-radius: calc(var(--radius-lg) - 6px);
  pointer-events: none;
  z-index: 1;
}

.custom-card-back {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: inherit;
}

.card-back-symbol {
  display: inline-block;
  margin-bottom: var(--space-md);
  filter: drop-shadow(0 0 20px rgba(255, 180, 0, 0.6));
  z-index: 2;
}

.card-back-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.12em;
  z-index: 2;
}

/* Hide card-back children and borders when card is flipped */
.card-back *,
.card-back::before,
.card-back::after {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Card Front */
.card-front {
  background: rgba(10, 15, 25, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid hsla(290, 70%, 65%, 0.3);
  transform: rotateY(180deg);
  position: absolute;
  box-shadow:
    inset 0 0 30px hsla(290, 70%, 65%, 0.1),
    0 25px 50px rgba(0, 0, 0, 0.75),
    0 0 35px hsla(25, 90%, 65%, 0.1),
    0 0 70px hsla(260, 60%, 65%, 0.1);
  transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-front:hover {
  box-shadow:
    inset 0 0 25px rgba(200, 162, 200, 0.12),
    0 30px 60px rgba(0, 0, 0, 0.85),
    0 0 45px rgba(200, 162, 200, 0.1),
    0 0 80px rgba(144, 161, 192, 0.06);
}

/* ---------- Card Image ---------- */
.card-image-wrapper {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  border-radius: var(--radius-md);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image-wrapper::after {
  display: none;
}

.card-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse at center, black 92%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, black 92%, transparent 100%);
}

/* No-image placeholder */
.card-image-wrapper.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-card-back);
  aspect-ratio: 4 / 3;
}

.card-image-wrapper.no-image::before {
  content: '✿';
  font-size: 4rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-image-wrapper.no-image::after {
  display: none;
}

/* ---------- Card Columns ---------- */
.card-left-column {
  width: 100%;
  height: 48%;
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-md) 0 var(--space-md);
  gap: var(--space-xs);
  flex-shrink: 0;
}

.card-right-column {
  width: 100%;
  height: 52%;
  padding: var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.2vw, 1.9rem);
  font-weight: 600;
  text-align: center;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  margin: 0 auto;
  padding: 0 0 var(--space-xs) 0;
  flex-shrink: 0;
  width: 100%;
}

.card-text-block {
  margin-bottom: var(--space-lg);
}

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

.card-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--color-magenta);
  margin-bottom: var(--space-xs);
}

.card-reflection,
.card-guidance {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--color-text);
  font-weight: 400;
  white-space: normal;
  flex: 1;
  overflow-y: auto;
  padding-right: var(--space-xs);
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 162, 200, 0.4) rgba(0, 0, 0, 0.15);
}

.card-paragraph {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--color-text);
  margin: 0 0 0.9rem 0;
  white-space: normal;
}

.card-paragraph:last-child {
  margin-bottom: 0;
}

.card-paragraph.reflection-sentence {
  font-size: 1.25rem;
  line-height: 1.65;
  color: var(--color-text);
  margin-bottom: 1.1rem;
}

.card-bullet-item {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--color-text);
  margin: 0 0 0.6rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.card-bullet-item::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-orange);
  font-weight: bold;
}

.card-section-header {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-magenta);
  border-left: 3px solid var(--color-magenta);
  padding: 4px 0 4px 12px;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: linear-gradient(90deg, hsla(290, 70%, 65%, 0.1) 0%, transparent 100%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.card-section-header::before {
  content: '✿';
  font-size: 0.7em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-sub-header {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-orange);
  margin-top: 1.15rem;
  margin-bottom: 0.5rem;
  display: block;
  border-left: 2px solid var(--color-orange);
  padding-left: 8px;
}

.card-subtitle-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  font-style: italic;
  color: var(--color-text-muted);
  margin-top: 0.6rem;
  margin-bottom: 1.1rem;
  display: block;
  line-height: 1.5;
}

.card-affirmation-block {
  background: rgba(10, 15, 25, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-magenta);
  border-top: 1px solid hsla(290, 70%, 65%, 0.1);
  border-right: 1px solid hsla(290, 70%, 65%, 0.1);
  border-bottom: 1px solid hsla(290, 70%, 65%, 0.1);
}

.card-affirmation {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.6;
  color: var(--color-text);
  white-space: normal;
}

/* ---------- Staggered Entrance Animations ---------- */
@keyframes staggerFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-inner.is-flipped .card-title,
.card-inner.is-flipped .card-image-wrapper,
.card-inner.is-flipped .card-right-column > * {
  animation: staggerFadeUp 0.6s var(--ease-out) both;
}

.card-inner.is-flipped .card-title {
  animation-delay: 0.2s;
}
.card-inner.is-flipped .card-image-wrapper {
  animation-delay: 0.3s;
}
.card-inner.is-flipped .card-right-column > *:nth-child(1) {
  animation-delay: 0.4s;
}
.card-inner.is-flipped .card-right-column > *:nth-child(2) {
  animation-delay: 0.5s;
}

/* ---------- Draw Again Button ---------- */
.draw-again-wrapper {
  margin-top: var(--space-2xl);
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s var(--ease-out) 1.2s both;
}

.draw-again-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-2xl);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 45, 138, 0.2), rgba(255, 107, 0, 0.2)) padding-box,
    var(--gradient-primary) border-box;
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.draw-again-button:hover {
  background: var(--gradient-primary) padding-box,
    var(--gradient-primary) border-box;
  box-shadow: 0 0 30px rgba(255, 45, 138, 0.4), 0 0 60px rgba(255, 107, 0, 0.2);
  transform: scale(1.05);
}

.draw-again-button:active {
  transform: scale(0.98);
}

.draw-again-button:focus-visible {
  outline: 2px solid var(--color-lime);
  outline-offset: 4px;
}

/* ---------- Loading / Shuffling ---------- */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  min-height: 400px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.spinner-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--color-text-muted);
  font-style: italic;
  letter-spacing: 0.05em;
  text-align: center;
  transition: opacity 0.3s ease;
  animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.deck-container {
  position: relative;
  width: 220px;
  height: 300px;
  margin-bottom: var(--space-xl);
}

.deck-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0d0818 0%, #040207 100%) padding-box,
    linear-gradient(135deg, rgba(255, 45, 138, 0.4), rgba(255, 180, 0, 0.4), rgba(107, 29, 158, 0.4)) border-box;
  border: 1.5px solid transparent;
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.7),
    inset 0 0 25px rgba(107, 29, 158, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
  transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.5s ease,
    box-shadow 0.5s ease;
  overflow: hidden;
}

/* Double-lined Celestial Gold Frame for Deck Cards */
.deck-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1.5px solid rgba(255, 180, 0, 0.35);
  border-radius: calc(var(--radius-md) - 4px);
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 10px rgba(255, 45, 138, 0.15);
}

.deck-card::after {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(255, 180, 0, 0.25);
  border-radius: calc(var(--radius-md) - 6px);
  pointer-events: none;
  z-index: 1;
}


.deck-count {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin-bottom: var(--space-lg);
  letter-spacing: 0.12em;
  font-style: italic;
}

/* Stacked deck — looks like a thick pile of cards */
.deck-card.card-1 {
  transform: translate3d(0, 0, 0);
  z-index: 1;
}

.deck-card.card-2 {
  transform: translate3d(0.5px, -2px, 0);
  z-index: 2;
}

.deck-card.card-3 {
  transform: translate3d(-0.5px, -4px, 0);
  z-index: 3;
}

.deck-card.card-4 {
  transform: translate3d(0.8px, -6px, 0);
  z-index: 4;
}

.deck-card.card-5 {
  transform: translate3d(-0.3px, -8px, 0);
  z-index: 5;
}

.deck-card.card-6 {
  transform: translate3d(0.5px, -10px, 0);
  z-index: 6;
}

.deck-card.card-7 {
  transform: translate3d(0, -12px, 0);
  z-index: 7;
}

/* ---- Shuffle Animation: Fan out + riffle ---- */

@keyframes fan-left-1 { 0%, 50%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 25% { transform: translate3d(-180px, 15px, 0) rotate(-35deg); } }
@keyframes fan-right-2 { 0%, 50%, 100% { transform: translate3d(0.5px, -2px, 0) rotate(0deg); } 75% { transform: translate3d(140px, 15px, 0) rotate(22deg); } }
@keyframes fan-left-3 { 0%, 50%, 100% { transform: translate3d(-0.5px, -4px, 0) rotate(0deg); } 25% { transform: translate3d(-130px, 5px, 0) rotate(-25deg); } }
@keyframes fan-right-4 { 0%, 50%, 100% { transform: translate3d(0.8px, -6px, 0) rotate(0deg); } 75% { transform: translate3d(90px, 0px, 0) rotate(12deg); } }
@keyframes fan-left-5 { 0%, 50%, 100% { transform: translate3d(-0.3px, -8px, 0) rotate(0deg); } 25% { transform: translate3d(-80px, -5px, 0) rotate(-15deg); } }
@keyframes fan-right-6 { 0%, 50%, 100% { transform: translate3d(0.5px, -10px, 0) rotate(0deg); } 75% { transform: translate3d(40px, -10px, 0) rotate(5deg); } }
@keyframes fan-left-7 { 0%, 50%, 100% { transform: translate3d(0, -12px, 0) rotate(0deg); } 25% { transform: translate3d(-30px, -15px, 0) rotate(-5deg); } }

/* Apply shuffle animations */
.deck-container.shuffling .card-1 {
  animation: fan-left-1 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-2 {
  animation: fan-right-2 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-3 {
  animation: fan-left-3 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-4 {
  animation: fan-right-4 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-5 {
  animation: fan-left-5 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-6 {
  animation: fan-right-6 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

.deck-container.shuffling .card-7 {
  animation: fan-left-7 0.9s cubic-bezier(0.4, 0, 0.2, 1) 3;
}

/* ---- Stopping State (transitioning back to stack smoothly) ---- */
.deck-container.stopping .deck-card {
  animation: none !important;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ---- Picking State ---- */

/* Non-picked cards fade out extremely quickly and sink slightly to avoid overlapping the picked card */
.deck-container.picking .deck-card:not(.picked) {
  transform: translate3d(0, 20px, 0) scale(0.85);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s ease-in,
    opacity 0.2s ease-in;
}

/* Picked card rises with a glow */
.deck-container.picking .deck-card.picked {
  z-index: 100;
  transform: translate3d(0, -40px, 0) scale(1.15);
  box-shadow:
    0 20px 60px rgba(255, 45, 138, 0.4),
    0 0 40px rgba(107, 29, 158, 0.3),
    0 0 80px rgba(255, 180, 0, 0.15);
  transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.8s ease;
}

/* ---------- Error ---------- */
.error-message {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-family: var(--font-serif);
  font-style: italic;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: var(--space-lg);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}

.footer-divider {
  font-size: 0.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.5;
}

.footer-nav-link {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.footer-nav-link:hover {
  color: var(--color-magenta);
}

.footer-tagline {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.footer-copyright {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.04em;
}

/* ---------- About Card ---------- */
.about-card {
  background: linear-gradient(180deg, #0e0917 0%, #06040a 100%) padding-box,
    var(--gradient-card-border) border-box;
  border: 1.5px solid transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    inset 0 0 20px rgba(107, 29, 158, 0.12),
    0 25px 50px rgba(0, 0, 0, 0.75),
    0 0 35px rgba(255, 45, 138, 0.08),
    0 0 70px rgba(107, 29, 158, 0.05);
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ---------- About Page Author Photo ---------- */
.about-left-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  background: #0c1017;
}

.author-photo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  padding: var(--space-md) 0;
}

.author-photo-frame {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  padding: 3px;
  background: var(--gradient-primary);
  box-shadow:
    0 0 25px rgba(255, 45, 138, 0.25),
    0 0 50px rgba(107, 29, 158, 0.15);
  animation: photoGlow 4s ease-in-out infinite;
}

.author-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.about-philosophy-left {
  margin-top: var(--space-md);
  width: 100%;
  text-align: center;
}

.about-philosophy-left .card-section-header {
  justify-content: center;
}

@keyframes photoGlow {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(200, 162, 200, 0.25),
      0 0 40px rgba(144, 161, 192, 0.15);
  }
  50% {
    box-shadow:
      0 0 35px rgba(200, 162, 200, 0.45),
      0 0 70px rgba(144, 161, 192, 0.3);
  }
}

/* Lead paragraph for About page */
.lead-paragraph {
  font-size: 1.25rem !important;
  line-height: 1.7 !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

/* Section divider */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-xl) 0 var(--space-sm);
  gap: var(--space-md);
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 45, 138, 0.25), transparent);
}

.divider-symbol {
  font-size: 0.8rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.6;
}

/* About page bio scrollable area */
.about-bio {
  position: relative;
}

/* ---------- Scroll Fade Indicator ---------- */
.scroll-fade-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, transparent, #06040a);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.scroll-fade-indicator.hidden-fade {
  opacity: 0;
}

.scroll-fade-arrow {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

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

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

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

@keyframes pulseGlow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 45, 138, 0.3), 0 0 40px rgba(255, 107, 0, 0.15);
  }

  50% {
    box-shadow: 0 0 30px rgba(255, 45, 138, 0.5), 0 0 60px rgba(255, 107, 0, 0.25);
  }
}

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

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

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

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

@keyframes borderShift {
  0% {
    background-position: 0% 0%, 0% 50%;
  }

  50% {
    background-position: 0% 0%, 100% 50%;
  }

  100% {
    background-position: 0% 0%, 0% 50%;
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

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

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .page-wrapper {
    padding: var(--space-md);
  }

  .site-header {
    padding: var(--space-lg) 0 var(--space-md);
  }

  .draw-button {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.15rem;
  }

  .card-flip-container {
    max-width: 100%;
  }

  .card-inner {
    min-height: 500px;
  }

  .card-content {
    padding: var(--space-lg) var(--space-md) var(--space-md);
  }

  .card-title {
    font-size: 1.4rem;
  }

  .card-reflection,
  .card-guidance,
  .card-affirmation {
    font-size: 1.05rem;
  }

  .card-paragraph,
  .card-bullet-item {
    font-size: 1.05rem;
    line-height: 1.5;
  }

  .card-paragraph.reflection-sentence {
    font-size: 1.12rem;
  }

  .card-subtitle-text {
    font-size: 1.12rem;
  }
}

@media (max-width: 380px) {
  .draw-button {
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
  }

  .card-content {
    padding: var(--space-md) var(--space-sm) var(--space-sm);
  }
}

/* ---------- Prefers Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card-inner {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- PC / Desktop Layout ---------- */
@media (min-width: 1024px) {
  body {
    overflow: hidden;
  }

  .page-wrapper {
    height: 100vh;
    overflow: hidden;
    padding: var(--space-md) var(--space-lg) var(--space-xs);
  }

  .site-header {
    padding: 0.5rem 0 0.25rem;
  }

  .main-content {
    flex: 1;
    min-height: 0;
  }

  .draw-section {
    flex: 1;
    min-height: 0;
  }

  .author-photo-frame {
    width: 260px;
    height: 260px;
  }

  .card-section {
    max-width: 1100px;
    padding: var(--space-xs) 0 var(--space-md);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-lg);
  }

  .card-flip-container {
    max-width: 1060px;
    flex: 0 1 520px;
    width: 100%;
    min-height: 0;
  }

  .card-inner {
    height: 100% !important;
    min-height: 0 !important;
  }

  .card-back {
    inset: 0 auto;
    left: 50%;
    transform: translateX(-50%) rotateY(0deg);
    width: 340px; /* Constrain to natural card width */
  }

  .card-front {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 100%;
  }

  .card-left-column {
    width: 45%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-xl) var(--space-md) var(--space-xl) var(--space-xl);
    gap: var(--space-md);
    border-right: 1px solid hsla(290, 70%, 65%, 0.1);
    background: transparent;
    flex-shrink: 0;
  }

  .card-image-wrapper {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .card-image-wrapper::after {
    display: none;
  }

  .card-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .card-right-column {
    width: 55%;
    height: 100%;
    padding: var(--space-xl) var(--space-xl) var(--space-xl) var(--space-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .card-reflection::-webkit-scrollbar {
    width: 6px;
  }

  .card-reflection::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
  }

  .card-reflection::-webkit-scrollbar-thumb {
    background: rgba(255, 45, 138, 0.4);
    border-radius: 3px;
  }

  .card-reflection::-webkit-scrollbar-thumb:hover {
    background: var(--color-magenta);
  }

  .draw-again-wrapper {
    margin-top: var(--space-lg);
  }

  /* About card matches homepage card dimensions */
  .about-card {
    flex-direction: row;
    align-items: stretch;
    height: calc(100vh - 200px);
    min-height: 400px;
    max-height: 520px;
    max-width: 1060px;
    margin: 0 auto;
  }

  .about-left-column {
    width: 42%;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space-xl) var(--space-md) var(--space-xl) var(--space-xl);
    gap: var(--space-md);
  }

  .about-philosophy-left {
    margin-top: auto;
    text-align: left;
    width: 100%;
  }

  .about-philosophy-left .card-section-header {
    justify-content: flex-start;
  }

  .about-card .card-right-column {
    width: 58%;
    height: 100%;
    padding: var(--space-xl) var(--space-xl) var(--space-xl) var(--space-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Inner scroll on biography — matches homepage .card-reflection behaviour */
  .about-bio {
    overflow-y: auto;
    flex: 1;
  }
}
