:root {
  color-scheme: dark;
  font-family: Figtree, system-ui, sans-serif;
  background: #0b1020;
  color: #f1f3ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #a2abc9;
  --soft: #7783a7;
  --line: #29314b;
  --mint: #35f0d2;
  --violet: #9f8cff;
  --panel: #11182b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 140px; }
body {
  margin: 0;
  min-width: 320px;
  background-color: #0b1020;
  color: #f1f3ff;
  background-image:
    radial-gradient(900px 480px at 78% -8%, color-mix(in srgb, #35f0d2 13%, transparent), transparent 70%),
    linear-gradient(rgba(140,160,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140,160,255,.045) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
}
button { color: inherit; font: inherit; cursor: pointer; }
a { color: inherit; }
.wrap { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgb(11 16 32 / 92%); backdrop-filter: blur(12px); }
.topbar-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; text-decoration: none; font-weight: 700; letter-spacing: -.03em; }
.brand-logo { display: block; width: 150px; height: auto; flex: 0 0 auto; }
.brand-divider { margin-inline: 5px; color: #53607f; }
.brand-module { color: var(--muted); font-weight: 500; }
.collection-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.collection-link:hover { color: var(--mint); }
.subnav { border-top: 1px solid rgb(41 49 75 / 65%); }
.subnav-inner { min-height: 48px; display: flex; align-items: center; gap: 16px; }
.module-nav { display: flex; min-width: 0; align-items: center; gap: 4px; margin-right: auto; }
.module-nav a { flex: 0 0 auto; border-radius: 999px; padding: 7px 11px; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.module-nav a:hover, .module-nav a:focus-visible { background: #9f8cff12; color: var(--violet); }
.lang-toggle { border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; background: transparent; color: var(--muted); font: 600 12px "JetBrains Mono", monospace; }
.lang-toggle:hover, .lang-toggle:focus-visible { border-color: var(--mint); color: var(--mint); }

.hero { padding-block: clamp(64px, 9vw, 112px) 54px; }
.eyebrow, .kicker, .live-label { display: flex; align-items: center; gap: 9px; color: var(--mint); font: 600 10px "JetBrains Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow { margin-bottom: 22px; }
.pulse, .live-dot { width: 7px; aspect-ratio: 1; border-radius: 50%; background: var(--mint); box-shadow: 0 0 15px var(--mint); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 22px 0; font: 500 clamp(34px, 6vw, 64px)/1.08 Unbounded, sans-serif; letter-spacing: -.065em; }
.hero h1 { margin: 0 0 22px; }
.title-accent { color: var(--violet); }
.hero-copy { max-width: 670px; margin: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.7; }
.section { margin-block: 0 84px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.section-heading .kicker { margin-bottom: 10px; color: var(--soft); }
.section-heading h2 { margin-bottom: 0; font: 500 clamp(22px, 3.3vw, 31px)/1.25 Unbounded, sans-serif; letter-spacing: -.045em; }
.section-index { color: var(--soft); font: 12px "JetBrains Mono", monospace; white-space: nowrap; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #141c32, var(--panel) 72%); }
.neuron-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, .75fr); gap: 16px; }
.neuron-panel { min-width: 0; padding: 18px 22px 14px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.live-label { color: var(--soft); font-size: 9px; }
.live-dot { width: 6px; }
.action-button { border: 1px solid #9f8cff70; border-radius: 9px; padding: 9px 13px; background: #9f8cff18; color: #d3cbff; font-size: 12px; font-weight: 700; transition: background .2s, border-color .2s, transform .2s; }
.action-button:hover:not(:disabled), .action-button:focus-visible { border-color: var(--violet); background: #9f8cff2b; }
.action-button:active:not(:disabled) { transform: translateY(1px); }
.action-button:disabled { cursor: wait; opacity: .65; }
.neuron-svg { display: block; width: 100%; height: auto; margin: 12px auto 0; overflow: visible; }
.dendrites path, .dendrites circle { fill: none; stroke: #9f8cff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.dendrites circle { fill: #9f8cff; stroke: none; }
.soma { fill: #9f8cff24; stroke: #9f8cff; stroke-width: 3; }
.nucleus { fill: #9f8cff; }
.axon { fill: none; stroke: url(#axon-gradient); stroke-width: 5; stroke-linecap: round; }
.myelin rect { fill: #9f8cff16; stroke: #9f8cff70; stroke-width: 1.5; }
.axon-branch { fill: none; stroke: var(--mint); stroke-width: 4; stroke-linecap: round; }
.terminal { fill: var(--mint); }
.synapse-gap { stroke: #ffc24b; stroke-width: 2; stroke-dasharray: 3 5; }
.receiving-cell { fill: none; stroke: #ffc24b; stroke-width: 4; stroke-linecap: round; }
.labels { fill: var(--soft); font: 600 10px "JetBrains Mono", monospace; letter-spacing: .08em; }
.signal-dot { fill: #fff; stroke: var(--mint); stroke-width: 4; filter: url(#soft-glow); opacity: 0; }
.transmitters circle { fill: #ffc24b; opacity: 0; }
.neuron-svg.is-firing .signal-dot { opacity: 1; animation: travel 1.8s cubic-bezier(.4,0,.2,1) forwards; }
.neuron-svg.is-firing .transmitters circle { animation: release .5s ease-out 1.8s both; }
.neuron-svg.is-firing .axon { filter: drop-shadow(0 0 5px #35f0d2); }
@keyframes travel { 0% { transform: translateX(0); } 70% { transform: translateX(375px); } 100% { transform: translate(427px, -18px); } }
@keyframes release { from { opacity: 0; transform: translateY(0); } to { opacity: 1; transform: translateY(10px); } }
.signal-status { min-height: 1.4em; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.parts-panel { padding: 22px; }
.parts-panel .kicker { margin-bottom: 9px; }
.parts-panel h3, .synapse-note h3, .memory-copy h3 { margin-bottom: 12px; font: 500 17px/1.35 Unbounded, sans-serif; letter-spacing: -.03em; }
.part-tabs { display: grid; gap: 6px; margin-block: 18px; }
.part-tab { border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; }
.part-tab:hover, .part-tab.is-active { border-color: #9f8cff52; background: #9f8cff12; color: #d3cbff; }
.part-description { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.neuron-svg[data-focus="dendrites"] .dendrites, .neuron-svg[data-focus="soma"] .soma, .neuron-svg[data-focus="axon"] .axon, .neuron-svg[data-focus="synapse"] .terminal, .neuron-svg[data-focus="synapse"] .synapse-gap, .neuron-svg[data-focus="synapse"] .receiving-cell { filter: drop-shadow(0 0 7px var(--mint)); }

.synapse-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .8fr); gap: 16px; }
.synapse-panel { padding: 26px; }
.synapse-visual { display: grid; grid-template-columns: minmax(120px, 1fr) 105px minmax(120px, 1fr); align-items: center; min-height: 150px; }
.synapse-cell { position: relative; display: grid; place-items: center; min-height: 104px; border: 2px solid #9f8cff80; background: #9f8cff12; color: var(--muted); font-size: 12px; text-align: center; }
.pre-cell { border-radius: 50% 10px 10px 50%; }
.post-cell { border-radius: 10px 50% 50% 10px; border-color: #35f0d280; background: #35f0d20d; }
.vesicles, .receptors { position: absolute; inset: 0; display: flex; align-items: end; justify-content: center; gap: 12px; padding-bottom: 14px; }
.vesicles i { width: 11px; height: 11px; border: 2px solid var(--violet); border-radius: 50%; }
.receptors i { width: 10px; height: 21px; border: 2px solid var(--mint); border-radius: 5px 5px 2px 2px; }
.cleft { display: grid; grid-template-columns: repeat(2, 1fr); place-items: center; gap: 14px; color: #ffc24b; font-size: 10px; }
.transmitter { filter: drop-shadow(0 0 5px #ffc24b); animation: float 2.5s ease-in-out infinite alternate; }
.transmitter:nth-child(even) { animation-delay: .5s; }
@keyframes float { to { transform: translate(5px, -5px); } }
.steps { display: grid; gap: 12px; margin: 24px 0 0; padding-left: 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.steps li::marker { color: var(--mint); font-family: "JetBrains Mono", monospace; font-weight: 700; }
.synapse-note { padding: 24px; }
.note-icon { display: grid; width: 38px; height: 38px; margin-bottom: 18px; place-items: center; border: 1px solid #35f0d255; border-radius: 12px; color: var(--mint); font-size: 21px; }
.synapse-note p, .memory-copy p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.small-note { color: var(--soft) !important; font-size: 12px !important; }

.memory-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .75fr); align-items: center; gap: 36px; padding: clamp(22px, 4vw, 38px); }
.memory-copy .kicker { margin-bottom: 15px; color: var(--mint); }
.memory-copy h3 { font-size: 20px; }
.memory-copy p:last-child { margin-bottom: 0; }
.memory-demo { display: grid; justify-items: center; gap: 12px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: #0b1020a8; }
.connection { display: flex; align-items: center; width: min(100%, 220px); height: 45px; }
.connection-node { z-index: 1; width: 34px; height: 34px; flex: 0 0 auto; border: 2px solid var(--violet); border-radius: 50%; background: #17162b; transition: border-color .3s, box-shadow .3s; }
.connection-line { width: 100%; height: 3px; background: var(--line); transition: height .35s, background .35s, box-shadow .35s; }
.connection[data-level="1"] .connection-line { background: #806fd0; }
.connection[data-level="2"] .connection-line { height: 5px; background: #8d7fe0; }
.connection[data-level="3"] .connection-line { height: 7px; background: #a294ff; box-shadow: 0 0 12px #9f8cff90; }
.connection[data-level="4"] .connection-line { height: 9px; background: var(--mint); box-shadow: 0 0 16px #35f0d270; }
.connection[data-level="4"] .connection-node { border-color: var(--mint); box-shadow: 0 0 12px #35f0d270; }
.connection-label { min-height: 1.5em; margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.memory-demo .action-button { width: 100%; }
.text-button { border: 0; padding: 4px 8px; background: transparent; color: var(--soft); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover:not(:disabled) { color: var(--mint); }
.text-button:disabled { cursor: default; opacity: .45; }
.count-label { margin: 0; color: var(--soft); font-size: 11px; }
.count-label strong { color: var(--mint); font: 600 12px "JetBrains Mono", monospace; }
.sources-section { margin-bottom: 64px; }
.source-list { display: grid; gap: 10px; margin: 0; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: #11182b99; list-style: none; }
.source-list a { color: #c4baff; font-size: 14px; text-decoration-color: #9f8cff60; text-underline-offset: 3px; }
.source-list a:hover { color: var(--mint); }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; padding-block: 22px 30px; border-top: 1px solid var(--line); color: var(--soft); font-size: 12px; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

@media (max-width: 820px) {
  .neuron-layout, .synapse-layout { grid-template-columns: 1fr; }
  .parts-panel { display: grid; grid-template-columns: minmax(140px, .5fr) 1fr; column-gap: 16px; align-items: center; }
  .parts-panel .kicker { grid-column: 1 / -1; margin-bottom: 0; }
  .parts-panel h3 { grid-column: 1 / -1; margin-bottom: 8px; }
  .part-tabs { grid-row: span 1; margin: 8px 0; }
  .part-description { align-self: center; }
}
@media (max-width: 560px) {
  html { scroll-padding-top: 136px; }
  .wrap { width: min(100% - 28px, 1160px); }
  .topbar-inner { min-height: 62px; }
  .brand { gap: 7px; font-size: 12px; }
  .brand-logo { width: 124px; }
  .collection-link { font-size: 11px; }
  .subnav-inner { min-height: 0; flex-direction: column; align-items: stretch; gap: 5px; padding-block: 6px; }
  .module-nav { width: 100%; overflow-x: auto; scrollbar-width: thin; }
  .module-nav a { padding: 6px 10px; font-size: 12px; }
  .subnav .lang-toggle { align-self: flex-end; padding: 6px 10px; }
  .hero { padding-top: 58px; }
  .section { margin-bottom: 64px; }
  .section-heading { align-items: start; }
  .neuron-panel { padding: 15px 10px; }
  .panel-heading { align-items: start; flex-wrap: wrap; }
  .neuron-svg { min-width: 560px; transform: scale(.62); transform-origin: top left; width: 160%; margin-bottom: -90px; }
  .parts-panel { grid-template-columns: 1fr; }
  .part-tabs { grid-row: auto; }
  .synapse-panel { padding: 18px 14px; }
  .synapse-visual { grid-template-columns: minmax(90px, 1fr) 70px minmax(90px, 1fr); }
  .synapse-cell { min-height: 88px; font-size: 10px; }
  .memory-panel { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .memory-demo { padding: 18px; }
  .footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
