/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --black: #0A0A0A;
  --off-white: #F5F0E8;
  --purple: #7029CF;
  --pink: #D10E85;
  --gold: #FFD700;
  --cyan: #1DDDDD;
  --orange: #D10E85;
  --dark-gray: #120828;
  --mid-gray: #1E1040;
  --muted: #A89CC8;
  --font-heading: 'Archivo Black', 'Archivo', sans-serif;
  --font-body: 'Playfair Display', serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--off-white);
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* Background video */
.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.12;
  pointer-events: none;
}

/* ===== GRAIN OVERLAY ===== */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100dvh;
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

/* When top nav is visible, add top spacing to screens */
.screen.has-nav {
  padding-top: 90px;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.08em;
  padding: 16px 32px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-large {
  width: 100%;
  padding: 18px 32px;
  font-size: 1.1rem;
}

.btn-primary {
  background: var(--pink);
  color: #fff;
}

.btn-primary:hover {
  background: #e8189a;
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
}

.btn-secondary:hover {
  background: rgba(255, 215, 0, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 12px 24px;
  letter-spacing: 0.02em;
}

.btn-ghost:hover {
  color: var(--off-white);
}

.btn-whatsapp {
  background: #25D366;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.08em;
  padding: 18px 32px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: block;
  width: 100%;
  transition: all 0.2s ease;
}

.btn-whatsapp:hover {
  background: #20bd5a;
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(209, 14, 133, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(209, 14, 133, 0); }
}

/* ===== SCREEN 1: LANDING ===== */
.landing-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
}

/* Landing page corner logo */
.landing-logo-corner {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
}

.landing-corner-logo {
  width: 64px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(112, 41, 207, 0.4));
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--off-white);
  margin-bottom: 20px;
  text-shadow: 2px 2px 0 rgba(112, 41, 207, 0.3);
}

.hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 40px;
  font-weight: 400;
}

#btnStart {
  margin-bottom: 32px;
}

.referral-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* ===== SCREEN 2: QUIZ ===== */
#screenQuiz {
  align-items: flex-start;
  padding-top: 40px;
}

#screenQuiz.has-nav {
  padding-top: 100px;
}

.quiz-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.progress-bar-container {
  margin-bottom: 32px;
}

.progress-text {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 10px;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: var(--mid-gray);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.question-area {
  position: relative;
  min-height: 400px;
}

.question-card {
  animation: slideIn 0.4s ease;
}

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

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-30px); }
}

.question-card.exit {
  animation: slideOut 0.3s ease forwards;
}

.question-text {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  line-height: 1.3;
  margin-bottom: 28px;
  color: var(--off-white);
}

.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card {
  background: var(--dark-gray);
  border: 2px solid var(--mid-gray);
  border-radius: 8px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--off-white);
  position: relative;
  overflow: hidden;
}

.option-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--purple);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.option-card span {
  position: relative;
  z-index: 1;
}

.option-card:hover {
  border-color: var(--purple);
}

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

.option-card.selected {
  border-color: var(--pink);
  background: var(--purple);
}

.option-card.selected::before {
  opacity: 1;
}

.option-letter {
  font-family: var(--font-heading);
  color: var(--pink);
  margin-right: 10px;
  font-size: 1rem;
  font-weight: 800;
  transition: color 0.2s ease;
}

.option-card.selected .option-letter {
  color: var(--off-white);
}

/* ===== SCREEN 3: RESULT ===== */
.result-container {
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.result-reveal {
  margin-bottom: 32px;
}

.result-label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 8px;
}

.score-display {
  font-family: var(--font-heading);
  margin-bottom: 24px;
}

.score-number {
  font-size: clamp(4rem, 15vw, 7rem);
  color: var(--gold);
  line-height: 1;
}

.score-total {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: var(--muted);
}

.type-name {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  color: var(--off-white);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.type-tagline {
  font-size: 1rem;
  color: var(--cyan);
  font-style: italic;
  margin-bottom: 20px;
  line-height: 1.5;
}

.type-description {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 8px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* Share card */
.share-card {
  margin: 32px auto;
  max-width: 340px;
  perspective: 1000px;
}

.share-card-inner {
  background: linear-gradient(145deg, #120828 0%, #0A0A0A 100%);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.share-card-inner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(112, 41, 207, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

.share-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--mid-gray);
}

.share-card-title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  color: var(--pink);
}

.share-card-year {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.share-card-body {
  padding: 16px 0;
}

.share-card-label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 8px;
}

.share-card-type {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--off-white);
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1.2;
}

.share-card-score {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
}

.share-card-footer {
  padding-top: 12px;
  border-top: 1px solid var(--mid-gray);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-family: var(--font-heading);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* ===== SCREEN 4: SHARE ===== */
.share-container {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  margin-bottom: 24px;
  color: var(--off-white);
}

.share-prompt {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.input-name {
  width: 100%;
  padding: 16px 20px;
  background: var(--dark-gray);
  border: 2px solid var(--mid-gray);
  border-radius: 8px;
  color: var(--off-white);
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-name:focus {
  border-color: var(--purple);
}

.input-name::placeholder {
  color: var(--muted);
}

.referral-stats {
  margin: 24px 0;
}

.stat-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}

.referral-link-box {
  background: var(--dark-gray);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  position: relative;
}

.link-label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 10px;
}

.link-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-text {
  flex: 1;
  font-size: 0.8rem;
  color: var(--off-white);
  word-break: break-all;
  text-align: left;
}

.btn-copy {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  padding: 8px 16px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.btn-copy:hover {
  background: #8133e8;
}

.copy-confirm {
  font-size: 0.8rem;
  color: #25D366;
  margin-top: 8px;
  display: block;
  animation: fadeIn 0.3s ease;
}

.share-buttons {
  margin-bottom: 32px;
}

/* ===== TOP NAV BAR ===== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.top-nav.hidden {
  display: none !important;
}

.home-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.home-btn:hover {
  transform: scale(1.08);
}

.home-btn:active {
  transform: scale(0.95);
}

.home-logo {
  width: 48px;
  height: auto;
  filter: drop-shadow(0 0 8px rgba(112, 41, 207, 0.4));
}

/* ===== LEADERBOARD ===== */
.leaderboard-toggle {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 8px 14px;
  background: var(--dark-gray);
  border: 1px solid var(--mid-gray);
  color: var(--pink);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.leaderboard-toggle:hover {
  border-color: var(--pink);
}

.leaderboard-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 32px;
}

.leaderboard-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--off-white);
  margin-bottom: 16px;
}

.leaderboard-list {
  list-style: none;
  counter-reset: rank;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.leaderboard-item {
  counter-increment: rank;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--dark-gray);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.leaderboard-item::before {
  content: counter(rank);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--muted);
  width: 32px;
  flex-shrink: 0;
}

.leaderboard-item:nth-child(1)::before { color: var(--gold); }
.leaderboard-item:nth-child(2)::before { color: var(--off-white); }
.leaderboard-item:nth-child(3)::before { color: var(--pink); }

.leaderboard-item.current-user {
  border: 1px solid var(--purple);
  background: rgba(112, 41, 207, 0.12);
}

.leaderboard-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.95rem;
}

.leaderboard-count {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--pink);
  letter-spacing: 0.05em;
}

.mini-leaderboard {
  margin-top: 8px;
  margin-bottom: 24px;
}

.full-leaderboard {
  margin-bottom: 32px;
}

.leaderboard-container {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

/* ===== UTILITY ===== */
.hidden {
  display: none !important;
}

/* ===== ANIMATIONS ===== */
@keyframes countUp {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.score-animate {
  animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.type-animate {
  animation: fadeIn 0.8s ease 0.5s both;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .screen {
    padding: 40px;
  }

  .option-card:hover {
    transform: translateX(4px);
    border-color: var(--purple);
  }

  .option-card.selected:hover {
    transform: none;
  }
}

@media (max-width: 360px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .option-card {
    padding: 14px 16px;
    font-size: 0.9rem;
  }
}
