/* ===========================
   TOKENS & THEME
   =========================== */
:root, [data-theme='light'] {
  --color-bg: #fff5f7;
  --color-surface: #ffffff;
  --color-surface-2: #fdf0f3;
  --color-border: #f5c6d2;
  --color-text: #1a0a10;
  --color-text-muted: #7a5563;
  --color-text-faint: #c4a0ae;
  --color-accent: #e8537a;
  --color-accent-dark: #c43060;
  --color-accent-light: #fde8ed;
  --color-accent-2: #ff8fab;
  --color-gold: #f5a623;
  --color-success: #2ecc71;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-hero: clamp(2.5rem, 1rem + 4vw, 5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --radius-xl: 2rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(200, 50, 80, 0.08);
  --shadow-md: 0 4px 16px rgba(200, 50, 80, 0.12);
  --shadow-lg: 0 12px 40px rgba(200, 50, 80, 0.18);
  --shadow-hover: 0 20px 60px rgba(200, 50, 80, 0.25);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme='dark'] {
  --color-bg: #150a0d;
  --color-surface: #1e1014;
  --color-surface-2: #261520;
  --color-border: #4a2030;
  --color-text: #fde8ee;
  --color-text-muted: #c49aab;
  --color-text-faint: #7a5060;
  --color-accent: #ff6b94;
  --color-accent-dark: #ff4080;
  --color-accent-light: #2a0d18;
  --color-accent-2: #ffb3c8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #150a0d;
    --color-surface: #1e1014;
    --color-surface-2: #261520;
    --color-border: #4a2030;
    --color-text: #fde8ee;
    --color-text-muted: #c49aab;
    --color-text-faint: #7a5060;
    --color-accent: #ff6b94;
    --color-accent-dark: #ff4080;
    --color-accent-light: #2a0d18;
    --color-accent-2: #ffb3c8;
  }
}

/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow-x: hidden;
}
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
h1,h2,h3 { text-wrap: balance; line-height: 1.15; }

/* ===========================
   HEARTS BACKGROUND
   =========================== */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.heart-particle {
  position: absolute;
  bottom: -40px;
  font-size: 1.2rem;
  opacity: 0;
  animation: floatHeart linear infinite;
  user-select: none;
}
@keyframes floatHeart {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-110vh) rotate(360deg) scale(0.5); opacity: 0; }
}

/* ===========================
   HEADER
   =========================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.01em;
}
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  transition: color var(--transition-interactive), background var(--transition-interactive);
}
.theme-toggle:hover { color: var(--color-accent); background: var(--color-accent-light); }

/* ===========================
   HERO
   =========================== */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--space-16) + 60px) var(--space-6) var(--space-16);
}
.hero-badge {
  display: inline-block;
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  border: 1px solid var(--color-accent);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  animation: fadeSlideIn 0.6s var(--ease-out) both;
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  animation: fadeSlideIn 0.7s var(--ease-out) 0.1s both;
}
.hero-title em {
  font-style: italic;
  color: var(--color-accent);
}
.trademark {
  font-size: 0.4em;
  vertical-align: super;
  color: var(--color-text-muted);
}
.hero-sub {
  max-width: 560px;
  color: var(--color-text-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
  animation: fadeSlideIn 0.7s var(--ease-out) 0.2s both;
}
.hero-meta {
  display: flex;
  gap: var(--space-6);
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-10);
  animation: fadeSlideIn 0.7s var(--ease-out) 0.3s both;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-start {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  font-weight: 600;
  font-family: var(--font-body);
  box-shadow: var(--shadow-md), 0 0 0 0 color-mix(in srgb, var(--color-accent) 40%, transparent);
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive), background var(--transition-interactive);
  animation: fadeSlideIn 0.7s var(--ease-out) 0.4s both, pulse 2.5s ease-in-out 1.5s infinite;
}
.btn-start:hover {
  background: var(--color-accent-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.btn-start:active { transform: translateY(0); }

@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow-md), 0 0 0 0 color-mix(in srgb, var(--color-accent) 40%, transparent); }
  50% { box-shadow: var(--shadow-md), 0 0 0 12px color-mix(in srgb, var(--color-accent) 0%, transparent); }
}

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

/* ===========================
   SURVEY CONTAINER
   =========================== */
.survey-container {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(80px + var(--space-8)) var(--space-6) var(--space-12);
}
.progress-bar-wrap {
  width: 100%;
  max-width: 680px;
  margin-bottom: var(--space-8);
  position: relative;
}
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
  border-radius: var(--radius-full);
  transition: width 0.5s var(--ease-out);
  width: var(--progress, 0%);
}
.progress-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}
.question-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-10);
  max-width: 680px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.5s var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.question-number {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 900;
  color: var(--color-accent);
  opacity: 0.12;
  line-height: 1;
  margin-bottom: calc(-1 * var(--space-6));
  user-select: none;
}
.question-text {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}
.question-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  font-style: italic;
}

/* ===========================
   OPTIONS GRID
   =========================== */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  position: relative;
}
.option-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform var(--transition-interactive), box-shadow var(--transition-interactive), border-color var(--transition-interactive), background var(--transition-interactive);
  overflow: visible;
  min-height: 64px;
}
.option-btn .opt-emoji {
  font-size: 1.4em;
  flex-shrink: 0;
}
.option-btn:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}
.option-btn.selected {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 25%, transparent);
  color: var(--color-accent-dark);
}
/* The BEST answer (flees on hover) */
.option-btn.flee-option {
  background: linear-gradient(135deg, #fff5f7, #ffe8ee);
  border-color: var(--color-accent);
  font-weight: 600;
  color: var(--color-accent-dark);
}

/* Second-best answer (also flees) */
.option-btn.flee2-option {
  background: linear-gradient(135deg, #fff9f0, #ffeeda);
  border-color: var(--color-gold);
  font-weight: 600;
  color: #7a4800;
}
[data-theme='dark'] .option-btn.flee2-option {
  background: linear-gradient(135deg, #231a0a, #2e2010);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

/* Worst answer — vanishes on hover but stays clickable */
.option-btn.vanish-option {
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
}
.option-btn.vanish-option:hover {
  opacity: 0;
  transform: scale(0.92);
}

/* Caught state */
.option-btn.caught {
  background: #f0fff4 !important;
  border-color: var(--color-success) !important;
  color: #1a5c2e !important;
  animation: caught-bounce 0.5s var(--ease-out);
}
[data-theme='dark'] .option-btn.caught {
  background: #0d2b18 !important;
  color: #6daa45 !important;
}
@keyframes caught-bounce {
  0% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ===========================
   FLEEING BUTTON (global, fixed position)
   =========================== */
.fleeing-btn {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: linear-gradient(135deg, #fff0f5, #ffe3ec);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-dark);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  min-width: 160px;
  transition: none; /* no transition while fleeing */
  pointer-events: auto;
  min-height: 64px;
}
.fleeing-btn::before {
  content: '😅';
  font-size: 1.3em;
  flex-shrink: 0;
}
.fleeing-btn .flee-label { flex: 1; }

/* Second flee button — gold/amber style */
.fleeing-btn-2 {
  background: linear-gradient(135deg, #fff9f0, #ffeeda);
  border-color: var(--color-gold);
  color: #7a4800;
}
.fleeing-btn-2::before {
  content: '🙈';
}
[data-theme='dark'] .fleeing-btn-2 {
  background: linear-gradient(135deg, #231a0a, #2e2010);
  border-color: var(--color-gold);
  color: var(--color-gold);
}
.fleeing-btn-2.caught-flee {
  background: #f0fff4 !important;
  border-color: var(--color-success) !important;
  color: #1a5c2e !important;
}
.fleeing-btn.caught-flee {
  background: #f0fff4 !important;
  border-color: var(--color-success) !important;
  color: #1a5c2e !important;
  animation: caught-bounce 0.5s var(--ease-out);
  pointer-events: none;
}
.fleeing-btn.caught-flee::before { content: '🎉'; }

/* Wiggle hint when cursor is far away */
.fleeing-btn.wiggle {
  animation: wiggle 0.5s ease-in-out;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-6deg) scale(1.05); }
  40% { transform: rotate(6deg) scale(1.05); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
}

/* ===========================
   CAUGHT OVERLAY
   =========================== */
.caught-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
}
.caught-text {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-accent);
  text-shadow: 0 2px 20px rgba(200,50,80,0.4);
  animation: caughtPop 0.8s var(--ease-out) both;
}
@keyframes caughtPop {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(3deg); opacity: 1; }
  80% { transform: scale(0.95) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.caught-text.fadeout {
  animation: fadeout 0.5s var(--ease-in) 0.8s both;
}
@keyframes fadeout {
  to { opacity: 0; transform: scale(1.1); }
}

/* ===========================
   NEXT BUTTON
   =========================== */
.btn-next {
  margin-top: var(--space-6);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-3) var(--space-8);
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform var(--transition-interactive), box-shadow var(--transition-interactive);
  transform: translateY(10px);
}
.btn-next.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.btn-next:hover { background: var(--color-accent-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-next:active { transform: translateY(0); }

/* ===========================
   RESULTS SCREEN
   =========================== */
.results-screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
}
.results-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.6s var(--ease-out) both;
}
.results-emoji {
  font-size: 5rem;
  margin-bottom: var(--space-4);
  animation: resultsBounce 0.8s var(--ease-out) 0.3s both;
}
@keyframes resultsBounce {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.25) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.results-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}
.results-body {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
  max-width: 42ch;
  margin-inline: auto;
}
.score-display {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-8);
}
.score-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.score-bar-wrap {
  height: 12px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.score-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-accent), var(--color-gold));
  transition: width 1.2s var(--ease-out);
  width: 0%;
}
.score-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 900;
  color: var(--color-accent);
}
.btn-restart {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: border-color var(--transition-interactive), color var(--transition-interactive), background var(--transition-interactive);
}
.btn-restart:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-light);
}

/* ===========================
   CONFETTI
   =========================== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall linear both;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 540px) {
  .options-grid { grid-template-columns: 1fr; }
  .question-card { padding: var(--space-6); }
  .results-card { padding: var(--space-8) var(--space-6); }
  .hero-meta { gap: var(--space-4); }
}
