/* ===================================================
   DISCOVER YOURSELF — Full Design System
   =================================================== */

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

:root {
  --bg:           #000000;
  --bg-card:      #0a0a1e;
  --bg-glass:     rgba(10, 10, 30, 0.7);
  --blue:         #00b4d8;
  --blue-bright:  #48cae4;
  --blue-glow:    transparent;
  --blue-subtle:  rgba(0, 180, 216, 0.12);
  --gold:         #c9a84c;
  --gold-bright:  #e8c96a;
  --text:         #d2c4b4;
  --text-dim:     #8888aa;
  --text-muted:   #55556a;
  --border-dim:   rgba(255,255,255,0.1);
  --border-card:  rgba(255,255,255,0.08);
  --gray-btn-bg:  rgba(255,255,255,0.05);
  --gray-btn-bd:  rgba(255,255,255,0.18);
  --selected-bg:  rgba(0,180,216,0.15);
  --selected-bd:  #00b4d8;
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    24px;
  --radius-pill:  999px;
  --shadow-glow:  none;
  --shadow-card:  0 8px 40px rgba(0,0,0,0.6);
  --transition:   0.35s cubic-bezier(0.4,0,0.2,1);

  /* EN font (Google Sans) */
  --font-english:  "Google Sans Flex", "Google Sans", sans-serif;

  /* TH font — Sukhumvit Set (Apple system) → Sarabun (Google, cross-platform fallback) */
  --font-thai:    "Sukhumvit Set", "SukhumvitSet", "Sarabun", sans-serif;
}

/* ── Thai language override ──────────────────────────────────
   When body has .lang-th, replace --font-english with --font-thai
   globally. Every element using var(--font-english) automatically
   switches — no need to touch individual selectors.
─────────────────────────────────────────────────────────── */
body.lang-th {
  --font-english: "Sukhumvit Set", "SukhumvitSet", "Sarabun", sans-serif;
}

/* Hero elements hardcode Roboto Condensed — override explicitly for TH */
body.lang-th .hero-subtitle,
body.lang-th .hero-title,
body.lang-th .hero-desc,
body.lang-th .q-text,
body.lang-th .section-title,
body.lang-th .q-eyebrow,
body.lang-th .break-text {
  font-family: "Sukhumvit Set", "SukhumvitSet", "Sarabun", sans-serif;
}

/* Thai script looks better with reduced letter-spacing */
body.lang-th .hero-title {
  letter-spacing: 0.02em;
  line-height: 1.00 !important;
  padding-top: 0.05em;
  padding-bottom: 0.05em;
}
body.lang-th .hero-subtitle { letter-spacing: 0.02em; }

/* ── Thai Vowel Clipping & Line-Height Fixes ───────────────
   Thai vowels/tone marks stack above/below and can be clipped
   by overflow:hidden or tight line-heights. We expand these here.
─────────────────────────────────────────────────────────── */
body.lang-th .q-text {
  line-height: 1.45 !important;
  letter-spacing: normal !important;
}
body.lang-th .radio-btn {
  line-height: 1.4;
  letter-spacing: normal !important;
  overflow: visible !important;
}
body.lang-th .answer-btn {
  overflow: visible !important;
}
body.lang-th .answer-btn .text-label {
  line-height: 1.4;
}
body.lang-th .custom-select,
body.lang-th .multi-option {
  line-height: 1.4;
}
body.lang-th .break-text {
  line-height: 1.6;
  letter-spacing: normal !important;
}
body.lang-th .hero-desc,
body.lang-th .result-desc,
body.lang-th .result-card-name {
  line-height: 1.45;
  letter-spacing: normal !important;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto Condensed', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- STARFIELD ---------- */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- PAGE SYSTEM ---------- */
.page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}
.page.active {
  opacity: 1;
  pointer-events: all;
}
.page-content {
  width: 100%;
  max-width: 780px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  padding: 40px 0;
  box-sizing: border-box;
}

/* ---------- UTILITY ---------- */
.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }
.fade-in { animation: fadeInUp 0.5s ease forwards; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInOnly {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50%       { transform: translateY(-18px) rotate(2deg); }
}
@keyframes shimmer {
  0%   { transform: translateX(-100%) skewX(-20deg); }
  100% { transform: translateX(200%) skewX(-20deg); }
}
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40%           { transform: scale(1.3); opacity: 1; }
}
@keyframes aurora-sweep {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes flip-card {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

/* ===================================================
   PAGE 1 — HERO
   =================================================== */
.hero-content { gap: 24px; padding: 40px 20px; }

.hero-subtitle {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.4em;
  color: var(--gold);
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.3s forwards;
}

.hero-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: clamp(2.8rem, 10vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ffffff 0%, var(--blue-bright) 40%, var(--gold) 80%, #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease 0.5s forwards;
  opacity: 0;
}

.hero-desc {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeInUp 0.8s ease 0.8s forwards;
}
.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
.btn-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  background: rgba(255, 255, 255, 0.04);
  color: var(--blue-bright);
  font-family: var(--font-english);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
  animation: fadeInUp 0.8s ease 1.1s forwards;
}
.btn-lang-toggle:hover {
  background: rgba(0, 180, 216, 0.15);
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 48px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #0077b6, var(--blue), #48cae4);
  background-size: 200% 200%;
  color: #fff;
  font-family: var(--font-english);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  opacity: 0;
  animation: fadeInUp 0.8s ease 1.1s forwards;
}
.btn-primary:not(.hidden):hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.btn-primary .btn-shimmer {
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2.5s ease-in-out 1.8s infinite;
}
.btn-primary.btn-glow {
  animation: fadeInUp 0.8s ease 1.1s forwards;
}
.btn-arrow { font-size: 1.1em; }

/* Continue button (appears after answer) */
.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  border: 1.5px solid var(--blue);
  border-radius: var(--radius-pill);
  background: var(--selected-bg);
  color: var(--blue-bright);
  font-family: var(--font-english);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}
.btn-continue:hover {
  background: rgba(0,180,216,0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}
.btn-continue.show {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 1;
  pointer-events: all;
}

/* Back Button (Personality Questions) */
.q-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  border: 1.5px solid #888888;
  border-radius: var(--radius-pill);
  background: transparent;
  color: #888888;
  font-family: var(--font-english);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: var(--transition);
}
.q-back-btn:hover {
  border-color: #aaaaaa;
  color: #aaaaaa;
  background: rgba(136,136,136,0.08);
  transform: translateX(-2px);
}

/* Capsule Button (Deck Select) */
.btn-capsule {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 32px;
  border: none;
  border-radius: var(--radius-pill);
  background: #e8e8f0;
  color: #111;
  font-family: var(--font-english);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
}
.btn-capsule:hover { transform: translateY(-2px); }
.btn-capsule.selected {
  background: #0a1a30;
  color: var(--blue-bright);
  border: 1.5px solid var(--blue);
}
.btn-capsule .aurora-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #00b4d8, #48cae4, #90e0ef, #00b4d8);
  background-size: 300% 100%;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: aurora-sweep 3s ease infinite;
  border-radius: var(--radius-pill);
}
.btn-capsule.selected .aurora-fill { opacity: 0.3; }
.btn-capsule span { position: relative; z-index: 1; }

/* ===================================================
   PAGE 2 — DECK SELECTION (3D Redesign)
   =================================================== */
.decks-container {
  position: relative;
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 40px 20px;
  transition: var(--transition);
}

/* Dim other decks when one is selected */
.decks-container:has(.selected) .deck-item:not(.selected) {
  opacity: 0.25;
  filter: blur(2px) grayscale(0.5);
  pointer-events: none;
  transform: scale(0.95);
}

.deck-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  transition: var(--transition);
  perspective: 1000px;
}

.deck-stack {
  position: relative;
  width: 130px;
  height: 217px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-in-stack {
  position: absolute;
  width: 120px;
  height: 200px;
  border-radius: 10px;
  background-image: url('assets/C_Back.png');
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(201, 168, 76, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* All Decks 3D Alignment (Facing straight forward and tilted back) */
.deck-stack {
  transform: rotateX(32deg) rotateY(0deg) rotateZ(0deg);
}
.deck-item:hover:not(.selected) .deck-stack {
  transform: translate3d(0, -15px, 20px) rotateX(30deg) rotateY(0deg) rotateZ(0deg);
}

/* Selection animation: Selected deck rises, aligns straight and glows */
.deck-item.selected .deck-stack {
  transform: translate3d(0, -25px, 50px) rotateX(15deg) rotateY(0deg) rotateZ(0deg) !important;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.55));
}
.deck-item.selected .card-in-stack {
  border-color: var(--blue-bright);
}

/* Card Stacking layers: default state translation */
.card-in-stack.s1  { transform: translate3d(0, 0, 0); z-index: 12; }
.card-in-stack.s2  { transform: translate3d(0, 1.5px, -1px); z-index: 11; }
.card-in-stack.s3  { transform: translate3d(0, 3.0px, -2px); z-index: 10; }
.card-in-stack.s4  { transform: translate3d(0, 4.5px, -3px); z-index: 9; }
.card-in-stack.s5  { transform: translate3d(0, 6.0px, -4px); z-index: 8; }
.card-in-stack.s6  { transform: translate3d(0, 7.5px, -5px); z-index: 7; }
.card-in-stack.s7  { transform: translate3d(0, 9.0px, -6px); z-index: 6; }
.card-in-stack.s8  { transform: translate3d(0, 10.5px, -7px); z-index: 5; }
.card-in-stack.s9  { transform: translate3d(0, 12.0px, -8px); z-index: 4; }
.card-in-stack.s10 { transform: translate3d(0, 13.5px, -9px); z-index: 3; }
.card-in-stack.s11 { transform: translate3d(0, 15.0px, -10px); z-index: 2; }
.card-in-stack.s12 { transform: translate3d(0, 16.5px, -11px); z-index: 1; box-shadow: 0 15px 30px rgba(0, 0, 0, 0.75); }

/* Hover spread effect */
.deck-item:hover .card-in-stack.s2  { transform: translate3d(0, 2.5px, -1.8px); }
.deck-item:hover .card-in-stack.s3  { transform: translate3d(0, 5.0px, -3.6px); }
.deck-item:hover .card-in-stack.s4  { transform: translate3d(0, 7.5px, -5.4px); }
.deck-item:hover .card-in-stack.s5  { transform: translate3d(0, 10.0px, -7.2px); }
.deck-item:hover .card-in-stack.s6  { transform: translate3d(0, 12.5px, -9.0px); }
.deck-item:hover .card-in-stack.s7  { transform: translate3d(0, 15.0px, -10.8px); }
.deck-item:hover .card-in-stack.s8  { transform: translate3d(0, 17.5px, -12.6px); }
.deck-item:hover .card-in-stack.s9  { transform: translate3d(0, 20.0px, -14.4px); }
.deck-item:hover .card-in-stack.s10 { transform: translate3d(0, 22.5px, -16.2px); }
.deck-item:hover .card-in-stack.s11 { transform: translate3d(0, 25.0px, -18.0px); }
.deck-item:hover .card-in-stack.s12 { transform: translate3d(0, 27.5px, -19.8px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85); }

/* ===================================================
   PAGE 3, 5, 7, 9, 11, 13 — BREAK PAGES
   =================================================== */
.break-content { gap: 20px; }

.break-icon {
  font-size: 3rem;
  animation: float 3s ease-in-out infinite;
  display: inline-block;
}

.break-text {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-style: Bold;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--text);
  max-width: 520px;
}

.break-dots {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.break-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: dot-bounce 1.4s ease-in-out infinite;
}
.break-dots span:nth-child(2) { animation-delay: 0.2s; }
.break-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ===================================================
   PAGE 4 — DEMOGRAPHIC
   =================================================== */
.form-content { gap: 32px; }
.form-header { display: flex; flex-direction: column; gap: 8px; }
.form-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  color: var(--gold);
  font-family: 'Roboto Condensed', sans-serif;
}
.section-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.dropdowns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
}
@media (max-width: 560px) { .dropdowns-grid { grid-template-columns: 1fr; } }

.dropdown-group { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.dropdown-label {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}

.custom-select-wrapper { position: relative; }
.custom-select {
  width: 100%;
  padding: 14px 44px 14px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-btn-bd);
  background: var(--gray-btn-bg);
  color: var(--text);
  font-family: var(--font-english);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: var(--transition);
}
.custom-select:focus, .custom-select:hover {
  border-color: var(--blue);
  background: var(--blue-subtle);
}
.custom-select option { background: #0a0a2a; color: var(--text); }
.select-arrow {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 1rem;
}

/* ===================================================
   PAGE 6 — MUTELU BEHAVIOR
   =================================================== */
.mutelu-wrapper { width: 100%; }
.mutelu-question { animation: fadeInUp 0.5s ease forwards; }

/* ===================================================
   ANSWER BUTTONS (General & 5-point Scale)
   =================================================== */
.answers-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.answer-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 14px;
  min-width: 100px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-btn-bd);
  background: var(--gray-btn-bg);
  color: var(--text);
  font-family: var(--font-english);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  overflow: hidden;
}
.answer-btn:hover:not(.selected) {
  border-color: rgba(0,180,216,0.4);
  background: rgba(0,180,216,0.06);
}
.answer-btn.selected {
  border-color: var(--selected-bd);
  background: var(--selected-bg);
}
.answer-btn.selected .check-icon {
  opacity: 1;
  transform: scale(1);
}
.answer-btn .num-label {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue-bright);
  font-family: var(--font-english);
}
.answer-btn .text-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.3;
  max-width: 90px;
}
.answer-btn.selected .text-label { color: var(--blue-bright); }
.check-icon {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 0.75rem;
  color: var(--blue-bright);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s ease;
}

/* Radio-style answer buttons (for mutelu Q1, Q2) */
.answers-radio {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 500px;
  margin: 16px auto 0;
}
.radio-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-btn-bd);
  background: var(--gray-btn-bg);
  color: var(--text);
  font-family: var(--font-english);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  position: relative;
  overflow: hidden;
}
.radio-btn:hover:not(.selected) {
  border-color: rgba(0, 180, 216, 0.45);
  background: rgba(0, 180, 216, 0.06);
}
.radio-btn.selected {
  border-color: var(--selected-bd);
  background: var(--selected-bg);
}
.radio-btn .check-icon { position: relative; top: auto; right: auto; margin-left: auto; font-size: 1rem; }
.radio-btn.selected .check-icon { opacity: 1; transform: scale(1); }

/* Multi-select for mutelu Q3 */
.multi-select-container { width: 100%; max-width: 500px; margin: 0 auto; }
.multi-select-toggle {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-btn-bd);
  background: var(--gray-btn-bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  font-family: var(--font-english);
}
.multi-select-toggle:hover { border-color: rgba(0,180,216,0.4); }
.multi-select-toggle.open { border-color: var(--blue); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.multi-select-dropdown {
  display: none;
  flex-direction: column;
  border: 1.5px solid var(--blue);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: #0a0a22;
  max-height: 280px;
  overflow-y: auto;
}
.multi-select-dropdown.open { display: flex; }
.multi-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.88rem;
  color: var(--text-dim);
  font-family: var(--font-english);
}
.multi-option:hover { background: rgba(0,180,216,0.08); }
.multi-option.selected { color: var(--blue-bright); background: rgba(0,180,216,0.1); }
.multi-option .multi-check {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--gray-btn-bd);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: var(--transition);
}
.multi-option.selected .multi-check {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.multi-count-badge {
  background: var(--blue);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===================================================
   QUESTION PAGE (pages 8, 10, 12)
   =================================================== */
.question-page-wrapper { width: 100%; padding: 20px 0; }

.q-progress-bar {
  width: 100%;
  max-width: 500px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  margin: 0 auto 32px;
  overflow: hidden;
}
.q-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.question-block { animation: fadeInUp 0.5s ease forwards; }
.q-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--gold);
  font-family: 'Roboto Condensed', sans-serif;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.q-text {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  line-height: 1.15;
  color: var(--text);
  max-width: 620px;
  margin: 0 auto 32px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-family: 'Roboto Condensed', sans-serif;
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  max-width: 560px;
  margin: 0 auto 8px;
  padding: 0 4px;
}
.scale-label-txt {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ===================================================
   PAGE 14 — RESULT CARD
   =================================================== */
.result-content {
  padding: 40px 20px 80px;
  min-height: 100vh;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
}

/* Card flip scene */
.card-scene {
  width: 180px;
  height: 300px;
  perspective: 1000px;
  margin: 0 auto;
}
.card-flipper {
  width: 180px;
  height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.card-flipper.is-flipped { transform: rotateY(180deg); }
.card-flipper.is-small {
  transform: rotateY(180deg) scale(0.6);
  transition: transform 1s cubic-bezier(0.4,0,0.2,1);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.card-back-face {
  background-image: url('assets/C_Back.png');
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  animation: float 3s ease-in-out infinite;
}
.card-flipper.is-flipped .card-back-face,
.card-flipper.is-small .card-back-face { animation: none; }

.card-front-face {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}
.card-front-bg {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #0d1b2a, #1a0a2e, #0a1520);
}
.card-front-face * { position: relative; z-index: 1; }
.card-front-icon { font-size: 2.5rem; }
.card-front-name {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.1em;
  line-height: 1.3;
}
.card-front-glow {
  display: none;
}

/* Card front with actual image */
.card-front-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  position: relative;
  z-index: 1;
}
.card-front-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Result mini card image */
.result-card-mini {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.result-mini-img {
  width: 120px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(201,168,76,0.5);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.result-mini-emoji {
  font-size: 3rem;
  text-align: center;
}

.click-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  animation: pulse-opacity 2s ease-in-out infinite;
}

/* Result Details */
.result-details {
  width: 100%;
  max-width: 640px;
  margin-top: 24px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.result-details.visible { opacity: 1; }

.result-header-box {
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
  text-align: center;
}
.result-archetype-label {
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  color: var(--gold);
  font-family: 'Roboto Condensed', sans-serif;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.result-card-name {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-bright), var(--blue-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 16px;
}
.result-desc {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-dim);
  font-family: var(--font-english);
}

.result-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 600px) {
  .result-info-grid {
    grid-template-columns: 1fr;
  }
  .result-info-grid .info-card {
    grid-column: span 1 !important;
  }
}

.info-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  backdrop-filter: blur(8px);
  text-align: left;
}
.info-card-label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  font-family: 'Roboto Condensed', sans-serif;
  margin-bottom: 6px;
}
.info-card-value {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  font-family: var(--font-english);
}

/* Chart */
.chart-container {
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
}
.chart-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.chart-canvas-wrap { width: 100%; max-width: 380px; margin: 0 auto; }

/* Action buttons */
.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  padding-bottom: 40px;
}
.segmented-capsule-btn {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--blue);
  background: rgba(10, 10, 30, 0.65);
  backdrop-filter: blur(8px);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  transition: var(--transition);
}
.capsule-divider {
  width: 1.5px;
  background-color: var(--blue);
  align-self: stretch;
}
.btn-share-segment, .btn-restart-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 36px;
  border: none;
  background: transparent;
  font-family: var(--font-english);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: var(--transition);
}
.btn-share-segment {
  color: var(--blue-bright);
}
.btn-share-segment:hover {
  background: rgba(0, 180, 216, 0.18);
}
.btn-restart-segment {
  color: var(--text-dim);
}
.btn-restart-segment:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.btn-icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Tie notice */
.tie-notice {
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.82rem;
  color: var(--gold);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mobile Carousel Controls (Hidden on Desktop) */
.mobile-carousel-controls {
  display: none;
}

@media (max-width: 600px) {
  .mobile-carousel-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    z-index: 10;
  }
  
  .carousel-indicator-triangle {
    color: var(--blue-bright);
    font-size: 1.1rem;
    transform: scaleY(0.7);
    margin-bottom: -2px;
    animation: bounceUpDown 2s ease-in-out infinite;
  }
  @keyframes bounceUpDown {
    0%, 100% { transform: scaleY(0.7) translateY(0); }
    50% { transform: scaleY(0.7) translateY(-3px); }
  }

  .shared-select-btn {
    background: #ffffff !important;
    color: #000000 !important;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
    padding: 12px 38px !important;
  }

  /* Carousel layout for decks container on mobile */
  .decks-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    width: 100% !important;
    max-width: 100vw !important;
    /* Calculated padding to center the 130px wide deck */
    padding: 30px calc(50% - 65px) !important;
    gap: 24px !important;
    box-sizing: border-box !important;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
  }
  .decks-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
  }

  .deck-item {
    scroll-snap-align: center !important;
    flex-shrink: 0 !important;
    width: 130px !important;
    opacity: 0.35;
    transform: scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  
  /* Disable desk hover effect on mobile to prevent conflicts with active swipe scaling */
  .deck-item:hover:not(.selected) .deck-stack {
    transform: rotateX(32deg) rotateY(0deg) rotateZ(0deg) !important;
  }
  
  .deck-item.active-mobile {
    opacity: 1;
    transform: scale(1.08);
  }
  .deck-item.active-mobile .deck-stack {
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
  }

  /* Hide individual deck buttons on mobile */
  .deck-item button.btn-capsule {
    display: none !important;
  }
}

/* Mobile responsive scaling under 520px */
@media (max-width: 520px) {
  .decks-container {
    /* Calculated padding to center the 90px wide deck */
    padding: 20px calc(50% - 45px) !important;
    gap: 16px !important;
  }
  .deck-item {
    width: 90px !important;
  }
  .deck-stack {
    width: 90px;
    height: 150px;
  }
  .card-in-stack {
    width: 84px;
    height: 140px;
    border-width: 1px;
  }

  /* Scale stack depth translates dynamically for mobile scale */
  .card-in-stack.s1  { transform: translate3d(0, 0, 0); }
  .card-in-stack.s2  { transform: translate3d(0, 1.0px, -0.7px); }
  .card-in-stack.s3  { transform: translate3d(0, 2.0px, -1.4px); }
  .card-in-stack.s4  { transform: translate3d(0, 3.0px, -2.1px); }
  .card-in-stack.s5  { transform: translate3d(0, 4.0px, -2.8px); }
  .card-in-stack.s6  { transform: translate3d(0, 5.0px, -3.5px); }
  .card-in-stack.s7  { transform: translate3d(0, 6.0px, -4.2px); }
  .card-in-stack.s8  { transform: translate3d(0, 7.0px, -4.9px); }
  .card-in-stack.s9  { transform: translate3d(0, 8.0px, -5.6px); }
  .card-in-stack.s10 { transform: translate3d(0, 9.0px, -6.3px); }
  .card-in-stack.s11 { transform: translate3d(0, 10.0px, -7.0px); }
  .card-in-stack.s12 { transform: translate3d(0, 11.0px, -7.7px); }

  /* Mobile hover spread */
  .deck-item:hover .card-in-stack.s2  { transform: translate3d(0, 1.8px, -1.2px); }
  .deck-item:hover .card-in-stack.s3  { transform: translate3d(0, 3.6px, -2.4px); }
  .deck-item:hover .card-in-stack.s4  { transform: translate3d(0, 5.4px, -3.6px); }
  .deck-item:hover .card-in-stack.s5  { transform: translate3d(0, 7.2px, -4.8px); }
  .deck-item:hover .card-in-stack.s6  { transform: translate3d(0, 9.0px, -6.0px); }
  .deck-item:hover .card-in-stack.s7  { transform: translate3d(0, 10.8px, -7.2px); }
  .deck-item:hover .card-in-stack.s8  { transform: translate3d(0, 12.6px, -8.4px); }
  .deck-item:hover .card-in-stack.s9  { transform: translate3d(0, 14.4px, -9.6px); }
  .deck-item:hover .card-in-stack.s10 { transform: translate3d(0, 16.2px, -10.8px); }
  .deck-item:hover .card-in-stack.s11 { transform: translate3d(0, 18.0px, -12.0px); }
  .deck-item:hover .card-in-stack.s12 { transform: translate3d(0, 19.8px, -13.2px); }
}


/* ─── INTRO POPUP ────────────────────────────────────────────
   Shows automatically on page load.
   Clicking anywhere closes it with a fade-out.
   Replace assets/intro-popup.png with your actual image.
──────────────────────────────────────────────────────────── */
.intro-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 15, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  animation: introFadeIn 0.5s ease forwards;
}
.intro-popup-overlay.closing {
  animation: introFadeOut 0.35s ease forwards;
}
@keyframes introFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes introFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.intro-popup-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: introSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes introSlideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Main popup image */
.intro-popup-img {
  display: block;
  max-width: min(88vw, 480px);
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-lg);
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}

/* Placeholder when image is not yet provided */
.intro-popup-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(88vw, 480px);
  height: 320px;
  border-radius: var(--radius-lg);
  border: 2px dashed rgba(255,255,255,0.15);
  background: rgba(10, 10, 30, 0.6);
  color: var(--text-dim);
  font-family: var(--font-english);
  font-size: 0.95rem;
  text-align: center;
  padding: 24px;
}
.intro-popup-placeholder span { font-size: 2.5rem; }
.intro-popup-placeholder code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--blue-bright);
}

/* "Tap to close" hint */
.intro-popup-hint {
  font-family: var(--font-english);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
}
