/* ======================================
   Ministry for Justice — Malta
   Born Digital | Justice Services Advisor
   Institutional Navy & Gold Theme
   ====================================== */

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

:root {
  --bg-primary: #F5F7FA;
  --bg-secondary: #E8ECF1;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-deep: #0C1B33;
  --border: #D0D7E2;
  --border-active: #1A365D;
  --text-primary: #0C1B33;
  --text-secondary: #4A5568;
  --text-muted: #8A94A6;
  --accent: #1A365D;
  --accent-light: #2B5797;
  --accent-dark: #0F2440;
  --accent-warm: #C4973B;
  --accent-warm-light: #D4AF55;
  --success: #2D8B46;
  --success-light: #4CAF50;
  --danger: #C53030;
  --malta-red: #CF142B;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-xs: 0 1px 3px rgba(12, 27, 51, 0.05);
  --shadow: 0 2px 16px rgba(12, 27, 51, 0.07);
  --shadow-md: 0 4px 24px rgba(12, 27, 51, 0.09);
  --shadow-lg: 0 8px 40px rgba(12, 27, 51, 0.12);
  --shadow-accent: 0 4px 20px rgba(26, 54, 93, 0.15);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Ambient Grain Texture ── */
.ambient-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ── Avatar Zone ── */
.avatar-zone {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  height: 30vh;
  min-height: 200px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #E3E8F0 0%, var(--bg-primary) 100%);
  overflow: hidden;
}

#avatar-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-speech {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  max-width: 300px;
  line-height: 1.4;
  transition: opacity 0.3s ease;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  border: 1px solid rgba(208, 215, 226, 0.6);
}

/* ── Content Zone ── */
.content-zone {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  padding: 2rem;
  overflow-y: auto;
  transform: translateY(12px);
}

.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
  transform: translateY(0);
}

.screen.exiting {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
}

/* ── Welcome Screen ── */
.welcome-content {
  text-align: center;
  max-width: 560px;
  animation: fadeUp 0.8s ease;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}

.malta-crest {
  width: 42px;
  height: 42px;
  border-radius: 5px;
  overflow: hidden;
}

.welcome-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-warm);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.welcome-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-warm), var(--accent-light));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.welcome-subtitle {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.8rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent), 0 8px 30px rgba(26, 54, 93, 0.2);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-glow {
  box-shadow: 0 4px 15px rgba(26, 54, 93, 0.2);
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 15px rgba(26, 54, 93, 0.2); }
  50% { box-shadow: 0 4px 25px rgba(26, 54, 93, 0.35), 0 0 40px rgba(26, 54, 93, 0.1); }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* ── Ripple Effect ── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(26, 54, 93, 0.12);
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Wizard Screen ── */
.wizard-container {
  width: 100%;
  max-width: 760px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}

.wizard-top-bar {
  flex-shrink: 0;
  padding-bottom: 1.25rem;
}

.progress-section {
  width: 100%;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.progress-label span:first-child {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.xp-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-warm);
  background: rgba(196, 151, 59, 0.1);
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  border: 1px solid rgba(196, 151, 59, 0.2);
  transition: all 0.3s ease;
}

.xp-badge.xp-bump {
  animation: xpBadgeBump 0.4s ease;
}

@keyframes xpBadgeBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); background: rgba(196, 151, 59, 0.2); }
  100% { transform: scale(1); }
}

.progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-light));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: progressShimmer 2.5s ease-in-out infinite;
}

@keyframes progressShimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.wizard-body::-webkit-scrollbar { width: 4px; }
.wizard-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.wizard-nav {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Question Area ── */
.question-title {
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
  font-weight: 800;
  margin-bottom: 0.4rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.question-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.4rem;
}

.question-title + .options-grid,
.question-subtitle + .options-grid,
.selection-counter + .options-grid {
  margin-top: 1.25rem;
}

/* ── Option Cards ── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-align: left;
  color: var(--text-primary);
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  /* FIX: Ensure the card itself receives clicks reliably */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.option-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(26, 54, 93, 0.05) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.option-card:hover::before { opacity: 1; }
.option-card > *:not(.ripple) { position: relative; z-index: 1; }

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.option-card.selected {
  border-color: var(--accent);
  background: rgba(26, 54, 93, 0.04);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-accent);
}

.option-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 10px;
  color: var(--accent);
  font-size: 1.2rem;
  transition: all var(--transition);
}

.option-card.selected .option-icon {
  background: rgba(26, 54, 93, 0.1);
}

.option-card:hover .option-icon {
  transform: rotate(3deg) scale(1.05);
}

.option-text {
  flex: 1;
  min-width: 0;
}

.option-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.1rem;
  font-family: 'Outfit', sans-serif;
}

.option-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.option-check {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  color: transparent;
  transition: all var(--transition);
}

.option-card.selected .option-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (min-width: 600px) {
  .options-grid-compact {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Analyzing Screen ── */
.analyzing-content {
  text-align: center;
  max-width: 440px;
  animation: fadeUp 0.6s ease;
}

.ai-orb {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 1.75rem;
}

.orb-core {
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  background: radial-gradient(circle, var(--accent-warm-light), var(--accent-warm));
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 30px rgba(196, 151, 59, 0.4), 0 0 60px rgba(196, 151, 59, 0.15);
  animation: orbPulse 2s ease-in-out infinite;
}

.orb-ring {
  position: absolute;
  top: 50%; left: 50%;
  border: 1.5px solid rgba(26, 54, 93, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.orb-ring-1 {
  width: 60px; height: 60px;
  animation: orbSpin 3s linear infinite;
  border-top-color: var(--accent);
}

.orb-ring-2 {
  width: 80px; height: 80px;
  animation: orbSpin 5s linear infinite reverse;
  border-right-color: var(--accent-warm);
}

.orb-ring-3 {
  width: 100px; height: 100px;
  animation: orbSpin 7s linear infinite;
  border-bottom-color: var(--accent);
}

.analyzing-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.analyzing-status {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
  min-height: 1.5em;
}

.analyzing-status .typing-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.analyzing-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.a-step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.a-step-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

.a-step-icon.pending { background: var(--bg-secondary); color: var(--text-muted); }
.a-step-icon.active { background: rgba(196, 151, 59, 0.15); color: var(--accent-warm); animation: stepPulse 1s ease-in-out infinite; }
.a-step-icon.done { background: rgba(45, 139, 70, 0.12); color: var(--success); }

/* ── Results Screen ── */
.results-container {
  width: 100%;
  max-width: 760px;
  padding: 1.5rem 0;
  text-align: center;
}

.results-header { margin-bottom: 1.75rem; }

.results-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: rgba(196, 151, 59, 0.1);
  border: 2px solid var(--accent-warm);
  border-radius: 50%;
  color: var(--accent-warm);
  margin-bottom: 0.75rem;
  animation: bounceIn 0.6s ease;
}

.results-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.results-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 460px;
  margin: 0 auto;
}

.results-xp-final {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

#final-xp {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--accent-warm);
  font-size: 0.95rem;
}

.badge-pill {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-summary {
  text-align: left;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.92rem;
  margin-bottom: 1.25rem;
  padding: 1.15rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-xs);
}

/* ── Recommendation Cards ── */
.recommendations-list { text-align: left; }

.rec-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.rec-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: var(--shadow-md), -3px 0 12px rgba(26, 54, 93, 0.08);
}

.rec-rank {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 54, 93, 0.08);
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 8px;
}

.rec-icon { flex-shrink: 0; color: var(--text-muted); display: none; }

.rec-body { flex: 1; min-width: 0; }

.rec-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  line-height: 1.3;
}

.rec-type {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(26, 54, 93, 0.06);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.rec-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.rec-match {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.match-ring {
  position: relative;
  width: 48px; height: 48px;
}

.match-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.match-ring svg path:last-child {
  transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.match-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent-warm);
}

.match-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Tips ── */
.tips-section { margin-top: 1.75rem; }

.tips-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  text-align: left;
}

.tips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 600px) {
  .tips-grid { grid-template-columns: 1fr 1fr; }
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  text-align: left;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}

.tip-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.tip-icon { color: var(--accent); margin-bottom: 0.4rem; }

.tip-card h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.tip-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Lead Capture ── */
.lead-capture-card {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-top: 1.75rem;
  text-align: left;
  box-shadow: var(--shadow-accent);
}

.lead-capture-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.lead-capture-card > p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.15rem;
  line-height: 1.5;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.form-group input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.08);
}

.form-group input::placeholder { color: var(--text-muted); }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--accent);
}

/* ── Thank You Screen ── */
.thankyou-content {
  text-align: center;
  max-width: 480px;
  animation: fadeUp 0.6s ease;
}

.thankyou-check { margin-bottom: 1.25rem; animation: bounceIn 0.8s ease; }

.thankyou-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.6rem; }

.thankyou-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.thankyou-summary {
  text-align: left;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.summary-row {
  padding: 0.35rem 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child { border-bottom: none; }

.summary-row strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 0.35rem;
}

/* ── XP Popup ── */
.xp-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-warm);
  text-shadow: 0 2px 12px rgba(196, 151, 59, 0.4);
  pointer-events: none;
  z-index: 100;
  opacity: 0;
}

.xp-popup.hidden { display: none; }
.xp-popup.show { display: block; animation: xpFloat 1.4s ease forwards; }

.xp-popup-detail {
  font-size: 0.82rem;
  display: block;
  margin-top: 0.12rem;
  opacity: 0.7;
}

/* ── XP Burst Particles ── */
.xp-burst { position: fixed; pointer-events: none; z-index: 99; }

.xp-particle {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--accent-warm);
  border-radius: 50%;
  animation: xpBurst 0.8s ease-out forwards;
}

@keyframes xpBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ── Confetti ── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  animation: confettiFall linear forwards;
  will-change: transform;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotateZ(0deg) rotateX(0deg); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translateY(100vh) rotateZ(var(--spin)) rotateX(var(--flip)); opacity: 0; }
}

/* ── Footer ── */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  padding: 0.6rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  color: var(--text-muted);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(transparent, var(--bg-primary));
  pointer-events: none;
}

.footer-dot {
  width: 3px; height: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes orbPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes orbSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes stepPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes xpFloat {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  40% { transform: translate(-50%, calc(-50% - 15px)) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, calc(-50% - 40px)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 80px)) scale(0.7); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── Speed Bonus Bar ── */
.speed-bar-container {
  width: 100%;
  height: 3px;
  background: var(--bg-secondary);
  border-radius: 3px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.speed-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--success), var(--accent-warm));
  border-radius: 3px;
  transition: width 0.1s linear;
}

/* ── Streak Indicator ── */
.streak-indicator {
  position: fixed;
  top: 0.8rem; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-warm);
  background: rgba(196, 151, 59, 0.1);
  border: 1px solid rgba(196, 151, 59, 0.25);
  padding: 0.35rem 1rem;
  border-radius: 30px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.streak-indicator.hidden { display: none; }
.streak-indicator.show { display: block; animation: streakPop 0.5s ease forwards; }

@keyframes streakPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(-16px); }
  60% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ── Combo Notification ── */
.combo-notification {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 1.25rem 2rem;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
}

.combo-notification.hidden { display: none; }
.combo-notification.show { display: block; animation: comboPop 0.6s ease forwards; }

.combo-icon { font-size: 1.8rem; margin-bottom: 0.25rem; }
.combo-name { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 800; color: var(--success); }

@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Selection Counter Ring ── */
.selection-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.selection-ring {
  position: relative;
  width: 44px; height: 44px;
}

.selection-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.selection-ring svg circle.ring-track { fill: none; stroke: var(--bg-secondary); stroke-width: 3; }

.selection-ring svg circle.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease, stroke 0.3s ease;
}

.selection-ring svg circle.ring-fill.maxed { stroke: var(--success); }

.selection-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-primary);
}

.selection-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Card Animations ── */
@keyframes energyGlow {
  0%, 100% { box-shadow: 0 0 0 1px var(--accent), var(--shadow-accent); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 4px 25px rgba(26, 54, 93, 0.25); }
}

.option-card.selected.energy-glow { animation: energyGlow 2.5s ease-in-out infinite; }

/* ── Question Slide Transitions ── */
.option-card.slide-out-left { animation: slideOutLeft 0.3s ease forwards; }
.option-card.slide-out-right { animation: slideOutRight 0.3s ease forwards; }

@keyframes slideOutLeft { to { opacity: 0; transform: translateX(-60px) scale(0.97); } }
@keyframes slideOutRight { to { opacity: 0; transform: translateX(60px) scale(0.97); } }

.question-title.fade-out { animation: titleFadeOut 0.25s ease forwards; }
@keyframes titleFadeOut { to { opacity: 0; transform: translateY(-8px); } }

.option-card.cascade-in-left { animation: cascadeInLeft 0.4s ease forwards; }
.option-card.cascade-in-right { animation: cascadeInRight 0.4s ease forwards; }

@keyframes cascadeInLeft { from { opacity: 0; transform: translateX(-50px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes cascadeInRight { from { opacity: 0; transform: translateX(50px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ── Level-Up Overlay ── */
.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(245, 247, 250, 0.96);
  backdrop-filter: blur(20px);
  text-align: center;
  /* FIX: Allow clicking to dismiss */
  cursor: pointer;
}

.level-up-overlay.hidden { display: none; }
.level-up-overlay.show { animation: levelUpFadeIn 0.6s ease forwards; }

.level-up-icon { font-size: 3.5rem; margin-bottom: 0.75rem; animation: levelUpBounce 0.8s ease; }

.level-up-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.level-up-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.level-up-dismiss {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  animation: fadeUp 0.6s ease 0.8s backwards;
}

@keyframes levelUpFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes levelUpBounce {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes levelUpDismiss { to { opacity: 0; transform: scale(1.1); } }

/* ── Stats Dashboard ── */
.stats-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.stats-dashboard.hidden { display: none; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 0.65rem;
  box-shadow: var(--shadow-xs);
  animation: fadeUp 0.5s ease backwards;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-warm);
  display: block;
}

.stat-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

/* ── Achievements ── */
.achievements-showcase { margin-bottom: 1.25rem; text-align: left; }
.achievements-showcase.hidden { display: none; }

.achievements-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.achievements-grid { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.achievement-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  box-shadow: var(--shadow-xs);
  animation: badgePopIn 0.4s ease backwards;
}

.achievement-badge-icon { font-size: 1.2rem; flex-shrink: 0; }
.achievement-badge-name { font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 700; display: block; }
.achievement-badge-desc { font-size: 0.65rem; color: var(--text-muted); }

@keyframes badgePopIn {
  0% { opacity: 0; transform: scale(0.5); }
  70% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── Pathway Visualization ── */
.pathway-visualization { margin-bottom: 1.25rem; overflow-x: auto; padding: 0.75rem 0; }
.pathway-visualization.hidden { display: none; }

.pathway-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: max-content;
}

.pathway-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.pathway-node.visible { opacity: 1; transform: scale(1); }

.pathway-node-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: border-color 0.4s ease, background 0.4s ease;
  box-shadow: var(--shadow-xs);
}

.pathway-node.visible .pathway-node-circle {
  border-color: var(--accent-warm);
  background: rgba(196, 151, 59, 0.08);
}

.pathway-node-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pathway-connector {
  width: 28px; height: 2px;
  background: var(--border);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.pathway-connector-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background: var(--accent-warm);
  transition: width 0.4s ease;
}

.pathway-connector.connected .pathway-connector-fill { width: 100%; }

/* ── Recommendation Face-Down State ── */
.rec-card.face-down { cursor: default; }
.rec-card.face-down .rec-body { display: none; }
.rec-card.face-down .rec-match .match-pct { visibility: hidden; }
.rec-card.face-down .match-ring svg path:last-child { stroke-dasharray: 0, 100 !important; }

.rec-card-mystery {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.rec-card-mystery-icon { font-size: 1.8rem; opacity: 0.45; }
.rec-card-mystery-text { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

.rec-card.revealed .rec-card-mystery { display: none; }
.rec-card:not(.face-down) .rec-card-mystery { display: none; }

.rec-card.revealed .rec-body {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* ── Drum Roll & Card Flip ── */
@keyframes drumRoll {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px) rotate(-0.5deg); }
  20% { transform: translateX(3px) rotate(0.5deg); }
  30% { transform: translateX(-3px) rotate(-0.5deg); }
  40% { transform: translateX(3px) rotate(0.5deg); }
  50% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
}

.rec-card.drum-roll { animation: drumRoll 0.8s ease; }

@keyframes cardFlip {
  0% { transform: perspective(800px) rotateY(0); }
  50% { transform: perspective(800px) rotateY(90deg); opacity: 0.5; }
  100% { transform: perspective(800px) rotateY(0); opacity: 1; }
}

.rec-card.card-flip { animation: cardFlip 0.5s ease; }

/* Golden Glow for 90%+ */
@keyframes goldenBurst {
  0% { box-shadow: 0 0 0 0 rgba(196, 151, 59, 0.5); }
  50% { box-shadow: 0 0 25px 8px rgba(196, 151, 59, 0.2); }
  100% { box-shadow: var(--shadow-md), 0 0 15px rgba(196, 151, 59, 0.12); }
}

.rec-card.golden-match { border-color: var(--accent-warm) !important; }
.rec-card.golden-burst { animation: goldenBurst 0.8s ease forwards; }
.rec-card.golden-match .match-ring svg path:last-child { stroke: var(--accent-warm-light) !important; stroke-width: 3.5; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .screen { padding: 1rem; }
  .wizard-container { padding: 0.4rem 0; }
  .option-card { padding: 0.85rem 0.9rem; gap: 0.65rem; }
  .option-icon { width: 38px; height: 38px; }
  .lead-capture-card { padding: 1.15rem; }
  .rec-card { flex-wrap: wrap; }
  .rec-match {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
  }
  .match-ring { width: 34px; height: 34px; }
  .stats-dashboard { gap: 0.4rem; }
  .stat-value { font-size: 1.3rem; }
  .achievement-badge { padding: 0.35rem 0.5rem; }
  .pathway-node-circle { width: 28px; height: 28px; font-size: 0.7rem; }
  .pathway-connector { width: 18px; }
  .level-up-number { font-size: 2rem; }
  .level-up-icon { font-size: 2.8rem; }
  .combo-notification { padding: 0.85rem 1.25rem; }
}

/* ── Kiosk ── */
@media (min-width: 1024px) {
  html { font-size: 18px; }
  .option-card { padding: 1.25rem 1.35rem; min-height: 76px; }
  .btn-primary { padding: 1rem 2.2rem; font-size: 1.05rem; }
  .options-grid:not(.options-grid-compact) { grid-template-columns: 1fr 1fr; }
}

/* ── Avatar Responsive ── */
@media (max-height: 700px) {
  .avatar-zone { height: 22vh; min-height: 150px; max-height: 220px; }
  .avatar-speech { font-size: 0.78rem; }
}

@media (max-height: 500px) {
  .avatar-zone { height: 120px; min-height: 120px; }
  .avatar-speech { display: none; }
}

/* ── Results Scrollbar ── */
#screen-results { overflow-y: auto; }
#screen-results::-webkit-scrollbar { width: 5px; }
#screen-results::-webkit-scrollbar-track { background: transparent; }
#screen-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
