/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  background: #f6f7f9;
  color: #222;
}

header {
  background: #20283a;
  color: #fff;
  padding: 34px 48px 28px;
}

header h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fd0c2;
}

.subtitle {
  margin: 0;
  max-width: 760px;
  font-size: 1rem;
  line-height: 1.45;
  color: #d6dce8;
}

/* ── Hero (animated intro) ─────────────────────────────────── */
header.hero {
  position: relative;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 25%, #2d3a5c 0%, transparent 60%),
    radial-gradient(ellipse at 75% 80%, #3a2f4f 0%, transparent 55%),
    linear-gradient(160deg, #161c2c 0%, #20283a 50%, #181f30 100%);
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.5;
  mix-blend-mode: overlay;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 70px 48px 90px;
}

.hero-eyebrow {
  color: #9fd0c2;
  opacity: 0;
  transform: translateY(12px);
  animation: hero-fadeup 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 0.1s forwards;
}

.hero-headline {
  margin: 18px 0 22px;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.35em;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5);
}

.hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px) rotateX(-30deg);
  transform-origin: 50% 100%;
  animation: hero-word-in 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: calc(0.45s + var(--i, 0) * 0.13s);
}

.hero-word-accent {
  background: linear-gradient(120deg, #ff8aa6 0%, #ffb86b 50%, #9fd0c2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-subtitle {
  margin: 0;
  max-width: 720px;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  color: #d6dce8;
  opacity: 0;
  transform: translateY(14px);
  animation: hero-fadeup 0.95s cubic-bezier(0.22, 0.61, 0.36, 1) 1.05s forwards;
}

.hero-stats {
  margin: 48px 0 60px;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  opacity: 0;
  animation: hero-fadeup 1s cubic-bezier(0.22, 0.61, 0.36, 1) 1.35s forwards;
}

.hero-stat {
  padding: 4px 36px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stat-divider {
  padding-left: 36px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-stat-value {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8aa0c8;
}

.hero-scroll {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(159, 208, 194, 0.3);
  border-radius: 40px;
  color: #9fd0c2;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(10px);
  animation: hero-fadeup 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 1.7s forwards;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.hero-scroll:hover {
  background: rgba(159, 208, 194, 0.12);
  border-color: rgba(159, 208, 194, 0.6);
}

.hero-scroll-arrow {
  display: inline-flex;
  animation: hero-arrow-bob 1.6s ease-in-out infinite;
}

@keyframes hero-fadeup {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-word-in {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

@keyframes hero-arrow-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}

@media (max-width: 720px) {
  header.hero { min-height: 92vh; }
  .hero-content { padding: 50px 24px 70px; }
  .hero-stat { padding: 4px 22px 4px 0; }
  .hero-stat-divider { padding-left: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow,
  .hero-word,
  .hero-subtitle,
  .hero-stats,
  .hero-scroll {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .hero-scroll-arrow { animation: none; }
}

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Variant: reveal that scales slightly (used for figures) */
.reveal-scale {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Reading progress bar ── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #4e79a7, #9fd0c2);
  z-index: 9999;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ── Chapter navigation dots ── */
.chapter-nav {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(20, 30, 60, 0.08);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.chapter-nav.ready {
  opacity: 1;
  pointer-events: auto;
}
.chapter-nav a {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c8cfdb;
  display: block;
  transition: background 0.25s ease, transform 0.25s ease;
}
.chapter-nav a:hover {
  background: #4e79a7;
  transform: scale(1.25);
}
.chapter-nav a.active {
  background: #20283a;
  transform: scale(1.3);
}
.chapter-nav a::after {
  content: attr(data-label);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  background: #20283a;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.chapter-nav a:hover::after {
  opacity: 1;
}
@media (max-width: 900px) {
  .chapter-nav { display: none; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .reading-progress { transition: none; }
  html { scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }

/* ── Sections ── */
section {
  background: #fff;
  margin: 0;
  padding: 28px 48px;
  border-bottom: 1px solid #e5e8ef;
}

section:nth-of-type(even) {
  background: #f8f9fb;
}

section h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a2e;
}

.section-kicker {
  margin: 0 0 5px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4e79a7;
}

.section-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: #666;
}

.section-takeaway {
  margin: 18px auto 0;
  padding: 14px 18px;
  max-width: 820px;
  background: #f6f7fb;
  border-left: 3px solid #4e79a7;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #2a2a3a;
}

.section-takeaway strong {
  color: #1a1a2e;
}

/* ── Pressure constellation ── */
.pressure-constellation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 22px;
  align-items: stretch;
}

.pressure-constellation {
  min-height: 520px;
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(78,121,167,0.09), rgba(255,255,255,0) 45%),
    #fff;
  padding: 8px;
  overflow-x: auto;
}

.pressure-constellation svg {
  display: block;
  min-width: 680px;
}

.pressure-node circle,
.pressure-center circle {
  filter: drop-shadow(0 8px 18px rgba(32,40,58,0.18));
}

.pressure-detail {
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  min-height: 260px;
}

.pressure-detail-kicker {
  display: block;
  margin-bottom: 7px;
  color: #4e79a7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pressure-detail h3 {
  margin: 0 0 12px;
  color: #20283a;
  font-size: 1.3rem;
}

.pressure-detail p {
  margin: 12px 0 0;
  color: #4b5563;
  font-size: 0.88rem;
  line-height: 1.55;
}

.pressure-detail-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pressure-detail-metrics div {
  border-top: 1px solid #edf0f5;
  padding-top: 10px;
}

.pressure-detail-metrics strong {
  display: block;
  color: #20283a;
  font-size: 1.35rem;
}

.pressure-detail-metrics span,
.pressure-detail-note {
  color: #6b7280;
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.controls label {
  font-size: 0.88rem;
  color: #555;
}

.controls select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.88rem;
  background: #fff;
  cursor: pointer;
}

/* ── Health fingerprints ── */
.fingerprint-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  max-width: 980px;
  margin: 0 0 16px;
}

.fingerprint-summary-card {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.fingerprint-summary-card span {
  display: block;
  margin-bottom: 5px;
  color: #4e79a7;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fingerprint-summary-card strong {
  display: block;
  color: #20283a;
  font-size: 1.05rem;
  line-height: 1.3;
}

.fingerprint-summary-card em {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 0.78rem;
  font-style: normal;
}

.fingerprint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 1120px;
}

.fingerprint-card {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.fingerprint-card-head {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 4px;
}

.fingerprint-card-head h3 {
  margin: 0;
  color: #20283a;
  font-size: 0.9rem;
  line-height: 1.2;
}

.fingerprint-card-head p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 0.68rem;
}

.fingerprint-card-head strong {
  flex: 0 0 auto;
  color: #20283a;
  font-size: 0.84rem;
}

.fingerprint-card svg {
  display: block;
}

.fingerprint-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid #edf0f5;
  color: #667085;
  font-size: 0.7rem;
}

.fingerprint-card-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.fingerprint-card-foot i {
  width: 12px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
}

.fingerprint-card-foot i.baseline {
  background: #9aa3b2;
}

.pressure-ribbon-stage {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pressure-ribbon-detail {
  min-height: 260px;
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.pressure-ribbon-detail > span {
  display: block;
  margin-bottom: 7px;
  color: #4e79a7;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pressure-ribbon-detail h3 {
  margin: 0 0 12px;
  color: #20283a;
  font-size: 1.18rem;
}

.ribbon-detail-metric {
  border-top: 1px solid #edf0f5;
  border-bottom: 1px solid #edf0f5;
  padding: 12px 0;
}

.ribbon-detail-metric strong {
  display: block;
  color: #20283a;
  font-size: 1.45rem;
}

.ribbon-detail-metric em {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 0.76rem;
  font-style: normal;
}

.pressure-ribbon-detail p {
  margin: 12px 0 0;
  color: #4b5563;
  font-size: 0.84rem;
  line-height: 1.5;
}

.pressure-ribbon-detail p.higher {
  color: #9c344b;
  font-weight: 800;
}

.pressure-ribbon-detail p.lower {
  color: #2d6f82;
  font-weight: 800;
}

.pressure-ribbon-detail small {
  display: block;
  margin-top: 14px;
  color: #667085;
  font-size: 0.74rem;
  line-height: 1.35;
}

.pressure-ribbon-chart-wrap {
  min-width: 0;
  overflow-x: auto;
}

.matrix-row {
  transition: opacity 0.18s ease;
}

.matrix-cell circle {
  filter: drop-shadow(0 1px 2px rgba(32, 40, 58, 0.12));
}

.matrix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: #5c6472;
}

.matrix-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.matrix-legend-item i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.matrix-legend-size b:first-child {
  font-size: 0.7rem;
  color: #9aa3b2;
}

.matrix-legend-size b:nth-child(2) {
  font-size: 1.15rem;
  color: #9aa3b2;
}

.gauge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 14px;
  justify-content: center;
  padding: 8px 0;
}

.gauge-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 138px;
  cursor: default;
}

.gauge-cell svg {
  filter: drop-shadow(0 2px 6px rgba(32, 40, 58, 0.1));
}

.gauge-label {
  margin: 4px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #3f4756;
  text-align: center;
  line-height: 1.25;
}

.pressure-ribbon-chart-wrap svg {
  display: block;
  min-width: 760px;
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 44%, rgba(78,121,167,0.08), rgba(255,255,255,0) 46%),
    #fff;
}

.pressure-ribbon {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.16s, stroke-width 0.16s;
}

.pressure-ribbon-group.active .pressure-ribbon {
  stroke-width: 7;
  opacity: 1;
}

.pressure-ribbon-group.muted .pressure-ribbon,
.pressure-ribbon-group.muted .pressure-ribbon-point {
  opacity: 0.18;
}

.pressure-ribbon-point {
  cursor: pointer;
  transition: opacity 0.16s;
}

.pressure-ribbon-baseline {
  fill: none;
  stroke: #20283a;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 7;
}

.pressure-ribbon-area {
  opacity: 0.15;
}

.pressure-ribbon-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pressure-ribbon-legend button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d6dbe5;
  border-radius: 999px;
  background: #fff;
  color: #3f4756;
  padding: 5px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}

.pressure-ribbon-legend button span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ribbon-color);
}

.pressure-ribbon-legend button.active {
  border-color: var(--ribbon-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ribbon-color) 35%, transparent);
  font-weight: 800;
}

@media (max-width: 920px) {
  .pressure-ribbon-stage {
    grid-template-columns: 1fr;
  }
}

/* ── Orientation passport + demographic flow ── */
.orientation-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.survey-passport {
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.passport-label {
  margin-bottom: 5px;
  color: #4e79a7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.passport-title {
  margin-bottom: 16px;
  color: #20283a;
  font-size: 1.2rem;
  font-weight: 800;
}

.passport-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.passport-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid #edf0f5;
}

.passport-value {
  color: #20283a;
  font-size: 1.35rem;
  font-weight: 800;
}

.passport-caption,
.passport-note {
  color: #5c6472;
  font-size: 0.8rem;
  line-height: 1.35;
}

.passport-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid #edf0f5;
}

.association-panel {
  min-width: 0;
}

.association-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.association-controls {
  margin-bottom: 0;
}

.flow-arrow {
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
}

.flow-swap {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  background: #fff;
  color: #303849;
  font-size: 0.82rem;
  cursor: pointer;
}

.flow-swap:hover {
  border-color: #20283a;
  color: #20283a;
}

.flow-summary {
  max-width: 420px;
  color: #5c6472;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: right;
}

#demographic-flow-chart {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  min-height: 360px;
  overflow-x: auto;
}

.flow-ribbon {
  transition: fill-opacity 0.12s ease;
}

.flow-node rect {
  transition: fill-opacity 0.12s ease, stroke 0.12s ease;
}

.loading-panel {
  min-height: 198px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.86rem;
  background: repeating-linear-gradient(
    -45deg,
    #f8f9fb,
    #f8f9fb 10px,
    #f1f3f7 10px,
    #f1f3f7 20px
  );
  border-radius: 6px;
}

/* ── Demographics grid ── */
.chart-row {
  display: grid;
  /* columns set dynamically in JS via naturalW fr ratios */
  gap: 14px;
  align-items: start;
}

.demo-chart-wrap {
  min-width: 0;           /* prevent grid cell overflow */
  display: flex;
  flex-direction: column;
}

.chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 6px;
  text-align: center;
}

/* ── Radar toggle pills (serve as legend) ── */
#radar-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.radar-toggle {
  padding: 5px 14px;
  border-radius: 20px;
  border: 2px solid var(--toggle-color, #aaa);
  background: transparent;
  color: #666;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  user-select: none;
}

.radar-toggle.active {
  background: var(--toggle-color, #aaa);
  color: #fff;
  font-weight: 600;
}

.radar-toggle:not(.active):hover {
  background: color-mix(in srgb, var(--toggle-color, #aaa) 15%, transparent);
  color: #333;
}

/* ── Radar SVG + controls — all constrained to same width ── */
#radar-controls,
#radar-toggles,
#radar-chart {
  max-width: 700px;
}

#risk-stack-chart {
  max-width: 1000px;
  overflow-x: auto;
}

/* ── Grade shift ── */
.grade-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.grade-summary-card {
  min-width: 220px;
  max-width: 360px;
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grade-summary-value {
  font-size: 1rem;
  font-weight: 800;
  color: #20283a;
}

.grade-summary-label {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #5c6472;
}

#grade-shift-chart,
#risk-role-chart {
  max-width: 900px;
}

.grade-series {
  transition: opacity 0.2s ease;
}

.grade-node circle {
  filter: drop-shadow(0 2px 4px rgba(32, 40, 58, 0.18));
}

/* ── Risk profiler ── */
.risk-stack-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  max-width: 1000px;
  margin: 0 0 14px;
}

.risk-stack-card {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.risk-stack-card span {
  display: block;
  margin-bottom: 5px;
  color: #4e79a7;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.risk-stack-card strong {
  display: block;
  color: #20283a;
  font-size: 1.05rem;
  line-height: 1.3;
}

.risk-stack-card em {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-size: 0.78rem;
  font-style: normal;
}

.risk-reading-note {
  max-width: 900px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 3px solid #20283a;
  border-radius: 4px;
  background: #f2f5f9;
  color: #3f4756;
  font-size: 0.88rem;
  line-height: 1.55;
}

.risk-reading-note strong {
  color: #20283a;
}

.risk-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.risk-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d6dbe5;
  border-radius: 8px;
  background: #fff;
  color: #303849;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.risk-toggle.active {
  border-color: #4e79a7;
  background: #edf4fb;
  box-shadow: inset 0 0 0 1px rgba(78,121,167,0.12);
}

.risk-toggle input {
  width: 14px;
  height: 14px;
  accent-color: #4e79a7;
}

.risk-reset {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: #20283a;
  color: #fff;
  font-size: 0.82rem;
  cursor: pointer;
}

.risk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 24px;
  align-items: start;
}

.risk-panel {
  min-width: 0;
}

.risk-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #20283a;
}

/* ── Sexual health ── */
.sexual-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.sexual-summary-card {
  min-width: 220px;
  max-width: 360px;
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sexual-summary-value {
  font-size: 1rem;
  font-weight: 800;
  color: #20283a;
}

.sexual-summary-label {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #5c6472;
}

.sexual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sexual-panel {
  min-width: 0;
}

.sexual-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #20283a;
}

/* ── Phone charts ── */
.phone-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.phone-summary-card {
  min-width: 220px;
  max-width: 360px;
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phone-summary-value {
  font-size: 1rem;
  font-weight: 800;
  color: #20283a;
}

.phone-summary-label {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #5c6472;
}

/* ── Demo filter badge ── */
#demo-filter-badge {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.filter-count {
  font-size: 0.88rem;
  color: #1a1a2e;
  background: #e8eaf6;
  padding: 4px 12px;
  border-radius: 20px;
}

.filter-count-neutral {
  font-size: 0.85rem;
  color: #888;
}

.filter-reset {
  background: #20283a;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.filter-reset:hover {
  background: #e15759;
}

/* ── Demo chart wrappers ── */
.demo-chart-wrap {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 6px 4px;
  background: #fafafa;
  transition: box-shadow 0.2s;
}

.demo-chart-wrap:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.09);
}

/* ── Demo tooltip ── */
.demo-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(32,40,58,0.92);
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 99;
  white-space: nowrap;
}

/* ── SVG text defaults ── */
svg text {
  font-family: "Segoe UI", Arial, sans-serif;
}

/* ── Dot plot tooltip ── */
.dot-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(32,40,58,0.92);
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 99;
  white-space: nowrap;
}

/* ── Map tooltip ── */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(32,40,58,0.92);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 99;
}

/* ── Addiction legend ── */
.world-map-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 14px;
}

.world-map-summary-card {
  border: 1px solid rgba(32,40,58,0.11);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32,40,58,0.08);
  padding: 14px 16px;
}

.world-map-summary-card span {
  display: block;
  color: #6f7785;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.world-map-summary-card strong {
  display: block;
  color: #20283a;
  font-size: clamp(1.05rem, 1.55vw, 1.4rem);
  line-height: 1.15;
  margin-top: 8px;
}

.world-map-summary-card p {
  color: #667085;
  font-size: 0.84rem;
  line-height: 1.35;
  margin: 8px 0 0;
}

.world-map-platform-controls {
  border: 1px solid rgba(32,40,58,0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32,40,58,0.07);
  padding: 14px 16px;
  margin: 0 0 14px;
}

.world-map-platform-control-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.world-map-platform-control-head strong {
  color: #20283a;
  font-size: 0.92rem;
}

.world-map-platform-control-head span {
  color: #7a8494;
  font-size: 0.78rem;
  font-weight: 700;
}

.world-map-platform-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.world-map-mode-button,
.world-map-platform-button {
  min-height: 34px;
  border: 1px solid rgba(32,40,58,0.14);
  border-radius: 999px;
  background: #f7f9fc;
  color: #4f5968;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.world-map-mode-button:hover,
.world-map-platform-button:hover {
  background: #eef2f7;
  border-color: rgba(32,40,58,0.22);
}

.world-map-mode-button.active {
  background: #20283a;
  border-color: #20283a;
  color: #fff;
  box-shadow: 0 4px 14px rgba(32,40,58,0.2);
}

.world-map-platform-button.active {
  background: color-mix(in srgb, var(--platform-color, #4e79a7) 16%, #fff);
  border-color: var(--platform-color, #4e79a7);
  color: #20283a;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--platform-color, #4e79a7) 24%, transparent);
}

.world-map-platform-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.76rem;
  font-weight: 900;
}

.world-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: stretch;
  margin-top: 16px;
}

.addiction-legend {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid rgba(32,40,58,0.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(32,40,58,0.07);
}

.addiction-legend p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #333;
}

.platform-legend-item:hover {
  background: #eef1f6 !important;
}

#world-map-container {
  height: 700px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(32,40,58,0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 22%, rgba(78,121,167,0.13), transparent 28%),
    radial-gradient(circle at 80% 64%, rgba(31,158,137,0.12), transparent 26%),
    linear-gradient(180deg, #f7fbff 0%, #eef5fb 100%);
  box-shadow: 0 18px 42px rgba(32,40,58,0.12);
  cursor: grab;
}

#world-map-container:active {
  cursor: grabbing;
}

#world-map {
  width: 100%;
  height: 100%;
  display: block;
}

.country {
  transition: fill 0.18s ease, stroke 0.18s ease;
}

.usage-halo {
  pointer-events: none;
  opacity: 0.18;
  stroke-width: 1.4;
  stroke-opacity: 0.35;
  filter: drop-shadow(0 0 9px rgba(179,71,0,0.32));
}

.percentage-label {
  paint-order: stroke;
  stroke: rgba(255,255,255,0.82);
  stroke-width: 4px;
}

.world-map-panel {
  border: 1px solid rgba(32,40,58,0.11);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(32,40,58,0.12);
  padding: 16px;
  min-height: 700px;
}

.world-map-panel > span {
  display: block;
  color: #6f7785;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.world-map-panel h3 {
  margin: 0;
  color: #20283a;
  font-size: 1.12rem;
  line-height: 1.2;
}

.world-map-panel-copy {
  color: #667085;
  font-size: 0.84rem;
  line-height: 1.45;
  margin: 8px 0 14px;
}

.world-map-panel-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.world-map-panel-head i,
.world-map-platform-mix i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  font-style: normal;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.32), 0 2px 8px rgba(32,40,58,0.16);
}

.world-map-panel-bars {
  display: grid;
  gap: 12px;
}

.world-map-panel-bar .bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #20283a;
  font-size: 0.82rem;
  font-weight: 800;
}

.world-map-panel-bar .bar-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-map-panel-bar .bar-head span {
  color: #4e79a7;
  flex-shrink: 0;
}

.world-map-panel-bar .bar-track {
  height: 8px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
  margin-top: 6px;
}

.world-map-panel-bar .bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f2c94c, #d24b59);
}

.world-map-panel-bar p {
  margin: 4px 0 0;
  color: #7a8494;
  font-size: 0.74rem;
  font-weight: 700;
}

.world-map-panel-divider {
  height: 1px;
  background: #edf0f5;
  margin: 16px 0;
}

.world-map-platform-mix {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.world-map-platform-mix div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  color: #20283a;
  font-size: 0.82rem;
}

.world-map-platform-mix strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-map-platform-mix em {
  color: #667085;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

@media (max-width: 980px) {
  .world-map-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .world-map-layout {
    grid-template-columns: 1fr;
  }

  .world-map-panel {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .world-map-summary {
    grid-template-columns: 1fr;
  }

  #world-map-container {
    height: 560px;
  }
}

/* ── Platform radar (section 10) ── */
.platform-fingerprint-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  max-width: 920px;
  margin: 0 0 16px;
}

.platform-fingerprint-card {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.platform-fingerprint-card span {
  display: block;
  margin-bottom: 5px;
  color: #4e79a7;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.platform-fingerprint-card strong {
  color: #20283a;
  font-size: 1rem;
  line-height: 1.3;
}

.platform-radar-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.radar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 2px solid var(--pill-color, #aaa);
  background: transparent;
  color: #666;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.radar-pill img {
  filter: invert(40%);
  transition: filter 0.15s;
}

.radar-pill.active {
  background: var(--pill-color, #aaa);
  color: #fff;
  font-weight: 600;
}

.radar-pill.active img {
  filter: none;
}

.radar-pill:not(.active):hover {
  background: color-mix(in srgb, var(--pill-color, #aaa) 12%, transparent);
  color: #333;
}

/* Outline the white ghost in black — it's invisible on Snapchat's yellow brand colour otherwise */
.radar-pill img[src*="snapchat"],
.radar-pill.active img[src*="snapchat"],
.platform-legend-item img[src*="snapchat"],
.world-map-platform-swatch img[src*="snapchat"],
.platform-mark img[src*="snapchat"],
image[href*="snapchat"] {
  filter: url(#snapchat-outline);
  transform: scale(0.9);
  transform-origin: center;
  transform-box: fill-box;
}

.radar-pill.active[data-platform="Snapchat"] {
  color: #1a1a2e;
}

#platform-radar-chart {
  max-width: 1120px;
}

.platform-fingerprint-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.platform-fingerprint-tile {
  border: 1px solid #e3e7ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.platform-tile-head {
  min-height: 54px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 4px;
}

.platform-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.14);
}

.platform-mark img {
  width: 19px;
  height: 19px;
}

.platform-mark span {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.platform-tile-head h3 {
  margin: 0;
  color: #20283a;
  font-size: 0.9rem;
  line-height: 1.2;
}

.platform-tile-head p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 0.68rem;
  line-height: 1.35;
}

.platform-tile-head strong {
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  background: #20283a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
}

.platform-tile-chart svg {
  display: block;
}

.platform-tile-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #edf0f5;
  color: #667085;
  font-size: 0.7rem;
}

.platform-tile-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.platform-tile-metrics i {
  width: 12px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
}

.platform-tile-metrics i.baseline {
  background: #9aa3b2;
}

.platform-tile-metrics .score {
  flex-basis: 100%;
  color: #20283a;
  font-weight: 800;
}

/* ── Health heatmap (section 12) ── */
#health-heatmap-chart {
  max-width: 1060px;
  margin: 0 auto;
}

.digital-terrain-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.digital-terrain-card {
  border: 1px solid rgba(32,40,58,0.11);
  border-radius: 8px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 8px 26px rgba(32,40,58,0.08);
  padding: 14px 16px;
}

.digital-terrain-card span {
  display: block;
  color: #6f7785;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.digital-terrain-card strong {
  display: block;
  color: #20283a;
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
  line-height: 1;
  margin-top: 8px;
}

.digital-terrain-card p {
  color: #667085;
  font-size: 0.84rem;
  line-height: 1.35;
  margin: 8px 0 0;
}

.digital-terrain-shell {
  overflow-x: auto;
  border: 1px solid rgba(32,40,58,0.1);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31,158,137,0.06), rgba(210,75,89,0.08)),
    #ffffff;
  box-shadow: 0 18px 42px rgba(32,40,58,0.12);
  padding: 8px;
}

.digital-terrain-key {
  min-width: 760px;
  display: flex;
  align-items: center;
  gap: 14px 18px;
  flex-wrap: wrap;
  padding: 10px 12px 4px;
}

.digital-terrain-key-block {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5d6675;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  min-height: 24px;
}

.digital-terrain-key-block.gradient {
  display: flex;
  align-items: center;
  gap: 8px;
}

.digital-terrain-key-block.gradient i {
  display: block;
  width: 176px;
  height: 11px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(32,40,58,0.14);
}

.digital-terrain-key-block.gradient em {
  color: #7a8494;
  font-size: 11px;
  font-weight: 850;
  font-style: normal;
  min-width: 12px;
  text-align: center;
}

.digital-terrain-key-block .impact-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #f2c94c;
  border: 2px solid #20283a;
}

.digital-terrain-key-block .terrain-swatch {
  width: 28px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,235,173,0.5), rgba(210,75,89,0.5));
  box-shadow: inset 0 0 0 1px rgba(32,40,58,0.12);
}

.digital-terrain-shell svg {
  display: block;
  min-width: 760px;
  width: 100%;
  height: auto;
}

.terrain-plot-bg {
  fill: #fbfcff;
  stroke: rgba(32,40,58,0.14);
}

.terrain-zone {
  pointer-events: none;
}

.terrain-zone-calm {
  fill: rgba(31,158,137,0.12);
}

.terrain-zone-risk {
  fill: rgba(210,75,89,0.12);
}

.terrain-threshold {
  stroke: rgba(32,40,58,0.34);
  stroke-width: 1.2;
  stroke-dasharray: 5 6;
}

.terrain-zone-label {
  pointer-events: none;
}

.terrain-zone-label rect {
  stroke-width: 1px;
  filter: drop-shadow(0 4px 10px rgba(32,40,58,0.14));
}

.terrain-zone-label text {
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.terrain-zone-label.risk rect {
  fill: rgba(255,246,247,0.94);
  stroke: rgba(159,51,64,0.28);
}

.terrain-zone-label.risk text {
  fill: #9f3340;
}

.terrain-zone-label.calm rect {
  fill: rgba(242,255,251,0.94);
  stroke: rgba(22,119,102,0.26);
}

.terrain-zone-label.calm text {
  fill: #167766;
}

.terrain-grid .domain {
  display: none;
}

.terrain-grid line {
  stroke: rgba(32,40,58,0.08);
}

.terrain-axis .domain,
.terrain-axis line {
  stroke: rgba(32,40,58,0.28);
}

.terrain-axis text {
  fill: #5d6675;
  font-size: 12px;
  font-weight: 650;
}

.terrain-axis-label {
  fill: #20283a;
  font-size: 13px;
  font-weight: 800;
}

.terrain-contours path {
  stroke: rgba(255,255,255,0.42);
  stroke-width: 0.6;
}

.terrain-points circle {
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.heatmap-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(26,26,46,0.96);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  max-width: 280px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

@media (max-width: 760px) {
  .digital-terrain-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .digital-terrain-summary {
    grid-template-columns: 1fr;
  }
}

.radar-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(32,40,58,0.92);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 99;
  white-space: nowrap;
}

/* ── Age trajectory (section 11) ── */
#academic-trajectory-chart {
  overflow-x: auto;
  margin-top: 16px;
}

.age-current-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.age-current-card {
  border: 1px solid rgba(32,40,58,0.11);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32,40,58,0.08);
  padding: 14px 16px;
}

.age-current-card span {
  display: block;
  color: #707987;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.age-current-card strong {
  display: block;
  color: #20283a;
  font-size: clamp(1.05rem, 1.45vw, 1.35rem);
  line-height: 1.15;
  margin-top: 8px;
}

.age-current-card p {
  color: #667085;
  font-size: 0.84rem;
  line-height: 1.35;
  margin: 8px 0 0;
}

.age-current-shell {
  min-width: 820px;
  border: 1px solid rgba(32,40,58,0.1);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31,158,137,0.05), rgba(143,106,217,0.07)),
    #ffffff;
  box-shadow: 0 18px 42px rgba(32,40,58,0.12);
  padding: 10px 12px 6px;
}

.age-current-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 4px 4px 8px;
}

.age-current-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4f5968;
  font-size: 12px;
  font-weight: 800;
}

.age-current-key i {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--series-color);
  box-shadow: inset 0 0 0 1px rgba(32,40,58,0.12);
}

.age-current-shell svg {
  display: block;
  min-width: 820px;
  width: 100%;
  height: auto;
}

.age-current-frame {
  fill: #fbfcff;
  stroke: rgba(32,40,58,0.14);
}

.age-current-band.low {
  fill: rgba(31,158,137,0.08);
}

.age-current-band.mid {
  fill: rgba(242,201,76,0.08);
}

.age-current-band.high {
  fill: rgba(210,75,89,0.08);
}

.age-current-band-label {
  fill: rgba(32,40,58,0.3);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.age-current-grid .domain {
  display: none;
}

.age-current-grid line {
  stroke: rgba(32,40,58,0.08);
}

.age-current-ribbon {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.14;
}

.age-current-line {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.age-current-dot {
  stroke: #fff;
  stroke-width: 1.6;
  opacity: 0.92;
}

.age-current-end-labels path {
  fill: none;
  stroke-width: 1.2;
  stroke-opacity: 0.45;
}

.age-current-end-labels text {
  font-size: 12px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.9);
  stroke-width: 4px;
}

.age-current-axis .domain,
.age-current-axis line {
  stroke: rgba(32,40,58,0.28);
}

.age-current-axis text {
  fill: #5d6675;
  font-size: 12px;
  font-weight: 650;
}

.age-current-axis-label {
  fill: #20283a;
  font-size: 13px;
  font-weight: 850;
}

.age-current-focus line {
  stroke: rgba(32,40,58,0.45);
  stroke-width: 1.2;
  stroke-dasharray: 5 5;
}

.age-current-focus circle {
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 2px 5px rgba(32,40,58,0.25));
}

.age-current-hitbox {
  fill: transparent;
  pointer-events: all;
}

.age-current-note {
  fill: #7b8492;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .age-current-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  header,
  section {
    padding-left: 20px;
    padding-right: 20px;
  }

  header h1 {
    font-size: 1.7rem;
  }

  .chart-row {
    grid-template-columns: 1fr !important;
  }

  .pressure-constellation-layout {
    grid-template-columns: 1fr;
  }

  .pressure-constellation {
    min-height: 420px;
  }

  .orientation-layout {
    grid-template-columns: 1fr;
  }

  .association-toolbar {
    flex-direction: column;
  }

  .flow-summary {
    text-align: left;
  }

  .risk-layout {
    grid-template-columns: 1fr;
  }

  .sexual-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Ending footer ── */
#story-ending {
  background: #20283a;
  color: #d6dce8;
  padding: 64px 48px 56px;
}

.ending-inner {
  max-width: 780px;
  margin: 0 auto;
}

.ending-kicker {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fd0c2;
}

.ending-headline {
  margin: 0 0 28px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.ending-body {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.75;
  color: #b8c4d8;
}

.ending-close {
  color: #d6dce8;
  font-style: italic;
  border-left: 3px solid #9fd0c2;
  padding-left: 16px;
  margin-top: 28px;
}

.ending-sources {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #35415a;
  font-size: 0.8rem;
  color: #7a8caa;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ending-sources a {
  color: #9fd0c2;
  text-decoration: none;
}

.ending-sources a:hover {
  text-decoration: underline;
}
