/* Single CSS entry point — all app styles loaded via one <link> tag.
   Base styles first, then components in dependency order. */

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--color-text);
  overflow-x: clip;
  background: var(--color-bg);
}

body {
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  cursor: pointer;
}

:root {
  /* Colors — dark genomics theme (default) */
  --color-primary: #818cf8;
  --color-primary-hover: #a5b4fc;
  --color-accent: #34d399;
  --color-accent-hover: #6ee7b7;
  --color-success: #22c55e;
  --color-success-hover: #4ade80;
  --color-warning: #f59e0b;
  --color-warning-hover: #fbbf24;
  --color-danger: #ef4444;
  --color-danger-hover: #f87171;
  --color-info: #38bdf8;
  --color-info-hover: #7dd3fc;
  --color-text: #e2e8f0;
  --color-text-muted: #a8b8cc;
  --color-text-inverse: #fff;
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #283548;
  --color-border: #334155;
  --color-btn-primary-bg: #6366f1;
  --color-btn-primary-hover: #818cf8;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --font-sans: system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.5rem;
  --text-hero: clamp(2.5rem, 5vw, 4rem);

  /* Borders */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow-md: 0 4px 6px rgb(0 0 0 / 40%);
  --shadow-glow: 0 0 40px rgb(99 102 241 / 15%);

  /* Scrollbar */
  --scrollbar-thumb: #475569;
  --scrollbar-track: transparent;

  /* Layout */
  --max-width: 72rem;
  --section-padding: var(--space-3xl) var(--space-xl);
}

/* Light mode */
[data-theme='light'] {
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-accent: #059669;
  --color-accent-hover: #047857;
  --color-success: #16a34a;
  --color-success-hover: #15803d;
  --color-warning: #d97706;
  --color-warning-hover: #b45309;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-info: #0284c7;
  --color-info-hover: #0369a1;
  --color-text: #1e293b;
  --color-text-muted: #4b5c73;
  --color-text-inverse: #fff;
  --color-bg: #eef0f6;
  --color-surface: #f8f9fc;
  --color-surface-alt: #e8eaf3;
  --color-border: #d4d6e4;
  --color-btn-primary-bg: #4f46e5;
  --color-btn-primary-hover: #4338ca;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 5%);
  --shadow-md: 0 4px 6px rgb(0 0 0 / 7%);
  --shadow-glow: 0 0 40px rgb(79 70 229 / 10%);
  --scrollbar-thumb: #94a3b8;
  --scrollbar-track: transparent;
}

/* Shared styles — error states, loading, icons, utilities, transitions.
   Loaded globally in index.html. All light DOM components inherit these. */

/* --- Error & Validation States --- */

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

  & input,
  & select,
  & textarea {
    border-color: var(--color-danger);
  }
}

.error-message {
  font-size: var(--text-sm);
  color: var(--color-danger);
  margin-top: var(--space-xs);
}

.success-message {
  font-size: var(--text-sm);
  color: var(--color-success);
  margin-top: var(--space-xs);
}

/* --- Loading States --- */

.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Icon Base --- */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
  fill: currentcolor;

  & svg {
    width: 100%;
    height: 100%;
  }
}

.icon-sm {
  width: 1em;
  height: 1em;
}

.icon-lg {
  width: 1.5em;
  height: 1.5em;
}

/* --- Screen Reader Only --- */

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

/* --- Common Transitions --- */

.fade-in {
  animation: fade-in 0.2s ease-in;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* --- Badge / Status Indicators --- */

.badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.badge-success {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.badge-warning {
  background: color-mix(in srgb, var(--color-warning) 15%, transparent);
  color: var(--color-warning);
}

.badge-danger {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

.badge-info {
  background: color-mix(in srgb, var(--color-info) 15%, transparent);
  color: var(--color-info);
}

/* --- Form Shared --- see forms.css --- */

/* Themed scrollbars — uses tokens --scrollbar-thumb / --scrollbar-track */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

/* Global button styles — usable on any <button class="btn"> element.
   Loaded in index.html via components.css or directly. */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);

  &:hover:not(:disabled) {
    background: var(--color-primary-hover);
  }
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);

  &:hover:not(:disabled) {
    background: var(--color-bg);
  }
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);

  &:hover:not(:disabled) {
    background: var(--color-bg);
  }
}

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);

  &:hover:not(:disabled) {
    background: var(--color-success-hover);
  }
}

.btn-warning {
  background: var(--color-warning);
  color: var(--color-text-inverse);

  &:hover:not(:disabled) {
    background: var(--color-warning-hover);
  }
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);

  &:hover:not(:disabled) {
    background: var(--color-danger-hover);
  }
}

.btn-info {
  background: var(--color-info);
  color: var(--color-text-inverse);

  &:hover:not(:disabled) {
    background: var(--color-info-hover);
  }
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
}

/* Shared form input styles.
   Loaded globally in index.html. */

input,
select,
textarea {
  font: inherit;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease;

  &:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgb(37 99 235 / 15%);
  }
}

/* View Transitions — push animations between pages */

/* Default: instant (covers initial load, replace, etc.) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

/* Forward — new pushes old out to the left */
[router-transition='forward']::view-transition-old(root) {
  animation: vt-push-out-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

[router-transition='forward']::view-transition-new(root) {
  animation: vt-push-in-right 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Backward — new pushes old out to the right */
[router-transition='backward']::view-transition-old(root) {
  animation: vt-push-out-right 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

[router-transition='backward']::view-transition-new(root) {
  animation: vt-push-in-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Header stays fixed during transition */
.app-header {
  view-transition-name: header;
}

::view-transition-old(header),
::view-transition-new(header) {
  animation: none;
}

/* Sub-header stays fixed during transition */
.app-layout__sub-header {
  view-transition-name: sub-header;
}

::view-transition-old(sub-header),
::view-transition-new(sub-header) {
  animation: none;
}

/* Floating bar stays fixed during transition */
.floating-bar {
  view-transition-name: floating-bar;
}

::view-transition-old(floating-bar),
::view-transition-new(floating-bar) {
  animation: none;
}

/* Overlap pages slightly to eliminate gap */
@keyframes vt-push-in-right {
  from {
    transform: translateX(calc(100vw - 15px));
  }
}

@keyframes vt-push-out-left {
  to {
    transform: translateX(calc(-100vw + 15px));
  }
}

@keyframes vt-push-in-left {
  from {
    transform: translateX(calc(-100vw + 15px));
  }
}

@keyframes vt-push-out-right {
  to {
    transform: translateX(calc(100vw - 15px));
  }
}

@media (prefers-reduced-motion: reduce) {
  [router-transition]::view-transition-old(root),
  [router-transition]::view-transition-new(root) {
    animation: none;
  }
}

/* App layout — shared shell structure for all app views */
.app-layout {
  min-height: 100vh;
}

.app-layout__sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-layout__sub-header {
  z-index: 90;
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(8px);
}

.app-layout__sub-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--space-lg);
  border-bottom: 2px solid var(--color-border);
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.app-layout__content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}


/* Atoms */
app-button {
  display: inline-block;
}

app-badge {
  display: inline-block;
  line-height: 1;
}

app-icon {
  display: inline-flex;
  vertical-align: -0.125em;
}

theme-toggle {
  display: inline-flex;

  & .theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    line-height: 1;
  }
}

hero-canvas {
  display: block;
  position: absolute;
  inset: 0 0 -20rem;
  pointer-events: none;
  z-index: 0;
}

.hero-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (width <= 640px) {
  hero-canvas {
    bottom: -10rem;
  }
}

.percentile-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.percentile-bar__track {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.percentile-bar__fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.3s ease;
}

.percentile-bar__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 5.5em;
  text-align: right;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.confidence-badge--success {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.confidence-badge--info {
  background: color-mix(in srgb, var(--color-info) 15%, transparent);
  color: var(--color-info);
}

.confidence-badge--warning {
  background: color-mix(in srgb, var(--color-warning) 15%, transparent);
  color: var(--color-warning);
}

.confidence-badge--danger {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

.aqs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.aqs__bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.aqs__row {
  display: grid;
  grid-template-columns: 6.5em 1fr 2.5em;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.aqs__row:hover {
  background: var(--color-surface-alt);
}

.aqs__row--active {
  background: var(--color-surface-alt);
}

.aqs__label {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.aqs__bar {
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: 3px;
  overflow: hidden;
}

.aqs__fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.aqs__val {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.aqs__tooltip {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-xs) var(--space-sm);
  margin: 0 0 var(--space-xs);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  line-height: 1.4;
  animation: aqs-fade-in 0.15s ease;
}

@keyframes aqs-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* Score distribution histogram with ancestry overlays */
.score-dist {
  width: 100%;
  margin: calc(-1 * var(--space-sm)) 0;
}

.score-dist--empty {
  display: none;
}

.score-dist__svg {
  width: 100%;
  height: auto;
  display: block;
}

.score-dist__bars rect {
  fill: var(--color-primary);
  opacity: 0.2;
}

.score-dist__marker {
  stroke: var(--color-warning);
  stroke-width: 2;
}

.score-dist__emoji {
  font-size: 12px;
}

.score-dist__legend {
  font-size: 7px;
  fill: var(--color-text-muted);
  cursor: default;
}

.score-dist__leg {
  cursor: pointer;
}

/* Hover: highlight one ancestry, dim others */
.score-dist__svg:has(.score-dist__leg:hover) .score-dist__curve {
  opacity: 0.15;
  transition: opacity 0.15s;
}

.score-dist__svg:has(.score-dist__leg:hover) .score-dist__bars rect {
  opacity: 0.08;
}

/* Match hovered legend to its curve by shared class */
.score-dist__svg:has(.pop-NFE:hover) .pop-NFE.score-dist__curve,
.score-dist__svg:has(.pop-FIN:hover) .pop-FIN.score-dist__curve,
.score-dist__svg:has(.pop-AFR:hover) .pop-AFR.score-dist__curve,
.score-dist__svg:has(.pop-EAS:hover) .pop-EAS.score-dist__curve,
.score-dist__svg:has(.pop-SAS:hover) .pop-SAS.score-dist__curve,
.score-dist__svg:has(.pop-AMR:hover) .pop-AMR.score-dist__curve,
.score-dist__svg:has(.pop-ASJ:hover) .pop-ASJ.score-dist__curve,
.score-dist__svg:has(.pop-MID:hover) .pop-MID.score-dist__curve {
  opacity: 1;
  stroke-width: 2.5;
}

/* Also highlight when hovering the curve itself */
.score-dist__curve {
  cursor: pointer;
  transition: opacity 0.15s;
}

.score-dist__svg:has(.score-dist__curve:hover) .score-dist__curve {
  opacity: 0.15;
}

.score-dist__svg:has(.score-dist__curve:hover) .score-dist__bars rect {
  opacity: 0.08;
}

.score-dist__curve:hover {
  opacity: 1 !important;
  stroke-width: 2.5;
}

/* Chromosome contribution diverging bar chart */
.chr-contrib {
  width: 100%;
}

.chr-contrib__svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chr-contrib__svg rect:hover {
  filter: brightness(1.3);
}

.chr-contrib__total {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: center;
  padding-top: var(--space-xs);
  font-family: var(--font-mono);
}

.chr-coverage {
  width: 100%;
}

.chr-coverage__svg {
  width: 100%;
  height: 250px;
  display: block;
  overflow: visible;
}

.chr-coverage__legend {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-xs) 0;
}

.speedometer {
  display: flex;
  justify-content: center;
}

.speedometer__svg {
  width: 140px;
  height: auto;
}

.mini-curve-wrap {
  width: 100%;
}

.mini-curve {
  width: 100%;
  height: auto;
  display: block;
}

.mini-curve__marker {
  cursor: pointer;
  transition: opacity 0.15s;
}

.mini-curve__marker:hover {
  opacity: 1 !important;
}

.mini-curve__marker:hover line {
  stroke-width: 1.5;
  stroke: var(--color-primary);
  opacity: 0.8;
}

.mini-curve__marker:hover circle {
  fill: var(--color-primary);
  opacity: 1;
  transform: scale(2);
  transform-origin: center;
}

.mini-curve__marker:hover text {
  opacity: 1;
  font-size: 12px;
}


/* Molecules */
.app-header {
  position: relative;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
  overflow: hidden;
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-lg);
  flex-shrink: 0;
  overflow: visible;
  height: 2.5rem;

  & img {
    height: 8rem;
    width: auto;
    margin-top: -2.2em;
    margin-bottom: -1.4em;
  }
}

.app-header__badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.app-header__center {
  flex: 1;
  min-width: 0;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.app-header__link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  cursor: pointer;

  &:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.app-header__link--active {
  color: var(--color-primary);
  background: var(--color-surface-alt);
}

@media (width <= 640px) {
  .app-header {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-xs);
    flex-wrap: wrap;
  }

  .app-header__center {
    order: 10;
    flex-basis: 100%;
  }

  .app-header__center:has(.app-view__ind-single) {
    order: unset;
    flex: 0 0 auto;
  }

  .app-header__center:empty,
  .app-header__center:not(:has(*)) {
    display: none;
  }

  .app-header__logo span {
    font-size: var(--text-sm);
  }

  .app-header__logo img {
    height: 9rem;
    margin-top: -3.2em;
    margin-bottom: -1.4em;
    margin-left: -0.8em;
  }

  .app-header__actions {
    margin-left: auto;
  }
}

.app-footer {
  padding: var(--space-lg) var(--space-xl);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);

  & p {
    margin: 0;
  }

  & a {
    color: var(--color-text-muted);
    text-decoration: none;

    &:hover {
      color: var(--color-primary);
    }
  }
}

.upload-zone {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.upload-zone--active,
.upload-zone:hover:not(.upload-zone--disabled) {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 5%, transparent);
}

.upload-zone--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.upload-zone__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-md);
}

.upload-zone__text {
  font-size: var(--text-lg);
  color: var(--color-text);
  margin: 0 0 var(--space-sm);
}

.upload-zone__link {
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: underline;
}

.upload-zone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-zone__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

@media (width <= 640px) {
  .upload-zone__text--desktop {
    display: none;
  }
}

.trait-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
}

.trait-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.trait-card--tier-high {
  border-left: 3px solid var(--color-success);
}

.trait-card--tier-mid {
  border-left: 3px solid var(--color-info);
}

.trait-card--tier-low {
  border-left: 3px solid var(--color-warning);
}

.trait-card--tier-min {
  border-left: 3px solid var(--color-danger);
}

.trait-card--empty {
  opacity: 0.65;
}

.trait-card__placeholder {
  opacity: 0.25;
  pointer-events: none;
}

.trait-card__percentile--empty {
  color: var(--color-text-muted);
}

.trait-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.trait-card__emoji {
  font-size: 1.4rem;
  line-height: 1;
}

.trait-card__name {
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.3;
}

.trait-card__score {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.trait-card__percentile {
  font-size: var(--text-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.trait-card__pct-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.trait-card__value {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: auto;
}

.trait-card__empty {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
  font-style: italic;
  text-align: center;
}

.trait-card__empty--nodata {
  color: var(--color-warning);
}

.trait-card__hint {
  font-size: var(--text-xs);
  opacity: 0.8;
}

.trait-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-top: auto;
}

.trait-card__coverage {
  font-size: 0.65rem;
  color: var(--color-warning);
}

.trait-card__category {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.family-compare {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.family-compare__row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  align-items: center;
  gap: var(--space-md);
}

.family-compare__name {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.family-compare__empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.pgs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.pgs-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
}

.pgs-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}

.pgs-table__best td {
  font-weight: 600;
  color: var(--color-primary);
}

.pgs-table__star {
  position: absolute;
  left: calc(-0.5em - var(--space-xs));
  top: 50%;
  transform: translateY(-50%);
}

.pgs-table__best td:first-child {
  position: relative;
}

.pgs-table__empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.individual-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.individual-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--color-primary) 12%, transparent) var(--progress, 0%),
    var(--color-surface) var(--progress, 0%)
  );
  background-size: 100% 100%;
  flex-wrap: wrap;
  transition: --progress 0.6s ease;
}

.individual-list__item--active {
  border-color: var(--color-primary);
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--color-primary) 18%, transparent) var(--progress, 0%),
    var(--color-surface-alt) var(--progress, 0%)
  );
}

.individual-list__item--scoring {
  animation: scoring-pulse 1.5s ease-in-out infinite;
}

@keyframes scoring-pulse {
  0%,
  100% {
    border-color: var(--color-border);
  }

  50% {
    border-color: var(--color-primary);
  }
}

.individual-list__select {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  text-align: left;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
}

.individual-list__select:hover {
  background: var(--color-surface-alt);
}

.individual-list__emoji {
  font-size: 1.5rem;
}

.individual-list__info {
  display: flex;
  flex-direction: column;
}

.individual-list__name {
  font-weight: 600;
}

.individual-list__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.individual-list__empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

.individual-list__upgrade {
  font-size: var(--text-xs, 0.7rem);
  white-space: nowrap;
  color: var(--color-warning);
}

.individual-list__upgrade-choices {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;

  & .btn {
    font-size: var(--text-xs, 0.7rem);
    gap: 2px;
  }
}

/* Inline edit */
.individual-list__edit {
  width: calc(100% + var(--space-sm) * 2);
  margin: var(--space-sm) calc(-1 * var(--space-sm)) calc(-1 * var(--space-sm))
    calc(-1 * var(--space-sm));
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--color-primary) 18%, transparent),
    transparent 85%
  );
  animation: edit-slide-in 0.2s ease-out;
}

@keyframes edit-slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.individual-list__edit-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.individual-list__edit-input {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: 600;

  &:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
  }
}

.individual-list__edit-preview {
  font-size: 2.5rem;
  line-height: 1;
}

.individual-list__edit-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.individual-list__edit-ancestry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.individual-list__edit-ancestry select {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
}

.individual-list__edit-ancestry-hint {
  flex-basis: 100%;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  opacity: 0.8;
}

.accordion-panel__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.accordion-panel__trigger:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.accordion-panel--open .accordion-panel__trigger {
  border-color: var(--color-primary);
  border-bottom: none;
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  color: var(--color-text);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.accordion-panel__body {
  position: relative;
  border: 1px solid var(--color-primary);
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  overflow: hidden;
}

.accordion-panel__content {
  margin: 0;
  padding: var(--space-sm);
  padding-top: var(--space-lg);
  background: var(--color-bg);
  font-family: monospace;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.accordion-panel__copy {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.accordion-panel__copy:hover {
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
  border-color: var(--color-primary);
}

/* Emoji builder — compact picker */
.emoji-builder {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emoji-builder__preview {
  display: none;
}

.emoji-builder__row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.emoji-builder__label {
  display: none;
}

.emoji-builder__sep {
  width: 1px;
  height: 1.2rem;
  background: var(--color-border);
  margin: 0 2px;
}

.emoji-builder__opt {
  font-size: 1.1rem;
  padding: 3px 5px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.1s;

  &:hover {
    border-color: var(--color-border);
  }
}

.emoji-builder__opt--sel {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.emoji-builder__dot {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.1s;

  &:hover {
    border-color: var(--color-text-muted);
  }
}

.emoji-builder__dot--sel {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.individual-switcher {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.individual-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color 0.15s;
}

.individual-switcher__btn:hover {
  border-color: var(--color-primary);
}

.individual-switcher__btn--active {
  border-color: var(--color-primary);
  background: var(--color-surface-alt);
  font-weight: 600;
}

/* Individual setup — compact form */
.individual-setup {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.individual-setup__top {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.individual-setup__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.individual-setup__preview {
  font-size: 5.5rem;
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}

.individual-setup__status-grid {
  font-size: var(--text-sm);
  color: var(--color-text-muted);

  & span {
    display: block;
  }

  & span:first-child {
    color: var(--color-success);
    font-weight: 600;
  }
}

.individual-setup__input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: var(--text-lg);
  font-weight: 600;

  &:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
  }
}

.individual-setup__actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xs);
}

.individual-setup__ancestry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.individual-setup__ancestry select {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
}

.individual-setup__ancestry-hint {
  width: 100%;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  opacity: 0.8;
}

.floating-bar {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgb(0 0 0 / 15%);
  font-size: var(--text-sm);
  max-width: calc(100vw - 2 * var(--space-md));
  flex-wrap: wrap;
  transition: width 0.3s ease;
}

.floating-bar--expanded {
  flex-direction: column;
  align-items: stretch;
}

.floating-bar__section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.floating-bar__section--scoring {
  min-width: min(11rem, 50vw);
  flex: 1;
}

.floating-bar__tracks {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.floating-bar__progress {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.floating-bar__track {
  height: 4px;
  background: var(--color-surface-alt);
  border-radius: 2px;
  overflow: hidden;
}

.floating-bar__fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.floating-bar__subtrack {
  height: 3px;
  background: var(--color-surface-alt);
  border-radius: 1.5px;
  overflow: hidden;
}

.floating-bar__subfill {
  height: 100%;
  background: var(--color-success, #22c55e);
  border-radius: 1.5px;
  transition: width 0.15s ease;
}

.floating-bar__stats {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-bar__stats-line {
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-bar__stats-line + .floating-bar__stats-line::before {
  content: ' · ';
}

.floating-bar__stats--tappable {
  border: none;
  background: none;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.floating-bar--expanded .floating-bar__stats--tappable {
  background: none;
}

.floating-bar--expanded > .floating-bar__section,
.floating-bar--expanded > .floating-bar__pager {
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

.floating-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--color-primary);
}

.floating-bar__icon--muted {
  color: var(--color-text-muted);
}

.floating-bar__status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--color-text-muted);
  opacity: 0.6;
  cursor: default;
  animation: fade-in 0.3s ease;
}

.floating-bar__status-icon .icon,
.floating-bar__status-icon .icon svg {
  width: 2rem;
  height: 2rem;
}

.floating-bar__action--resume {
  color: var(--color-success, #22c55e);

  &:hover {
    color: var(--color-success, #22c55e);
    background: color-mix(in srgb, var(--color-success, #22c55e) 12%, transparent);
  }
}

.floating-bar__spinner-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  overflow: visible;
}

.floating-bar__spinner-wrap .floating-bar__action {
  position: relative;
  z-index: 1;
  background: none;
  border-radius: 50%;

  &:hover {
    background: none;
    color: var(--color-text);
  }
}

.floating-bar__spinner-wrap:hover {
  cursor: pointer;
}

.floating-bar__spinner-wrap .floating-bar__icon {
  position: relative;
  z-index: 1;
}

.floating-bar__spinner {
  position: absolute;
  width: 2rem;
  height: 2rem;
  top: 50%;
  left: 50%;
  margin-top: -1rem;
  margin-left: -1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: color-mix(in srgb, var(--color-primary) 40%, transparent);
  animation: spin 6s linear infinite;
  pointer-events: none;
  transition: color 0.15s;
}

.floating-bar__spinner-wrap:hover .floating-bar__spinner {
  color: color-mix(in srgb, var(--color-primary) 60%, transparent);
}

.floating-bar__spinner .icon,
.floating-bar__spinner .icon svg {
  width: 2rem;
  height: 2rem;
}

.floating-bar__spinner-wrap--paused .floating-bar__spinner {
  animation-play-state: paused;
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.6;
  }
}

.floating-bar__action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color 0.15s,
    background 0.15s;

  &:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.floating-bar__pager {
  display: flex;
  gap: var(--space-xs);
  margin-left: auto;
}

.floating-bar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;

  &:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.floating-bar__btn--disabled {
  opacity: 0.3;
  pointer-events: none;
}

.floating-bar--error {
  border-color: var(--color-danger);
}

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

/* Detail panel */
.floating-bar__detail {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-xs) 0;
  font-size: var(--text-xs);
  animation: detail-in 0.2s ease;
}

.floating-bar__detail-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--color-text-muted);
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
}

.floating-bar__detail-row:nth-child(even) {
  background: color-mix(in srgb, var(--color-surface-alt) 50%, transparent);
}

.floating-bar__detail-row--error {
  color: var(--color-danger);
  white-space: normal;
  overflow-wrap: anywhere;
}

.floating-bar__detail-heading {
  font-weight: 600;
  color: var(--color-text);
  margin-top: 4px;
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (width <= 640px) {
  .floating-bar {
    bottom: -1px;
    right: 0;
    left: 0;
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    padding: var(--space-sm);
  }

  .floating-bar--expanded {
    animation: slide-up 0.25s ease;
  }

  .floating-bar__section--scoring {
    display: grid;
    grid-template: 'tracks tracks  tracks' auto 'pause  stats   actions' auto / auto 1fr auto;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
  }

  /* Paused: no progress wrapper, collapse to single row */
  .floating-bar__section--scoring:not(:has(.floating-bar__progress)) {
    grid-template-rows: auto;
    grid-template-areas: 'pause stats actions';
  }

  /* On mobile, break out of the progress wrapper */
  .floating-bar__section--scoring .floating-bar__progress {
    display: contents;
  }

  .floating-bar__section--scoring .floating-bar__spinner-wrap,
  .floating-bar__section--scoring .floating-bar__status-icon {
    grid-area: pause;
    width: 2.75rem;
    height: 2.75rem;
  }

  .floating-bar__section--scoring .floating-bar__tracks {
    grid-area: tracks;
  }

  .floating-bar__section--scoring .floating-bar__stats {
    grid-area: stats;
    display: flex;
    flex-direction: column;
    white-space: nowrap;
    overflow: hidden;
  }

  .floating-bar__section--scoring .floating-bar__action:last-of-type {
    grid-area: actions;
  }

  .floating-bar__action,
  .floating-bar__btn {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.25rem;
  }

  .floating-bar__spinner .icon,
  .floating-bar__spinner .icon svg {
    width: 3rem;
    height: 3rem;
  }

  .floating-bar__stats-line + .floating-bar__stats-line::before {
    content: none;
  }

  @keyframes slide-up {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }
}


/* Organisms */
.trait-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.trait-grid__controls {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
  flex-wrap: wrap;
}

.trait-grid__search {
  flex: 1;
  min-width: 140px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
}

.trait-grid__sort {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
}

.trait-grid__dir {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

.trait-grid__filters {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.trait-grid__cat {
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;

  &:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
  }
}

.trait-grid__cat--on {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.trait-grid__cat--clear {
  display: flex;
  align-items: center;
  border-style: dashed;
}

.trait-grid__status {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.trait-grid__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
}

.trait-grid__link {
  text-decoration: none;
  color: inherit;
  display: contents;
}

@media (width <= 640px) {
  .trait-grid__search {
    flex-basis: 100%;
  }
}

/* Switch toggle — reusable iOS-style toggle */
.trait-grid__switch {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;

  & input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  & input:checked + .trait-grid__switch-track {
    background: var(--color-primary);
    border-color: var(--color-primary);
  }

  & input:checked + .trait-grid__switch-track::after {
    transform: translateX(14px);
  }
}

.trait-grid__switch-track {
  position: relative;
  width: 30px;
  height: 16px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition:
    background 0.2s,
    border-color 0.2s;
  flex-shrink: 0;

  &::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--color-text-inverse);
    border-radius: 50%;
    transition: transform 0.2s;
  }
}

.explore-grid__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.explore-grid__link {
  text-decoration: none;
  color: inherit;
  display: contents;
}

.explore-grid__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  padding-left: calc(var(--space-md) + 4px);
  border: 1px solid var(--color-border);
  border-left: 4px solid hsl(var(--card-hue, 200) 65% 55%);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  position: relative;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
  cursor: pointer;

  &:hover {
    border-color: hsl(var(--card-hue, 200) 70% 60%);
    box-shadow: 0 2px 12px hsl(var(--card-hue, 200) 60% 50% / 15%);
    transform: translateY(-1px);
  }
}

.explore-grid__card-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.explore-grid__card chr-ideogram {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
}

.explore-grid__symbol {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--color-text);
}

.explore-grid__chr {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono, monospace);
}

.explore-grid__name {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explore-grid__tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.explore-grid__tag {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-subtle, rgb(99 102 241 / 8%));
  color: var(--color-primary);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.explore-grid__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-xs);
}

.explore-grid__cat-badge {
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-elevated, rgb(0 0 0 / 4%));
  color: var(--color-text-muted);
}

.explore-grid__pubs {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


.explore-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.explore-grid__controls {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.explore-grid__search {
  flex: 1;
  min-width: 140px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
}

.explore-grid__sort {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
}

.explore-grid__dir {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s;

  &:hover {
    color: var(--color-primary);
  }
}

.explore-grid__filters {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.explore-grid__cat {
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.15s;

  &:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
  }
}

.explore-grid__cat--on {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.explore-grid__cat--clear {
  display: flex;
  align-items: center;
  border-style: dashed;
}

.explore-grid__status {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

@media (width <= 640px) {
  .explore-grid__search {
    flex-basis: 100%;
  }

  .explore-grid__cards {
    grid-template-columns: 1fr;
  }
}

/* Radar chart — SVG polygon */
.radar-chart {
  display: flex;
  justify-content: center;
}

.radar-chart__svg {
  width: 100%;
  max-width: 400px;
  height: auto;
  overflow: visible;
}

.radar-chart__ring {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 0.5;
}

.radar-chart__axis {
  stroke: var(--color-border);
  stroke-width: 0.5;
  opacity: 0.5;
}

.radar-chart__outline {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2;
  transition: all 0.3s ease;
}

.radar-chart__dot {
  fill: var(--color-primary);
  transition: all 0.3s ease;
}

.radar-chart__label {
  font-size: 13px;
  fill: var(--color-text-muted);
}

.radar-chart__ring-label {
  font-size: 9px;
  fill: var(--color-text-muted);
  opacity: 0.6;
}

.radar-chart__empty {
  color: var(--color-text-muted);
  font-style: italic;
}

@media print {
  .radar-chart__shape {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .radar-chart__svg {
    max-width: 200px;
  }

  .radar-chart__label {
    font-size: 8px;
  }

  .radar-chart__ring-label {
    font-size: 7px;
  }
}

.ss {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.ss__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  z-index: 1;
  max-width: 24rem;
  width: 100%;
  padding: var(--space-xl);
}

.ss__logo {
  width: 8rem;
  height: auto;
  animation: ss-pulse 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgb(99 102 241 / 30%));
}

@keyframes ss-pulse {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

.ss__clock {
  font-size: var(--text-3xl);
  font-weight: 200;
  color: var(--color-text);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

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

.ss__bar {
  height: 8px;
  background: var(--color-surface-alt);
  border-radius: 4px;
  overflow: hidden;
}

.ss__bar--chr {
  height: 4px;
}

.ss__fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.ss__fill--total {
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

.ss__fill--chr {
  background: var(--color-accent);
  opacity: 0.7;
}

.ss__trait {
  font-size: var(--text-lg);
  color: var(--color-text);
  text-align: center;
  margin: 0;
  min-height: 1.5em;
}

.ss__stats {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.ss__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  opacity: 0.4;
  margin: var(--space-xl) 0 0;
}

@media (width <= 480px) {
  .ss__logo {
    width: 6rem;
  }

  .ss__clock {
    font-size: var(--text-2xl);
  }
}

/* DNA helix — vertical animated dot pairs for scoring screen */
.ss__helix {
  position: absolute;
  left: 10%;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  opacity: 0.15;
  pointer-events: none;
}

.ss__dot-pair {
  display: flex;
  justify-content: center;
  width: 60px;
  animation: ss-helix 2s ease-in-out infinite;
}

.ss__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ss__dot--a {
  background: var(--color-primary);
  animation: ss-a 2s ease-in-out infinite;
}

.ss__dot--b {
  background: var(--color-accent);
  animation: ss-b 2s ease-in-out infinite;
}

@keyframes ss-helix {
  0%,
  100% {
    gap: 4px;
  }

  50% {
    gap: 40px;
  }
}

@keyframes ss-a {
  0%,
  100% {
    transform: translateX(-8px);
    opacity: 1;
  }

  50% {
    transform: translateX(8px);
    opacity: 0.4;
  }
}

@keyframes ss-b {
  0%,
  100% {
    transform: translateX(8px);
    opacity: 0.4;
  }

  50% {
    transform: translateX(-8px);
    opacity: 1;
  }
}

@media (width <= 480px) {
  .ss__helix {
    left: 5%;
  }
}

/* Settings drawer — slides down from header */
.settings-drawer__backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgb(0 0 0 / 40%);
  animation: sd-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 201;
  width: min(400px, 90vw);
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  animation: sd-slide-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-drawer--closing .settings-drawer__backdrop {
  animation: sd-fade-out 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.settings-drawer--closing .settings-drawer {
  animation: sd-slide-out 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.settings-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);

  & h2 {
    margin: 0;
    font-size: var(--text-lg);
  }
}

.settings-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);

  &:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
  }
}

.settings-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.settings-drawer__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);

  & h3 {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text-muted);
  }
}

.settings-drawer__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-drawer__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

@keyframes sd-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sd-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes sd-slide-in {
  from {
    transform: translateX(100%);
  }
}

@keyframes sd-slide-out {
  to {
    transform: translateX(100%);
  }
}

/* Settings drawer — row, note, clearing styles */
.settings-drawer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  cursor: pointer;

  & select {
    padding: 2px var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-sm);
  }
}

.settings-drawer__note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0;
  opacity: 0.8;
  line-height: 1.4;
}

.settings-drawer__clearing {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.settings-drawer__profile-progress {
  font-size: var(--text-sm);
  font-family: var(--font-mono, monospace);
  color: var(--color-primary);
  font-weight: 600;
}

.settings-drawer__row--profile {
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--color-primary) 12%, transparent) var(--progress, 0%),
    transparent var(--progress, 0%)
  );
  transition: --progress 0.4s ease;
}

.settings-drawer__row--rebuilding {
  animation: profile-pulse 1.5s ease-in-out infinite;
  cursor: wait;
  pointer-events: none;
}

@keyframes profile-pulse {
  0%,
  100% {
    outline: 1px solid transparent;
  }

  50% {
    outline: 1px solid var(--color-primary);
  }
}

.data-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.data-table__controls {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.data-table__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.data-table__fields {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);

  & legend {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding: 0 var(--space-xs);
  }

  & label {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    white-space: nowrap;
  }
}

.data-table__col-groups {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: var(--space-sm) var(--space-lg);
}

.data-table__col-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.data-table__group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2px;
}

.data-table__scroll {
  overflow-x: auto;
}

.data-table__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.data-table__table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--color-surface);
}

.data-table__sortable {
  cursor: pointer;
  user-select: none;

  &:hover {
    color: var(--color-primary);
  }
}

.data-table__table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.data-table__table tr:hover td {
  background: var(--color-surface-alt);
}

.data-table__trait-link {
  color: var(--color-text);
  text-decoration: none;

  &:hover {
    color: var(--color-primary);
  }
}

/* Table tab sub-tabs */
.table-tab__subs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.table-tab__sub {
  padding: var(--space-xs) var(--space-md);
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.table-tab__sub:hover {
  color: var(--color-text);
}

.table-tab__sub--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Gene table */
.gene-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gene-table__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gene-table__count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.gene-table__col-btn {
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.gene-table__col-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.gene-table__col-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.gene-table__col-option {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
}

.gene-table__scroll {
  overflow-x: auto;
}

.gene-table__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.gene-table__th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 0.15s;
}

.gene-table__th:hover {
  color: var(--color-text);
}

.gene-table__th--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.gene-table__th--num {
  text-align: right;
}

.gene-table__row {
  cursor: pointer;
  transition: background 0.1s;
}

.gene-table__row:hover {
  background: var(--color-surface-elevated, rgb(255 255 255 / 3%));
}

.gene-table__row td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.gene-table__symbol {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  white-space: nowrap;
}

.gene-table__num {
  font-family: var(--font-mono, monospace);
  text-align: right;
}


/* Pages */
/* Coming Soon — layout, header, hero */

home-view {
  display: block;
}

.coming-soon {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header bar --- */

.coming-soon__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.coming-soon__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 800;
  font-size: var(--text-xl);
  letter-spacing: 0.04em;
}

.coming-soon__logo-img {
  height: 9rem;
  width: auto;
  margin-top: -3.4em;
  margin-bottom: -1.3em;
}

.coming-soon__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Hero --- */

.coming-soon__hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-xl) 0;
  position: relative;
}

.coming-soon__hero > *:not(hero-canvas) {
  position: relative;
  z-index: 1;
}

.coming-soon__hero-fade {
  height: 8rem;
  background: linear-gradient(to bottom, transparent, var(--color-surface));
  position: relative;
}

.coming-soon__logo-hero {
  width: 16rem;
  margin-top: -3em;
  margin-bottom: var(--space-lg);
  filter: drop-shadow(0 0 11px rgb(26 146 0 / 40%)) drop-shadow(0 0 2px rgb(146 29 29 / 30%));
}

.coming-soon__title {
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.coming-soon__sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 36rem;
  margin-bottom: var(--space-2xl);
}

.coming-soon__badges {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.coming-soon__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.coming-soon__cta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* Coming Soon — features, footer, mobile */

.coming-soon__features {
  position: relative;
  z-index: 1;
  padding: 0 var(--space-xl) var(--space-3xl);
  background: var(--color-surface);
}

.coming-soon__features-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.coming-soon__features-title {
  text-align: center;
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-2xl);
}

.coming-soon__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  max-width: calc(3 * 15rem + 2 * var(--space-lg));
  margin: 0 auto;
  gap: var(--space-lg);
}

.coming-soon__card {
  padding: var(--space-lg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.coming-soon__card-emoji {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.coming-soon__card h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.coming-soon__card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* --- Footer --- */

.coming-soon__footer {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.coming-soon__footer a {
  color: var(--color-primary);
}

/* --- Mobile --- */

@media (width <= 640px) {
  .coming-soon__header {
    padding: var(--space-sm) var(--space-md);
  }

  .coming-soon__logo-img {
    height: 6rem;
    margin-top: -2.2em;
    margin-bottom: -0.8em;
  }

  .coming-soon__logo {
    font-size: var(--text-lg);
  }

  .coming-soon__back-text {
    display: none;
  }

  .coming-soon__title {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .coming-soon__sub {
    font-size: var(--text-base);
  }

  .coming-soon__cta {
    flex-direction: column;
    align-items: center;
  }
}

.app-view__header {
  margin-bottom: var(--space-lg);
}

.app-view__header-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
}

.app-view__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--color-text);
  font-size: var(--text-xl);
  font-weight: 600;
}

.app-view__logo-img {
  height: 2rem;
}

.app-view__tag {
  font-size: var(--text-sm);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--color-warning);
  color: #000;
  font-weight: 600;
}

.app-view__ind-single {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.app-view__selector {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.app-view__ind-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.app-view__ind-btn:hover {
  border-color: var(--color-primary);
}

.app-view__ind-btn--active {
  border-color: var(--color-primary);
  background: var(--color-surface-alt);
  font-weight: 600;
}

.app-view__ind-btn--scoring {
  border-color: var(--color-accent);
}

.app-view__ind-progress {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.app-view__ind-btn--add:hover {
  border-color: var(--color-warning);
}

.app-view__ind-btn--add-active {
  border-color: var(--color-warning);
  background: var(--color-surface-alt);
  font-weight: 600;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: var(--color-surface-alt);
  position: relative;
  z-index: 21;
}

.app-view__settings {
  margin-left: auto;
  text-decoration: none;
  font-size: var(--text-xl);
  opacity: 0.7;
}

.app-view__settings:hover {
  opacity: 1;
}

.app-view__title {
  font-size: var(--text-2xl);
  margin: 0;
  text-align: center;
}

.app-view__sub {
  color: var(--color-text-muted);
  margin: 0;
  text-align: center;
}

.app-view__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Upload panel — header drawer */
.app-view__upload-panel {
  position: fixed;
  top: var(--header-height, 3.5rem);
  right: var(--space-lg);
  z-index: 95;
  width: min(28rem, calc(100vw - 2 * var(--space-lg)));
  max-height: calc(100vh - var(--header-height, 3.5rem) - var(--space-lg));
  overflow-y: auto;
  padding: var(--space-lg);
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  animation: upload-slide-down 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-view__upload-backdrop {
  position: fixed;
  inset: 0;
  z-index: 94;
  background: transparent;

  &::after {
    content: '';
    position: absolute;
    inset: var(--header-height, 3.5rem) 0 0;
    background: rgb(0 0 0 / 30%);
  }
}

.app-view__upload--closing .app-view__upload-panel {
  animation: upload-slide-up 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.app-view__upload--closing .app-view__upload-backdrop::after {
  animation: upload-fade-out 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes upload-slide-down {
  from {
    transform: translateY(-100%);
  }
}

@keyframes upload-slide-up {
  to {
    transform: translateY(-100%);
  }
}

@keyframes upload-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes upload-fade-out {
  to {
    opacity: 0;
  }
}

/* Upload inline states */
.app-view__status {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.app-view__spinner {
  font-size: 3rem;
  animation: spin 2s linear infinite;
}

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

.app-view__error {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
}

.app-view__error-icon {
  font-size: 2rem;
  margin: 0;
}

.app-view__error-msg {
  color: var(--color-danger);
  margin: 0;
  max-width: 24rem;
}

@media (width <= 640px) {
  .app-view__upload-panel {
    right: 0;
    left: 0;
    width: auto;
    border-radius: 0;
  }
}

.app-view__scoring-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.app-view__scoring-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-view__scoring-bar {
  height: 6px;
  background: var(--color-surface-alt);
  border-radius: 3px;
  overflow: hidden;
}

.app-view__scoring-bar--chr {
  height: 6px;
}

.app-view__scoring-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.app-view__scoring-fill--chr {
  height: 100%;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

.app-view__scoring {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.app-view__scoring--done {
  color: var(--color-success);
}

.beta-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3xl);
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-3xl);
  position: relative;
}

.beta-hero > hero-canvas {
  position: absolute;
  inset: 0;
  bottom: calc(100% - 36rem); /* bleeds through intro + upload zone */
  width: 100%;
  z-index: 0;
  pointer-events: none;
}

.beta-hero > *:not(hero-canvas) {
  position: relative;
  z-index: 1;
}

.beta-hero__intro {
  max-width: 38rem;
}

.beta-hero__logo {
  width: 10rem;
  display: block;
  margin: 0 auto var(--space-lg);
  filter: drop-shadow(0 0 11px rgb(26 146 0 / 40%)) drop-shadow(0 0 2px rgb(146 29 29 / 30%));
}

.beta-hero__title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  margin: 0 0 var(--space-lg);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.beta-hero__sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin: 0;
}

.beta-hero__upload {
  width: 100%;
  max-width: 28rem;
}

.beta-hero__source-link {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-md) 0 0;
}

.beta-hero__source-link a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.beta-hero__source-link a:hover {
  text-decoration: underline;
}

.beta-hero__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
}

.beta-hero__spinner {
  font-size: var(--text-xl);
  animation: hero-spin 1.5s linear infinite;
}

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

.beta-hero__error {
  text-align: center;
  color: var(--color-danger);
  padding: var(--space-lg);
}

.beta-hero__below-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.beta-hero__divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.beta-hero__divider::before,
.beta-hero__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.beta-hero__demo-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-base);
  gap: var(--space-sm);
}

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-lg);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
  border-bottom: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  font-size: var(--text-sm);
  text-align: center;
}

.demo-banner__text {
  color: var(--color-text-muted);
}

.demo-banner__cta {
  flex-shrink: 0;
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-md);
}

.beta-hero__showcase {
  width: 100%;
  max-width: 42rem;
}

.beta-hero__section-title {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-lg);
}

.beta-hero__trait-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  text-align: left;
}

.beta-hero__trait-preview {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.beta-hero__trait-preview:hover {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface-alt));
  text-decoration: none;
}

.beta-hero__trait-emoji {
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.beta-hero__trait-preview strong {
  display: block;
  font-size: var(--text-sm);
}

.beta-hero__trait-detail {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.beta-hero__trait-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-md) 0 0;
}

.beta-hero__trait-count a {
  color: var(--color-primary);
}

.beta-hero__steps {
  width: 100%;
  max-width: 42rem;
}

.beta-hero__step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.beta-hero__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.beta-hero__step-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
}

.beta-hero__step-emoji {
  font-size: var(--text-2xl);
}

.beta-hero__step p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

.beta-hero__privacy {
  max-width: 36rem;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.beta-hero__privacy-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin: 0;
}

.beta-hero__privacy-text a {
  color: var(--color-primary);
}

@media (width <= 640px) {
  .beta-hero__trait-grid {
    grid-template-columns: 1fr;
  }

  .beta-hero__step-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .beta-hero__step {
    flex-direction: row;
    text-align: left;
  }
}

/* Tab bar for beta view */
.app-view__tabs {
  display: flex;
  gap: 0;
}

.app-view__tab {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;

  &:hover {
    color: var(--color-text);
  }
}

.app-view__tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Report tab — layout, header, sections */
.report-tab {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.report-tab__header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  & h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }
}

.report-tab__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.report-tab__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.report-tab__stat-val {
  font-size: var(--text-xl);
  font-weight: 800;
}

.report-tab__stat-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.report-tab__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);

  & h3 {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }
}

.report-tab__overview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-lg);
  align-items: start;
}

.report-tab__overview-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);

  & h3 {
    margin: 0;
    font-size: var(--text-base);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }
}

.report-tab__overview-breakdown {
  min-width: 0;
}

.report-tab__overview-breakdown .report-tab__cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}

.report-tab__overview-breakdown .report-tab__cat-card mini-curve {
  display: none;
}

.report-tab__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.report-tab__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.report-tab__table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
}

.report-tab__table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.report-tab__trait-link {
  color: inherit;
  text-decoration: none;

  &:hover {
    color: var(--color-primary);
  }
}

.report-tab__disclaimer {
  font-size: var(--text-sm);
  color: var(--color-warning);
  font-style: italic;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
}

@media (width <= 640px) {
  .report-tab__stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-tab__overview {
    grid-template-columns: 1fr;
  }
}

/* Report tab — category cards, quality bars, print */
.report-tab__cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-sm);
}

.report-tab__cat-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.report-tab__cat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.report-tab__cat-name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.report-tab__cat-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.report-tab__cat-pct {
  font-size: var(--text-lg);
  font-weight: 800;
}

.report-tab__cat-detail {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.report-tab__cat-bar {
  height: 4px;
  background: var(--color-surface-alt);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-xs) 0;
}

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

.report-tab__quality-summary {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.report-tab__quality-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: var(--space-xs) 0 var(--space-sm);
}

.report-tab__quality-hint a {
  color: var(--color-primary);
  text-decoration: underline;
}

.report-tab__histogram {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 80px;
  padding-top: var(--space-xs);
}

.report-tab__histogram-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.report-tab__histogram-bar {
  width: 100%;
  min-height: 2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  opacity: 0.85;
  transition: height 0.3s ease;
}

.report-tab__histogram-col:nth-child(1) .report-tab__histogram-bar {
  background: #dc2626;
}

.report-tab__histogram-col:nth-child(2) .report-tab__histogram-bar {
  background: #ea580c;
}

.report-tab__histogram-col:nth-child(3) .report-tab__histogram-bar {
  background: #d97706;
}

.report-tab__histogram-col:nth-child(4) .report-tab__histogram-bar {
  background: #ca8a04;
}

.report-tab__histogram-col:nth-child(5) .report-tab__histogram-bar {
  background: #65a30d;
}

.report-tab__histogram-col:nth-child(6) .report-tab__histogram-bar {
  background: #16a34a;
}

.report-tab__histogram-col:nth-child(7) .report-tab__histogram-bar {
  background: #0d9488;
}

.report-tab__histogram-col:nth-child(8) .report-tab__histogram-bar {
  background: #0284c7;
}

.report-tab__histogram-col:nth-child(9) .report-tab__histogram-bar {
  background: #2563eb;
}

.report-tab__histogram-col:nth-child(10) .report-tab__histogram-bar {
  background: #4f46e5;
}

.report-tab__histogram-label {
  font-size: 9px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.report-tab__histogram-axis {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin: var(--space-xs) 0 0;
}

/* Report tab — print styles */
@media print {
  /* Force light colors for ink saving */
  :root {
    --color-text: #1e293b;
    --color-text-muted: #4b5c73;
    --color-bg: #fff;
    --color-surface: #fff;
    --color-surface-alt: #f1f5f9;
    --color-border: #d4d6e4;
    --color-primary: #4f46e5;
  }

  /* Hide non-report UI */
  .app-header,
  .app-footer,
  floating-bar,
  .app-view__tabs,
  .individual-switcher,
  .report-tab__header button,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
    color: #1e293b;
  }

  /* Tighten spacing */
  .report-tab {
    gap: var(--space-sm);
  }

  .report-tab__section {
    gap: var(--space-xs);
    break-inside: avoid;
  }

  .report-tab__overview {
    gap: var(--space-sm);
  }

  .report-tab__overview-breakdown mini-curve {
    display: none;
  }

  .report-tab__cat-grid {
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    gap: var(--space-xs);
  }

  .report-tab__cat-card {
    padding: var(--space-xs) var(--space-sm);
  }

  .report-tab__stat,
  .report-tab__cat-card {
    border: 1px solid #ccc;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-tab__qbar-fill,
  .report-tab__cat-bar-fill,
  .report-tab__cat-badge {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .report-tab__disclaimer {
    display: none;
  }

  .report-tab__section:has(.report-tab__histogram) {
    display: none;
  }
}

.trait-detail__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
}

.trait-detail__breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-xs);
  margin: calc(-1 * var(--space-xs)) 0;
  border-radius: var(--radius-md);

  &:hover {
    background: var(--color-surface-alt);
  }

  @media (width <= 640px) {
    min-height: 2.75rem;
  }
}

.trait-detail__breadcrumb-sep {
  color: var(--color-text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.trait-detail__breadcrumb-current {
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-detail__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);

  @media (width <= 640px) {
    grid-template-columns: 1fr;
  }
}

.trait-detail__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);

  & h2 {
    font-size: var(--text-base);
    margin: 0;
    color: var(--color-text-muted);
  }
}

.trait-detail__value {
  font-size: var(--text-lg);
  margin: 0;
}

.trait-detail__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;

  & a {
    color: var(--color-primary);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  & app-icon {
    vertical-align: -0.1em;
    opacity: 0.6;
  }
}

.trait-detail__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);

  & h2 {
    margin: 0;
  }
}

.trait-detail__pgs-link {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;

  &:hover {
    text-decoration: underline;
  }
}

.trait-detail__help-link {
  color: var(--color-text-muted);
  opacity: 0.6;
  transition: opacity 0.15s;

  &:hover {
    opacity: 1;
    color: var(--color-primary);
  }
}

/* Trait detail helper section styles — bars, upsell, nodata */
.trait-detail__balance-bar {
  height: 12px;
  background: var(--color-success);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.trait-detail__balance-risk {
  height: 100%;
  background: var(--color-danger);
  transition: width 0.3s ease;
}

.trait-detail__coverage-bar {
  height: 12px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.trait-detail__coverage-fill {
  height: 100%;
  background: var(--color-info);
  transition: width 0.3s ease;
}

.trait-detail__grid--wide {
  grid-column: 1 / -1;
}

.trait-detail__score-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.trait-detail__score-stats,
.trait-detail__score-meta {
  justify-content: center;
}

.trait-detail__score-hero-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  cursor: help;
}

.trait-detail__score-hero .mini-curve-wrap {
  width: 100%;
  align-self: stretch;
}

.trait-detail__score-stats {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.trait-detail__score-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.trait-detail__r2-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
  text-align: center;
}

.trait-detail__percentile {
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1;
}

.trait-detail__pct-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.trait-detail__pred {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.trait-detail__hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: stretch;
  margin-bottom: var(--space-lg);

  @media (width <= 640px) {
    grid-template-columns: 1fr;
    margin-bottom: 0;

    & .trait-detail__identity {
      min-height: 280px;
    }
  }
}

.trait-detail__identity {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    var(--color-surface) 0%,
    var(--color-surface-alt) 50%,
    var(--color-primary) 150%
  );
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.trait-detail__identity--cover {
  color: #fff;

  & .trait-detail__desc {
    color: rgb(255 255 255 / 70%);
  }
}

.trait-detail__attribution {
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-sm);
  font-size: 0.6rem;
  color: rgb(255 255 255 / 40%);
  text-decoration: none;

  &:hover {
    color: rgb(255 255 255 / 70%);
  }
}

.trait-detail__hero-emoji {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 70%));
}

.trait-detail__identity-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-shadow: 0 1px 4px rgb(0 0 0 / 80%);
}

.trait-detail__title {
  font-size: var(--text-2xl);
  margin: 0;
  line-height: 1.2;
}

.trait-detail__desc {
  color: var(--color-text-muted);
  margin: 0;
  font-size: var(--text-sm);
}

.trait-detail__empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.trait-detail__nodata {
  color: var(--color-text-muted);
  margin: 0;
}

.trait-detail__upsell {
  font-size: var(--text-sm);
  color: var(--color-warning);
  margin: 0;
  font-style: italic;
}

.trait-detail__interp {
  font-size: var(--text-sm);
  margin: 0;
  text-align: center;
}

.trait-detail__interp--neutral {
  color: var(--color-text-muted);
}

.trait-detail__interp--good {
  color: var(--color-success);
}

.trait-detail__interp--caution {
  color: var(--color-warning);
}

/* Top variants — table with waterfall background */
.trait-detail__variants {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trait-detail__variants-title {
  margin: 0;
  padding-bottom: var(--space-sm);
}

.trait-detail__variants-scroll {
  max-height: 12rem;
  overflow-y: auto;
}

/* Waterfall layer — sits behind tbody rows */
.trait-detail__variants-body {
  position: relative;
}

.trait-detail__var-wf-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding-top: calc(1.75rem + 2px); /* offset for thead height + alignment */
}

.trait-detail__var-wf-zero {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
  opacity: 0.3;
}

.trait-detail__var-wf-row {
  flex: 1;
  position: relative;
}

.trait-detail__var-wf-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  opacity: 0.25;
}

/* Table sits on top of waterfall */
.trait-detail__var-table {
  position: relative;
  z-index: 1;
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.trait-detail__var-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.trait-detail__var-table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
  background: var(--color-surface);
}

.trait-detail__var-table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: transparent;
  line-height: 1.4;
}

.trait-detail__var-table tbody tr {
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
}

.trait-detail__var-link {
  color: var(--color-primary);
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

.trait-detail__var-geno {
  font-weight: 600;
  color: var(--color-accent);
}

.trait-detail__var-impact {
  font-weight: 600;
}

/* Trait detail unscored/empty state styles */
.trait-detail__empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  opacity: 0.6;
}

.trait-detail__info-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.trait-detail__info-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}

.trait-detail__info-label {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.trait-detail__info-value {
  text-align: right;
}

.trait-detail__feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--text-sm);

  & li {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }
}

/* Gene ticks */
.chr-rail__tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  text-decoration: none;
  z-index: 2;
}

.chr-rail__tick-mark {
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: rgb(255 255 255 / 45%);
  border-radius: 1px;
  box-shadow: 0 0 2px rgb(0 0 0 / 60%);
  transition:
    background 0.2s,
    height 0.2s,
    box-shadow 0.2s;
}

.chr-rail__tick--active .chr-rail__tick-mark {
  height: 4px;
  top: -2px;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.chr-rail__tick:hover .chr-rail__tick-mark {
  background: rgb(255 255 255 / 90%);
  height: 3px;
}

.chr-rail__tick-highlight {
  position: absolute;
  left: -3px;
  right: -3px;
  top: -12px;
  height: 24px;
  background: rgb(255 255 255 / 8%);
  border-radius: 4px;
  transition: opacity 0.25s ease;
  opacity: 0;
}

.chr-rail__tick:hover .chr-rail__tick-highlight {
  opacity: 1;
  animation: tick-pulse 1s ease-in-out infinite;
}

.chr-rail__tick--active .chr-rail__tick-highlight {
  opacity: 1;
  background: rgb(99 102 241 / 15%);
  animation: tick-pulse 2s ease-in-out infinite;
}

@keyframes tick-pulse {
  0%,
  100% {
    transform: scaleX(1);
    opacity: 0.8;
  }

  50% {
    transform: scaleX(1.3);
    opacity: 1;
  }
}

/* Mobile: rail clips off right edge, content gets max space */
@media (width <= 640px) {
  .gene-detail--with-rail {
    grid-template-columns: 1fr 42px;
    gap: 0;
  }

  /* Break out of app-layout__content right padding */
  .app-layout__content:has(.gene-detail--with-rail) {
    padding-right: 0;
  }

  .gene-detail__main {
    padding-right: 0;
  }

  .gene-detail--with-rail .chr-rail {
    --rail-labels-w: 57px;
    --rail-conn-w: 9px;
    --rail-track-w: 36px;

    align-self: stretch;
    height: auto;
    min-height: 100%;
    position: relative;
    top: 0;
    width: 60px;
    gap: 2px;
  }

  .gene-detail--with-rail .chr-rail__header,
  .gene-detail--with-rail .chr-rail__footer {
    margin-left: 0;
    width: auto;
    align-self: center;
  }

  .chr-rail__body {
    height: 100%;
  }

  .gene-detail--with-rail .chr-rail__track-clip {
    width: calc(var(--rail-track-w) / 2);
    overflow: hidden;
  }

  .gene-detail--with-rail .chr-rail__track {
    border-radius: 17px;
  }

  .chr-rail__strip {
    border-radius: 16px;
  }

  .chr-rail__label {
    font-size: 8px;
  }

  .chr-rail__label--active {
    font-size: 9px;
  }

  .chr-rail__header {
    font-size: 9px;
  }

  .chr-rail__footer {
    font-size: 8px;
  }
}

.chr-rail__track-clip {
  flex-shrink: 0;
  align-self: stretch;
  width: var(--rail-track-w);
  overflow: visible;
  position: relative;
}

.chr-rail__track {
  width: var(--rail-track-w);
  height: 100%;
  flex-shrink: 0;
  align-self: stretch;
  position: relative;
  border-radius: 18px;
  overflow: visible;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
}

.chr-rail--raw .chr-rail__track {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.chr-rail__track::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 17px;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgb(120 120 150 / 25%) 4px,
    rgb(120 120 150 / 25%) 6px
  );
  z-index: 0;
}

.chr-rail__strip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  overflow: hidden;
  z-index: 1;
}

.chr-rail__strip--empty {
  background: var(--color-surface-alt);
  border-radius: 17px;
}


/* ===== Vertical chromosome rail ===== */
.chr-rail {
  --rail-labels-w: 50px;
  --rail-conn-w: 24px;
  --rail-track-w: 36px;

  position: sticky;
  top: 80px;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: calc(100vh - 120px);
  min-height: 500px;
  user-select: none;
}

.chr-rail__header,
.chr-rail__footer {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
  width: var(--rail-track-w);
  margin-left: calc(var(--rail-labels-w) + var(--rail-conn-w));
}

.chr-rail__header .chr-icon {
  display: block;
  margin: 0 auto;
}

.chr-rail__body {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 0;
  position: relative;
}

.chr-rail__labels {
  position: relative;
  width: var(--rail-labels-w);
  flex-shrink: 0;
}

.chr-rail__label {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 9px;
  font-family: var(--font-mono, monospace);
  color: var(--color-text-muted);
  text-decoration: none;
  opacity: 0.7;
  white-space: nowrap;
  transition:
    opacity 0.2s,
    color 0.2s;
}

.chr-rail__label--active {
  opacity: 1;
  color: var(--color-primary, #6366f1);
  font-weight: 600;
  font-size: 10px;
}

.chr-rail__label:hover {
  opacity: 1;
  color: var(--color-text, #e5e7eb);
}

/* SVG connector lines */
.chr-rail__conn-wrap {
  width: var(--rail-conn-w);
  flex-shrink: 0;
  position: relative;
}

.chr-rail__conn-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chr-rail__svg-line {
  stroke: var(--color-text-muted, #6b7280);
  vector-effect: non-scaling-stroke;
  stroke-width: 1;
}

.chr-rail__svg-line.chr-rail__svg-active {
  stroke: var(--color-primary, #6366f1);
  stroke-width: 1.5;
}

/* Variants section */
.gene-detail__variants {
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.gene-detail__variants--imputed {
  border-color: var(--color-success, #22c55e);
  background: rgb(34 197 94 / 4%);
}

.gene-detail__coverage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.gene-detail__coverage-badge--full {
  background: rgb(34 197 94 / 12%);
  color: var(--color-success, #22c55e);
}

.gene-detail__coverage-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.gene-detail__empty-msg {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.gene-detail__variant-summary {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.gene-detail__hit-count {
  font-weight: 700;
  color: var(--color-text-muted);
}

.gene-detail__hit-count--found {
  color: var(--color-success, #22c55e);
}

.gene-detail__hit-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.gene-detail__hit-rsid {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgb(34 197 94 / 10%);
  color: var(--color-success, #22c55e);
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
}

.gene-detail__impute-cta {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);

  & p {
    margin: 0 0 var(--space-sm);
  }
}

.gene-detail__impute-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-text-inverse, #fff);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;

  &:hover {
    opacity: 0.85;
  }
}

/* Per-gene variant stats */
.gene-detail__gene-stats {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin: var(--space-sm) 0;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-border);
}

.gene-detail__gene-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gene-detail__gene-stat-val {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--color-text);
}

.gene-detail__gene-stat-lbl {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.gene-detail__nonref-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-xs) 0 0;
  line-height: 1.5;
}

/* Individual label in Your Data */
.gene-detail__ind-label {
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-left: auto;
}

/* Description */
.gene-detail__description {
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.gene-detail__description .gene-detail__desc-text {
  margin: 0 0 var(--space-sm);
}

.gene-detail__description .gene-detail__desc-text:last-of-type {
  margin-bottom: 0;
}

.gene-detail__desc-text {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
}

.gene-detail__desc-text--editorial {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
}

.gene-detail__desc-text--fun {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-primary-subtle, rgb(99 102 241 / 6%));
  font-style: italic;
}

/* Aliases */
.gene-detail__aliases {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.gene-detail__aliases-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.gene-detail__alias {
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

/* Collapsible NCBI summary */
.gene-detail__ncbi-summary {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.gene-detail__ncbi-summary summary {
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  opacity: 0.7;
}

.gene-detail__ncbi-summary summary:hover {
  opacity: 1;
}

.gene-detail__ncbi-summary p {
  margin-top: var(--space-xs);
  line-height: 1.6;
}

/* Clinical significance badges */
.gene-detail__sig-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-transform: capitalize;
}

.gene-detail__sig-badge--high {
  background: rgb(239 68 68 / 12%);
  color: #f87171;
}

.gene-detail__sig-badge--moderate {
  background: rgb(251 191 36 / 12%);
  color: #fbbf24;
}

.gene-detail__sig-badge--low {
  background: rgb(34 197 94 / 12%);
  color: #4ade80;
}

/* Stats */
.gene-detail__stats {
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.gene-detail__stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-md);
}

.gene-detail__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gene-detail__stat-value {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--color-text);
}

.gene-detail__stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Links */
.gene-detail__links {
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.gene-detail__link-list {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.gene-detail__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--color-primary);
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

/* Loading */
.gene-detail__loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
}


.gene-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.gene-detail--with-rail {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: var(--space-md);
  max-width: 900px;
}

@media (width <= 640px) {
  .gene-detail--with-rail {
    grid-template-columns: 1fr 72px;
    gap: 0;
  }
}

.gene-detail__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

/* Breadcrumb */
.gene-detail__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
}

.gene-detail__breadcrumb-back {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-muted);
  text-decoration: none;

  &:hover {
    color: var(--color-primary);
  }
}

.gene-detail__breadcrumb-sep {
  color: var(--color-text-muted);
}

.gene-detail__breadcrumb-current {
  color: var(--color-text);
  font-weight: 500;
}

/* Hero */
.gene-detail__hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gene-detail__hero-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.gene-detail__title {
  font-size: var(--text-3xl, 2rem);
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  margin: 0;
  letter-spacing: -0.02em;
}

.gene-detail__subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0;
}

.gene-detail__hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.gene-detail__location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-family: var(--font-mono, monospace);
  color: var(--color-text-muted);
}

.gene-detail__cat-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-subtle, rgb(99 102 241 / 10%));
  color: var(--color-primary);
  font-weight: 500;
}

.gene-detail__pubs {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.gene-detail__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gene-detail__tag {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-subtle, rgb(99 102 241 / 8%));
  color: var(--color-primary);
  font-size: var(--text-sm);
}

/* Sections */
.gene-detail__section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-base);
  font-weight: 600;
  margin: 0 0 var(--space-sm);
}

.report {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.report__content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg);
  flex: 1;
  width: 100%;
}

.report__header {
  margin-bottom: var(--space-2xl);
}

.report__header h1 {
  font-size: var(--text-2xl);
  margin: var(--space-md) 0 var(--space-xs);
}

.report__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);

  &:hover {
    color: var(--color-primary);
  }
}

.report__date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.report__disclaimer {
  font-size: var(--text-sm);
  color: var(--color-warning);
  margin: var(--space-sm) 0 0;
}

.report__section {
  margin: var(--space-xl) 0;
}

.report__section h2 {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-md);
}

.report__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-sm) 0 0;
}

.report__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.report__table th {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
}

.report__table td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

@media print {
  .no-print {
    display: none !important;
  }

  .report {
    padding: 0;
    color: #000;
  }

  .report__header h1 {
    font-size: 1.5rem;
  }

  .report__section {
    break-inside: avoid;
  }
}


.demo-badge {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.65em;
  font-weight: 600;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  vertical-align: middle;
  background: color-mix(in srgb, var(--color-warning) 18%, transparent);
  color: var(--color-warning);
  border: 1px solid color-mix(in srgb, var(--color-warning) 35%, transparent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
