/* ============================================================
   Modern Theme — Safe Haven Investment inspired
   Minimal, typography-driven, black + blue + white.
   Independent from the retro version — own HTML, own JS.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- Variables ------------------------------------------- */
:root {
  --pri: #2779a7;
  --pri-dark: #1a5a7a;
  --pri-light: rgba(39,121,167,0.06);
  --bg: #f5f5f3;
  --surface: #ffffff;
  --text: #111;
  --text-soft: #5a5a5a;
  --text-faint: #999;
  --line: #e4e4e0;
  --good: #3a8a4a;
  --warn: #d0902a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.05);
  --rad: 10px;
  --maxw: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --pri: #4aa0d0;
    --pri-dark: #6ab8e0;
    --pri-light: rgba(74,160,208,0.08);
    --bg: #0e0e0e;
    --surface: #181818;
    --text: #e0e0e0;
    --text-soft: #888;
    --text-faint: #5a5a5a;
    --line: #282828;
    --good: #4aaa5a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.3);
  }
}

/* ---- Reset ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Top Nav bar ----------------------------------------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.top-nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 24px;
  gap: 12px;
  position: relative;
}
.top-nav-brand {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.top-nav-brand:hover {
  color: var(--pri);
}
.sym { color: var(--pri); }
.top-nav-brand .sym { font-size: 0.85em; }
.top-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-nav-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.top-nav-btn:hover {
  color: var(--pri);
  background: var(--pri-light);
}

/* Progress bar inside nav — visible during questions */
.nav-progress {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}
.nav-progress-fill {
  height: 100%;
  background: var(--pri);
  width: 0%;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- App container --------------------------------------- */
main#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 80px;
  min-height: 100vh;
}

/* ---- Screens --------------------------------------------- */
.screen { display: none; }
.screen.active { display: block; }
.screen.active.anim-in {
  animation: m-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes m-enter {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LANDING
   ============================================================ */
.landing {
  display: flex;
  flex-direction: column;
  min-height: calc(70vh - 48px);
  justify-content: center;
  padding-top: 48px;
}

.landing-brand {
  margin-bottom: 40px;
}
.brand-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 6px;
  color: var(--text);
}
.brand-title .sym {
  font-size: 0.7em;
  vertical-align: middle;
}
.brand-sub {
  font-size: 1.05rem;
  font-weight: 350;
  color: var(--text-faint);
  margin: 0;
  letter-spacing: -0.01em;
}

.landing-body {
  margin-bottom: 40px;
}
.landing-copy {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.7;
  margin: 0 0 28px;
  max-width: 480px;
}

/* ---- Mode pills ------------------------------------------ */
.mode-group {
  margin-bottom: 28px;
}
.mode-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mode-pill {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-soft);
  text-align: left;
  font-family: inherit;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
}
.mode-pill:hover {
  border-color: var(--pri);
}
.mode-pill.selected {
  border-color: var(--pri);
  background: var(--pri-light);
}
.pill-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.mode-pill.selected .pill-title {
  color: var(--pri);
}
.pill-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--text-faint);
  line-height: 1.5;
}
.mode-pill.selected .pill-desc {
  color: var(--text-soft);
}

/* ---- Consent --------------------------------------------- */
.consent-wrap {
  margin-bottom: 24px;
}
.consent {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-faint);
  line-height: 1.5;
  transition: border-color 0.2s;
}
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--rad);
  width: 100%;
}
.consent-row + .consent-row {
  margin-top: 8px;
}
.consent:focus-within {
  border-color: var(--pri);
}
.consent input {
  width: 16px;
  height: 16px;
  accent-color: var(--pri);
  margin: 0;
  flex-shrink: 0;
}

/* ---- Buttons --------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  border: none;
  border-radius: 999px;
  background: var(--pri);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: -0.01em;
}
.btn-primary:hover {
  background: var(--pri-dark);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}
.privacy-note {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin: 6px 0 0 4px;
  line-height: 1.4;
  max-width: 500px;
}
.btn-hint {
  font-size: 0.78rem;
  color: var(--warn);
  margin: 10px 0 0;
  transition: opacity 0.2s;
}
.btn-hint[hidden] { display: none; }
@keyframes hint-pulse {
  0%, 100% { opacity: 0.6; }
  25% { opacity: 1; color: #c44; }
}
.btn-hint.pulse {
  animation: hint-pulse 0.7s ease;
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  border-color: var(--pri);
  color: var(--pri);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
.btn-ghost:hover { color: var(--text); }
.btn-ghost.danger { color: #c44; }
.btn-ghost.danger:hover { color: #a22; }



.link-subtle {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-faint);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}
.link-subtle:hover {
  color: var(--pri);
}
.sep {
  color: var(--line);
  margin: 0 8px;
}

/* ---- How it works (collapsible) -------------------------- */
details.how {
  margin: 24px 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  background: var(--surface);
  transition: border-color 0.2s;
}
details.how:hover { border-color: var(--pri-border); }
details.how summary {
  cursor: pointer;
  font-weight: 520;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
}
details.how[open] summary {
  margin-bottom: 14px;
}
details.how p {
  margin: 10px 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.65;
}
details.how .link-subtle {
  font-size: 0.85rem;
  margin-top: 6px;
  display: inline-block;
}

/* ---- Landing foot ---------------------------------------- */
.landing-foot {
  font-size: 0.82rem;
  line-height: 1.6;
}
.crisis-link, #report-crisis {
  display: block;
  font-size: 0.8rem;
  color: var(--text-faint);
  line-height: 1.6;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  background: var(--surface);
}
#report-crisis {
  margin-top: 0;
}

/* ============================================================
   QUESTION SCREEN
   ============================================================ */
.q-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 80px 0 0;
  text-align: left;
}
.q-step {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-faint);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}
.q-text {
  font-size: 1.4rem;
  font-weight: 550;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin: 0 0 36px;
  color: var(--text);
  text-align: left;
  min-height: 5em;
  scroll-margin-top: 80px;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.q-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 470;
  color: var(--text);
  text-align: left;
  transition: all 0.15s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}
.q-option:hover {
  border-color: var(--pri);
  background: var(--pri-light);
  transform: translateY(-1px);
}
.q-option:active {
  transform: translateY(0) scale(0.99);
}
.q-option.selected {
  border-color: var(--pri);
  background: var(--pri-light);
}
.q-option .opt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
  z-index: 1;
}
.q-option:hover .opt-dot {
  border-color: var(--pri);
}
.q-option.selected .opt-dot {
  background: var(--pri);
  border-color: var(--pri);
}

/* Confirm timer bar — fills over 2s inside the selected option */
.q-option-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 6px;
  width: 0%;
  background: var(--pri);
  border-radius: 0 2px 2px 0;
  pointer-events: none;
  z-index: 0;
  transition: width 2s cubic-bezier(0.22, 1, 0.36, 1);
}
.q-option.selected .q-option-bar {
  /* width is set by JS */
}
.q-option-bar { display: none; }
.q-option.selected .q-option-bar { display: block; }

.q-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
}
.q-pos {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 500;
}

.q-foot {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
}

/* ============================================================
   REPORT SCREEN
   ============================================================ */
.report-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.report-band-label {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.report-copy {
  font-size: 0.92rem;
  color: var(--text-soft);
  line-height: 1.65;
  margin: 0;
  max-width: 520px;
}

/* ---- Trait grid (2-col on wide) -------------------------- */
.trait-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 32px;
}
@media (min-width: 600px) {
  .trait-grid { grid-template-columns: 1fr 1fr; }
}

.trait-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.trait-card:hover { box-shadow: var(--shadow-md); }
.trait-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 2.8rem;
}
.trait-label { font-weight: 560; font-size: 0.93rem; }
.trait-band {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.trait-band.band-low { background: #e8f2e8; color: #2a6a3a; }
.trait-band.band-some { background: #eeeef0; color: #5a5a62; }
.trait-band.band-elevated { background: var(--pri-light); color: var(--pri); }
.trait-band.band-high { background: #fcf0e0; color: #a45a1a; }
.trait-band.band-inconclusive { background: #f4f4f4; color: #888; }

.trait-bar {
  position: relative;
  height: 10px;
  background: var(--line);
  border-radius: 5px;
  margin: 10px 0 6px;
  overflow: hidden;
}
.trait-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.trait-fill.band-low          { background: var(--good); }
.trait-fill.band-some         { background: #8a8a92; }
.trait-fill.band-elevated     { background: var(--pri); }
.trait-fill.band-high         { background: #d48a2a; }
.trait-fill.band-inconclusive { background: repeating-linear-gradient(45deg,#d0d0d0,#d0d0d0 6px,#e4e4e2 6px,#e4e4e2 12px); }
.trait-ci {
  position: absolute; top: 0; height: 100%;
  background: rgba(0,0,0,0.08);
  border-left: 1.5px solid rgba(0,0,0,0.15);
  border-right: 1.5px solid rgba(0,0,0,0.15);
  pointer-events: none;
}
.trait-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-faint);
}
.trait-blurb {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 8px 0 0;
  line-height: 1.5;
  flex: 1;
}

/* ---- Report sections (concordance, details) -------------- */
.report-screens { margin-bottom: 28px; }
.report-screens details.screen-detail {
  margin: 10px 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
}
.report-screens details.screen-detail > summary {
  font-size: 0.9rem;
  font-weight: 520;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.concordance-lead {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--pri-light);
  border-left: 3px solid var(--pri);
  border-right: 3px solid var(--pri);
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.concordance-note {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 10px;
}

.screen-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}
.screen-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.84rem;
  cursor: pointer;
  transition: background 0.15s;
}
.screen-item:hover { background: var(--pri-light); }
.screen-item .si-name { font-weight: 500; flex: 1; }
.screen-item .si-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.si-badge.si-green { background: #e8f2e8; color: #2a6a3a; }
.si-badge.si-amber { background: #fcf0e0; color: #a45a1a; }
.si-badge.si-gray  { background: #eeeef0; color: #5a5a62; }

.screen-detail-text {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 4px 0 0;
}
.screen-detail-items {
  list-style: none;
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 0.76rem;
  background: var(--pri-light);
  border-radius: 6px;
}
.screen-detail-items li { padding: 2px 0; }

/* Detail sections (asrs, bias) */
.detail-content {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-soft);
  line-height: 1.55;
}

/* ---- Next steps ------------------------------------------ */
.report-next {
  margin-bottom: 28px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
}
.report-next h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 10px;
}
.report-next ol {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.report-next li { margin-bottom: 6px; }

/* ---- Report foot ----------------------------------------- */
.report-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

/* ---- Disclaimer ------------------------------------------ */
.report-disclaimer {
  font-size: 0.82rem;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
  padding: 16px 0;
  margin: 24px 0 0;
  white-space: pre-line;
  line-height: 1.65;
  max-width: 600px;
}

/* ============================================================
   EXPLAINER — premium research-doc layout
   ============================================================ */
.explainer {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 0 60px;
}

.explainer-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.back-link {
  display: inline-block;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.explainer-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pri);
  background: var(--pri-light);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.explainer-header h2 {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 16px;
}
.explainer-lede {
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 560px;
}

.explainer-section {
  margin-bottom: 40px;
}
.explainer-section h3 {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.explainer-section p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 14px;
}
.explainer-section ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.65;
}
.explainer-section ul li { margin-bottom: 6px; }
.explainer-section strong { color: var(--text); font-weight: 550; }

/* ---- Instrument cards (grid) ---------------------------- */
.explainer-instruments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.explainer-inst {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  background: var(--surface);
  transition: box-shadow 0.2s;
}
.explainer-inst:hover { box-shadow: var(--shadow-md); }
.explainer-inst h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
}
.explainer-inst .inst-role {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.explainer-inst .inst-val {
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* ---- Honesty check cards -------------------------------- */
.explainer-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.check-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  background: var(--surface);
}
.check-icon {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 8px;
}
.check-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 6px;
}
.check-card p {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0;
}

/* ---- Limitations ---------------------------------------- */
.explainer-limits {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.limit-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--text-soft);
}
.limit-item strong {
  color: var(--text);
  font-weight: 600;
}

/* ---- References ----------------------------------------- */
.explainer-sources { margin-top: 16px; }
.source-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  line-height: 1.55;
}
.source-entry:last-child { border-bottom: none; }
.source-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 2px;
}
.source-role {
  display: block;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.source-entry .citation {
  display: block;
  color: var(--text-soft);
  margin-top: 4px;
}
.source-entry .validation {
  display: block;
  color: var(--text-faint);
  font-style: italic;
  font-size: 0.78rem;
  margin-top: 2px;
}
.source-link {
  display: inline-block;
  font-size: 0.76rem;
  color: var(--pri);
  text-decoration: none;
  margin-top: 4px;
}
.source-link:hover {
  text-decoration: underline;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 360px;
  text-align: center;
}
.modal-card p {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: var(--text);
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 480;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  white-space: nowrap;
}
.toast[hidden] { display: none; }

/* ============================================================
   DARK MODE
   ============================================================ */
@media (prefers-color-scheme: dark) {
  .trait-band.band-low { background: rgba(74,170,90,0.2); color: #6aaa7a; }
  .trait-band.band-some { background: rgba(100,100,110,0.2); color: #9a9aa2; }
  .trait-band.band-elevated { background: rgba(74,160,208,0.15); color: #6ab8e0; }
  .trait-band.band-high { background: rgba(212,138,42,0.2); color: #d4a84a; }
  .trait-band.band-inconclusive { background: rgba(150,150,150,0.15); color: #888; }
  .si-badge.si-green { background: rgba(74,170,90,0.2); color: #6aaa7a; }
  .si-badge.si-amber { background: rgba(212,138,42,0.2); color: #d4a84a; }
  .si-badge.si-gray { background: rgba(100,100,110,0.2); color: #9a9aa2; }
  .trait-ci { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
  .check-card, .limit-item, .explainer-inst { background: var(--surface); }
  .q-option.selected .q-option-bar { background: var(--pri); }
}

/* ============================================================
   PRINT — PDF report layout
   ============================================================ */
.print-only { display: none; }

@media print {
  @page {
    margin: 1.5cm 2cm 2cm;
    @bottom-center { content: counter(page); font-size: 8pt; color: #999; }
  }
  @page :first { margin-top: 1.5cm; }

  * { color: #000 !important; background: transparent !important; }
  html, body {
    font-size: 11pt !important;
    line-height: 1.5 !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* Hide everything except the report screen */
  .screen { display: none !important; }
  #screen-report { display: block !important; }
  .top-nav, .report-foot, .toast, .modal-overlay,
  #theme-toggle, #link-explainer, #nav-how { display: none !important; }

  /* Force all collapsible sections open in print */
  details, details[open] { display: block !important; }
  details > .detail-content { display: block !important; }
  details > summary { display: block; }
  details > summary::-webkit-details-marker { display: none; }

  /* Show print-only header and appendix */
  .print-only { display: block !important; }
  #print-header {
    text-align: center;
    margin-bottom: 1.5cm;
    padding-bottom: 0.5cm;
    border-bottom: 2px solid #000 !important;
  }
  #print-header h1 {
    font-size: 18pt !important;
    font-weight: 800;
    margin: 0 0 4pt;
    letter-spacing: -0.02em;
  }
  .print-meta {
    font-size: 9pt !important;
    color: #555 !important;
    margin: 2pt 0;
  }

  /* Report header */
  .report-header { margin-bottom: 20pt; }
  .report-band-label {
    font-size: 16pt !important;
    font-weight: 700;
    text-transform: capitalize;
  }
  .report-copy { font-size: 10pt !important; line-height: 1.5; }

  /* Trait profile — single column, one per row */
  .trait-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10pt;
    margin-bottom: 24pt;
  }
  .trait-card {
    border: 1px solid #ccc !important;
    border-radius: 4pt;
    padding: 10pt 12pt;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .trait-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6pt;
  }
  .trait-label { font-weight: 600; font-size: 10pt; }
  .trait-band {
    font-size: 7pt !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2pt 8pt;
    border-radius: 999px;
    border: 1px solid #ccc !important;
  }
  .trait-bar {
    height: 12pt;
    background: #eee !important;
    border-radius: 6pt;
    margin: 6pt 0 4pt;
    overflow: hidden;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .trait-fill {
    height: 100%;
    border-radius: 6pt;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .trait-fill.band-low          { background: #5aaa6a !important; }
  .trait-fill.band-some         { background: #8a8a92 !important; }
  .trait-fill.band-elevated     { background: #4a8ab8 !important; }
  .trait-fill.band-high         { background: #d48a2a !important; }
  .trait-fill.band-inconclusive { background: #b0b0b8 !important; }
  .trait-ci {
    background: rgba(0,0,0,0.08) !important;
    border-left: 1.5pt solid rgba(0,0,0,0.2) !important;
    border-right: 1.5pt solid rgba(0,0,0,0.2) !important;
  }
  .trait-meta { font-size: 8pt !important; }
  .trait-blurb { font-size: 8pt !important; line-height: 1.4; }

  /* Screen cards */
  .report-screens { margin-bottom: 24pt; }
  .report-screens details.screen-detail {
    border: 1px solid #ccc !important;
    border-radius: 4pt;
    padding: 10pt 12pt;
    margin: 8pt 0;
    display: block !important;
    break-inside: avoid;
  }
  .report-screens details.screen-detail > summary {
    list-style: none !important;
    font-weight: 600;
    font-size: 10pt;
    display: block;
  }
  .report-screens details.screen-detail[open] { display: block; }
  .report-screens details.screen-detail > summary::-webkit-details-marker { display: none; }
  .screen-grid { margin-top: 8pt; }
  .screen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4pt 0;
    border-bottom: 1pt solid #eee !important;
    font-size: 9pt;
  }
  .si-badge {
    font-size: 7pt !important;
    font-weight: 600;
    padding: 2pt 8pt;
    border-radius: 999px;
    border: 1px solid #ccc !important;
  }
  .detail-content { font-size: 9pt !important; }

  /* Next steps */
  .report-next {
    border: 1px solid #ccc !important;
    padding: 10pt 12pt;
    margin-bottom: 20pt;
    font-size: 9pt;
  }

  /* Appendix table */
  #print-appendix {
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 2px solid #000 !important;
  }
  #print-appendix h2 {
    font-size: 14pt !important;
    margin: 0 0 6pt;
  }
  #print-appendix p { font-size: 9pt !important; margin: 0 0 8pt; }
  #print-item-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 7.5pt !important;
    break-inside: auto;
  }
  #print-item-table th {
    text-align: left;
    font-weight: 600;
    padding: 4pt 6pt;
    border-bottom: 2px solid #000 !important;
    font-size: 7pt !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  #print-item-table td {
    padding: 3pt 6pt;
    border-bottom: 1px solid #ccc !important;
    vertical-align: top;
  }
  #print-item-table tr:nth-child(even) td { background: #f5f5f5 !important; }

  /* Disclaimer */
  .report-disclaimer {
    font-size: 7.5pt !important;
    border-top: 1px solid #ccc !important;
    padding-top: 10pt;
    margin-top: 20pt;
    line-height: 1.5;
  }

  /* Crisis */
  .crisis-link {
    font-size: 7pt !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 8pt !important;
  }

  /* Page breaks */
  .report-next, #print-appendix { break-before: page; }
  .trait-card { break-inside: avoid; }
  .report-screens details.screen-detail { break-inside: avoid; }

  /* JS-populated band colours (report-band-label) */
  .band-low { color: #2a6a3a !important; }
  .band-some { color: #5a5a62 !important; }
  .band-elevated { color: #2779a7 !important; }
  .band-high { color: #a45a1a !important; }
  .band-inconclusive { color: #888 !important; }
}
