:root {
  --bg:       #08090d;
  --s1:       #10131a;
  --s2:       #171c27;
  --s3:       #1e2535;
  --border:   rgba(255,255,255,0.06);
  --border2:  rgba(255,255,255,0.1);
  --text:     #e8eaf2;
  --muted:    #6b7491;
  --muted2:   #9099b8;
  --teal:     #4ecdc4;
  --blue:     #4a90d9;
  --purple:   #9b72cf;
  --rose:     #e8637a;
  --gold:     #f5c842;
  --green:    #56cf8a;
  --orange:   #f09552;
  --red:      #e85c5c;
  --glow-t:   rgba(78,205,196,0.12);
  --glow-p:   rgba(155,114,207,0.12);
}
*{box-sizing:border-box;margin:0;padding:0;}
html{scroll-behavior:smooth;}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated nebula background ── */
.nebula {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.nebula-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5;
  animation: orb-float 12s ease-in-out infinite alternate;
}
.orb1 { width:500px;height:500px;background:radial-gradient(circle,rgba(78,205,196,0.08),transparent);top:-100px;left:-100px;animation-delay:0s; }
.orb2 { width:400px;height:400px;background:radial-gradient(circle,rgba(155,114,207,0.07),transparent);bottom:-80px;right:-80px;animation-delay:-4s; }
.orb3 { width:300px;height:300px;background:radial-gradient(circle,rgba(74,144,217,0.06),transparent);top:40%;left:40%;animation-delay:-8s; }
@keyframes orb-float{from{transform:translate(0,0) scale(1);}to{transform:translate(30px,20px) scale(1.05);}}

/* ── Layout ── */
.app {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
}

.container {
  width: 100%; max-width: 700px;
  padding: 40px 20px 100px;
}

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; animation: screen-in 0.5s cubic-bezier(0.4,0,0.2,1) both; }
@keyframes screen-in { from{opacity:0;transform:translateY(20px);}to{opacity:1;transform:translateY(0);} }

/* ── Logo / Header ── */
.logo-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 32px;
}
.logo-gem {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 24px rgba(78,205,196,0.3);
}
.logo-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 600;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--teal), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-badge {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  background: rgba(78,205,196,0.1); border: 1px solid rgba(78,205,196,0.2);
  border-radius: 100px; padding: 3px 8px; color: var(--teal);
  margin-left: 4px; margin-top: 2px;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px,6vw,52px); font-weight: 600;
  line-height: 1.15; letter-spacing: -0.5px;
  text-align: center; margin-bottom: 14px;
}
.page-title em { font-style: italic; color: var(--teal); }
.page-sub {
  text-align: center; color: var(--muted2);
  font-size: 15px; line-height: 1.7;
  max-width: 500px; margin: 0 auto 40px;
}

/* ── Card ── */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  position: relative; overflow: hidden;
  margin-bottom: 16px;
}
.card-glow {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(78,205,196,0.4), transparent);
}
.card-title {
  font-size: 11px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 18px;
}

/* ── Privacy badge ── */
.privacy-row {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 28px;
  font-size: 12px; color: var(--muted);
}
.privacy-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 2s infinite;
}
@keyframes blink{0%,100%{opacity:1;}50%{opacity:0.4;}}

/* ── Feature grid ── */
.feature-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 28px;
}
.feat {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.feat-icon { font-size: 22px; margin-bottom: 8px; }
.feat-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.feat-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ── Disclaimer ── */
.disclaimer {
  background: rgba(245,200,66,0.06);
  border: 1px solid rgba(245,200,66,0.2);
  border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: #c9a63a; line-height: 1.6;
  display: flex; gap: 10px; margin-bottom: 24px;
}

/* ── Big CTA button ── */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  border: none; border-radius: 16px;
  padding: 20px; color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 16px; font-weight: 600; letter-spacing: 0.3px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 32px rgba(78,205,196,0.2);
}
.btn-primary:hover { opacity:0.92; transform:translateY(-2px); box-shadow:0 12px 40px rgba(78,205,196,0.3); }
.btn-secondary {
  width: 100%;
  background: var(--s2); border: 1px solid var(--border2);
  border-radius: 16px; padding: 16px; color: var(--muted2);
  font-family:'Outfit',sans-serif; font-size:14px; font-weight:500;
  cursor:pointer; margin-top:10px; transition:all 0.2s;
}
.btn-secondary:hover { border-color:var(--teal); color:var(--teal); }

/* ═══════════════════════════════
   FACE SCAN SCREEN
═══════════════════════════════ */
.guide-steps {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px; margin-bottom: 24px;
}
.guide-step {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 10px; text-align: center;
}
.guide-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg,var(--teal),var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin: 0 auto 8px;
}
.guide-step-icon { font-size: 20px; margin-bottom: 6px; }
.guide-step-text { font-size: 11px; color: var(--muted); line-height: 1.4; }

.camera-wrap {
  position: relative; width: 100%;
  aspect-ratio: 4/3; max-height: 360px;
  background: var(--s2); border-radius: 16px; overflow: hidden;
  border: 2px solid var(--border2);
  margin-bottom: 16px;
}
.camera-wrap video, .camera-wrap canvas {
  position: absolute; top:0;left:0; width:100%;height:100%;
  object-fit: cover; border-radius: 14px;
}
#overlay-canvas { z-index: 2; }
#video-el { transform: scaleX(-1); }
#snapshot-canvas { display:none; z-index:3; border-radius:14px; }

.camera-overlay-ui {
  position: absolute; inset: 0; z-index: 4;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.face-reticle {
  width: 180px; height: 220px;
  border-radius: 50%;
  border: 2px dashed rgba(78,205,196,0.4);
  box-shadow: 0 0 0 4px rgba(78,205,196,0.05);
  animation: reticle-pulse 2.5s ease-in-out infinite;
}
@keyframes reticle-pulse {
  0%,100%{border-color:rgba(78,205,196,0.4);box-shadow:0 0 0 4px rgba(78,205,196,0.05);}
  50%{border-color:rgba(78,205,196,0.7);box-shadow:0 0 0 8px rgba(78,205,196,0.1);}
}
.face-reticle.detected {
  border-color: var(--green); border-style: solid;
  animation: none;
  box-shadow: 0 0 0 6px rgba(86,207,138,0.15), 0 0 30px rgba(86,207,138,0.2);
}

.camera-status {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 5; background: rgba(0,0,0,0.7); backdrop-filter: blur(10px);
  border: 1px solid var(--border2); border-radius: 100px;
  padding: 6px 16px; font-size: 12px; color: var(--muted2);
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.status-dot { width:6px;height:6px;border-radius:50%;background:var(--muted); }
.status-dot.green{background:var(--green);box-shadow:0 0 6px var(--green);}
.status-dot.pulse{background:var(--teal);animation:blink 1s infinite;}

.emotion-live {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px; min-height: 36px; align-items: center;
}
.emotion-chip {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 100px; padding: 4px 12px;
  font-size: 12px; color: var(--muted);
  transition: all 0.3s;
}
.emotion-chip.dominant {
  background: rgba(78,205,196,0.1);
  border-color: rgba(78,205,196,0.3);
  color: var(--teal); font-weight: 600;
}

.model-status {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: var(--muted); text-align: center;
  margin-bottom: 16px; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}

#btn-capture { display: none; }
#btn-retake  { display: none; }
#div-analysis-preview { display: none; }

.face-result-preview {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px;
  display: flex; gap: 16px; align-items: flex-start;
}
.face-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit:cover; flex-shrink:0; }
.face-emotions-list { flex: 1; }
.face-emotions-list h4 { font-size: 14px; margin-bottom: 10px; }
.emotion-bar-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.emotion-bar-label { width: 80px; font-size: 11px; color: var(--muted); flex-shrink:0; }
.emotion-bar-track { flex:1; background:var(--s3); border-radius:100px; height:5px; overflow:hidden; }
.emotion-bar-fill  { height:100%; border-radius:100px; transition:width 0.8s ease; }
.emotion-bar-pct   { font-size:11px; color:var(--muted); width:32px; text-align:right; }

/* ═══════════════════════════════
   QUESTIONS
═══════════════════════════════ */
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 12px; color: var(--muted);
}
.progress-track {
  height: 3px; background: var(--s2); border-radius:100px;
  margin-bottom: 28px; overflow:hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--purple));
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.q-cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(78,205,196,0.08); border: 1px solid rgba(78,205,196,0.15);
  border-radius: 100px; padding: 4px 14px;
  font-size: 11px; font-weight: 600; color: var(--teal);
  letter-spacing: 0.8px; text-transform: uppercase;
  margin-bottom: 16px;
}
.q-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(20px,3.5vw,28px); font-weight: 400;
  line-height: 1.45; color: var(--text);
  margin-bottom: 32px;
}
.q-hint { font-size: 13px; color: var(--muted); margin-bottom: 32px; margin-top: -20px; }

.answer-grid { display: grid; grid-template-columns:1fr 1fr; gap: 12px; }
.btn-ans {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px 16px;
  color: var(--text); font-family:'Outfit',sans-serif;
  font-size: 15px; font-weight: 500; cursor:pointer;
  transition: all 0.2s; display:flex; flex-direction:column;
  align-items:center; gap:10px;
}
.btn-ans-icon { font-size: 28px; }
.btn-ans.yes:hover {
  border-color: var(--green); background: rgba(86,207,138,0.07);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(86,207,138,0.12);
}
.btn-ans.no:hover {
  border-color: var(--rose); background: rgba(232,99,122,0.07);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,99,122,0.12);
}
.btn-back-q {
  background: none; border: none; color: var(--muted);
  font-family:'Outfit',sans-serif; font-size:13px; cursor:pointer;
  display:flex; align-items:center; gap:6px; margin-top:20px;
  padding: 8px 0; transition:color 0.2s;
}
.btn-back-q:hover { color: var(--text); }

/* ═══════════════════════════════
   RESULTS
═══════════════════════════════ */
.result-hero {
  text-align: center; padding: 36px 32px 28px;
  background: var(--s1); border: 1px solid var(--border);
  border-radius: 20px; margin-bottom: 16px; position: relative;
  overflow: hidden;
}
.result-hero-bg {
  position:absolute;inset:0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(78,205,196,0.06), transparent);
  pointer-events:none;
}
.result-big-icon {
  font-size: 64px; line-height: 1;
  margin-bottom: 16px;
  animation: icon-drop 0.6s cubic-bezier(0.34,1.56,0.64,1) both 0.1s;
}
@keyframes icon-drop{from{opacity:0;transform:scale(0.5) translateY(-20px);}to{opacity:1;transform:scale(1) translateY(0);}}

.result-level {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px; font-weight: 600; margin-bottom: 6px;
}
.result-tagline { font-size: 15px; color: var(--muted2); line-height: 1.6; }

/* Gauge */
.gauge-wrap { margin: 28px auto 0; width: 180px; }
.gauge-svg { width:180px; height:100px; }
.gauge-bg    { fill:none; stroke:var(--s2); stroke-width:12; stroke-linecap:round; }
.gauge-fill  { fill:none; stroke-width:12; stroke-linecap:round; transition:stroke-dashoffset 1.5s cubic-bezier(0.4,0,0.2,1) 0.3s; }
.gauge-label { text-anchor:middle; fill:var(--text); font-family:'Cormorant Garamond',serif; font-weight:600; }
.gauge-sublabel { text-anchor:middle; fill:var(--muted); font-family:'Outfit',sans-serif; }

/* Dual source breakdown */
.source-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
.source-card {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; text-align: center;
}
.source-card-icon { font-size: 24px; margin-bottom: 8px; }
.source-card-label { font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform:uppercase; color:var(--muted); margin-bottom: 4px; }
.source-card-score { font-family:'Cormorant Garamond',serif; font-size: 28px; font-weight:700; }
.source-card-sub   { font-size: 11px; color: var(--muted); }

/* Category breakdown */
.cat-breakdown { margin-bottom: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cat-row:last-child { border-bottom: none; }
.cat-icon { font-size: 20px; width: 28px; text-align:center; flex-shrink:0; }
.cat-info  { flex: 1; }
.cat-name  { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.cat-level { font-size: 11px; font-weight: 600; text-transform:uppercase; letter-spacing:0.5px; }
.cat-bar-track { flex:1; background:var(--s3); border-radius:100px; height:6px; overflow:hidden; }
.cat-bar-fill  { height:100%; border-radius:100px; transition: width 1s ease 0.5s; }
.cat-pct { font-size: 12px; color:var(--muted); width:32px; text-align:right; flex-shrink:0; }

/* Face signal card */
.face-signal-card {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-bottom: 8px;
}
.face-signal-header {
  display:flex; align-items:center; gap:10px; margin-bottom:14px;
}
.face-signal-header h4 { font-size: 14px; font-weight:600; }
.face-signal-thumb { width:56px;height:56px;border-radius:10px;object-fit:cover;flex-shrink:0; }
.face-signal-desc { font-size:13px;color:var(--muted);line-height:1.6;margin-bottom:12px; }
.face-chip-row { display:flex;gap:6px;flex-wrap:wrap; }
.face-chip {
  background: var(--s3); border:1px solid var(--border);
  border-radius:100px; padding:4px 12px; font-size:12px;
}
.face-chip.dominant { background:rgba(78,205,196,0.1);border-color:rgba(78,205,196,0.3);color:var(--teal); }

/* Diagnosis deep-dive */
.diag-block {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px; margin-bottom: 16px;
}
.diag-block-header {
  display:flex;align-items:center;gap:12px;margin-bottom:18px;
}
.diag-block-icon {
  width:48px;height:48px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0;
}
.diag-block h3 { font-family:'Cormorant Garamond',serif; font-size:22px; font-weight:600; margin-bottom:2px; }
.diag-block .level-label {
  font-size:11px;font-weight:600;letter-spacing:1px;text-transform:uppercase;
}
.diag-desc {
  font-size:14px;color:var(--muted2);line-height:1.75;margin-bottom:20px;
}
.diag-desc strong { color:var(--text); font-weight:500; }

.insight-box {
  background: var(--s2); border-radius:12px; padding:16px;
  font-size:13px; color:var(--muted2); line-height:1.7;
  border-left: 3px solid var(--teal); margin-bottom:16px;
}

.symptom-list { list-style:none; margin-bottom:16px; }
.symptom-list li {
  display:flex;align-items:flex-start;gap:10px;
  padding:8px 0;border-bottom:1px solid var(--border);
  font-size:13px;color:var(--muted2);line-height:1.5;
}
.symptom-list li:last-child{border-bottom:none;}
.symptom-bullet {
  width:18px;height:18px;border-radius:6px;
  display:flex;align-items:center;justify-content:center;
  font-size:10px;flex-shrink:0;margin-top:1px;
}

/* Motivation */
.motivation-card {
  background: linear-gradient(135deg, rgba(78,205,196,0.08), rgba(155,114,207,0.08));
  border: 1px solid rgba(78,205,196,0.2);
  border-radius: 16px; padding: 24px;
  text-align:center; margin-bottom:16px;
}
.motivation-quote {
  font-family:'Cormorant Garamond',serif;
  font-size:clamp(18px,3vw,24px);font-style:italic;
  line-height:1.5;color:var(--text);margin-bottom:12px;
}
.motivation-author { font-size:12px;color:var(--muted);letter-spacing:0.5px; }
.motivation-affirmation {
  font-size:14px;color:var(--muted2);line-height:1.7;margin-top:14px;
  padding-top:14px;border-top:1px solid var(--border);
}

/* Recommendations */
.rec-block {
  background: var(--s1); border:1px solid var(--border);
  border-radius:20px;padding:28px;margin-bottom:16px;
}
.rec-item {
  display:flex;align-items:flex-start;gap:14px;
  padding:14px 0;border-bottom:1px solid var(--border);
}
.rec-item:last-child{border-bottom:none;}
.rec-icon-wrap {
  width:42px;height:42px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  font-size:20px;flex-shrink:0;
}
.rec-content h5 { font-size:14px;font-weight:600;margin-bottom:4px; }
.rec-content p  { font-size:13px;color:var(--muted2);line-height:1.6; }
.rec-tag {
  display:inline-block;margin-top:6px;
  background:var(--s2);border:1px solid var(--border);
  border-radius:100px;padding:2px 10px;
  font-size:10px;font-weight:600;letter-spacing:0.5px;color:var(--muted);text-transform:uppercase;
}

/* Pro referral banner */
.pro-banner {
  background:rgba(155,114,207,0.06);border:1px solid rgba(155,114,207,0.2);
  border-radius:16px;padding:20px;margin-bottom:16px;
  display:flex;gap:14px;align-items:flex-start;
}
.pro-banner-icon{font-size:28px;flex-shrink:0;margin-top:2px;}
.pro-banner h4{font-size:15px;font-weight:600;color:var(--purple);margin-bottom:6px;}
.pro-banner p{font-size:13px;color:var(--muted2);line-height:1.7;}

/* Restart */
.btn-restart {
  width:100%;background:var(--s2);border:1px solid var(--border2);
  border-radius:16px;padding:18px;color:var(--muted2);
  font-family:'Outfit',sans-serif;font-size:15px;font-weight:500;
  cursor:pointer;margin-top:8px;transition:all 0.2s;
}
.btn-restart:hover{border-color:var(--teal);color:var(--teal);}

/* Section title */
.sec-title {
  font-size:11px;font-weight:600;letter-spacing:1.5px;
  text-transform:uppercase;color:var(--muted);margin:28px 0 14px;
}

/* Color utils */
.c-green{color:var(--green);}
.c-yellow{color:var(--gold);}
.c-orange{color:var(--orange);}
.c-red{color:var(--red);}
.c-teal{color:var(--teal);}
.bg-green{background:rgba(86,207,138,0.1);}
.bg-yellow{background:rgba(245,200,66,0.1);}
.bg-orange{background:rgba(240,149,82,0.1);}
.bg-red{background:rgba(232,92,92,0.1);}
.b-green{border-color:rgba(86,207,138,0.3)!important;}
.b-yellow{border-color:rgba(245,200,66,0.3)!important;}
.b-orange{border-color:rgba(240,149,82,0.3)!important;}
.b-red{border-color:rgba(232,92,92,0.3)!important;}

@media(max-width:480px){
  .feature-grid{grid-template-columns:1fr;}
  .guide-steps{grid-template-columns:1fr;}
  .answer-grid{grid-template-columns:1fr;}
  .source-row{grid-template-columns:1fr;}
}