/* ══════════════════════════════════════════════════════════════
   Behaviour, Risk & Ambiguity Experiment — production styles
   Ported verbatim from mockups/index.html. Dev-only rules removed;
   form-error / invalid-field cues added for validation gating.
══════════════════════════════════════════════════════════════ */

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: linear-gradient(180deg, #F5F7FC 0%, #EAEEF6 100%);
  background-attachment: fixed;
  color: #1A1A2E;
  min-height: 100vh;
}

/* ── PAGE WRAPPER ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.screen.active .card, .screen.active .welcome-layout { animation: fadeInUp 0.45s ease both; }

/* ── CARD ── */
.card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 30px rgba(27,58,107,0.08), 0 1px 3px rgba(0,0,0,0.04);
  padding: 48px 56px;
  width: 100%; max-width: 740px;
}
.card-wide { max-width: 980px; }

/* ── PROGRESS BAR ── */
.progress-wrap { margin-bottom: 32px; }
.progress-label { font-size: 12px; font-weight: 500; color: #9CA3AF; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 8px; }
.progress-track { height: 6px; background: #E5E7EB; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #2B5CA6, #1B3A6B); border-radius: 99px; transition: width 0.4s ease; }

/* ── TYPOGRAPHY ── */
.screen-label { font-size: 11px; font-weight: 600; color: #6B7280; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
h1 { font-size: 28px; font-weight: 700; color: #111827; line-height: 1.3; margin-bottom: 8px; }
h2 { font-size: 22px; font-weight: 700; color: #111827; line-height: 1.3; margin-bottom: 8px; }
.subtitle { font-size: 15px; color: #6B7280; line-height: 1.6; margin-bottom: 32px; }
.divider { height: 1px; background: #F3F4F6; margin: 28px 0; }

/* ── BUTTON ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #24467D, #1B3A6B); color: #fff; border: none;
  padding: 14px 28px; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: box-shadow 0.2s, transform 0.1s;
  text-decoration: none; box-shadow: 0 4px 14px rgba(27,58,107,0.22);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(27,58,107,0.30); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.full { width: 100%; justify-content: center; margin-top: 32px; }
.btn-arrow::after { content: '→'; }

/* ── WELCOME SCREEN ── */
.welcome-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; max-width: 1100px; width: 100%; }
.welcome-brand { font-size: 12px; font-weight: 600; color: #9CA3AF; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 40px; }
.welcome-left h1 { font-size: 36px; margin-bottom: 16px; }
.welcome-left .subtitle { margin-bottom: 36px; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 16px; margin-bottom: 40px; }
.feature-list li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: #374151; }
.feature-dot { width: 22px; height: 22px; border-radius: 50%; background: #EEF2FF; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.feature-dot span { width: 8px; height: 8px; border-radius: 50%; background: #1B3A6B; display: block; }
.welcome-footer { font-size: 12px; color: #9CA3AF; margin-top: 16px; }
.welcome-right { display: flex; align-items: center; justify-content: center; }
.welcome-illustration {
  width: 320px; height: 320px; border-radius: 50%;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #C7D2FE 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.welcome-illustration::after {
  content: ''; position: absolute; z-index: 1;
  width: 200px; height: 200px; border-radius: 50%;
  background: linear-gradient(135deg, #C7D2FE, #A5B4FC);
  opacity: 0.5;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.float-ball { position: absolute; z-index: 2; border-radius: 50%; box-shadow: inset -2px -3px 4px rgba(0,0,0,0.18), 0 3px 6px rgba(0,0,0,0.12); animation: floaty 3.4s ease-in-out infinite; }
.float-ball::after { content: ''; position: absolute; top: 18%; left: 20%; width: 28%; height: 28%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.9), transparent 70%); }
.fb1 { width: 54px; height: 54px; background: #DC2626; top: 70px; left: 78px; }
.fb2 { width: 40px; height: 40px; background: #2563EB; top: 168px; left: 210px; animation-delay: 0.7s; }
.fb3 { width: 34px; height: 34px; background: #9CA3AF; top: 214px; left: 116px; animation-delay: 1.3s; }
.fb4 { width: 44px; height: 44px; background: #2563EB; top: 92px; left: 198px; animation-delay: 1.0s; }
.fb5 { width: 30px; height: 30px; background: #DC2626; top: 200px; left: 196px; animation-delay: 0.4s; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 500; color: #374151; }
input[type="number"], select {
  padding: 11px 14px; border: 1.5px solid #E5E7EB; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: #111827; background: #fff;
  outline: none; transition: border-color 0.2s;
  appearance: none; -webkit-appearance: none;
}
input[type="number"]:focus, select:focus { border-color: #1B3A6B; box-shadow: 0 0 0 3px rgba(27,58,107,0.1); }
.toggle-group { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px; border: 1.5px solid #E5E7EB; border-radius: 8px;
  background: #fff; font-size: 14px; font-family: inherit; color: #374151;
  cursor: pointer; text-align: center; font-weight: 500; transition: all 0.15s;
}
.toggle-btn.selected { border-color: #1B3A6B; background: #EEF2FF; color: #1B3A6B; }

/* ── VALIDATION CUES ── */
.form-error { color: #DC2626; font-size: 13px; font-weight: 600; margin-top: 16px; display: none; }
.form-error.show { display: block; }
.invalid { border-color: #DC2626 !important; box-shadow: 0 0 0 3px rgba(220,38,38,0.08) !important; }
.invalid-block { outline: 1px solid #FCA5A5; outline-offset: 4px; border-radius: 8px; }

/* ── ATTENTION / COMPREHENSION / CONSENT CHECK ── */
.attn-options { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }
.attn-option {
  padding: 14px 18px; border: 1.5px solid #E5E7EB; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: #374151; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; gap: 12px;
}
.attn-option:hover { border-color: #1B3A6B; background: #F8FAFF; }
.attn-option.selected { border-color: #1B3A6B; background: #F0F4FF; }
.attn-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #D1D5DB; flex-shrink: 0; transition: all 0.15s; }
.attn-option.selected .attn-radio { border-color: #1B3A6B; background: #1B3A6B; }

/* ── THANK YOU / EXIT ── */
.thankyou-center { text-align: center; padding: 20px 0; }
.thankyou-icon {
  width: 72px; height: 72px; border-radius: 50%; background: #ECFDF5;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 24px;
  font-size: 32px;
}
.thankyou-icon.neutral { background: #F3F4F6; }
.thankyou-center h1 { font-size: 32px; margin-bottom: 16px; }
.thankyou-center .subtitle { max-width: 460px; margin: 0 auto 32px; }

/* ── GAME INSTRUCTIONS ── */
.instruction-list { list-style: none; display: flex; flex-direction: column; gap: 18px; margin: 24px 0 24px; }
.instruction-item { display: flex; gap: 16px; align-items: flex-start; }
.instruction-num {
  width: 28px; height: 28px; border-radius: 50%; background: #EEF2FF; color: #1B3A6B;
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.instruction-text { font-size: 14px; color: #374151; line-height: 1.6; padding-top: 4px; }
.legend-row { display: flex; gap: 28px; align-items: center; padding: 16px 20px; background: #F9FAFB; border-radius: 10px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }
.legend-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; box-shadow: inset -1px -1px 2px rgba(0,0,0,0.18); }
.legend-dot.red { background: #DC2626; }
.legend-dot.blue { background: #2563EB; }
.legend-dot.grey { background: #9CA3AF; }

/* ── PEER INCOME MODULE ── */
.peer-module {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
  padding: 18px 24px; border-radius: 16px; margin-bottom: 28px;
  border: 1.5px solid #E5E7EB; background: #F9FAFB;
  transition: background 0.35s ease, border-color 0.35s ease;
}
.peer-module.behind { background: linear-gradient(135deg, #FEF2F2, #FFF6F6); border-color: #FECACA; }
.peer-module.ahead  { background: linear-gradient(135deg, #F0FDF4, #F6FFF9); border-color: #BBF7D0; }
.peer-side { display: flex; align-items: center; gap: 14px; }
.peer-side.peer { justify-content: flex-end; text-align: right; }
.peer-avatar { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0; letter-spacing: 0.5px; }
.peer-avatar.you-av { background: linear-gradient(180deg, #24467D, #1B3A6B); }
.peer-avatar.peer-av { background: linear-gradient(180deg, #94A3B8, #64748B); transition: background 0.35s ease; }
.peer-module.behind .peer-avatar.peer-av { background: linear-gradient(180deg, #F87171, #DC2626); }
.peer-module.ahead  .peer-avatar.peer-av { background: linear-gradient(180deg, #4ADE80, #16A34A); }
.peer-name { font-size: 12px; font-weight: 700; color: #6B7280; text-transform: uppercase; letter-spacing: 0.4px; }
.peer-amount { font-size: 20px; font-weight: 800; color: #111827; margin-top: 1px; white-space: nowrap; }
.peer-sub { font-size: 11.5px; color: #9CA3AF; margin-top: 2px; line-height: 1.4; max-width: 180px; }
.peer-side.peer .peer-sub { margin-left: auto; }
.peer-module.behind #peer-certain { color: #DC2626; }
.peer-module.ahead  #peer-certain { color: #16A34A; }
.peer-vs { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.peer-vs-icon { font-size: 12px; color: #9CA3AF; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.vs-badge { font-size: 11px; font-weight: 700; padding: 5px 13px; border-radius: 99px; white-space: nowrap; transition: all 0.35s ease; }
.peer-module.behind .vs-badge { background: #FEE2E2; color: #B91C1C; }
.peer-module.ahead  .vs-badge { background: #DCFCE7; color: #15803D; }

/* ── DECISION LAYOUT / JAR ── */
.decision-layout { display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: start; }
.jar-stage { position: relative; width: 280px; height: 380px; margin: 0 auto; }
.jar-base {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 210px; height: 28px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(27,58,107,0.18), transparent 70%);
}
.jar-rim {
  position: absolute; left: 12px; top: 4px; width: 256px; height: 26px;
  border: 2px solid rgba(27,58,107,0.16); border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(224,231,255,0.35));
}
.jar-glass {
  position: absolute; left: 20px; bottom: 10px; width: 240px; height: 300px;
  border: 2px solid rgba(27,58,107,0.15);
  border-radius: 14px 14px 42px 42px;
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, rgba(238,242,255,0.30) 22%, rgba(224,231,255,0.42) 100%);
  box-shadow: inset 0 0 26px rgba(27,58,107,0.06), inset -12px 0 24px rgba(255,255,255,0.45), 0 12px 32px rgba(27,58,107,0.08);
  overflow: hidden;
}
.jar-glass::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 32%; background: linear-gradient(180deg, rgba(255,255,255,0.5), transparent); }
.jar-glass::after { content: ''; position: absolute; top: 16px; left: 18px; width: 26px; height: 70%; border-radius: 40px; background: linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0)); filter: blur(1px); }
.ball {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background-color: #9CA3AF;
  transition: top 0.7s cubic-bezier(0.34,1.56,0.64,1), background-color 0.5s ease;
  box-shadow: inset -1px -1px 2px rgba(0,0,0,0.22), 0 1px 2px rgba(0,0,0,0.14);
  z-index: 3;
}
.ball::after { content: ''; position: absolute; top: 2px; left: 2px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.9), transparent 70%); }
.ball-red { background-color: #DC2626; }
.ball-blue { background-color: #2563EB; }
.ball-grey { background-color: #9CA3AF; }

/* ── GAMBLE CARDS ── */
.gamble-row { display: flex; flex-direction: column; gap: 16px; }
.gamble-card {
  border: 1.5px solid #E5E7EB; border-radius: 14px; padding: 20px 24px;
  cursor: pointer; transition: all 0.18s; background: #fff; position: relative;
}
.gamble-card:hover { border-color: #1B3A6B; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(27,58,107,0.10); }
.gamble-card.selected { border-color: #1B3A6B; background: #F8FAFF; box-shadow: 0 0 0 3px rgba(27,58,107,0.10); }
.gamble-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.gamble-title { font-size: 15px; font-weight: 700; color: #111827; }
.gamble-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #D1D5DB; transition: all 0.18s; display: flex; align-items: center; justify-content: center; }
.gamble-card.selected .gamble-check { border-color: #1B3A6B; background: #1B3A6B; }
.gamble-card.selected .gamble-check::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 700; }
.gamble-payoffs { display: flex; gap: 36px; }
.payoff-item { display: flex; align-items: center; gap: 10px; }
.payoff-ball { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; box-shadow: inset -1px -1px 2px rgba(0,0,0,0.2); }
.payoff-amount { font-size: 18px; font-weight: 700; color: #111827; }
.payoff-label { font-size: 12px; color: #9CA3AF; }
.sample-note { font-size: 12px; color: #9CA3AF; font-style: italic; margin-top: 20px; line-height: 1.5; }

/* ── "HOW TO READ A GAMBLE" HELPER (constant across all 12 decisions) ── */
.gamble-help { background: #F8FAFC; border: 1px solid #E5E7EB; border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; font-size: 13px; color: #374151; line-height: 1.65; }
.gamble-help strong { color: #111827; }
.gamble-help .g-red { color: #DC2626; font-weight: 700; }
.gamble-help .g-blue { color: #2563EB; font-weight: 700; }

/* ── SEGMENTED PROGRESS (two sets of 6) ── */
.seg-progress { display: flex; align-items: center; gap: 6px; }
.seg-group { display: flex; gap: 6px; }
.seg-gap { width: 22px; height: 1px; background: #D7DBE3; }
.seg-dot { width: 28px; height: 6px; border-radius: 99px; background: #E5E7EB; transition: background 0.3s, box-shadow 0.3s; }
.seg-dot.done { background: #1B3A6B; }
.seg-dot.current { background: #2B5CA6; box-shadow: 0 0 0 3px rgba(43,92,166,0.16); }

/* ── INTERLUDE (set break) ── */
.interlude-center { text-align: center; padding: 16px 0; }
.interlude-badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: #1B3A6B; background: #EEF2FF; padding: 6px 16px; border-radius: 99px; margin-bottom: 20px; }
.interlude-center h2 { font-size: 24px; margin-bottom: 12px; }
.interlude-center .subtitle { max-width: 480px; margin: 0 auto 8px; }
.interlude-dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 24px 0 28px; }

/* ── DECISION MICRO-TRANSITION ── */
@keyframes softIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.soft-in { animation: softIn 0.35s ease both; }

/* ── REQUIRED-FIELD CUES ── */
.req { color: #DC2626; font-weight: 700; margin-left: 2px; }
.required-note { font-size: 12px; color: #6B7280; margin-bottom: 24px; display: flex; align-items: center; gap: 6px; }
.required-note .req { font-size: 14px; }

/* ── CONSENT BLOCK ── */
.consent-callouts { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 22px; }
.consent-callout {
  background: #F8FAFC; border-left: 3px solid #1B3A6B; border-radius: 8px;
  padding: 14px 18px; font-size: 13.5px; line-height: 1.6; color: #374151;
}
.consent-callout strong { color: #111827; }
.consent-prompt { font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 14px; line-height: 1.5; }

/* ── MATRIX SCALE TABLE ── */
.scale-part { margin-bottom: 36px; }
.scale-part:last-of-type { margin-bottom: 12px; }
.scale-part-sub { font-size: 16px; font-weight: 600; color: #1F2937; line-height: 1.5; margin-bottom: 18px; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; border: 1px solid #E5E7EB; }
.matrix thead th {
  background: #1B3A6B; color: #fff; font-size: 12px; font-weight: 600;
  padding: 12px 8px; text-align: center; vertical-align: middle; line-height: 1.3;
}
.matrix thead th.stmt-col { text-align: left; padding-left: 18px; width: 42%; }
.matrix tbody td { padding: 12px 8px; border-top: 1px solid #EEF1F5; text-align: center; vertical-align: middle; }
.matrix tbody tr:nth-child(even) { background: #F8FAFC; }
.matrix tbody tr.row-invalid { background: #FEF2F2; }
.matrix tbody td.stmt { text-align: left; padding-left: 18px; font-size: 13.5px; color: #1F2937; line-height: 1.45; }
.matrix tbody td.stmt .q-num { color: #9CA3AF; margin-right: 6px; }
.matrix-radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #CBD2DC;
  background: #fff; cursor: pointer; transition: all 0.15s; display: inline-block;
}
.matrix-radio:hover { border-color: #1B3A6B; background: #EEF2FF; }
.matrix-radio.checked { border-color: #1B3A6B; background: #1B3A6B; box-shadow: inset 0 0 0 3px #fff; }

/* ── RATIO / ODDS BOX (above jar) ── */
.odds-box {
  background: linear-gradient(135deg, #EEF2FF, #F5F7FF); border: 1.5px solid #C7D2FE;
  border-radius: 12px; padding: 14px 18px; margin: 0 auto 18px; text-align: center; max-width: 320px;
}
.odds-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: #6366F1; margin-bottom: 10px; white-space: nowrap; }
.odds-chips { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.odds-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #1F2937; min-width: 130px; }
.odds-chip .od-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset -1px -1px 2px rgba(0,0,0,0.2); }
.odds-chip .od-dot.red { background: #DC2626; }
.odds-chip .od-dot.blue { background: #2563EB; }
.odds-chip .od-dot.grey { background: #9CA3AF; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .card { padding: 32px 24px; }
  .welcome-layout { grid-template-columns: 1fr; gap: 40px; }
  .welcome-right { order: -1; }
  .form-grid { grid-template-columns: 1fr; }
  .decision-layout { grid-template-columns: 1fr; gap: 28px; }
  .jar-stage { margin-bottom: 8px; }
}

/* Stack the You · vs · Peer module so it never overflows on phones. */
@media (max-width: 560px) {
  .peer-module { grid-template-columns: 1fr; gap: 12px; padding: 16px 18px; }
  .peer-side, .peer-side.peer { justify-content: flex-start; text-align: left; }
  .peer-side.peer .peer-sub { margin-left: 0; }
  .peer-sub { max-width: none; }
  .peer-vs { flex-direction: row; gap: 10px; align-self: flex-start; }
}
