/* Atkinson Hyperlegible is loaded from Google Fonts (see the <link> tags in index.html). Falls back to system fonts. */
:root {
  color-scheme: light;
  --or: #FF4500;
  --tx: #181b21;
  --gr: #333333;
  --back: #f1f3f6;
  --opt-hover: #eef1f5;
  --foot: #6b7280;
  --bl: #1871C9;
  --ok: #16a34a;
  --bad: #dc2626;
  --bg: #f5f6f8;
  --pk: #fff1ec;
  --ln: #e5e8ee;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e9edf2;
  --border: #b7bec9;
  --border-2: #d3d8e0;
  --chip: #eef1f5;
  --chip-2: #e3e7ee;
  --muted: #8a93a0;
  --ph: #828a96;
  --tree: #dde2e9;
  --pill: #eef1f5;
  --or-hover: #d93c00;
  --grad-hover: #A01F57;
  --shadow: rgba(16, 24, 40, 0.06);
  --shadow-strong: rgba(16, 24, 40, 0.14);
  --map-bg: #eef1f5;
  --map-base: #f4f6f9;
  --map-base-stroke: #c9d2de;
  --map-stroke: rgba(255, 255, 255, 0.9);
  --map-detail-stroke: rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --tx: #eef1f5;
  --gr: #a7b0bd;
  --back: #1a2029;
  --opt-hover: #242b35;
  --foot: #9aa4b1;
  --bl: #1871C9;
  --ok: #4ade80;
  --bad: #fb7185;
  --bg: #0d1015;
  --pk: #3a2119;
  --ln: #272e38;
  --surface: #151a21;
  --surface-2: #1c222b;
  --surface-3: #242b35;
  --border: #4a525e;
  --border-2: #353c46;
  --chip: #232a34;
  --chip-2: #2d3540;
  --muted: #7e8794;
  --ph: #8b95a2;
  --tree: #2a313b;
  --pill: #232a34;
  --or-hover: #ff6a33;
  --shadow: rgba(0, 0, 0, .45);
  --shadow-strong: rgba(0, 0, 0, .6);
  --map-bg: #0c1520;
  --map-base: #27303b;
  --map-base-stroke: #3b4655;
  --map-stroke: rgba(0, 0, 0, 0.5);
  --map-detail-stroke: rgba(255, 255, 255, 0.2);
}

* {
  box-sizing: border-box;
}

/* Flag emoji come from Google Fonts' Noto Color Emoji (loaded in index.html);
   it is placed before the system emoji font so Windows shows real flags. */
body {
  margin: 0;
  color-scheme: light;
  background: var(--bg);
  color: var(--tx);
  font: 16px/1.6 "Atkinson Hyperlegible", "Noto Color Emoji", system-ui, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[data-theme="dark"] body {
  color-scheme: dark;
}

/* Only the page scrollbar (owned by <html>) uses the dark scheme. Everything
   inside <body> follows the site theme, so form controls, autofill and inner
   scrollbars keep their normal light/dark appearance. */
html[data-theme="dark"] body {
  color-scheme: dark;
}

a {
  color: var(--bl);
}

h1, h2, h3 {
  margin: 0;
}

.site-header {
  background: transparent;
  border-bottom: 1px solid var(--ln);
}

.site-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  min-height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Site-wide announcement under the header. */
.site-notice {
  border-bottom: 1px solid var(--ln);
  background: var(--pk);
  color: var(--gr);
  font-size: 13px;
  line-height: 1.45;
}

.site-notice-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 24px;
}

.site-notice-tag {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--or);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-notice-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.site-notice-text a {
  color: var(--bl);
  font-weight: 700;
  white-space: nowrap;
}

.site-notice-x {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.site-notice-x:hover {
  color: var(--gr);
}

@media (max-width: 640px) {
  .site-notice-inner {
    align-items: flex-start;
    padding: 8px 16px;
  }
}

.brand {
  display: flex;
  align-items: center;
  flex: none;
}

.brand img {
  display: block;
  height: 54px;
  width: auto;
  max-width: 100%;
}

/* The logo's wordmark is dark, so swap in a light-text version in dark mode. */
.brand .logo-dark {
  display: none;
}

html[data-theme="dark"] .brand .logo-light {
  display: none;
}

html[data-theme="dark"] .brand .logo-dark {
  display: block;
}

.theme {
  width: 40px;
  height: 40px;
  flex: none;
  margin-left: auto;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--tx);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme:hover {
  background: var(--chip);
}

.theme:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.theme svg {
  width: 20px;
  height: 20px;
}

.theme .moon {
  fill: currentColor;
}

.theme .sun {
  display: none;
}

html[data-theme="dark"] .theme .moon {
  display: none;
}

html[data-theme="dark"] .theme .sun {
  display: block;
}

html[data-theme="dark"] .logo img {
  filter: invert(1) hue-rotate(180deg);
}

.pw {
  display: inline-block;
  position: relative;
  line-height: 0;
  vertical-align: top;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

.pw .pa {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.pw .pr {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(0,0,0,.2);
}

.rc .pw {
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
}

.rc .pr {
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}

.pie {
  display: block;
  overflow: visible;
}

/* Clickable report chart: the invisible overlay keeps 23andMe's exact artwork
   while still giving every wedge a hit target. */
.pw > .pie-hit {
  position: absolute;
  left: 0;
  top: 0;
}

.pie-live path,
.pie-live circle,
.pie-hit path,
.pie-hit circle {
  cursor: pointer;
}

.pie-live path:hover,
.pie-live circle:hover,
.pie-hover path:hover,
.pie-hover circle:hover {
  filter: brightness(1.08);
}

.pie-hit path:hover,
.pie-hit circle:hover {
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 2;
}

/* Hover label for the clickable report chart. */
.pie-tip {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 240px;
  padding: 8px 11px;
  border: 1px solid var(--ln);
  border-radius: 9px;
  background: var(--surface);
  color: var(--tx);
  box-shadow: 0 8px 24px var(--shadow-strong);
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}

.pie-tip.on {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pie-tip-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tip-color, var(--muted));
  box-shadow: 0 0 0 1px var(--shadow);
}

.pie-tip-name {
  font-weight: 700;
}

.pie-tip-pct {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

/* Soft blue wash when a chart wedge jumps to an ancestry row. */
.ac-cat,
.ac-details > summary {
  position: relative;
}

.ac-cat.ac-flash::before,
.ac-details.ac-flash > summary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bl), transparent 55%);
  opacity: 0;
  pointer-events: none;
  animation: ac-flash 1.6s ease;
}

@keyframes ac-flash {
  0%,
  100% {
    opacity: 0;
  }
  18%,
  62% {
    opacity: 0.16;
  }
}

.ph {
  width: 100%;
  max-width: 260px;
  height: auto;
}

/* Theme-coloured loading ring used while reports are fetched. */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.results-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--ln);
  border-top-color: var(--or);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.8s;
  }
}

.hero {
  width: 100%;
  max-width: 660px;
  height: auto;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 22px;
  box-shadow: 0 1px 3px var(--shadow);
  display: grid;
  grid-template-columns: minmax(0,40fr) minmax(0,60fr);
  overflow: clip;
  min-height: 440px;
}

.card.one {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 48px 28px;
  justify-items: center;
}

/* Home hero */
.card.home {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
  padding: 56px;
  min-height: 0;
  overflow: visible;
  text-align: center;
}

.home-copy {
  max-width: 720px;
  margin: 0 auto;
}

.home-eyebrow {
  margin: 0 0 14px;
  color: var(--or);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-title {
  margin: 0 0 18px;
  color: var(--tx);
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.home-lede {
  max-width: 54ch;
  margin: 0 auto;
  color: var(--gr);
  font-size: 17px;
  line-height: 1.65;
}

.home-count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  width: max-content;
  margin: 14px auto 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--gr);
  font-size: 13px;
  font-weight: 700;
}

.home-count strong {
  color: var(--or);
  font-size: 15px;
}

.home-cta {
  grid-column: 1 / -1;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.home-about {
  margin: 14px 0 0;
  text-align: center;
}

.home-visual {
  order: -1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  min-width: 0;
}

.home-visual .hero {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 40px var(--shadow-strong));
}

/* Shared page headings */
.page-head {
  margin: 0 0 26px;
}

.page-eyebrow {
  margin: 0 0 10px;
  color: var(--or);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-title {
  margin: 0 0 10px;
  color: var(--tx);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.page-lede {
  max-width: 68ch;
  margin: 0;
  color: var(--gr);
  font-size: 16px;
  line-height: 1.6;
}

/* Prose pages */
.card.prose {
  display: block;
  padding: 48px;
  text-align: left;
}

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

.card.prose .back {
  position: static;
  margin-bottom: 28px;
}

.prose-inner p:not(.page-eyebrow) {
  margin: 0 0 18px;
  color: var(--gr);
  font-size: 16px;
  line-height: 1.7;
}

.prose-inner p b {
  color: var(--tx);
}

.prose-inner h3 {
  margin: 30px 0 10px;
  color: var(--tx);
  font-size: 18px;
}

.disclaimer .prose-inner h3 {
  color: var(--or);
}

.prose-inner h3.about-heading {
  color: var(--or);
}

.prose-inner h2 {
  margin: 36px 0 12px;
  color: var(--tx);
  font-size: 24px;
  line-height: 1.25;
}

/* Step heading that matches the page title size. */
.prose-inner h2.step-title {
  margin: 36px 0 12px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.prose-inner .row {
  justify-content: flex-end;
  margin-top: 28px;
}

.success-preview {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--ln);
  border-radius: 16px;
  background: var(--surface);
}

.success-id {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.success-id .disp {
  overflow-wrap: anywhere;
}

.success-id p,
.prose-inner .success-id p {
  margin: 0 0 2px;
}

.success-preview .disp {
  font-size: 16px;
}

@media (max-width: 760px) {
  .card.prose {
    padding: 28px 22px;
  }
  .page-title {
    font-size: 32px;
  }
  .prose-inner h2.step-title {
    font-size: 32px;
  }
}

/* Report detail: chart and name stay in a narrow left column, the section
   tabs switch the content on the right. */
.card.detail {
  grid-template-columns: 320px minmax(0, 1fr);
  text-align: left;
  overflow: clip;
}

.card.detail .fixed {
  position: sticky;
  top: 0;
  z-index: 20;
  align-self: start;
  justify-content: flex-start;
  padding: 30px 20px 30px 40px;
}

.card.detail .scroll {
  max-height: none;
  overflow: visible;
  padding: 30px 36px 30px 12px;
}

.fixed {
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 440px;
  position: sticky;
  top: 0;
  align-self: start;
}

/* Placeholder pages: the image sits a fixed distance below the top. */
.fixed.top {
  justify-content: flex-start;
  padding-top: 150px;
}

.scroll {
  background: var(--surface);
  padding: 30px 36px 30px 16px;
  min-width: 0;
}

.scroll h2 {
  color: var(--or);
  font-size: 22px;
  margin-bottom: 8px;
  scroll-margin-top: 12px;
}

.scroll h3 {
  color: var(--or);
  font-size: 15px;
  margin: 18px 0 4px;
}

/* Inline terms expander on the submit intro, so reading them does not leave
   the submit flow. */
details.terms {
  margin: 0 0 16px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
}

details.terms > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--tx);
  font-weight: 700;
  list-style: none;
}

details.terms > summary:hover {
  background: var(--surface-3);
}

details.terms > summary::-webkit-details-marker {
  display: none;
}

details.terms > summary::before {
  content: "\25B8";
  color: var(--gr);
  font-weight: 400;
}

details.terms[open] > summary::before {
  content: "\25BE";
}

details.terms > summary:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: -3px;
}

details.terms .terms-body {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--ln);
}

details.terms .terms-body > :first-child {
  margin-top: 0;
}

details.terms .terms-body > :last-child {
  margin-bottom: 0;
}

.btn {
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  border-radius: 999px;
  padding: 9px 19px;
  border: 2px solid var(--or);
  background: var(--surface);
  color: var(--or);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn.f {
  background: var(--or);
  color: #fff;
  box-shadow: 0 1px 2px var(--shadow);
}

.btn.g {
  background: var(--or);
  border-color: var(--or);
  color: #fff;
  box-shadow: 0 1px 2px var(--shadow);
}

.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-ico svg {
  width: 20px;
  height: 20px;
  flex: none;
}

/* Quiet secondary link under the bookmarklet button. */
.code-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gr);
  font-size: 13px;
  text-decoration: none;
}

.code-link:hover {
  color: var(--or);
  text-decoration: underline;
}

.code-link .code-mark {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Inline copy feedback under the bookmarklet button. */
.copy-status {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ok);
}

.copy-status.is-error {
  color: var(--bad);
}

.btn.gray {
  background: var(--chip);
  border-color: var(--border-2);
  color: var(--muted);
}

.btn.gray:not(.f):not(.g):not(:disabled):hover {
  background: var(--chip-2);
  border-color: var(--border);
  color: var(--tx);
}

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

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 18px;
}

.close {
  position: absolute;
  top: 20px;
  left: 24px;
  padding: 3px 16px;
}

.foot {
  margin-top: 0;
  border-top: 1px solid var(--ln);
  background: var(--surface);
  color: var(--foot);
  font-size: 13px;
  text-align: center;
}

.foot-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
  margin: 0 0 16px;
  padding: 0;
}

.foot-note {
  margin: 0;
  line-height: 1.5;
}

.foot-credit {
  margin: 6px 0 0;
  font-size: 12px;
}

.foot a {
  color: inherit;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.12s ease;
}

footer.foot a:hover {
  color: var(--or);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Inline credits stay underlined so they still read as links. */
.foot-credit a {
  text-decoration: underline;
  text-decoration-color: var(--border-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

footer.foot .foot-credit a:hover {
  text-decoration-color: currentColor;
}

.foot a:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.foot .reddit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.foot .reddit svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: currentColor;
}

.dots {
  display: flex;
  gap: 18px;
}

.dots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--gr);
  background: var(--surface);
}

.dots i.on {
  background: var(--or);
  border-color: var(--or);
}

.box {
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  margin: 10px 0;
}

.box .cols {
  display: flex;
  justify-content: space-around;
  text-align: center;
  font-size: 13px;
}

.drag {
  display: block;
  margin: 10px 0;
  padding: 34px 10px;
  background: repeating-conic-gradient(var(--surface-3) 0 25%,var(--surface) 0 50%) 0 0/24px 24px;
  text-align: center;
  font-weight: 700;
  border-radius: 6px;
}

pre, textarea, input, select {
  font: 13px/1.4 ui-monospace, Menlo, monospace;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 140px;
  overflow: auto;
}

button, textarea, input, select {
  font-family: inherit;
}

textarea, input[type=text], select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--tx);
  font-family: inherit;
  font-size: 14px;
}

.ok {
  color: var(--ok);
}

.er {
  color: var(--bad);
}

.hdr {
  background: var(--or);
  color: #fff;
  font-weight: 700;
  padding: 14px 16px;
  margin: -6px 0 12px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 14px;
}

.kv input {
  width: 55%;
  padding: 3px 6px;
  font-size: 13px;
}

hr {
  border: 0;
  border-top: 1px solid var(--ln);
  margin: 12px 0;
}

/* Haplogroup, family-background and Neanderthal summary panels. */
.summary-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
}

.summary-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.summary-head .summary-title {
  color: var(--tx);
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
}

.summary-body {
  min-width: 0;
}

/* 23andMe-style report list used by the compact summary sections. */
.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 14px;
  overflow: hidden;
}

.scroll .report-list {
  margin: 0;
  padding: 0;
}

.report-list li + li {
  border-top: 1px solid var(--ln);
}

.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  color: var(--tx);
  text-decoration: none;
}

a.report-item:hover {
  background: var(--surface-2);
}

.report-item .text-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.report-item .report-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.report-item .report-line > span:first-child {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
}

.result-summary {
  font-size: 14px;
  color: #6B6B6B;
  white-space: pre-line;
}

.report-description {
  font-size: 14px;
  line-height: 1.4;
  color: var(--gr);
}

.section-description {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--gr);
}

.report-item.paternal .result-summary {
  color: #3595D6;
  font-weight: 700;
}

.report-item.maternal .result-summary {
  color: #9F0F7B;
  font-weight: 700;
}

html[data-theme="dark"] .result-summary {
  color: var(--gr);
}

.report-item .svg-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: currentColor;
  color: var(--gr);
}

.ac-list {
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 14px;
  overflow: hidden;
  font-size: 14px;
}

.ac-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 14px;
}

.ac-cat + .ac-cat {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.ac-cat-pct {
  font-weight: 700;
  white-space: nowrap;
}

.ac-cat-name {
  font-size: 16px;
}

.ac-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--ln);
  font-weight: 700;
}

.ac-row.ac-depth-3 {
  font-weight: 400;
  color: var(--tx);
  font-size: 13px;
}

.ac-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 16px;
}

.ac-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.ac-pct {
  margin-left: auto;
  font-weight: 700;
  white-space: nowrap;
}

/* Static overview map above the ancestry list. */
.ancestry-map-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
}

.ancestry-map {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  max-height: 460px;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 14px;
  background: var(--map-bg);
}

.leaflet-map {
  width: 100%;
  height: 100%;
  background: var(--map-bg);
}

/* Small map shown under an expanded ancestry row's description. */
.row-map {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 200px;
  margin: 8px 0 6px;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--map-bg);
}

.row-map .map-state {
  padding: 14px;
  font-size: 12px;
  line-height: 1.4;
}

.row-map .leaflet-control-zoom a {
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 16px;
}

/* Map shown under an expanded genetic group's description. */
.group-map {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 180px;
  margin: 8px 0 0;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--map-bg);
}

.group-map .map-state {
  padding: 14px;
  font-size: 12px;
  line-height: 1.4;
}

.group-map .leaflet-group-detail-pane {
  opacity: 1;
}

.group-map .leaflet-control-zoom a {
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 16px;
}

.leaflet-container {
  background: var(--map-bg);
  font: inherit;
}

.leaflet-bar {
  border: 1px solid var(--ln);
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-control-zoom a {
  background: var(--surface);
  color: var(--tx);
  border-bottom-color: var(--ln);
}

.leaflet-control-zoom a:hover {
  background: var(--surface-2);
  color: var(--tx);
}

.leaflet-control-zoom a.leaflet-disabled {
  background: var(--surface-2);
  color: var(--muted);
}

.leaflet-tooltip {
  background: var(--surface);
  color: var(--tx);
  border: 1px solid var(--ln);
  box-shadow: 0 2px 8px var(--shadow);
  font: 12px/1.35 "Atkinson Hyperlegible", system-ui, sans-serif;
}

.leaflet-tooltip-top::before {
  border-top-color: var(--surface);
}

/* Map hover label styled like the report chart's pie-tip. */
.leaflet-tooltip.map-tip-wrap {
  display: flex;
  align-items: center;
  max-width: 240px;
  padding: 8px 11px;
  border: 1px solid var(--ln);
  border-radius: 9px;
  background: var(--surface);
  color: var(--tx);
  box-shadow: 0 8px 24px var(--shadow-strong);
  font: 13px/1.3 "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  white-space: normal;
}

.map-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 240px;
}

.map-tip-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 1px var(--shadow);
}

.map-tip-name {
  font-weight: 700;
}

.map-tip-pct {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.map-base-poly {
  fill: var(--map-base);
  stroke: none;
  fill-opacity: 1;
  opacity: 1;
}

.map-overview-poly {
  cursor: pointer;
}

/* Genetic-group shapes stay translucent so the land remains visible. */
.map-gg-poly {
  fill-opacity: 0.4;
}

.map-gg-poly.map-hover {
  fill-opacity: 0.55;
}

/* Migrations draw all genetic groups in one pane. Opaque fills are composited
   as a group, so overlapping groups keep the top colour instead of darkening. */
.leaflet-mig-gg-pane {
  opacity: 0.45;
}

.map-gg-poly.map-gg-solid {
  fill-opacity: 1;
}

.map-gg-solid.map-hover {
  fill-opacity: 1;
}

/* Hovering a region keeps it fully visible and fades every other region. */
.leaflet-pane.map-hovering .map-overview-poly:not(.map-hover),
.leaflet-pane.map-hovering .map-detail-poly:not(.map-hover) {
  opacity: 0.12;
  stroke: none;
}

.leaflet-pane.map-hovering .map-gg-poly:not(.map-hover) {
  opacity: 0.18;
  stroke: none;
}

/* Use the exact 23andMe colours for map fills: pane-level opacity would blend
   them with the base map and make them look different from the report. */
.ancestry-map .leaflet-map-overview-pane,
.row-map .leaflet-row-overview-pane {
  opacity: 1;
}

.map-state {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--gr);
  font-size: 14px;
  background: var(--map-bg);
}

.map-state .loading {
  min-height: 0;
}

.map-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.ac-depth-1 {
  padding-left: 14px;
}

.ac-depth-2 {
  padding-left: 32px;
}

.ac-depth-3 {
  padding-left: 50px;
}

.ac-detail {
  padding: 10px 14px 6px;
  background: var(--surface-2);
  border-top: 1px solid var(--ln);
  font-size: 12px;
  line-height: 1.5;
  color: var(--gr);
}

/* Population, migration and genetic-group descriptions from descriptions.json. */
.region-description {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gr);
  white-space: pre-line;
}

.region-description + .match-section .match-heading {
  margin-top: 0;
}

.match-section {
  margin-top: 8px;
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 14px;
}

.match-section:first-child {
  margin-top: 0;
}

.match-heading {
  margin: 8px -14px 0;
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

.match-section:first-child .match-heading {
  margin-top: -10px;
}

.mig-body .match-section:first-child .match-heading {
  margin-top: -8px;
}

.match-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--ln);
  font-size: 16px;
  line-height: 1.45;
  color: var(--tx);
}

.match-section:last-child > .match-item:last-child,
.match-section:last-child > .match-expand:last-child > summary {
  padding-bottom: 0;
}

.match-section:last-child > .match-expand:last-child .match-aggs {
  padding-bottom: 0;
}

.match-name {
  flex: 1 1 auto;
  min-width: 0;
}

.match-strength {
  flex: 0 0 auto;
  position: relative;
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 14px;
  font-weight: 700;
  font-feature-settings: "kern", "liga", "pnum";
  color: #6B6B6B;
  white-space: nowrap;
  cursor: help;
}

.match-strength::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  padding: 6px 9px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--surface);
  color: var(--tx);
  box-shadow: 0 6px 18px var(--shadow-strong);
  font: 600 12px/1.3 "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  pointer-events: none;
}

.match-strength:hover::after {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.match-item .gm-ral {
  font-weight: 400;
  color: var(--tx);
}

.match-item .gm-ral strong {
  font-weight: 700;
  color: var(--tx);
}

.match-item .gm-gg {
  font-weight: 700;
  color: var(--tx);
}

.match-expand > summary {
  list-style: none;
  cursor: pointer;
}

.match-expand > summary::-webkit-details-marker {
  display: none;
}

.match-expand > summary:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: -2px;
}

.match-expand > summary::after {
  align-self: center;
}

.match-aggs,
.match-desc {
  padding: 0 0 6px 10px;
}

.match-desc .region-description {
  margin: 0;
}

.match-section:last-child > .match-expand:last-child .match-desc {
  padding-bottom: 0;
}

.match-agg {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--gr);
}

button.match-agg {
  display: block;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

button.match-agg:hover {
  background: var(--surface-2);
  color: var(--tx);
}

button.match-agg.selected {
  background: var(--pk);
  color: var(--tx);
  font-weight: 700;
}

button.match-agg:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: 1px;
}

.ac-preview,
.mig-preview {
  background: var(--surface);
  padding-bottom: 9px;
}

.ac-details.has-preview > summary {
  padding-bottom: 2px;
}

.mig-preview {
  padding: 0 14px 12px;
}

.ac-preview-item,
.mig-preview-item {
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--gr);
}

.ac-preview-item {
  margin-top: 2px;
}

.mig-preview-item {
  margin-top: 4px;
}

.ac-preview-item .gm-ral,
.mig-preview-item .gm-ral {
  font-weight: 400;
  color: var(--gr);
}

.ac-preview-item .gm-ral strong,
.mig-preview-item .gm-ral strong {
  font-weight: 700;
  color: var(--tx);
}

.ac-preview-item .gm-gg,
.mig-preview-item .gm-gg {
  font-weight: 400;
  color: var(--gr);
}

.preview-more {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--gr);
}

.mig-preview .preview-more {
  margin-top: 4px;
}

.ac-details[open] + .ac-preview,
.mig-item[open] + .mig-preview {
  display: none;
}

.ac-details > summary,
.mig-item > summary {
  list-style: none;
  cursor: pointer;
}

.ac-details > summary::-webkit-details-marker,
.mig-item > summary::-webkit-details-marker {
  display: none;
}

/* Expanding rows are controls, not selectable text: a quick click or drag
   should open them instead of selecting the label. */
.ac-details > summary,
.mig-item > summary,
.match-expand > summary {
  -webkit-user-select: none;
  user-select: none;
}

.ac-details > summary::after,
.mig-item > summary::after,
.match-expand > summary::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z'/%3E%3C/svg%3E") center/contain no-repeat;
  color: var(--gr);
  transition: transform 0.15s ease;
}

.mig-item > summary::after {
  color: inherit;
}

/* Match rows use the same chevron, rotated down when closed. */
.match-expand > summary::after {
  transform: rotate(90deg);
}

.ac-details[open] > summary::after,
.mig-item[open] > summary::after,
.match-expand[open] > summary::after {
  transform: rotate(-90deg);
}

.ac-details > summary:focus-visible,
.mig-item > summary:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: -2px;
}

.migrations {
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 14px;
  overflow: hidden;
}

.mig-item {
  border-top: 1px solid var(--ln);
}

.mig-item:first-child {
  border-top: 0;
}

.mig-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 700;
}

.mig-title strong {
  font-weight: 700;
}

.mig-body {
  padding: 8px 14px 8px;
  background: var(--surface-2);
  border-top: 1px solid var(--ln);
  font-size: 12px;
  line-height: 1.5;
  color: var(--gr);
}

.mig-updated {
  padding: 10px 14px;
  text-align: center;
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
  font-size: 14px;
  color: var(--gr);
}

.report-updated {
  margin-top: 28px;
}

/* ---------- Report detail: tabs + data/map split ---------- */
.card.report {
  --report-tabs-h: 62px;
  display: block;
  text-align: left;
  overflow: visible;
  padding: 28px 32px 32px;
}

.card.report .report-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ln);
}

.card.report .report-head .back {
  position: static;
  flex: none;
  margin-top: 4px;
}

.report-head-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.report-title {
  margin: 0;
  color: var(--tx);
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.report-title a {
  color: inherit;
  text-decoration: none;
}

.report-title a:hover,
.card.report .report-title a:hover {
  color: var(--or);
}

.report-meta {
  margin: 0;
  color: #333333;
  font-size: 15px;
}

.report-about {
  margin: 0;
  max-width: 70ch;
  color: var(--gr);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .report-meta {
  color: var(--gr);
}

.report-head-art {
  flex: 0 0 auto;
}

.report-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0;
  padding: 14px 0;
  background: var(--surface);
  box-shadow: 0 8px 16px -14px var(--shadow-strong);
  overflow-x: auto;
  scrollbar-width: none;
}

.report-tabs::-webkit-scrollbar {
  display: none;
}

.report-tabs .tabs {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  width: max-content;
  margin: 0;
}

.report-tabs .tab {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  width: auto;
  flex: 0 0 auto;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--ln);
  border-radius: 999px;
  background: var(--surface);
  color: var(--tx);
  font-size: 13px;
  white-space: nowrap;
}

.report-tabs .tab span {
  order: 0;
}

.report-tabs .tab svg {
  order: 1;
  flex: none;
  width: 18px;
  height: 18px;
  color: inherit;
  opacity: 1;
}

.report-tabs .tab.on {
  border-color: var(--or);
  background: var(--or);
  color: #fff;
}

.report-tabs .tab.on:hover {
  border-color: var(--or-hover);
  background: var(--or-hover);
  color: #fff;
}

.report-tabs .tab:not(.on):hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.report-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 44%);
  gap: 30px;
  align-items: start;
}

.report-body.no-map {
  grid-template-columns: minmax(0, 1fr);
}

.report-body.more-top {
  padding-top: 16px;
}

.report-data {
  min-width: 0;
}

/* The active tab already names the section. */
.report-data .summary-head {
  display: none;
}

.report-map {
  position: sticky;
  top: var(--report-tabs-h);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-map-canvas {
  height: clamp(340px, 64vh, 620px);
}

/* Mobile-only collapse handle for the report map. */
.map-handle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--tx);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.map-grip {
  width: 32px;
  height: 2px;
  border-radius: 999px;
  background: var(--gr);
}

.report-map-canvas .ancestry-map,
.report-map-canvas .row-map,
.report-map-canvas .group-map {
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
}

.report-map-canvas .ancestry-map-wrap {
  height: 100%;
  margin: 0;
}

.report-map-canvas .ancestry-map-wrap .ancestry-map {
  flex: 1 1 auto;
  height: auto;
}

@media (max-width: 980px) {
  .card.report {
    --report-tabs-h: 50px;
  }
  .report-tabs {
    padding: 8px 0;
  }
  .report-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .report-map {
    position: sticky;
    top: var(--report-tabs-h);
    z-index: 20;
    order: -1;
    padding: 10px 0 0;
    background: var(--surface);
  }
  .report-map-canvas {
    height: clamp(200px, 36vh, 340px);
    overflow: hidden;
    transition: height 0.5s ease, opacity 0.35s ease;
  }
  .map-handle {
    display: flex;
  }
  .report-map.is-collapsed .report-map-canvas {
    height: 0;
    opacity: 0;
    overflow: hidden;
  }
}

details.exp {
  flex: 1;
  min-width: 0;
}

details.exp>summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 2px 0;
}

details.exp>summary::-webkit-details-marker {
  display: none;
}

details.exp>summary .exp-name::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--gr);
}

details.exp[open]>summary .exp-name::before {
  content: "▾";
}

details.exp.right>summary {
  justify-content: flex-end;
}

.migsub {
  display: block;
  font-size: 12px;
  color: var(--gr);
}

/* Collection page: filters sit in a sidebar beside the report grid. */
.browse-page .page-head {
  margin-bottom: 24px;
}

.collection {
  display: grid;
  grid-template-columns: 270px minmax(0,1fr);
  gap: 26px;
  align-items: start;
  margin: 0 0 14px;
}

.filters {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 18px;
  box-shadow: 0 1px 6px var(--shadow);
}

.filters-title {
  color: var(--or);
  font-size: 16px;
  font-weight: 700;
}

.filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-apply,
.filters-close {
  display: none;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.filters-apply {
  color: var(--or);
}

.filters-apply:hover {
  color: var(--or-hover);
  text-decoration: underline;
}

.filters-close {
  color: var(--gr);
}

.filters-close:hover {
  color: var(--tx);
  text-decoration: underline;
}

.filters-apply:focus-visible,
.filters-close:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.filters-clear {
  padding: 2px 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--bl);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.filters-clear:hover {
  text-decoration: underline;
}

.filters-clear:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.results-bar p {
  margin: 0;
}

/* Mobile-only text link beside the report count. */
.filters-toggle {
  display: none;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--or);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.filters-toggle:hover {
  color: var(--or-hover);
  text-decoration: underline;
}

.filters-toggle[aria-expanded=true] {
  color: var(--or-hover);
}

.filters-toggle:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 3px;
  border-radius: 4px;
}

.filters-arrow {
  margin-left: 3px;
}

.filters>div>label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
}

.filters input[type=text] {
  height: 42px;
}

.pct-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pct-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tx);
}

.pct-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 2px 0 0;
  background: transparent;
  cursor: pointer;
}

.pct-slider:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.pct-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--or) 0 var(--pct, 0%),
    var(--chip) var(--pct, 0%) 100%
  );
}

.pct-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--or);
  box-shadow: 0 1px 3px var(--shadow-strong);
}

.pct-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--or) 0 var(--pct, 0%),
    var(--chip) var(--pct, 0%) 100%
  );
}

.pct-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--or);
  box-shadow: 0 1px 3px var(--shadow-strong);
}

.pct-slider:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.pct-readout {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--or);
}

.pct-readout.off {
  font-weight: 400;
  color: var(--muted);
}

.results {
  min-width: 0;
}

.ver-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gr);
}

/* Version picker: same menu look as the filter options. */
.ver-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0 0 6px;
}

.ver-menu.col {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  max-width: 240px;
  margin: 0;
}

.ver-menu .ms {
  flex: 0 1 auto;
  max-width: 340px;
  min-width: 0;
}

.ver-menu .msb {
  width: auto;
}

.ver-menu .msp {
  min-width: 200px;
}

.ver-menu.col .ms {
  flex: none;
  width: auto;
  max-width: 100%;
  align-self: flex-start;
}

.filters .ver-menu.col {
  max-width: none;
  margin-bottom: 0;
}

.filters .ver-menu.col .ms,
.filters .ver-menu.col .msb {
  width: 100%;
}

.filters .ver-label {
  color: var(--tx);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(250px,1fr));
  gap: 18px;
}

.rc {
  background: var(--surface);
  border: 1px solid var(--ln);
  border-radius: 16px;
  box-shadow: 0 1px 2px var(--shadow);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

/* No transform on hover: a transformed ancestor becomes the containing block
   for the chart's fixed-position tooltip, which then gets clipped by
   overflow: hidden. */
.rc:hover {
  border-color: var(--border-2);
  box-shadow: 0 8px 24px var(--shadow-strong);
}

.rc:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

/* The chart keeps its size; the text column shrinks and wraps long public IDs
   instead of spilling out of the card. */
.rc > div:first-child {
  flex: 0 0 auto;
}

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

.rc b {
  display: block;
  overflow-wrap: anywhere;
  color: var(--tx);
  font-size: 15px;
  line-height: 1.35;
}

.rc-ver {
  display: block;
  margin-top: 2px;
  color: #333333;
  font-size: 13px;
}

html[data-theme="dark"] .rc-ver {
  color: var(--gr);
}

.rc-view {
  display: block;
  margin-top: 6px;
  color: var(--bl);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.rc:hover .rc-view {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin: 22px 0;
}

.pgb {
  background: none;
  border: 0;
  font: inherit;
  font-size: 16px;
  color: var(--tx);
  cursor: pointer;
  padding: 4px 10px;
}

.pgb:hover {
  text-decoration: underline;
}

.pgb:disabled {
  opacity: .4;
  cursor: default;
  text-decoration: none;
}

.pg-gap {
  padding: 4px 2px;
  color: var(--muted);
  font-size: 16px;
}

.pgb.on {
  color: var(--or);
  font-weight: 700;
}

.pgb:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.pill {
  background: var(--pill);
  border-radius: 99px;
  padding: 2px 14px;
  font-size: 13px;
}

/* Sidebar navigation under the identity block on the review page. */
.side-nav {
  width: 100%;
  max-width: 280px;
}

/* Stacked report sections: the nav scrolls between them instead of replacing content. */
.report-sections {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.report-section {
  scroll-margin-top: 16px;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
}

.tabs-mobile {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--gr);
  cursor: pointer;
}

.tab svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: .9;
}

.tab.on {
  background: var(--pk);
  color: var(--or);
}

.tab:not(.on):hover {
  background: var(--surface-2);
}

.tab:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.disp {
  color: var(--or);
  font-weight: 700;
  font-size: 18px;
}

/* Anonymous public IDs are not Reddit identities; keep them neutral. */
.disp.anon-id {
  color: var(--tx);
}

.chk {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 8px 0;
}

.ts-check {
  margin: 12px 0 0;
}

.ts-check p {
  margin: 6px 0 0;
  font-size: 13px;
}

.idr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.idr label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
}

.idr input[type=text] {
  flex: 1;
  width: auto;
  min-width: 150px;
  padding: 6px 8px;
}

input.c {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gr);
  border-radius: 50%;
  background: var(--surface);
  margin: 0;
  flex: none;
  cursor: pointer;
}

input.c:checked {
  border-color: var(--or);
  background: radial-gradient(var(--or) 0 45%,var(--surface) 50%);
}

input.c:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.fr {
  display: block;
  width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 6px;
}

.step-picture {
  display: block;
}

.av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}

/* ---------- Review flow (guided steps) ---------- */
.card.review {
  display: block;
  width: 100%;
  max-width: 860px;
  min-height: 0;
  margin: 0 auto;
  overflow: visible;
  text-align: left;
}

.review-inner {
  padding: 34px 40px 0;
}

.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ln);
}

.review-title {
  margin: 0;
  color: var(--tx);
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.review-lede {
  max-width: 50ch;
  margin: 8px 0 0;
  color: var(--gr);
  font-size: 15px;
  line-height: 1.5;
}

.review-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.review-preview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.review-preview-text b {
  color: var(--tx);
  font-size: 14px;
}

.review-preview-text small {
  color: var(--gr);
  font-size: 12px;
}

.review-steps {
  display: flex;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.review-step-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--ln);
  border-radius: 999px;
  background: var(--surface);
  color: var(--tx);
  font-size: 13px;
  font-weight: 700;
}

.review-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--gr);
  font-size: 12px;
}

.review-step-mark.on {
  border-color: var(--or);
  background: var(--or);
  color: #fff;
}

.review-step-mark.on .review-step-num {
  background: #fff;
  color: var(--or);
}

.review-step-mark.on:hover {
  border-color: var(--or-hover);
  background: var(--or-hover);
}

.review-step-mark:not(.on):hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.review-step-mark.done {
  color: var(--tx);
}

.review-step-mark.done .review-step-num {
  background: var(--ok);
  color: #fff;
}

.review-step-body {
  padding: 30px 0 8px;
}

.review-step-title {
  margin: 0;
  color: var(--tx);
  font-size: 20px;
  line-height: 1.25;
}

.review-step-lede {
  margin: 6px 0 20px;
  color: var(--gr);
  font-size: 14px;
  line-height: 1.55;
}

.review-step-body .note {
  margin: 0 0 16px;
}

.review-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-choice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--ln);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.review-choice:hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.review-choice.on {
  border-color: var(--or);
  background: var(--pk);
}

.review-choice > input.c {
  margin-top: 3px;
}

.review-choice-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.review-choice-text label {
  cursor: pointer;
}

.review-choice-text b {
  font-size: 16px;
}

.review-choice-text small {
  color: var(--gr);
  font-size: 13px;
  line-height: 1.45;
}

.review-user {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  margin-top: 10px;
}

.review-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.review-field {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 6px 18px;
  align-items: center;
}

.review-field.full {
  grid-template-columns: 1fr;
  gap: 6px;
}

.review-field > .lb {
  color: var(--tx);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.review-field .lb.top {
  align-self: start;
  padding-top: 11px;
}

.review-field.full .lb.top {
  padding-top: 0;
}

.review-field textarea.in {
  height: auto;
  min-height: 110px;
  padding: 10px 12px;
  resize: vertical;
}

.review-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 24px;
}

.review-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--ln);
  border-radius: 14px;
  background: var(--surface);
}

.review-summary-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.review-summary-text b {
  font-size: 14px;
}

.review-summary-text small {
  color: var(--gr);
  font-size: 13px;
}

.review-edit {
  flex: none;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--or);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.review-edit:hover {
  background: var(--pk);
}

.review-edit:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.review-data {
  border: 1px solid var(--ln);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.review-data-head {
  padding: 14px 16px;
  font-weight: 700;
}

.review-data-body {
  padding: 16px;
  border-top: 1px solid var(--ln);
}

.review-data-body > .summary-panel + .summary-panel {
  margin-top: 16px;
  padding-top: 0;
}

.review-data-body .summary-title {
  font-size: 16px;
}

.review-data-body > :first-child {
  margin-top: 0;
}

.review-data-body > :last-child {
  margin-bottom: 0;
}

.review-submit {
  margin-top: 16px;
  padding-top: 0;
}

.review-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 16px 0 22px;
  background: var(--surface);
}

.review-actions .btn {
  white-space: nowrap;
}

.id-prefix {
  color: var(--gr);
  font-size: 14px;
}

.review-user .in {
  min-width: 0;
}

.review-user .in:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.in {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--tx);
}

/* Repeatable "Other ancestors' birthplace" rows on review. */
.fam-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* Birthplace autocomplete (local Natural Earth list, no network calls). */
.place-field {
  position: relative;
  min-width: 0;
}

.fam-row .place-field {
  flex: 1 1 auto;
}

.place-list {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.place-list li {
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
}

.place-list li:hover,
.place-list li.on {
  background: var(--surface-3);
}

.fam-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fam-row .in {
  flex: 1 1 auto;
  min-width: 0;
}

.fam-del {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--gr);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.fam-del:hover {
  border-color: var(--bad);
  color: var(--bad);
}

.fam-del:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.fam-add {
  align-self: flex-end;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border: 2px solid var(--or);
  border-radius: 999px;
  background: var(--or);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fam-add svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.fam-add:hover {
  background: var(--or-hover);
  border-color: var(--or-hover);
  color: #fff;
}

.fam-add:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .report-item .report-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .report-item .report-line .result-summary {
    white-space: normal;
  }
}

.note {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* A note directly under a summary title already follows the panel's gap; drop
   the browser's default paragraph margin so it hugs the title. */
.summary-body > .note:first-child {
  margin-top: 0;
}

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--gr);
  font-size: 13px;
  line-height: 1.45;
}

.info-note svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  fill: #333333;
}

.info-note b {
  color: var(--tx);
}

/* Bookmarklet hint: copy instructions on touch, drag instructions on desktop. */
.copy-only {
  display: block;
}

.drag-only {
  display: none;
}

.hint {
  font-size: 14px;
  margin: 0 0 10px;
}

.hint p {
  margin: 0 0 6px;
}

.hint p:last-child {
  margin-bottom: 0;
}

.hint ol {
  margin: 0;
  padding-left: 22px;
}

.hint li + li {
  margin-top: 4px;
}

/* Bookmarklet page: keyboard shortcuts in the bookmark-bar hint. */
.hint kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 1px 5px;
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .copy-only {
    display: none;
  }
  .drag-only {
    display: block;
  }
}

.disp a {
  color: var(--or);
}

.scroll ul {
  margin: 6px 0;
  padding-left: 20px;
}

@media (max-width: 860px) {
  .collection {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .filters {
    position: static;
  }
  .filters:not(.open) {
    display: none;
  }
  .filters-toggle {
    display: inline-flex;
  }
  .filters-actions {
    display: flex;
    gap: 10px;
  }
  .filters-apply,
  .filters-close {
    display: inline-block;
  }
  .filters-apply {
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--or);
    color: #fff;
  }
  .filters-apply:hover {
    background: var(--or-hover);
    color: #fff;
    text-decoration: none;
  }
  /* While the filters are open on mobile, they own the page; the report list
     (and its "Showing …" bar) returns when the filters are closed. */
  .filters.open ~ .results {
    display: none;
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    min-height: 66px;
    padding: 0 16px;
    gap: 12px;
  }
  .brand img {
    height: 50px;
  }
  .wrap {
    padding: 18px 16px 40px;
  }
  .card.home {
    grid-template-columns: 1fr;
    padding: 32px 24px;
    gap: 28px;
  }
  .home-visual {
    order: -1;
  }
  .home-title {
    font-size: 34px;
  }
  .home-actions {
    flex-wrap: nowrap;
  }
  .home-actions .btn {
    flex: 1 1 0;
    padding: 9px 10px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
  }
  .success-preview {
    flex-direction: column;
    align-items: flex-start;
  }
  .card {
    grid-template-columns: minmax(0, 1fr);
  }
  .card.detail {
    grid-template-columns: minmax(0, 1fr);
  }
  .card,
  .card.detail {
    overflow: visible;
  }
  .scroll {
    padding: 6px 22px 22px;
    border-radius: 0 0 28px 28px;
  }
  .card.detail .fixed {
    position: relative;
    padding: 30px 20px 20px;
  }
  .card.detail .scroll {
    padding: 6px 22px 22px;
  }
  .fixed {
    order: -1;
    position: relative;
    min-height: 0;
  }
  .fixed {
    padding: 20px;
  }
  .fixed.top {
    padding-top: 76px;
  }
  .fixed .tabs,
  .side-nav {
    display: none;
  }
  .tabs-mobile {
    display: block;
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 0 16px;
    padding: 8px 0;
    background: var(--surface);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 6px 12px -10px var(--shadow-strong);
    min-width: 0;
  }
  .tabs-mobile .tabs {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
  }
  .tabs-mobile .tabs::-webkit-scrollbar {
    display: none;
  }
  .tabs-mobile .tab {
    width: auto;
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 13px;
    white-space: nowrap;
    border-radius: 999px;
  }
  .tabs-mobile .tab svg {
    width: 16px;
    height: 16px;
  }
  .summary-title {
    font-size: 18px;
  }
  .row-map {
    height: 170px;
  }
  .group-map {
    height: 160px;
  }
  .card.report {
    padding: 22px 20px 24px;
  }
  .card.report .report-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 14px;
    align-items: center;
  }
  .card.report .report-head .back {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .report-id .disp {
    font-size: 18px;
  }
  .report-head-art {
    display: block;
    margin-left: 0;
  }
  .report-map-canvas {
    height: clamp(180px, 30vh, 260px);
  }
  .review-inner {
    padding: 24px 20px 0;
  }
  .review-head {
    flex-direction: column;
    gap: 18px;
  }
  .review-title {
    font-size: 32px;
  }
  .review-preview {
    align-self: stretch;
  }
  .review-steps {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .review-steps::-webkit-scrollbar {
    display: none;
  }
  .review-step-mark {
    flex: 0 0 auto;
    min-height: 0;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 11.5px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .review-step-num {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
  .review-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .review-field > .lb {
    white-space: normal;
  }
  .review-field .lb.top {
    padding-top: 0;
  }
  .review-actions {
    padding: 14px 0 18px;
  }
}

/* Narrow phones: shrink the header chart so the username / public ID has room
   to stay on one line ("u/andy_thatsno / tme" was the old mid-word break). */
@media (max-width: 480px) {
  .report-head-art .pw {
    width: 72px !important;
    height: 72px !important;
  }
  .report-head-art .pw > .pie {
    width: 72px;
    height: 72px;
  }
  .report-head-art .pw > .pr {
    width: 38% !important;
    height: 38% !important;
  }
  .report-head-art .pw > .pa {
    width: 35% !important;
    height: 35% !important;
  }
  .report-title {
    font-size: clamp(19px, 5.4vw, 22px);
  }
}

@media (max-width: 380px) {
  .site-header-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .brand img {
    height: 44px;
  }
  .theme {
    width: 36px;
    height: 36px;
  }
  .review-actions .btn {
    padding: 9px 16px;
  }
}

.btn:not(.f):not(.g):not(:disabled):hover {
  background: var(--surface);
  color: var(--or-hover);
  border-color: var(--or-hover);
}

.btn.f:not(:disabled):hover {
  background: var(--or-hover);
  color: #fff;
  border-color: var(--or-hover);
}

a:not(.btn):not(.rc):hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.about-link {
  font-weight: 700;
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

.disp a:hover {
  color: var(--or);
}

.back {
  position: absolute;
  top: 20px;
  left: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--back);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 2;
}

.back:hover {
  background: var(--chip-2);
}

.back svg {
  width: 20px;
  height: 20px;
  fill: var(--tx);
}

.back:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.btn.g:not(:disabled):hover {
  background: var(--or-hover);
  border-color: var(--or-hover);
  color: #fff;
}

.pgb.on {
  text-decoration: underline;
}

.srch {
  position: relative;
}

.srch input {
  padding-right: 46px;
}

.srch svg {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
  stroke: var(--tx);
}

.ms {
  position: relative;
}

.msb {
  width: 100%;
  height: 42px;
  padding: 0 44px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23333435' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center/14px 9px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  color: var(--tx);
}

.msb span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msb .ph0 {
  color: var(--ph);
}

.msb:focus-visible {
  outline: 3px solid var(--or);
  outline-offset: 2px;
}

/* The open filter search / version picker shouldn't show the focus ring. */
.msb-search:focus,
.msb-search:focus-visible {
  outline: none;
}

.msp {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 6px 18px var(--shadow-strong);
  z-index: 20;
  padding: 6px;
  max-height: min(65vh, 520px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msp-head {
  flex: none;
  padding-bottom: 4px;
}

.msp-up {
  top: auto;
  bottom: calc(100% + 4px);
}

.msp-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.msb-search {
  background: var(--surface);
  padding-right: 10px;
  cursor: text;
}

.msb-search::placeholder {
  color: var(--ph);
}

.msp-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 0;
}

.msp-count {
  font-size: 12px;
  color: var(--muted);
}

.msp-tools .msx {
  padding: 4px;
  font-size: 13px;
}

.msp-empty {
  margin: 4px 0;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--muted);
}

.mso {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  color: var(--tx);
}

.mso:hover {
  background: var(--opt-hover);
  color: var(--tx);
}

.mso input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--or);
  cursor: pointer;
}

.msx {
  background: none;
  border: 0;
  color: var(--or);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: underline;
}

.msx:hover {
  color: var(--or-hover);
}

.ib {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--back);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ib:hover {
  background: var(--chip-2);
}

.ib svg {
  width: 20px;
  height: 20px;
  fill: var(--tx);
}

.ib:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

html[data-theme="dark"] .msb {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23e6e8ea' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .msb-search {
  background-image: none;
}

html[data-theme="dark"] .match-strength {
  color: var(--gr);
}

/* Consent checkbox: orange */
input.ck {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: none;
  display: grid;
  place-content: center;
  border: 2px solid #333333;
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

html[data-theme="dark"] input.ck {
  border-color: var(--border);
}

input.ck:checked {
  background: var(--or);
  border-color: var(--or);
}

input.ck:checked::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

input.ck:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

/* ---------- DNA Painting ---------- */
.paint,
.paint button {
  font-family: "Atkinson Hyperlegible", "Helvetica Neue", Helvetica, Roboto, sans-serif;
}

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

.paint-filter {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 6px var(--shadow);
}

.paint-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ln);
  color: var(--tx);
  font-size: 14px;
  font-weight: 700;
}

.paint-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.paint-filter-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The applied population reads as content, not as the orange section title. */
.paint-filter-toggle.has-filter .paint-filter-name {
  color: var(--tx);
}

.paint-filter-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

/* The scrollable list lives inside the filter card. */
.paint-filter > .paint-tree {
  max-height: 400px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: none;
}

.paint-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.paint-filter-toggle:hover {
  color: var(--or);
}

.paint-filter-caret {
  width: 16px;
  height: 16px;
  flex: none;
  margin-left: auto;
  transition: transform 0.15s ease;
}

.paint-filter-toggle[aria-expanded="true"] .paint-filter-caret {
  transform: rotate(180deg);
}

.paint-filter-toggle:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: 2px;
}

.paint-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--gr);
  cursor: pointer;
}

.paint-clear:hover {
  background: var(--chip-2);
  color: var(--or);
}

.paint-clear:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: 2px;
}

.paint-clear-icon {
  width: 16px;
  height: 16px;
}

/* The filter rows reuse the Ancestry tab styles (.ac-list/.ac-cat/.ac-row),
   rendered as buttons without the expander affordance. */
.paint-tree button.ac-cat,
.paint-tree button.ac-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}

/* Restore the separators the button reset removes. */
.paint-tree button.ac-cat + button.ac-cat {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.paint-tree button.ac-row {
  border-top: 1px solid var(--ln);
}

.paint-tree button.ac-row.ac-depth-3 {
  color: var(--tx);
  font-size: 13px;
  font-weight: 400;
}

.paint-tree button.ac-row:hover {
  background: var(--surface-2);
}

.paint-tree button.ac-cat:hover {
  filter: brightness(0.96);
}

.paint-tree button.ac-row.on {
  background: var(--chip-2);
}

.paint-tree button.ac-cat:focus-visible,
.paint-tree button.ac-row:focus-visible {
  outline: 2px solid var(--bl);
  outline-offset: -2px;
}

.paint-chroms {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.paint-chrom {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
}

.paint-name {
  color: #333333;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

/* Each haplotype row keeps its own slightly rounded left and right ends, like
   23andMe's painting. */
.paint-bars {
  display: grid;
  gap: 3px;
}

.paint-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 3px;
  /* Shows as the notch where the inner bar is clipped away. */
  background: var(--surface);
}

/* The bar is clipped to its real shape: the 23andMe pinch is cut out of the
   bar itself rather than painted over it, so no seam or line can appear. */
.paint-clip {
  position: absolute;
  inset: 0;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(
    135deg,
    var(--surface-3) 0,
    var(--surface-3) 2px,
    transparent 2px,
    transparent 5px
  );
  clip-path: polygon(
    0 0,
    calc(var(--cen) - var(--notch)) 0,
    var(--cen) 22%,
    calc(var(--cen) + var(--notch)) 0,
    100% 0,
    100% 100%,
    calc(var(--cen) + var(--notch)) 100%,
    var(--cen) 78%,
    calc(var(--cen) - var(--notch)) 100%,
    0 100%
  );
}

.paint-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
}

/* Centromere: a tiny gap at the centromere midpoint, like 23andMe. */
.paint-centromere {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: var(--surface);
}

@media (max-width: 760px) {
  .paint-layout {
    grid-template-columns: 1fr;
  }

  /* While the filter is open, the ancestry list owns the page and the
     painting is hidden until it's closed again. */
  .paint.filter-open .paint-chroms {
    display: none;
  }

  .paint.filter-open .paint-filter > .paint-tree {
    max-height: none;
  }

  .paint-filter-head {
    padding: 8px 14px;
  }

  .paint-filter:not(.open) .paint-filter-head {
    border-bottom-color: transparent;
  }

  .paint-filter > .paint-tree {
    max-height: 280px;
  }

  .paint-tree button.ac-cat,
  .paint-tree button.ac-row {
    min-height: 42px;
  }
}
