/* ============================================
   LOVE LANGUAGE ARCHETYPE QUIZ — STYLES
   Dark theme · Glassmorphism · Mobile-first
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --purple-deep: #1a0a2e;
  --purple-mid: #3d1a78;
  --purple-light: #7c3aed;
  --rose-gold: #b76e79;
  --hot-pink: #ff2d87;
  --pink-light: #ff6eb4;
  --gold: #f0c27f;
  --white: #ffffff;
  --white-10: rgba(255, 255, 255, 0.1);
  --white-15: rgba(255, 255, 255, 0.15);
  --white-20: rgba(255, 255, 255, 0.2);
  --white-60: rgba(255, 255, 255, 0.6);
  --white-80: rgba(255, 255, 255, 0.8);
  --white-90: rgba(255, 255, 255, 0.9);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 50px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glow: 0 0 40px rgba(124, 58, 237, 0.3);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--purple-deep) 0%, #0f0520 40%, #1a0a2e 100%);
  color: var(--white-90);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Animated Background ---------- */
.bg-animation {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-particle {
  position: absolute;
  font-size: 1.2rem;
  opacity: 0;
  animation: floatUp linear infinite;
  will-change: transform, opacity;
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(100vh) rotate(0deg) scale(0.5);
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translateY(-10vh) rotate(360deg) scale(1);
  }
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--white-10);
  z-index: 100;
  opacity: 0;
  transition: opacity var(--transition);
}

.progress-bar.visible {
  opacity: 1;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple-light), var(--hot-pink), var(--rose-gold));
  border-radius: 0 2px 2px 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- App Container ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 1.5rem;
}

.screen.active {
  display: flex;
  animation: fadeInUp 0.6s ease-out;
}

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

/* ---------- Glassmorphism Card ---------- */
.glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-15);
  box-shadow: var(--shadow);
}

.card {
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: linear-gradient(135deg, var(--purple-light), var(--hot-pink), var(--rose-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-light), var(--hot-pink));
  color: var(--white);
  box-shadow: 0 4px 20px rgba(255, 45, 135, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(255, 45, 135, 0.6);
}

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

.btn.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 45, 135, 0.4); }
  50% { box-shadow: 0 4px 40px rgba(255, 45, 135, 0.7); }
}

.btn-arrow {
  transition: transform var(--transition);
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

/* ---------- WELCOME SCREEN ---------- */
.welcome-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.welcome-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.welcome-subtitle {
  color: var(--white-60);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-archetypes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.archetype-pill {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--white-10);
  border: 1px solid var(--white-15);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--white-80);
  white-space: nowrap;
}

.welcome-time {
  color: var(--white-60);
  font-size: 0.8rem;
  margin-top: 1rem;
}

/* ---------- QUIZ SCREEN ---------- */
.quiz-card {
  padding: 2rem 1.5rem;
}

.quiz-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.quiz-counter {
  font-size: 0.8rem;
  color: var(--white-60);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 3.6em;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--white-10);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--white-80);
  text-align: left;
  line-height: 1.4;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.quiz-option:hover {
  background: var(--white-15);
  border-color: var(--white-20);
  transform: translateX(4px);
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.selected {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(255, 45, 135, 0.2));
  border-color: var(--hot-pink);
  color: var(--white);
  box-shadow: 0 0 20px rgba(255, 45, 135, 0.15);
}

.quiz-option-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.quiz-option-text {
  flex: 1;
}

/* Question transition */
.quiz-card.slide-out-left {
  animation: slideOutLeft 0.3s ease-in forwards;
}

.quiz-card.slide-in-right {
  animation: slideInRight 0.4s ease-out forwards;
}

@keyframes slideOutLeft {
  to {
    opacity: 0;
    transform: translateX(-60px);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- RESULTS SCREEN ---------- */
#screenResults {
  align-items: stretch;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.results-card-wrapper {
  width: 100%;
}

.results-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.results-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 45, 135, 0.08) 0%, transparent 60%);
  animation: rotateGlow 10s linear infinite;
  pointer-events: none;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.results-badge {
  font-size: 4.5rem;
  margin-bottom: 0.5rem;
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.results-archetype {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.3rem;
}

.results-tagline {
  font-size: 1rem;
  font-style: italic;
  color: var(--rose-gold);
  margin-bottom: 1.2rem;
}

.results-description {
  font-size: 0.95rem;
  color: var(--white-80);
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.results-traits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.trait-tag {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(255, 45, 135, 0.15));
  border: 1px solid var(--white-15);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--white-80);
}

.results-book-inspiration {
  background: var(--white-10);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--white-80);
}

.results-book-inspiration a {
  color: var(--pink-light);
  text-decoration: none;
  font-weight: 600;
}

.results-book-inspiration a:hover {
  text-decoration: underline;
}

/* ---------- Compatibility Card ---------- */
.compat-card {
  padding: 1.5rem;
}

.compat-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 1rem;
}

.compat-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.compat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--white-10);
}

.compat-emoji {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.compat-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.85rem;
}

.compat-bar-wrapper {
  flex: 1.5;
  height: 8px;
  border-radius: 4px;
  background: var(--white-10);
  overflow: hidden;
}

.compat-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--purple-light), var(--hot-pink));
  width: 0%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.compat-percent {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pink-light);
  width: 3rem;
  text-align: right;
}

.compat-row.best-match {
  border: 1px solid rgba(255, 45, 135, 0.3);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(255, 45, 135, 0.1));
}

.compat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hot-pink);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 45, 135, 0.15);
}

/* ---------- Share Card ---------- */
.share-card {
  text-align: center;
  padding: 1.5rem;
}

.share-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.share-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-share {
  flex: 1;
  min-width: 140px;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.btn-twitter {
  background: #1d9bf0;
  color: var(--white);
}

.btn-twitter:hover {
  background: #1a8cd8;
  transform: translateY(-2px);
}

.btn-copy {
  background: var(--white-15);
  color: var(--white);
  border: 1px solid var(--white-20);
}

.btn-copy:hover {
  background: var(--white-20);
  transform: translateY(-2px);
}

.btn-copy.copied {
  background: #22c55e;
  border-color: #22c55e;
}

/* ---------- Promo Card ---------- */
.promo-card {
  text-align: center;
  padding: 2rem 1.5rem;
  border: 1px solid rgba(255, 45, 135, 0.2);
}

.promo-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.promo-text {
  color: var(--white-60);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.promo-books {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.promo-book {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--white-80);
}

.promo-emoji {
  font-size: 1.2rem;
}

.promo-btn {
  width: 100%;
  font-size: 1rem;
  padding: 1rem;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--white-60);
  line-height: 1.8;
}

.footer a {
  color: var(--pink-light);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-copy {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.9);
  color: var(--white);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  backdrop-filter: blur(10px);
  border: 1px solid var(--white-15);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ---------- Responsive ---------- */
@media (min-width: 480px) {
  .welcome-title {
    font-size: 2.5rem;
  }
  .quiz-question {
    font-size: 1.6rem;
  }
  .results-archetype {
    font-size: 2.5rem;
  }
  .card {
    padding: 2.5rem 2rem;
  }
}

@media (min-width: 768px) {
  .welcome-title {
    font-size: 3rem;
  }
  .app {
    padding: 2rem;
  }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .bg-particle {
    display: none;
  }
}

/* Focus styles for keyboard nav */
.btn:focus-visible,
.quiz-option:focus-visible {
  outline: 2px solid var(--hot-pink);
  outline-offset: 3px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--white-20);
  border-radius: 3px;
}
