:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --text: #1d2b2a;
  --muted: #5a6b6a;

  --green-900: #2f5b4f;
  --green-800: #356658;
  --green-700: #3f7d67;

  --line: rgba(0, 0, 0, 0.06);

  --radius-lg: 3px;
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.05);
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.06);

  --amber: #d97706;
  --amber-soft: #f59e0b;
  --danger: #b42318;
  --danger-soft: #dc2626;
}

@property --gradient-rotate-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* { box-sizing: border-box; }
/* Ensure [hidden] always wins regardless of element-level display rules */
[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(47, 91, 79, 0.14), transparent 44%),
    radial-gradient(circle at 90% 15%, rgba(47, 91, 79, 0.10), transparent 42%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

.container {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 0 12px;
  background: rgba(246, 243, 238, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.app-header .container {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  background: var(--green-900);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-title {
  font-weight: 800;
  letter-spacing: -0.2px;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 20px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.top-nav {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  display: inline-flex;
  gap: 10px;
  box-shadow: var(--shadow-soft);
}

.nav-btn {
  border: 0;
  background: transparent;
  width: 44px;
  height: 34px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  color: var(--green-900);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
}

.nav-btn:hover { background: rgba(47, 91, 79, 0.08); }
.nav-btn:active { transform: translateY(1px); }

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.nav-btn--active {
  background: rgba(47, 91, 79, 0.14);
}

/* Page */
.page {
  padding: 18px 0 44px;
}

.rank-head {
  display: grid;
  gap: 16px;
}

.rank-head-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 3px;
  border: 1.5px solid var(--green-900);
  background: transparent;
  color: var(--green-900);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  width: 100%;
  justify-content: center;
}

.export-csv-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.export-csv-btn:hover {
  background: rgba(47, 91, 79, 0.08);
}

.export-csv-btn:active {
  background: rgba(47, 91, 79, 0.15);
}

.export-csv-btn[hidden] {
  display: none;
}

@media (min-width: 640px) {
  .rank-head-controls {
    flex-direction: row;
    align-items: center;
  }
  .export-csv-btn {
    width: auto;
    flex-shrink: 0;
  }
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  width: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.view-toggle[hidden] {
  display: none;
}

.view-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 2px;
  width: 100%;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.view-toggle-btn.is-active {
  background: rgba(47, 91, 79, 0.14);
  color: var(--green-900);
}

.view-toggle-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

h1 {
  margin: 10px 0 6px;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 34px;
  letter-spacing: -0.4px;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
}

.insight-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  position: relative;
  isolation: isolate;
}

.insight-card[hidden] {
  display: none;
}

.insight-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--gradient-rotate-angle, 0deg),
    #ef4444,
    #f59e0b,
    #8b5cf6,
    #3b82f6,
    #ef4444
  );
  animation: insight-border-hue 14s linear infinite;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 0;
  pointer-events: none;
}

.insight-card > * {
  position: relative;
  z-index: 1;
}

.insight-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.insight-title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  line-height: 1.12;
}

.insight-sections {
  display: grid;
  gap: 10px;
}

.insight-section {
  display: grid;
  gap: 8px;
}

.insight-section-title {
  margin: 0;
  color: var(--green-900);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.insight-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.insight-section--cons .insight-list {
  color: #4b5563;
}

@keyframes insight-border-hue {
  from {
    --gradient-rotate-angle: 0deg;
  }
  to {
    --gradient-rotate-angle: 360deg;
  }
}

.formula-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
}

.formula-card--collapsible {
  margin-top: 16px;
}

.formula-card-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.formula-card-toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.formula-card-toggle::-webkit-details-marker {
  display: none;
}

.formula-card-toggle::after {
  content: "+";
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.formula-card[open] .formula-card-toggle::after {
  content: "−";
}

.formula-grid {
  display: grid;
  gap: 10px;
}

.formula-block {
  padding: 12px;
  border-radius: 3px;
  background: rgba(47, 91, 79, 0.05);
  border: 1px solid rgba(47, 91, 79, 0.08);
}

.formula-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--green-900);
  margin-bottom: 6px;
}

.formula-copy {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VERDICT OVERLAY + CARD  (fixed modal, centred above the page)
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes vc-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes vc-card-in {
  from { opacity: 0; transform: scale(0.94) translateY(18px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes vc-glow-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1);    }
  50%       { opacity: 0.75; transform: scale(1.08); }
}
@keyframes vc-pct-pop {
  0%   { opacity: 0; transform: scale(0.7); }
  70%  { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── Background blur when verdict is open ───────────────────────────────── */
body > header,
body > main,
body > footer {
  transition: filter 0.3s ease;
}
body.verdict-open > header,
body.verdict-open > main,
body.verdict-open > footer {
  filter: blur(4px);
}

/* ── Overlay backdrop ────────────────────────────────────────────────────── */
.verdict-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: vc-backdrop-in 0.25s ease both;
}

.verdict-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ── Slider wrapper ──────────────────────────────────────────────────────── */
.verdict-slider-outer {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: vc-card-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.verdict-slider {
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.verdict-slides-track {
  display: flex;
  will-change: transform;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Individual slide ────────────────────────────────────────────────────── */
.verdict-slide {
  flex: 0 0 100%;
  min-width: 0;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  padding: 28px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Green (slide 1 — top combined) ─────────────────────────────────────── */
.verdict-slide--green {
  background:
    radial-gradient(ellipse 80% 55% at 55% 38%, rgba(62, 170, 120, 0.18) 0%, transparent 65%),
    linear-gradient(155deg, #0d2318 0%, #183328 45%, #234c3e 100%);
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(255,255,255,.12) inset;
}
.verdict-slide--green .vc-label { color: rgba(52, 211, 153, 0.80); }
.verdict-slide--green .vc-pct   { text-shadow: 0 0 40px rgba(52, 211, 153, 0.35); }
.verdict-slide--green .vc-glow  { background: radial-gradient(circle, rgba(52, 211, 153, 0.22) 0%, transparent 70%); }

/* ── Red (slide 2 — biggest disagreement) ───────────────────────────────── */
.verdict-slide--red {
  background:
    radial-gradient(ellipse 80% 55% at 55% 38%, rgba(239, 68, 68, 0.16) 0%, transparent 65%),
    linear-gradient(155deg, #1a0808 0%, #2d1111 45%, #3d1818 100%);
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(255,100,100,.12) inset;
}
.verdict-slide--red .vc-label { color: rgba(248, 113, 113, 0.80); }
.verdict-slide--red .vc-pct   { text-shadow: 0 0 40px rgba(239, 68, 68, 0.38); }
.verdict-slide--red .vc-glow  { background: radial-gradient(circle, rgba(239, 68, 68, 0.22) 0%, transparent 70%); }

/* ── Orange (slide 3 — partner's top) ───────────────────────────────────── */
.verdict-slide--orange {
  background:
    radial-gradient(ellipse 80% 55% at 55% 38%, rgba(249, 115, 22, 0.16) 0%, transparent 65%),
    linear-gradient(155deg, #1a1008 0%, #2d1e0d 45%, #3d2a12 100%);
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(255,160,80,.12) inset;
}
.verdict-slide--orange .vc-label { color: rgba(251, 146, 60, 0.82); }
.verdict-slide--orange .vc-pct   { text-shadow: 0 0 40px rgba(249, 115, 22, 0.38); }
.verdict-slide--orange .vc-glow  { background: radial-gradient(circle, rgba(249, 115, 22, 0.22) 0%, transparent 70%); }

/* ── Purple (slide 4 — your top) ────────────────────────────────────────── */
.verdict-slide--purple {
  background:
    radial-gradient(ellipse 80% 55% at 55% 38%, rgba(139, 92, 246, 0.18) 0%, transparent 65%),
    linear-gradient(155deg, #110a1c 0%, #1d1030 45%, #2c1848 100%);
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(180,140,255,.12) inset;
}
.verdict-slide--purple .vc-label { color: rgba(196, 181, 253, 0.82); }
.verdict-slide--purple .vc-pct   { text-shadow: 0 0 40px rgba(139, 92, 246, 0.38); }
.verdict-slide--purple .vc-glow  { background: radial-gradient(circle, rgba(139, 92, 246, 0.24) 0%, transparent 70%); }

/* ── Blue (slide 5 — biggest agreement) ─────────────────────────────────── */
.verdict-slide--blue {
  background:
    radial-gradient(ellipse 80% 55% at 55% 38%, rgba(59, 130, 246, 0.16) 0%, transparent 65%),
    linear-gradient(155deg, #08101c 0%, #111d30 45%, #172848 100%);
  box-shadow: 0 32px 64px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(100,160,255,.12) inset;
}
.verdict-slide--blue .vc-label { color: rgba(147, 197, 253, 0.82); }
.verdict-slide--blue .vc-pct   { text-shadow: 0 0 40px rgba(59, 130, 246, 0.38); }
.verdict-slide--blue .vc-glow  { background: radial-gradient(circle, rgba(59, 130, 246, 0.22) 0%, transparent 70%); }

/* Animated ambient glow orb */
.vc-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.22) 0%, transparent 70%);
  pointer-events: none;
  animation: vc-glow-pulse 4s ease-in-out infinite;
}

/* ── Close × (floats above the slider in .verdict-slider-outer) ──────────── */
.vc-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.65);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.vc-close-btn:hover {
  background: rgba(255, 255, 255, 0.20);
  color: #fff;
}

/* ── Label + address ─────────────────────────────────────────────────────── */
.vc-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(52, 211, 153, 0.75); /* emerald accent */
  padding-right: 40px;
}

.vc-address {
  font-size: 18px;
  font-weight: 800;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  color: #fff;
  line-height: 1.25;
  margin: 0;
  padding-right: 40px;
}

/* ── Score block ─────────────────────────────────────────────────────────── */
.vc-score-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 4px 0;
}

.vc-pct {
  font-size: 80px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.03em;
  animation: vc-pct-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
  /* Subtle text glow */
  text-shadow: 0 0 40px rgba(52, 211, 153, 0.35);
}

.vc-pct-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding-bottom: 4px; /* align to baseline */
}

/* ── Names row ───────────────────────────────────────────────────────────── */
.vc-names {
  display: flex;
  gap: 10px;
}

.vc-person {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 10px 14px;
  flex: 1;
  min-width: 0;
}

.vc-person-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-person-score {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* ── Insight block ───────────────────────────────────────────────────────── */
.vc-insight {
  border-left: 2px solid rgba(52, 211, 153, 0.35);
  padding: 8px 0 8px 12px;
}
.vc-insight--gap       { border-left-color: rgba(251, 191, 36, 0.50); }
.vc-insight--alignment { border-left-color: rgba(52, 211, 153, 0.50); }
.vc-insight--individual { border-left-color: rgba(255, 255, 255, 0.18); }

/* Header row: tag chip + preference name */
.vci-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.vci-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
}
.vc-insight--gap       .vci-tag { background: rgba(251, 191, 36, 0.14); color: #fbbf24; }
.vc-insight--alignment .vci-tag { background: rgba(52, 211, 153, 0.14); color: #34d399; }
.vc-insight--individual .vci-tag { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.50); }

.vci-pref {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mini bar rows */
.vci-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vci-row {
  display: grid;
  grid-template-columns: 72px 1fr 40px;
  align-items: center;
  gap: 8px;
}

.vci-row-name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.42);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vci-bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 2px;
  overflow: hidden;
}

.vci-bar-fill {
  height: 100%;
  border-radius: 2px;
}

/* Gap: current user purple · partner amber */
.vc-insight--gap .vci-bar--a { background: #a78bfa; }
.vc-insight--gap .vci-bar--b { background: #f59e0b; }

/* Alignment: both emerald */
.vc-insight--alignment .vci-bar--a,
.vc-insight--alignment .vci-bar--b { background: #34d399; }

/* Individual: single emerald bar */
.vc-insight--individual .vci-bar--a { background: #34d399; }

.vci-row-score {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.58);
  text-align: right;
  white-space: nowrap;
}

/* ── Agreed / Disagreed tags ──────────────────────────────────────────────── */
.vc-tags-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vc-tags-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.vc-tags-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.vc-tags-label--agreed    { color: rgba(52, 211, 153, 0.62); }
.vc-tags-label--disagreed { color: rgba(248, 113, 113, 0.62); }
.vc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.vc-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.vc-tag--agreed    { background: rgba(52, 211, 153, 0.10); color: #34d399;  border: 1px solid rgba(52, 211, 153, 0.22); }
.vc-tag--disagreed { background: rgba(248, 113, 113, 0.10); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.22); }

/* ── Dot navigation ──────────────────────────────────────────────────────── */
/* Arrows either side of the dots, mirroring the hero verdict. */
.verdict-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.verdict-arrow {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}

/* The button is deliberately small, and the mobile scale takes it to ~19px —
   too fine for a thumb. This extends the hit area without changing the size it
   appears, and without affecting layout. */
.verdict-arrow::after {
  content: "";
  position: absolute;
  inset: -11px;
}

.verdict-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

/* Faded rather than removed at the ends, so the row does not reflow. */
.verdict-arrow:disabled {
  opacity: 0.22;
  cursor: default;
}

.verdict-arrow:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.verdict-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.verdict-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.20);
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: width 0.25s ease, background 0.25s ease;
}
.verdict-dot.is-active { width: 20px; }
/* Active colour matches each theme */
.verdict-dot[data-theme="green"].is-active  { background: #34d399; }
.verdict-dot[data-theme="red"].is-active    { background: #f87171; }
.verdict-dot[data-theme="orange"].is-active { background: #fb923c; }
.verdict-dot[data-theme="purple"].is-active { background: #a78bfa; }
.verdict-dot[data-theme="blue"].is-active   { background: #60a5fa; }

/* ── Verdict breakdown slide ─────────────────────────────────────────────────
   Rendered after each summary slide. Shows top-5 prefs for that verdict type.
   ─────────────────────────────────────────────────────────────────────────── */
.vb-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.44);
  line-height: 1.4;
  margin-top: -6px; /* pulls closer to .vc-label */
}
.vb-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vb-legend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vb-legend-dot--current { background: #a78bfa; }
.vb-legend-dot--partner { background: #f59e0b; }
.vb-legend-name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.40);
  letter-spacing: 0.02em;
  margin-right: 6px;
}
.vb-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}
/* Individual row: name | bar | score */
.vb-row {
  display: grid;
  grid-template-columns: 1fr 76px 38px;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.vb-row:last-child { border-bottom: none; }
/* Coupled row: name | chips */
.vb-row--coupled {
  grid-template-columns: 1fr 80px;
  gap: 10px;
}
.vb-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vb-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 2px;
  overflow: hidden;
}
.vb-bar-fill { height: 100%; border-radius: 2px; }
.vb-score {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.50);
  text-align: right;
  white-space: nowrap;
}
.vb-chips { display: flex; gap: 5px; flex-shrink: 0; }
.vb-chip {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 0;
  border-radius: 2px;
  white-space: nowrap;
  min-width: 36px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vb-chip--current { background: rgba(139,92,246,0.14);  color: #c4b5fd; }
.vb-chip--partner { background: rgba(245,158,11,0.14);  color: #fbbf24; }

/* ── Branded footer ──────────────────────────────────────────────────────── */
.vc-footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.22);
  margin-top: 2px;
}

/* ── Brand icon (favicon SVG with CSS-class colours) ────────────────────── */
.bi { display: block; flex-shrink: 0; }
.bi-house { fill: rgba(255, 255, 255, 0.88); }
.bi-bg    { fill: rgba(255, 255, 255, 0.12); }
.bi-door  { fill: transparent; }

.verdict-slide--green  .bi-bg   { fill: rgba(52,  211, 153, 0.35); }
.verdict-slide--green  .bi-door { fill: #0d2318; }
.verdict-slide--red    .bi-bg   { fill: rgba(239, 68,  68,  0.35); }
.verdict-slide--red    .bi-door { fill: #1a0808; }
.verdict-slide--orange .bi-bg   { fill: rgba(249, 115, 22,  0.35); }
.verdict-slide--orange .bi-door { fill: #1a1008; }
.verdict-slide--purple .bi-bg   { fill: rgba(139, 92,  246, 0.35); }
.verdict-slide--purple .bi-door { fill: #110a1c; }
.verdict-slide--blue   .bi-bg   { fill: rgba(59,  130, 246, 0.35); }
.verdict-slide--blue   .bi-door { fill: #08101c; }

/* ── Reopen chip (floats top-right after overlay is dismissed) ───────────── */
.verdict-reopen-chip {
  position: fixed;
  top: 80px; /* below sticky header */
  right: 16px;
  z-index: 400;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-900);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  padding: 7px 12px 7px 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(47, 91, 79, 0.35);
  transition: opacity 0.15s;
}
.verdict-reopen-chip:hover { opacity: 0.88; }

.vrc-pct {
  font-size: 14px;
  font-weight: 900;
}

/* ── Unscored properties (one partner hasn't scored yet) ─────────────────── */
.rank-badge--unscored .rank-badge-value {
  font-size: 14px;
  color: var(--muted);
}
.rank-badge--unscored {
  background: rgba(0, 0, 0, 0.05);
  border: 1px dashed rgba(0, 0, 0, 0.14);
  color: var(--muted);
}
.rank-card--unscored {
  opacity: 0.62;
  border-style: dashed;
  border-color: rgba(0, 0, 0, 0.10);
}
.rank-card--unscored .rank-score {
  color: var(--muted);
}
.rank-card--unscored .pct {
  color: var(--muted);
}
.unscored-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}
.unscored-divider::before,
.unscored-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* List */
.rank-list {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.rank-card {
  position: relative;
  background: var(--card);
  border-radius: 3px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0, 0, 0, 0.03);
  padding: 13px;
  transition: transform 0.06s ease, box-shadow 0.18s ease;
}

.rank-card--leader {
  border: 1px solid transparent;
  isolation: isolate;
}

.rank-card--leader::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--gradient-rotate-angle, 0deg),
    #ef4444,
    #f59e0b,
    #8b5cf6,
    #3b82f6,
    #ef4444
  );
  animation: insight-border-hue 14s linear infinite;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 0;
  pointer-events: none;
}

.rank-card--leader > * {
  position: relative;
  z-index: 1;
}

.rank-card:hover {
  box-shadow: var(--shadow);
}

.rank-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 56px;
  min-height: 56px;
  padding: 9px 10px;
  border-radius: 3px;
  background: var(--green-900);
  color: #fff;
  display: grid;
  place-items: center;
  border: none;
}

.rank-badge-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.rank-badge-value {
  font-weight: 900;
  font-size: 24px;
  line-height: 1;
  color: #fff;
}

.rank-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-left: 70px;
}

.rank-left {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rank-title {
  font-weight: 900;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.rank-sub {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.01em;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  overflow-wrap: anywhere;
}

.rank-sub svg {
  width: 14px;
  height: 14px;
}

.rank-score {
  text-align: right;
  min-width: 102px;
}

.rank-score .pct {
  font-weight: 900;
  font-size: 23px;
  line-height: 1;
}

.rank-score .label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 14px 0 0 70px;
}

.meter > div {
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

.score-red .pct { color: var(--danger-soft); }
.score-amber .pct { color: var(--amber-soft); }
.score-green .pct { color: var(--green-700); }

.meter.score-red > div { background: var(--danger-soft); }
.meter.score-amber > div { background: var(--amber-soft); }
.meter.score-green > div { background: var(--green-700); }

/* Repayment card now lives outside the details, needs margin */
.rank-card > .repayment-card {
  margin-top: 12px;
}

.rank-details {
  margin-top: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.rank-details-toggle {
  list-style: none;
  cursor: pointer;
  color: var(--green-900);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rank-details-toggle::-webkit-details-marker {
  display: none;
}

.rank-details-toggle::after {
  content: "+";
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.rank-details[open] .rank-details-toggle::after {
  content: "−";
}

.rank-details-body {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  justify-items: stretch;
  width: 100%;
  min-width: 0;
}

.rank-details-body--compare {
  display: grid;
  gap: 10px;
}

.repayment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid rgba(47, 91, 79, 0.12);
  background: linear-gradient(180deg, rgba(47, 91, 79, 0.06), rgba(255, 255, 255, 0.8));
  border-radius: 3px;
  padding: 12px;
}

.repayment-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.repayment-value {
  font-size: 20px;
  line-height: 1.05;
  font-weight: 900;
  color: var(--green-900);
}

.repayment-subcopy {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}

.repayment-toggle {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 6px;
  padding: 4px;
  border-radius: 3px;
  background: rgba(47, 91, 79, 0.08);
  border: 1px solid rgba(47, 91, 79, 0.12);
}

.repayment-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 2px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.repayment-toggle-btn.is-active {
  background: #fff;
  color: var(--green-900);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.repayment-toggle-btn:focus-visible {
  outline: 2px solid rgba(47, 91, 79, 0.22);
  outline-offset: 2px;
}

.pref-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.pref-cell {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 10px 12px;
  min-height: 118px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 4px;
}

.pref-name {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.pref-val {
  font-size: 14px;
  font-weight: 800;
}

.pref-note-box {
  margin-top: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 2px;
  padding: 7px 8px;
  min-height: 46px;
  display: grid;
  align-content: start;
  gap: 2px;
}

.pref-note-box--empty {
  opacity: 0.78;
}

.pref-note-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pref-note {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rank-card--shared .pref-cell {
  min-height: 118px;
}

.shared-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.shared-panel {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.82);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.shared-grid--details {
  margin-top: 0;
  align-items: start;
}

.shared-detail-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.82);
  padding: 12px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.shared-detail-card--empty {
  align-content: start;
  background: rgba(0, 0, 0, 0.02);
}

.shared-panel--empty {
  display: grid;
  gap: 12px;
  align-content: start;
  background: rgba(0, 0, 0, 0.02);
}

.shared-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.shared-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: flex-start;
  gap: 12px;
}

.shared-panel-label {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
  width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.shared-panel-pct {
  font-size: 18px;
  font-weight: 900;
  color: var(--green-900);
  justify-self: end;
}

.shared-pref-grid {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  grid-auto-rows: 1fr;
}

.pref-cell--shared {
  background: rgba(0, 0, 0, 0.015);
  padding: 9px 10px;
  min-width: 0;
}

.shared-empty-copy {
  color: var(--muted);
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty-state,
.error-state {
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.error-state {
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
}

.toast-inner {
  background: #1d2b2a;
  color: #fff;
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  min-width: 240px;
}

.toast-title {
  font-weight: 800;
  margin-bottom: 3px;
}

.toast-sub {
  opacity: 0.88;
  font-size: 13px;
}

.pager {
  margin: 16px auto 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pager-item {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.pager-btn {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(47, 91, 79, 0.12);
  border: 1px solid rgba(47, 91, 79, 0.28);
  color: var(--green-900);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.06s ease,
    box-shadow 0.15s ease;
}

.pager-btn:hover {
  background: rgba(47, 91, 79, 0.18);
  box-shadow: var(--shadow);
}

.pager-btn:active {
  transform: translateY(1px);
}

.pager-btn svg {
  width: 22px;
  height: 22px;
  stroke: var(--green-900);
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pager-caption {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  max-width: 84px;
  text-align: center;
  text-transform: lowercase;
}

@media (max-width: 700px) {
  .container {
    width: min(100%, calc(100% - 24px));
  }

  h1 {
    font-size: 28px;
  }

  .insight-title {
    font-size: 17px;
  }

  .formula-copy {
    font-size: 12px;
  }

  .rank-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
  }

  .rank-card > .repayment-card {
    grid-column: 1 / -1;
    margin-top: 10px;
  }

  .rank-badge {
    position: static;
    top: auto;
    left: auto;
    grid-column: 1;
    grid-row: 1;
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 7px 6px;
    border-radius: 3px;
  }

  .rank-badge-label {
    font-size: 9px;
  }

  .rank-badge-value {
    font-size: 20px;
  }

  .rank-top {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 1fr;
    display: grid;
    padding-left: 0;
    padding-top: 0;
    min-width: 0;
  }

  .rank-score {
    text-align: left;
    min-width: 0;
  }

  .meter {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .rank-card--shared .shared-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .rank-details {
    grid-column: 1 / -1;
  }

  .repayment-card {
    grid-template-columns: 1fr;
  }

  .pref-grid {
    grid-template-columns: 1fr;
  }

  .shared-grid {
    gap: 8px;
  }

  .shared-panel {
    padding: 10px;
  }

  .shared-panel-head {
    align-items: flex-start;
    gap: 8px;
  }

  .shared-panel-label {
    font-size: 12px;
  }

  .shared-panel-pct {
    font-size: 16px;
  }

  .rank-details-toggle {
    font-size: 10px;
  }
}

/* ── Preference comparison: column headers ── */
.compare-prefs-wrap {
  display: grid;
  gap: 10px;
}

.compare-col-headers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 14px;
}

.compare-col-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Section divider (custom prefs) ── */
.compare-section-divider {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 2px 2px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 4px;
}

/* ── Preference comparison cards (shared view) ── */
.compare-pref-row {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  padding: 12px 14px;
  display: grid;
  gap: 12px;
}

.compare-pref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compare-pref-name {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.compare-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.compare-badge--aligned {
  background: rgba(47, 91, 79, 0.1);
  color: var(--green-700);
}

.compare-badge--minor-gap {
  background: rgba(217, 119, 6, 0.1);
  color: var(--amber);
}

.compare-badge--disagree {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.compare-badge--sole {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
}

.compare-pref-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compare-pref-person {
  display: grid;
  gap: 6px;
}

/* Ghost state — person doesn't have this preference */
.compare-pref-person--ghost {
  opacity: 0.32;
  pointer-events: none;
}

.compare-ghost-label {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
}

/* Sole-preference row */
.compare-pref-row--sole {
  background: rgba(0, 0, 0, 0.015);
}

.compare-person-score {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}

.compare-person-score.score-green { color: var(--green-700); }
.compare-person-score.score-amber { color: var(--amber-soft); }
.compare-person-score.score-red   { color: var(--danger-soft); }

.compare-bar-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.compare-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.15);
  transition: width 0.2s ease;
}

.compare-bar-fill.bar-green { background: var(--green-700); }
.compare-bar-fill.bar-amber { background: var(--amber-soft); }
.compare-bar-fill.bar-red   { background: var(--danger-soft); }

.compare-pref-single {
  display: grid;
  gap: 6px;
}

.compare-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

/* Partner invite banner styles live in shell.css */

/* ═══════════════════════════════════════════════════════════════════════════
   VIZ MODE — sub-toggle bar + data-visualisation view
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Accessibility helper ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Visualise toggle button (icon-only, solid green) ────────────────────── */
.viz-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 3px;
  border: 1.5px solid var(--green-900);
  background: var(--green-900);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.14s;
  width: 100%;
  font-family: inherit;
  letter-spacing: -0.5px;
}

.viz-toggle-btn:hover  { background: var(--green-800); border-color: var(--green-800); }
.viz-toggle-btn:active { background: #1e3d35; border-color: #1e3d35; }

.viz-toggle-btn--active {
  background: #1e3d35;
  border-color: #1e3d35;
}

.viz-toggle-btn--active:hover { background: #162e28; border-color: #162e28; }

.viz-toggle-btn[hidden] { display: none; }

/* Icon state: chart + "Data analytics" by default; "Short list" when in viz mode */
.viz-btn-icon-viz {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.viz-btn-icon-scores {
  display: none;
  align-items: center;
  gap: 6px;
}

.viz-toggle-btn--active .viz-btn-icon-viz    { display: none; }
.viz-toggle-btn--active .viz-btn-icon-scores { display: inline-flex; }

@media (min-width: 640px) {
  .viz-toggle-btn { width: auto; flex-shrink: 0; }
}

/* ── Viz view container ──────────────────────────────────────────────────── */
.viz-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.viz-view[hidden] { display: none; }

/* ── Shared viz-section card style ──────────────────────────────────────── */
.viz-section {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 20px 18px;
}

.viz-section-head {
  margin-bottom: 18px;
}

.viz-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}

.viz-section-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.viz-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 28px 0 12px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 1 — Weighting Alignment Dumbbell Chart
   ═══════════════════════════════════════════════════════════════════════════ */

/* Legend */
.dumbbell-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dumbbell-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.dumbbell-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dumbbell-legend-dot--a  { background: #8b5cf6; }
.dumbbell-legend-dot--b  { background: #d97706; }
.dumbbell-legend-dot--eq { background: #2f5b4f; }

/* Row list */
.dumbbell-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dumbbell-row {
  display: grid;
  grid-template-columns: minmax(90px, 28%) 1fr 44px;
  align-items: center;
  gap: 10px;
}

.dumbbell-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Track + axis wrapper */
.dumbbell-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dumbbell-track {
  position: relative;
  height: 4px;
  background: rgba(0, 0, 0, 0.09);
  border-radius: 2px;
  margin: 8px 7px; /* room for dots that overflow top/bottom */
}

.dumbbell-line {
  position: absolute;
  top: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.38);
  pointer-events: none;
  border-radius: 2px;
}

.dumbbell-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  top: -5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
  cursor: default;
}

.dumbbell-dot--a {
  background: #8b5cf6;
  border: 2px solid #fff;
  z-index: 2;
}

.dumbbell-dot--b {
  background: #d97706;
  border: 2px solid #fff;
  z-index: 2;
}

.dumbbell-dot--eq {
  background: #2f5b4f;
  border: 2px solid #fff;
  z-index: 3;
}

/* Tick axis below each track */
.dumbbell-axis {
  display: flex;
  justify-content: space-between;
  padding: 0 7px;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Delta value */
.dumbbell-delta {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.dumbbell-delta--warn {
  color: var(--danger);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 2 — Score Divergence Heatmap
   ═══════════════════════════════════════════════════════════════════════════ */

/* Heatmap legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.heatmap-legend-swatch {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.heatmap-legend-swatch--a  { background: rgba(139, 92, 246, 0.45); }
.heatmap-legend-swatch--b  { background: rgba(217, 119, 6, 0.4); }
.heatmap-legend-swatch--eq { background: rgba(47, 91, 79, 0.55); }

/* Scrollable container — only scrolls horizontally if many properties */
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Semantic table — fills available width naturally */
.heatmap-table {
  border-collapse: separate;
  border-spacing: 3px;
  width: 100%;
}

/* Corner cell — "Preference" label above row headers */
.heatmap-corner {
  font-size: 10px;
  color: var(--muted);
  padding: 0 10px 6px 0;
  vertical-align: bottom;
  font-weight: 600;
  white-space: nowrap;
  width: 160px;
  min-width: 140px;
}

/* Column headers = property names (truncated with title tooltip) */
.heatmap-col-head {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: 0 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 68px;
  min-width: 60px;
  max-width: 90px;
  vertical-align: bottom;
}

/* Row headers = preference names (full text, wrappable) */
.heatmap-row-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 14px 6px 0;
  white-space: normal;
  line-height: 1.3;
  width: 160px;
  min-width: 140px;
  vertical-align: middle;
  text-align: left;
}

/* Each data cell */
.heatmap-cell {
  min-width: 44px;
  width: 44px;
  height: 36px;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.1s;
  border: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

.heatmap-cell:hover,
.heatmap-cell:focus-visible {
  opacity: 0.75;
  outline: 2px solid var(--green-900);
  outline-offset: 1px;
}

/* One-sided cells — only one participant has this preference (clickable) */
/* sole-a: current user has it, partner doesn't → tinted purple (matches you-higher scale) */
.heatmap-cell--sole-a {
  background: rgba(139, 92, 246, 0.10);
  color: #6d28d9;
  font-weight: 700;
  letter-spacing: 0.5px;
}
/* sole-b: partner has it, current user doesn't → tinted amber (matches partner-higher scale) */
.heatmap-cell--sole-b {
  background: rgba(217, 119, 6, 0.10);
  color: #7c3e00;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Legacy non-interactive missing cell (kept for compat) */
.heatmap-cell--missing {
  background: transparent;
  color: var(--muted);
  cursor: default;
  font-weight: 400;
}

/* "Not in their preferences" label in the expand panel */
.heatmap-detail-bar-val--none {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  font-style: italic;
  padding-left: 4px;
}

/* Colour classes — diverging scale */
.heatmap-cell--eq    { background: rgba(47, 91, 79, 0.50);   color: #fff; }     /* Equal — deep green */
.heatmap-cell--a1    { background: rgba(139, 92, 246, 0.18); color: #4c1d95; }  /* You higher +1–3 — purple */
.heatmap-cell--a2    { background: rgba(139, 92, 246, 0.48); color: #fff; }     /* You higher +4–9 — purple */
.heatmap-cell--b1    { background: rgba(217, 119, 6, 0.18);  color: #7c3e00; }  /* Partner higher +1–3 */
.heatmap-cell--b2    { background: rgba(217, 119, 6, 0.48);  color: #fff; }     /* Partner higher +4–9 */

/* Expand panel — standalone div below the table */
.heatmap-expand-panel {
  background: rgba(47, 91, 79, 0.04);
  border-radius: 2px;
  padding: 14px 16px;
  margin-top: 10px;
  animation: hmExpand 0.15s ease;
}

@keyframes hmExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.heatmap-detail-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.heatmap-detail-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.heatmap-detail-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 24px;
  align-items: center;
  gap: 8px;
}

.heatmap-detail-bar-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-detail-bar-label--a { color: #8b5cf6; }
.heatmap-detail-bar-label--b { color: #d97706; }

.heatmap-detail-bar-track {
  height: 10px;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.heatmap-detail-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.25s ease;
}

.heatmap-detail-bar-fill--a { background: #8b5cf6; }
.heatmap-detail-bar-fill--b { background: #d97706; }

.heatmap-detail-bar-val {
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION 3 — Agreement Scatter Plot
   ═══════════════════════════════════════════════════════════════════════════ */

.scatter-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  cursor: pointer;
}

.scatter-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  aspect-ratio: 1 / 1;
}

.scatter-summary {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scatter-summary-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.scatter-summary-badge {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
}

.scatter-summary-badge--fav  {
  background: rgba(47, 91, 79, 0.15);
  color: #2f5b4f;
}

.scatter-summary-badge--split {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

.scatter-summary-link {
  font-weight: 700;
  color: var(--green-900);
  text-decoration: none;
}

.scatter-summary-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  /* Hide interactive-only controls */
  .view-toggle,
  .viz-toggle-btn,
  .export-csv-btn,
  .rank-details-toggle,
  .pager,
  .formula-card,
  .app-header,
  .site-footer,
  .toast { display: none !important; }

  /* Show all expand panels when printing */
  .heatmap-expand-panel { display: block !important; margin-top: 8px; }

  /* Heatmap fills page width, no scroll wrapper clipping */
  .heatmap-scroll {
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .heatmap-table { width: 100% !important; }

  /* Scatter at a predictable size */
  .scatter-canvas-wrap {
    max-width: 360px !important;
    height: 360px !important;
  }

  /* Cards without shadow for print */
  .viz-section {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .viz-view { gap: 24px; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   AD SLOT
   Sits below the ranked list and the analytics view, above the results
   collapsible. Collapses entirely when nothing fills it, so an unfilled or
   blocked ad leaves no gap and causes no layout shift.
   ═══════════════════════════════════════════════════════════════════════════ */
.ad-slot {
  display: block;
  margin: 22px 0 4px;
  /* Never let a wide creative break the page layout */
  max-width: 100%;
  overflow: hidden;
}

/* Nothing rendered (no fill, blocked, or Auto ads chose elsewhere) → no gap */
.ad-slot:empty {
  display: none;
}

/* Distinguish paid placement from the ranking content above it */
.ad-slot::before {
  content: "Advertisement";
  display: block;
  margin-bottom: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}

.ad-slot ins,
.ad-slot iframe {
  max-width: 100%;
}
