/* ── VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:          #0f0f1a;
  --card-bg:     #1a1a2e;
  --card-bd:     #2a2a4a;
  --gold:        #d4af37;
  --gold-lt:     #f0d060;
  --gold-dim:    #6a5318;
  --text:        #f0f0f8;
  --muted:       #7a7a9a;
  --success:     #4caf50;
  --danger:      #e74c3c;
  --opt-hover:   #242440;
  --opt-sel:     rgba(212,175,55,.18);
  --opt-sel-bd:  #d4af37;

  --sec-a: #d4af37; --sec-b: #4a9eff; --sec-c: #9b59b6;
  --sec-d: #2ecc71; --sec-e: #e74c3c; --sec-f: #e67e22; --sec-g: #d4af37;

  --radius: 16px;
  --trans:  transform .38s cubic-bezier(.4,0,.2,1);
}

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

html, body { height: 100%; overflow: hidden; touch-action: pan-y; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── TOP BAR ────────────────────────────────────────────── */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 58px; z-index: 100;
  background: rgba(15,15,26,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-bd);
  display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px;
}

.top-left { display: flex; align-items: center; gap: 10px; }
.progress-ring-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.progress-ring-wrap span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--gold);
}
.section-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .5px; }

.top-right { display: flex; align-items: center; }
.streak-wrap {
  display: flex; align-items: center; gap: 4px;
  background: rgba(212,175,55,.12);
  border: 1px solid var(--gold-dim);
  border-radius: 20px; padding: 4px 12px;
  font-size: 13px; font-weight: 700; color: var(--gold);
}

/* ── CARD STAGE ─────────────────────────────────────────── */
#stage {
  position: fixed; inset: 58px 0 72px 0;
  overflow: hidden;
}

/* ── CARD ───────────────────────────────────────────────── */
.card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 20px;
  transition: var(--trans);
  will-change: transform;
  overflow-y: auto;
}

.card.enter-right { transform: translateX(100%); }
.card.enter-left  { transform: translateX(-100%); }
.card.exit-left   { transform: translateX(-100%); }
.card.exit-right  { transform: translateX(100%); }
.card.active      { transform: translateX(0); }

/* ── CARD INNER ─────────────────────────────────────────── */
.card-box {
  width: 100%; max-width: 520px;
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

/* ── SECTION BADGE ──────────────────────────────────────── */
.section-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px;
  margin-bottom: 14px; color: #000;
}

/* ── QUESTION TEXT ──────────────────────────────────────── */
.q-text {
  font-size: 17px; font-weight: 600; line-height: 1.55;
  color: var(--text); margin-bottom: 22px;
}
.q-optional { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.q-note {
  font-size: 11px; color: var(--gold); margin-bottom: 16px;
  background: rgba(212,175,55,.1); border-left: 3px solid var(--gold);
  padding: 6px 10px; border-radius: 4px;
}

/* ── RADIO / CHECKBOX OPTIONS ───────────────────────────── */
.options { display: flex; flex-direction: column; gap: 10px; }

.opt-btn {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.04);
  border: 1.5px solid var(--card-bd);
  border-radius: 12px; padding: 13px 16px;
  cursor: pointer; transition: all .18s; color: var(--text);
  font-size: 15px; font-family: inherit;
  text-align: left; width: 100%;
}
.opt-btn:active { transform: scale(.97); }
.opt-btn:hover  { background: var(--opt-hover); border-color: var(--muted); }
.opt-btn.selected {
  background: var(--opt-sel);
  border-color: var(--opt-sel-bd);
  color: var(--gold);
}
.opt-btn.selected .opt-indicator { background: var(--gold); border-color: var(--gold); }

.opt-indicator {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--muted);
  transition: all .18s;
}
.opt-check {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 4px; border: 2px solid var(--muted);
  transition: all .18s; display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.opt-btn.selected .opt-check {
  background: var(--gold); border-color: var(--gold); color: #000;
}

/* ── LIKERT SCALE ───────────────────────────────────────── */
.likert-wrap { width: 100%; }
.likert-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--muted);
  margin-bottom: 10px; padding: 0 4px;
}
.likert-btns {
  display: flex; gap: 8px; justify-content: center;
}
.lk-btn {
  flex: 1; max-width: 60px; min-width: 44px;
  aspect-ratio: 1;
  background: rgba(255,255,255,.05);
  border: 2px solid var(--card-bd);
  border-radius: 12px;
  font-size: 18px; font-weight: 700; color: var(--muted);
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.lk-btn:hover { border-color: var(--gold-dim); color: var(--text); }
.lk-btn.selected {
  background: var(--gold); border-color: var(--gold);
  color: var(--bg); transform: scale(1.12);
  box-shadow: 0 0 16px rgba(212,175,55,.5);
}
.lk-scale-note {
  text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px;
}
.reverse-note {
  font-size: 11px; color: #e06020;
  text-align: center; margin-top: 8px;
}

/* ── TEXTAREA ───────────────────────────────────────────── */
.q-textarea {
  width: 100%; background: rgba(255,255,255,.05);
  border: 1.5px solid var(--card-bd); border-radius: 12px;
  color: var(--text); font-size: 14px; font-family: inherit;
  padding: 14px 16px; resize: vertical; min-height: 120px;
  transition: border-color .2s; outline: none;
}
.q-textarea:focus { border-color: var(--gold); }
.q-textarea::placeholder { color: var(--muted); }

/* ── INTRO CARD ─────────────────────────────────────────── */
.intro-card {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.intro-card .logo {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--gold); display: flex; align-items: center;
  justify-content: center; font-size: 28px;
}
.intro-card h1 { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.3; }
.intro-card p  { font-size: 14px; color: var(--muted); line-height: 1.6; }

.video-wrap {
  width: 100%; border-radius: 12px; overflow: hidden;
  background: #000; aspect-ratio: 16/9;
  border: 1px solid var(--card-bd);
}
.video-wrap iframe { width: 100%; height: 100%; border: none; }
.video-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: rgba(255,255,255,.04);
  border: 2px dashed var(--card-bd); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px;
}

.btn-primary {
  background: var(--gold); color: var(--bg);
  font-weight: 800; font-size: 16px; font-family: inherit;
  padding: 15px 40px; border-radius: 12px;
  border: none; cursor: pointer; transition: all .2s;
  width: 100%; letter-spacing: .5px;
}
.btn-primary:hover { background: var(--gold-lt); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: var(--gold-dim); color: var(--muted); cursor: not-allowed; transform: none; }

/* ── CONSENT CARD ───────────────────────────────────────── */
.consent-box {
  background: rgba(212,175,55,.07);
  border: 1px solid var(--gold-dim);
  border-radius: 12px; padding: 16px;
  font-size: 13px; color: var(--muted); line-height: 1.7;
  margin: 16px 0;
}

/* ── MILESTONE CARD ─────────────────────────────────────── */
.milestone-card {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.ms-icon { font-size: 52px; line-height: 1; }
.ms-section { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.ms-title { font-size: 24px; font-weight: 800; color: var(--text); }
.ms-desc  { font-size: 14px; color: var(--muted); line-height: 1.6; max-width: 340px; }
.ms-badge {
  background: rgba(212,175,55,.15);
  border: 1px solid var(--gold-dim);
  border-radius: 20px; padding: 6px 18px;
  font-size: 13px; color: var(--gold); font-weight: 600;
}

/* ── EMAIL GATE ─────────────────────────────────────────── */
.email-gate { text-align: center; display: flex; flex-direction: column; gap: 18px; }
.email-gate h2 { font-size: 20px; font-weight: 800; }
.email-gate p  { font-size: 14px; color: var(--muted); line-height: 1.6; }
.email-input {
  width: 100%; background: rgba(255,255,255,.06);
  border: 1.5px solid var(--card-bd); border-radius: 12px;
  color: var(--text); font-size: 16px; font-family: inherit;
  padding: 14px 16px; outline: none; transition: border-color .2s;
}
.email-input:focus { border-color: var(--gold); }
.email-input::placeholder { color: var(--muted); }

/* ── THANK YOU CARD ─────────────────────────────────────── */
.thankyou-card { text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.thankyou-card .big-check {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(76,175,80,.15); border: 2px solid var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.thankyou-card h2 { font-size: 22px; font-weight: 800; }
.thankyou-card p  { font-size: 14px; color: var(--muted); line-height: 1.6; }

.btn-download {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--gold); color: var(--bg);
  font-weight: 800; font-size: 15px; font-family: inherit;
  padding: 14px 28px; border-radius: 12px;
  border: none; cursor: pointer; transition: all .2s;
  width: 100%; text-decoration: none;
}
.btn-download:hover { background: var(--gold-lt); transform: translateY(-2px); }

.btn-share {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(37,211,102,.15); color: #25D366;
  border: 1px solid rgba(37,211,102,.4);
  font-weight: 700; font-size: 14px; font-family: inherit;
  padding: 12px 20px; border-radius: 12px;
  cursor: pointer; transition: all .2s; width: 100%;
  text-decoration: none;
}
.btn-share:hover { background: rgba(37,211,102,.25); }

/* Character counter for textarea */
.char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  transition: color 0.2s;
}

.char-counter.warning {
  color: #e74c3c;
  font-weight: 600;
}

.email-status { font-size: 12px; color: var(--success); min-height: 18px; }
.email-err    { color: var(--danger); }

/* ── EXIT CARD ──────────────────────────────────────────── */
.exit-card { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.exit-card .emoji { font-size: 52px; }

/* ── BOTTOM BAR ─────────────────────────────────────────── */
#bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 72px; z-index: 100;
  background: rgba(15,15,26,.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-bd);
  display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px; gap: 12px;
}

.btn-back {
  background: rgba(255,255,255,.06);
  border: 1.5px solid var(--card-bd);
  color: var(--muted); font-size: 18px;
  width: 48px; height: 48px; border-radius: 12px;
  cursor: pointer; transition: all .18s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.btn-back:hover { border-color: var(--muted); color: var(--text); }

.timer-wrap {
  position: relative; width: 52px; height: 52px; flex-shrink: 0;
}
.timer-wrap span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--gold);
}

.btn-next {
  background: var(--gold); color: var(--bg);
  font-weight: 800; font-size: 15px; font-family: inherit;
  padding: 0 24px; height: 48px; border-radius: 12px;
  border: none; cursor: pointer; transition: all .2s; flex: 1;
}
.btn-next:disabled {
  background: var(--gold-dim); color: var(--muted);
  cursor: not-allowed; transform: none;
}
.btn-next:not(:disabled):hover { background: var(--gold-lt); }
.btn-next:not(:disabled):active { transform: scale(.97); }

/* ── XP POPUP ───────────────────────────────────────────── */
.xp-popup {
  position: fixed; top: 30%; left: 50%;
  transform: translateX(-50%);
  background: rgba(212,175,55,.9);
  color: var(--bg); font-weight: 900; font-size: 18px;
  padding: 8px 20px; border-radius: 20px;
  pointer-events: none; z-index: 999;
  animation: xpFloat 1s ease-out forwards;
}
@keyframes xpFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px); }
}

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

/* ── SPINNER ────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px; border: 3px solid rgba(212,175,55,.2);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--card-bd); border-radius: 4px; }
