:root {
  /* Base surfaces — deep, near-monochrome dark glass */
  --bg: #06080c;
  --bg-2: #0a0e14;
  --panel: rgba(255, 255, 255, 0.026);
  --panel-2: rgba(255, 255, 255, 0.04);
  --panel-3: rgba(255, 255, 255, 0.055);
  --line: rgba(158, 188, 218, 0.12);
  --line-strong: rgba(158, 188, 218, 0.22);
  --text: #e9eef4;
  --muted: #8a97a8;
  --soft: #bdc9d7;
  /* One restrained cool UI accent (no rainbow) */
  --accent: #9fb4c9;
  --accent-bright: #cfdcec;
  --accent-dim: rgba(159, 180, 201, 0.12);
  /* Per-region tint — set inline per part, kept light/subtle */
  --part-color: #9fb4c9;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.34);
  /* Legacy aliases (kept so older rules resolve to the new accent) */
  --cyan: var(--accent);
  --amber: var(--accent);
  --magenta: var(--accent);
  --green: var(--accent);
  --violet: var(--accent);
  --orange: var(--accent);
  --danger: var(--accent);
}

/* Light, subtle tint derived from each region's base color */
* { --tint: color-mix(in srgb, var(--part-color), white 42%); }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(159, 180, 201, 0.07), transparent 42rem),
    radial-gradient(circle at 12% 108%, rgba(159, 180, 201, 0.05), transparent 34rem),
    linear-gradient(160deg, #070a10 0%, #060809 52%, #05070b 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  letter-spacing: 0.1px;
  -webkit-font-smoothing: antialiased;
}

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

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.72), rgba(6, 8, 12, 0.82));
  backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 11px;
  align-items: center;
  min-height: 44px;
  flex: 0 0 auto;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(159, 180, 201, 0.12), rgba(159, 180, 201, 0.03)),
    rgba(10, 14, 20, 0.9);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(207, 220, 236, 0.42);
}

.brand-mark::before {
  inset: 10px 13px;
  border-radius: 16px 16px 9px 9px;
}

.brand-mark::after {
  left: 20px;
  top: 7px;
  bottom: 7px;
  width: 1px;
  border-width: 0 0 0 1px;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.page-nav {
  display: inline-flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-link iconify-icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  border-color: var(--line);
  color: var(--text);
  background: var(--accent-dim);
  outline: none;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.search-box label,
.part-list-heading,
.eyebrow,
.article-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.article-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.article-kicker-icon,
.article-title-icon {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.search-box label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 0 12px;
  outline: none;
}

.search-box input:focus {
  border-color: color-mix(in srgb, var(--accent), transparent 35%);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.part-list-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.parts-list {
  display: grid;
  gap: 8px;
}

.part-button {
  width: 100%;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 11px;
  align-items: start;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.part-button:hover,
.part-button:focus-visible {
  background: rgba(255, 255, 255, 0.03);
  border-left-color: color-mix(in srgb, var(--tint), transparent 30%);
  outline: none;
}

.part-button.is-active {
  background: color-mix(in srgb, var(--tint), transparent 92%);
  border-color: var(--line);
  border-left-color: var(--tint);
}

/* Quiet tint dot replaces the glowing swatch */
.part-swatch {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  display: block;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: 0 0 8px color-mix(in srgb, var(--tint), transparent 55%);
}

.part-swatch .part-icon {
  display: none;
}

.part-button strong {
  display: block;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.part-button span:last-child {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px 18px;
  min-height: 72px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 8, 12, 0.55);
  backdrop-filter: blur(18px);
}

.topbar .page-nav {
  margin-right: auto;
}

.topbar-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.language-switcher {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.lang-btn {
  min-height: 34px;
  min-width: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
}

.lang-btn:hover,
.lang-btn:focus-visible,
.lang-btn.is-active {
  color: var(--text);
  border-color: var(--line);
  background: var(--accent-dim);
  outline: none;
}

.eyebrow,
.article-kicker {
  margin: 0 0 4px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar-actions {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.control-btn {
  min-height: 34px;
  min-width: 66px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.control-btn:hover,
.control-btn:focus-visible,
.control-btn.is-active {
  color: var(--text);
  border-color: var(--line);
  background: var(--accent-dim);
  outline: none;
}

.atlas-screen {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.stage-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(159, 180, 201, 0.05), transparent 30rem),
    radial-gradient(ellipse at 50% 120%, rgba(159, 180, 201, 0.04), transparent 60%),
    #05070b;
}

/* Faint depth grid behind the brain (parallax handled in JS via transform) */
.stage-panel::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  background:
    linear-gradient(rgba(158, 188, 218, 0.04) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, rgba(158, 188, 218, 0.04) 1px, transparent 1px) 0 0 / 56px 100%;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 78%);
  transform: translate(var(--par-x, 0px), var(--par-y, 0px));
  pointer-events: none;
}

#brainCanvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: auto;
}

.brain-render {
  --brain-x: 0px;
  --brain-scale: 1;
  position: absolute;
  z-index: 1;
  inset: 26px 42px 34px;
  width: calc(100% - 84px);
  height: calc(100% - 60px);
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.45)) saturate(1.08) contrast(1.04);
  animation: brainFloat 7s ease-in-out infinite;
  display: none;
}

.stage-panel[data-view="half"] .brain-render {
  --brain-x: -3%;
  --brain-scale: 1.04;
  clip-path: inset(0 28% 0 0 round 8px);
}

.stage-panel[data-view="inside"] .brain-render {
  opacity: 0.64;
  filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.45)) saturate(0.9) contrast(1.08);
}

.stage-panel[data-view="split"] .brain-render {
  --brain-scale: 0.96;
  filter: drop-shadow(0 24px 52px rgba(0, 0, 0, 0.48)) saturate(1.16) contrast(1.06);
}

.stage-panel[data-view="inside"] .brain-hotspots::before {
  content: "";
  position: absolute;
  left: 38%;
  top: 34%;
  width: 28%;
  height: 38%;
  border: 1px solid rgba(56, 232, 211, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 48% 30%, rgba(240, 98, 180, 0.26), transparent 28%),
    radial-gradient(circle at 52% 58%, rgba(56, 232, 211, 0.24), transparent 34%),
    radial-gradient(circle at 58% 78%, rgba(240, 200, 106, 0.18), transparent 24%);
  box-shadow: inset 0 0 28px rgba(56, 232, 211, 0.16), 0 0 34px rgba(56, 232, 211, 0.16);
  pointer-events: none;
}

.brain-hotspots {
  display: none;
}

.brain-hotspot {
  --hotspot-color: var(--cyan);
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--hotspot-color), white 22%);
  border-radius: 50%;
  color: var(--text);
  background: radial-gradient(circle, color-mix(in srgb, var(--hotspot-color), white 22%) 0 30%, rgba(6, 10, 14, 0.78) 32% 100%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hotspot-color), transparent 60%), 0 6px 14px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 160ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.brain-hotspot::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  min-width: max-content;
  max-width: 150px;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--hotspot-color), white 12%);
  border-radius: 7px;
  color: var(--soft);
  background: rgba(7, 11, 16, 0.84);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  font-size: 0.68rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.brain-hotspot:hover,
.brain-hotspot:focus-visible,
.brain-hotspot.is-active {
  border-color: color-mix(in srgb, var(--hotspot-color), white 44%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hotspot-color), transparent 70%), 0 6px 16px rgba(0, 0, 0, 0.4);
  outline: none;
  transform: translate(-50%, -50%) scale(1.18);
}

.brain-hotspot:hover::after,
.brain-hotspot:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes brainFloat {
  0%,
  100% {
    transform: translate(var(--brain-x), 0) scale(var(--brain-scale));
  }
  50% {
    transform: translate(var(--brain-x), -8px) scale(calc(var(--brain-scale) + 0.01));
  }
}

.label-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: none;
}

.label-layer.is-visible {
  display: none;
}

.brain-callout {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  min-height: 0;
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--tint);
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 16, 0.66);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft), 0 0 24px color-mix(in srgb, var(--tint), transparent 82%);
  opacity: 0;
  transform-origin: top left;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 200ms ease;
}

.brain-callout.is-visible {
  opacity: 1;
}

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

.callout-icon {
  width: 24px;
  height: 24px;
  color: var(--part-color);
}

.callout-head small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.callout-head strong {
  display: block;
  font-size: 0.86rem;
}

.brain-callout p {
  margin: 7px 0 0;
  color: var(--soft);
  font-size: 0.78rem;
}

.callout-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  line-height: 1;
}

.callout-close:hover,
.callout-close:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--part-color), white 12%);
  outline: none;
}

.scan-overlay {
  display: none;
}

.model-status,
.legend-card {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 11, 16, 0.5);
  backdrop-filter: blur(16px);
}

.model-status {
  left: 16px;
  top: 16px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent), transparent 40%);
}

/* Region name already lives in the bottom card — keep this quiet */
.legend-card {
  display: none;
}

.legend-accent {
  width: 6px;
  align-self: stretch;
  min-height: 34px;
  border-radius: 6px;
  background: var(--cyan);
}

.legend-card small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.legend-card strong {
  display: block;
  overflow-wrap: anywhere;
}

/* Dive / Surface control on the stage */
.stage-control {
  position: absolute;
  z-index: 6;
  right: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(8, 11, 16, 0.5);
  backdrop-filter: blur(16px);
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 180ms ease, background 180ms ease;
}

.stage-control iconify-icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.stage-control:hover,
.stage-control:focus-visible {
  border-color: color-mix(in srgb, var(--accent), transparent 30%);
  background: var(--accent-dim);
  outline: none;
}

/* Dive caption overlay (neuron mode) */
.neuron-caption {
  position: absolute;
  z-index: 6;
  left: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100% - 32px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(8, 11, 16, 0.62);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 360ms ease, transform 360ms ease;
  pointer-events: none;
}

.neuron-caption.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.neuron-caption small {
  display: block;
  color: var(--accent-bright);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.neuron-caption strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 1.02rem;
}

.neuron-caption p {
  margin: 0;
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.42;
}

.stage-panel:not([data-mode="dive"]) .neuron-caption {
  display: none;
}

/* Hover label for any region (dot or mesh) — replaces the old sidebar list */
.node-tip {
  position: absolute;
  z-index: 7;
  left: 0;
  top: 0;
  transform: translate(13px, -50%);
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--tint);
  border-radius: 7px;
  background: rgba(8, 11, 16, 0.82);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 0.76rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.node-tip.is-visible {
  opacity: 1;
}

/* "Due for review" badge inside the Study tab */
.review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: #06080c;
  background: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
}

.review-badge[hidden] {
  display: none;
}

/* Slim bottom dock — a single short→long region card */
.info-dock {
  position: relative;
  display: block;
  padding: 12px 26px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.34), rgba(6, 8, 12, 0.66));
  backdrop-filter: blur(14px);
}

.region-card {
  position: relative;
  border: 1px solid var(--line);
  border-left: 2px solid var(--tint);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  transition: border-color 200ms ease, background 200ms ease;
}

.region-card:hover {
  border-color: var(--line-strong);
}

.region-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.region-card__dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: 0 0 12px color-mix(in srgb, var(--tint), transparent 40%);
}

.region-card__titles {
  min-width: 0;
  flex: 1 1 auto;
}

.region-card__titles small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.region-card__titles strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
}

.region-card__hint {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.region-card__hint iconify-icon {
  width: 16px;
  height: 16px;
  transition: transform 240ms ease;
}

.region-card.is-expanded .region-card__hint iconify-icon {
  transform: rotate(180deg);
}

.region-card__short {
  margin: 9px 0 0;
  color: var(--soft);
  font-size: 0.86rem;
  line-height: 1.4;
}

.region-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.region-chip iconify-icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.region-chip:hover,
.region-chip:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--tint), transparent 30%);
  background: color-mix(in srgb, var(--tint), transparent 90%);
  outline: none;
}

.region-chip.is-queued {
  border-color: color-mix(in srgb, var(--tint), transparent 25%);
  background: color-mix(in srgb, var(--tint), transparent 86%);
  color: var(--text);
}

/* Long form — revealed on double-click */
.region-card__long {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 360ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 280ms ease, margin-top 360ms ease;
  margin-top: 0;
}

.region-card.is-expanded .region-card__long {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 12px;
}

.region-card__long-inner {
  overflow: hidden;
  min-height: 0;
}

.region-long-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  max-height: 34vh;
  overflow: auto;
}

.region-long-block h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  color: var(--accent-bright);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.region-long-block h4 iconify-icon {
  width: 15px;
  height: 15px;
  color: var(--tint);
}

.region-long-block p {
  margin: 0;
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.42;
}

.region-pathway {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.region-pathway span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.74rem;
}

.region-pathway b {
  color: color-mix(in srgb, var(--tint), white 10%);
  font-weight: 700;
}

.info-main,
.info-grid,
.article-panel,
.study-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.78);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.22);
}

.info-main {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-color: rgba(180, 245, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(8, 12, 18, 0.9);
}

.info-main::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -42px;
  width: 128px;
  height: 128px;
  border: 1px solid color-mix(in srgb, var(--part-color), transparent 52%);
  border-radius: 50%;
  box-shadow: inset 0 0 28px color-mix(in srgb, var(--part-color), transparent 80%);
  opacity: 0.58;
  pointer-events: none;
}

.info-main h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.info-main p {
  margin-bottom: 14px;
  color: var(--soft);
}

.info-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.info-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--part-color), white 18%);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--part-color), transparent 68%), rgba(255, 255, 255, 0.03));
  box-shadow: 0 0 24px color-mix(in srgb, var(--part-color), transparent 62%);
}

.info-icon-glyph {
  width: 24px;
  height: 24px;
  color: var(--part-color);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(180, 245, 255, 0.16);
  border-radius: 7px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.74rem;
}

.info-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.console-modules::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 28px;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--part-color), transparent 35%), transparent 78%);
  opacity: 0.52;
  pointer-events: none;
}

.fact-card {
  position: relative;
  min-height: 0;
  padding: 13px 13px 12px;
  overflow: hidden;
  border: 1px solid rgba(180, 245, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(9, 13, 19, 0.84);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 34px rgba(0, 0, 0, 0.2);
}

.fact-card::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  width: 38px;
  height: 2px;
  background: color-mix(in srgb, var(--part-color), white 8%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--part-color), transparent 42%);
}

.fact-card h3,
.fact-card summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  min-height: 0;
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.fact-card h3::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--part-color);
  box-shadow: 0 0 14px var(--part-color);
}

.fact-card summary {
  cursor: pointer;
  list-style: none;
}

.fact-card summary::after {
  content: "+";
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(180, 245, 255, 0.18);
  border-radius: 7px;
  color: var(--part-color);
  background: rgba(255, 255, 255, 0.035);
  font-size: 1rem;
}

.summary-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summary-copy strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.2;
}

.summary-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.fact-card[open] summary::after {
  content: "-";
}

.fact-card summary::-webkit-details-marker {
  display: none;
}

.card-icon {
  width: 18px;
  height: 18px;
  color: var(--part-color);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--part-color), transparent 50%));
}

.fact-card p,
.fact-card li {
  color: #d0dde0;
  font-size: 0.82rem;
  line-height: 1.36;
}

.fact-card p {
  display: -webkit-box;
  margin-bottom: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.fact-card ul {
  margin: 0;
  padding-left: 18px;
}

.fact-card.expandable {
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.fact-card.expandable:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--part-color), white 12%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--part-color), transparent 88%), rgba(255, 255, 255, 0.018)),
    rgba(9, 13, 19, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 42px rgba(0, 0, 0, 0.28);
}

.fact-card.expandable[open] {
  grid-column: span 1;
  min-height: 0;
  border-color: color-mix(in srgb, var(--part-color), white 10%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--part-color), transparent 72%), 0 16px 42px rgba(0, 0, 0, 0.3);
}

.fact-card.expandable[open] p {
  display: block;
}

.expanded-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.dock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.primary-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.86rem;
}

.primary-link {
  border: 1px solid color-mix(in srgb, var(--part-color), white 18%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--part-color), transparent 68%), rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 18px color-mix(in srgb, var(--part-color), transparent 82%);
}

.ghost-link {
  border: 1px solid var(--line);
  color: var(--soft);
  background: rgba(255, 255, 255, 0.035);
}

.action-icon {
  width: 17px;
  height: 17px;
  margin-right: 7px;
}

.article-screen {
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.article-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.article-panel {
  padding: 20px;
}

.article-panel h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.article-panel p {
  color: var(--soft);
}

.article-panel .lede {
  color: var(--text);
  font-size: 1.02rem;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 1rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.note-block {
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.72);
}

.note-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1rem;
}

.note-block p,
.note-block li {
  color: var(--soft);
  font-size: 0.93rem;
}

.note-block ul {
  margin: 0;
  padding-left: 18px;
}

.pathway-map {
  display: grid;
  gap: 10px;
}

.path-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 52px;
}

.path-step span:first-child {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(56, 232, 211, 0.08);
  font-weight: 700;
}

.path-step strong {
  display: block;
  color: var(--text);
}

.path-step small {
  color: var(--muted);
}

.neuron-diagram {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(56, 232, 211, 0.08), rgba(240, 98, 180, 0.06)),
    rgba(255, 255, 255, 0.03);
}

.neuron-diagram::before {
  content: "";
  position: absolute;
  left: 16%;
  top: 38%;
  width: 110px;
  height: 110px;
  border: 2px solid rgba(56, 232, 211, 0.7);
  border-radius: 50%;
  background: rgba(56, 232, 211, 0.08);
  box-shadow: 0 0 48px rgba(56, 232, 211, 0.18);
}

.neuron-diagram::after {
  content: "";
  position: absolute;
  left: calc(16% + 108px);
  right: 12%;
  top: calc(38% + 54px);
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--magenta));
  box-shadow: 0 0 22px rgba(240, 98, 180, 0.28);
}

.axon-node {
  position: absolute;
  top: calc(38% + 38px);
  width: 30px;
  height: 30px;
  border: 1px solid rgba(240, 200, 106, 0.7);
  border-radius: 8px;
  background: rgba(240, 200, 106, 0.16);
}

.axon-node.one {
  left: 43%;
}

.axon-node.two {
  left: 58%;
}

.axon-node.three {
  left: 73%;
}

.dendrite {
  position: absolute;
  width: 82px;
  height: 2px;
  background: rgba(56, 232, 211, 0.7);
  transform-origin: right center;
}

.dendrite.a {
  left: 8%;
  top: 33%;
  transform: rotate(24deg);
}

.dendrite.b {
  left: 6%;
  top: 50%;
  transform: rotate(-18deg);
}

.dendrite.c {
  left: 12%;
  top: 67%;
  transform: rotate(-46deg);
}

.diagram-label {
  position: absolute;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--soft);
  background: rgba(7, 9, 13, 0.7);
  font-size: 0.78rem;
}

.diagram-label.soma {
  left: 17%;
  top: 24%;
}

.diagram-label.axon {
  left: 55%;
  top: 28%;
}

.diagram-label.synapse {
  right: 8%;
  top: 56%;
}

.neuron-figure {
  position: relative;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(56, 232, 211, 0.08), transparent 22rem),
    #05080c;
  box-shadow: 0 18px 62px rgba(0, 0, 0, 0.28);
}

.neuron-figure img {
  width: 100%;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
  padding: 12px 12px 0;
  display: block;
  object-fit: contain;
  filter: contrast(1.05) saturate(1.08);
}

.neuron-figure figcaption {
  position: static;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
}

.neuron-figure figcaption span {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(56, 232, 211, 0.26);
  border-radius: 8px;
  color: var(--soft);
  background: rgba(7, 11, 16, 0.72);
  backdrop-filter: blur(10px);
  font-size: 0.76rem;
  text-transform: uppercase;
}

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

.study-panel {
  padding: 18px;
}

.study-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.study-panel p,
.study-panel li {
  color: var(--soft);
}

.study-panel ul {
  margin-bottom: 0;
  padding-left: 18px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.compare-table th,
.compare-table td {
  padding: 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compare-table th {
  color: var(--text);
  background: rgba(56, 232, 211, 0.08);
}

.compare-table td {
  color: var(--soft);
  background: rgba(255, 255, 255, 0.025);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-state a {
  color: var(--accent-bright);
}

.queue-due {
  color: var(--muted);
}

[data-aos] {
  opacity: 0;
  transform: translateY(14px) scale(0.992);
  transition:
    opacity 520ms ease,
    transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 180ms ease,
    box-shadow 180ms ease;
  transition-delay: var(--aos-delay, 0ms);
}

[data-aos="fade-left"] {
  transform: translateX(18px) scale(0.992);
}

[data-aos="fade-in"] {
  transform: scale(0.992);
}

[data-aos].aos-in {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

@keyframes stageAwake {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stage-panel {
  animation: stageAwake 620ms ease both;
}

@media (max-width: 1180px) {
  .info-dock {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-hero,
  .article-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .parts-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .language-switcher {
    align-self: flex-start;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .control-btn {
    min-width: 0;
  }

  .atlas-screen {
    height: auto;
    min-height: 0;
    overflow: visible;
    grid-template-rows: minmax(300px, 44vh) auto;
    padding: 0 0 14px;
  }

  .article-screen {
    padding: 14px;
  }

  .stage-panel {
    min-height: 300px;
  }

  .brain-render,
  .brain-hotspots {
    inset: 44px 12px 48px;
    width: calc(100% - 24px);
    height: calc(100% - 92px);
  }

  .info-dock {
    overflow: visible;
    padding: 0 14px;
  }

  .metric-strip,
  .study-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .parts-list,
  .info-grid,
  .page-nav {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 1.35rem;
  }

  .legend-card {
    left: 14px;
    right: 14px;
  }

  .model-status {
    right: 14px;
  }

  .brain-hotspot {
    width: 18px;
    height: 18px;
  }

  .region-long-grid {
    grid-template-columns: 1fr;
  }

  .atlas-screen {
    grid-template-rows: minmax(260px, 40vh) auto;
  }

  .stage-panel {
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .brain-render {
    animation: none !important;
  }
}
