/*
 * Neuron 3D Model: stage, masthead, panels, controls, action cards, labels.
 *
 * Same dark navy family as Fossils Near You (tokens, Fraunces display serif over
 * the system sans, frosted glass panels) with the control language of the
 * Regions of Italy map: 42px pill controls, uppercase 11px kicker labels, a
 * sliding segmented thumb, option cards that lift on hover, a snap-point bottom
 * sheet on phones.
 *
 * Layout contract (CONTRACT.md): main.n3m-stage is exactly one viewport minus
 * the masthead. Desktop: a 360px glass panel on the left, a 340px tabbed panel
 * on the right, the model centred between them. Under 900px both panels merge
 * into one bottom sheet (js builds .n3m-sheet and moves them in) with peek,
 * half and full snap points. Every box that moves is sized from CSS variables
 * so nothing reflows when the canvas, the font or an ad bar arrives.
 *
 * Motion: every duration is a variable. The reduced-motion block at the bottom
 * collapses them, so there is one switch rather than one override per rule.
 */

:root {
	/* Part colours: CONTRACT.md table; src/scene/util.js HEX must match. */
	--n3m-dendrites: #8fd0ff;
	--n3m-dendritic-spines: #c4ecff;
	--n3m-cell-body: #6f9dff;
	--n3m-cell-membrane: #c7d8ff;
	--n3m-nucleus: #a97cff;
	--n3m-nucleolus: #6a4ad6;
	--n3m-nissl-bodies: #3fd6c6;
	--n3m-golgi-apparatus: #ffd166;
	--n3m-mitochondria: #ff8a5c;
	--n3m-axon-hillock: #5fe0a2;
	--n3m-axon: #6fc3ff;
	--n3m-microtubules: #e0f0ff;
	--n3m-myelin-sheath: #f4efe6;
	--n3m-nodes-of-ranvier: #ffe066;
	--n3m-axon-terminals: #ff9ec7;
	--n3m-schwann-cells: #f2c9a0;
	--n3m-neuromuscular-junction: #ff6b8a;
	--n3m-muscle-fiber: #e05563;
	--n3m-oligodendrocyte: #9be37a;
	--n3m-astrocyte: #f7a35c;
	--n3m-microglia: #d18cff;
	--n3m-capillary: #ff3b4e;
	--n3m-other-neurons: #7e93c4;
	--n3m-synaptic-vesicles: #ffb84d;
	--n3m-neurotransmitters: #fff27a;
	--n3m-calcium-channels: #5fe0d8;
	--n3m-synaptic-cleft: #7fd4ff;
	--n3m-receptors: #ff7ad1;
	--n3m-reuptake-transporters: #8cf0b4;
	--n3m-postsynaptic-membrane: #a8b8ff;
	--n3m-lipid-bilayer: #ffe2a0;
	--n3m-sodium-channels: #ffcf3f;
	--n3m-potassium-channels: #b58cff;
	--n3m-sodium-potassium-pump: #48e5b0;
	--n3m-signal: #fff6c2;

	/* Neurotransmitter tints and ion dots. */
	--n3m-nt-glutamate: #fff27a;
	--n3m-nt-gaba: #6fb8ff;
	--n3m-nt-dopamine: #ff9f43;
	--n3m-nt-serotonin: #ff6fae;
	--n3m-nt-acetylcholine: #5fe0a2;
	--n3m-sodium: #ffcf3f;
	--n3m-potassium: #b58cff;
	--n3m-calcium: #d8f4ff;

	--n3m-bg: #050a1a;
	--n3m-bg2: #0a1330;
	--n3m-ink: #e8eefc;
	--n3m-dim: #a9b8d6;
	--n3m-faint: #8a9bc0;
	--n3m-accent: #3de0c4;
	--n3m-accent-ink: #04201b;
	--n3m-warm: #ffd84d;
	--n3m-cold: #6aa8ff;
	--n3m-hot: #ff8a5c;
	--n3m-ok: #46e3a0;
	--n3m-bad: #ff7a6b;
	--n3m-glass: rgba(9, 17, 40, 0.68);
	--n3m-glass-strong: rgba(9, 17, 40, 0.9);
	--n3m-line: rgba(160, 190, 255, 0.16);
	--n3m-line2: rgba(160, 190, 255, 0.28);
	--n3m-fill: rgba(255, 255, 255, 0.045);
	--n3m-radius: 18px;
	--n3m-serif: Fraunces, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
	--n3m-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

	--n3m-mast-h: 56px;
	--n3m-pw-l: 360px;
	--n3m-pw-r: 340px;
	--n3m-gap: 16px;

	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--d1: 0.18s;
	--d2: 0.35s;
	--d3: 0.6s;
	--d4: 0.7s;
	--d5: 0.9s;
	--dl0: 0.25s;
	--dl: 70ms;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	background: var(--n3m-bg);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body.n3m-body {
	margin: 0;
	background: var(--n3m-bg);
	color: var(--n3m-ink);
	font: 16px/1.5 var(--n3m-sans);
	-webkit-font-smoothing: antialiased;
}

body.n3m-body a {
	color: var(--n3m-accent);
}

body.n3m-body :focus-visible {
	outline: 2px solid var(--n3m-accent);
	outline-offset: 2px;
}

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

/* Things that need JavaScript are hidden until it has run. */
html:not(.n3m-js) [data-needs-js],
html:not(.n3m-js) .n3m-controls,
html:not(.n3m-js) .n3m-dock {
	display: none;
}

button {
	font: inherit;
	color: inherit;
}

/* ---------------------------------------------------------------- masthead */

.n3m-mast {
	position: relative;
	z-index: 40;
	height: var(--n3m-mast-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 20px;
	background: var(--n3m-bg);
	border-bottom: 1px solid var(--n3m-line);
}

.n3m-logo {
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

.n3m-logo img {
	width: 140px;
	height: auto;
	display: block;
}

.n3m-mast-nav {
	display: flex;
	align-items: center;
	gap: 4px;
}

body.n3m-body .n3m-nav-link {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 12px;
	border-radius: 999px;
	color: var(--n3m-ink);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	list-style: none;
	cursor: pointer;
	transition: background var(--d2);
}

.n3m-nav-link::-webkit-details-marker {
	display: none;
}

body.n3m-body .n3m-nav-link:hover,
.n3m-menu[open] > .n3m-nav-link {
	background: rgba(255, 255, 255, 0.1);
}

.n3m-menu {
	position: relative;
}

.n3m-menu > summary::after {
	content: '';
	margin-left: 8px;
	border: 4px solid transparent;
	border-top-color: currentColor;
	border-bottom: 0;
}

.n3m-menu-list {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	z-index: 50;
	min-width: 230px;
	margin: 0;
	padding: 8px;
	list-style: none;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	border: 1px solid var(--n3m-line);
	border-radius: 14px;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

body.n3m-body .n3m-menu-list a {
	display: block;
	padding: 9px 12px;
	border-radius: 8px;
	color: var(--n3m-ink);
	font-size: 0.9rem;
	text-decoration: none;
}

body.n3m-body .n3m-menu-list a:hover {
	background: rgba(61, 224, 196, 0.14);
}

/* ------------------------------------------------------------------- stage */

.n3m-stage {
	position: relative;
	height: calc(100vh - var(--n3m-mast-h));
	height: calc(100svh - var(--n3m-mast-h));
	min-height: 520px;
	overflow: hidden;
	background:
		radial-gradient(900px 620px at 50% 46%, #12306a 0, #0a1a45 38%, transparent 74%),
		linear-gradient(180deg, var(--n3m-bg2), var(--n3m-bg));
	isolation: isolate;
	--n3m-vis: 0px;
	--n3m-pad: 0px;
}

body.n3m-embed .n3m-stage {
	height: 100vh;
	height: 100svh;
	min-height: 0;
}

.n3m-poster {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: 50% 50%;
	transition: opacity var(--d3) ease;
}

.n3m-stage.is-ready .n3m-poster {
	opacity: 0;
	pointer-events: none;
}

.n3m-canvas {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	display: block;
	opacity: 0;
	transition: opacity var(--d3) ease;
	touch-action: pan-y;
	cursor: grab;
}

.n3m-canvas:active {
	cursor: grabbing;
}

.n3m-stage.is-ready .n3m-canvas {
	opacity: 1;
}

.n3m-noscript {
	position: absolute;
	z-index: 3;
	left: 24px;
	bottom: 24px;
	margin: 0;
	max-width: 300px;
	color: var(--n3m-dim);
	font-size: 0.85rem;
}

/* ------------------------------------------------------------------ labels */

/*
 * The scene creates .n3m-lbl pills (data-kind) and an SVG of leader lines inside
 * this layer and positions them itself. Only appearance lives here: a glass
 * pill, a colour dot taken from the part, 13px text at high contrast.
 */
.n3m-labels {
	position: absolute;
	inset: 0;
	z-index: 5;
	overflow: hidden;
	pointer-events: none;
}

.n3m-lbl {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px 3px 8px;
	color: #f4f7ff;
	font: 600 13px/1.25 var(--n3m-sans);
	letter-spacing: 0.01em;
	white-space: nowrap;
	background: rgba(7, 13, 32, 0.86);
	border: 1px solid rgba(190, 208, 255, 0.32);
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	will-change: transform;
}

.n3m-lbl-dot {
	flex: none;
	width: 9px;
	height: 9px;
	border-radius: 50%;
}

.n3m-lbl-measure {
	color: var(--n3m-accent);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ panels */

.n3m-info,
.n3m-controls {
	position: absolute;
	z-index: 20;
	top: var(--n3m-gap);
	bottom: var(--n3m-gap);
	display: flex;
	flex-direction: column;
	background: linear-gradient(180deg, rgba(14, 25, 56, 0.76), rgba(7, 13, 32, 0.82));
	-webkit-backdrop-filter: blur(20px) saturate(1.3);
	backdrop-filter: blur(20px) saturate(1.3);
	border: 1px solid var(--n3m-line);
	border-radius: var(--n3m-radius);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 24px 60px rgba(0, 0, 0, 0.45);
	overflow: hidden;
}

.n3m-info {
	left: var(--n3m-gap);
	width: var(--n3m-pw-l);
}

.n3m-controls {
	right: var(--n3m-gap);
	width: var(--n3m-pw-r);
}

.n3m-info-scroll,
.n3m-panels {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: rgba(160, 190, 255, 0.3) transparent;
}

.n3m-info-scroll {
	padding: 22px 22px 28px;
}

.n3m-panels {
	padding: 6px 20px 26px;
}

.n3m-kicker {
	margin: 0 0 6px;
	color: var(--n3m-accent);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.n3m-h1 {
	margin: 0 0 10px;
	color: #fff;
	font: 700 clamp(1.7rem, 2.6vw, 2.2rem) / 1.1 var(--n3m-serif);
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.n3m-h2 {
	margin: 0 0 8px;
	color: #fff;
	font: 700 1.35rem / 1.2 var(--n3m-serif);
	text-wrap: balance;
}

.n3m-lede {
	margin: 0 0 16px;
	color: var(--n3m-ink);
	font-size: 1rem;
	line-height: 1.5;
}

.n3m-body {
	margin: 0 0 12px;
	color: var(--n3m-dim);
	font-size: 0.95rem;
	line-height: 1.55;
}

/* ------------------------------------------------------------- info panel */

.n3m-info.is-card .n3m-lede {
	display: none;
}

/* ------------------------------------------------------------------- cards */

.n3m-card-wrap {
	position: relative;
}

.n3m-card {
	padding: 18px 18px 16px;
	background: var(--n3m-fill);
	border: 1px solid var(--n3m-line);
	border-radius: 16px;
}

.n3m-dot {
	flex: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--c, var(--n3m-accent));
	box-shadow: 0 0 10px var(--c, var(--n3m-accent));
}

.n3m-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
	gap: 8px;
	margin: 14px 0;
}

.n3m-stat {
	padding: 10px 8px 9px;
	text-align: center;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--n3m-line);
	border-radius: 12px;
}

.n3m-stat b {
	display: block;
	color: var(--c, #fff);
	font: 700 1.5rem / 1.1 var(--n3m-serif);
	font-variant-numeric: tabular-nums;
}

.n3m-stat span {
	display: block;
	margin-top: 4px;
	color: var(--n3m-dim);
	font-size: 0.72rem;
	line-height: 1.25;
}

.n3m-acts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 14px 0 4px;
}

.n3m-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 6px 0;
	color: var(--n3m-dim);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	background: none;
	border: 0;
}

.n3m-back:hover {
	color: #fff;
}

.n3m-related {
	display: block;
	margin-top: 8px;
	font-size: 0.85rem;
}

/* ----------------------------------------------------------------- buttons */

.n3m-btn,
.n3m-btn-p {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 42px;
	padding: 0 18px;
	color: var(--n3m-ink);
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid var(--n3m-line2);
	border-radius: 21px;
	transition: background var(--d2), transform var(--d2) var(--ease), border-color var(--d2), box-shadow var(--d2);
}

.n3m-btn:hover {
	background: rgba(255, 255, 255, 0.13);
	border-color: rgba(160, 190, 255, 0.5);
	transform: translateY(-1px);
}

.n3m-btn:active,
.n3m-btn-p:active {
	transform: translateY(0) scale(0.98);
}

body.n3m-body .n3m-btn-p {
	color: var(--n3m-accent-ink);
	background: var(--n3m-accent);
	border-color: var(--n3m-accent);
	box-shadow: 0 6px 20px rgba(61, 224, 196, 0.25);
}

.n3m-btn-p:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 26px rgba(61, 224, 196, 0.4);
}

.n3m-btn[disabled],
.n3m-btn-p[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

.n3m-btn-sm {
	height: 34px;
	padding: 0 14px;
	font-size: 0.82rem;
}

.n3m-btn-wide {
	width: 100%;
	margin-top: 16px;
}

.n3m-btn .n3m-ico {
	width: 18px;
	height: 18px;
}

.n3m-link {
	padding: 4px 2px;
	color: var(--n3m-accent);
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	background: none;
	border: 0;
}

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

/* -------------------------------------------------------------------- tabs */

.n3m-tabs {
	position: relative;
	flex: none;
	display: flex;
	padding: 8px 10px 0;
	border-bottom: 1px solid var(--n3m-line);
}

.n3m-tab {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	min-width: 0;
	padding: 8px 2px 10px;
	color: var(--n3m-faint);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 10px 10px 0 0;
	transition: color var(--d2), background var(--d2);
}

.n3m-tab[hidden] {
	display: none;
}

.n3m-tab .n3m-ico {
	transition: transform var(--d2) var(--spring);
}

.n3m-tab:hover {
	color: var(--n3m-ink);
	background: rgba(255, 255, 255, 0.05);
}

.n3m-tab:hover .n3m-ico {
	transform: translateY(-2px);
}

.n3m-tab[aria-selected='true'] {
	color: #fff;
}

.n3m-tab[aria-selected='true'] .n3m-ico {
	color: var(--n3m-accent);
}

.n3m-tab-ind {
	position: absolute;
	left: 0;
	bottom: -1px;
	width: var(--w, 0px);
	height: 3px;
	background: var(--n3m-accent);
	border-radius: 3px 3px 0 0;
	box-shadow: 0 0 12px var(--n3m-accent);
	transform: translateX(var(--x, 0px));
	transition: transform var(--d3) var(--ease), width var(--d3) var(--ease);
}

.n3m-panel[hidden] {
	display: none;
}

/* ---------------------------------------------------------- panel controls */

.n3m-gh {
	margin: 20px 0 10px;
	color: var(--n3m-faint);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.n3m-panel {
	padding-top: 16px;
}

.n3m-panel > .n3m-gh:first-child {
	margin-top: 4px;
}

.n3m-help {
	margin: 8px 0 0;
	color: var(--n3m-faint);
	font-size: 0.82rem;
	line-height: 1.4;
}

.n3m-help-top {
	margin: -4px 0 12px;
	color: var(--n3m-dim);
}

/* Segmented control with a sliding thumb. */
.n3m-seg {
	position: relative;
	display: grid;
	grid-template-columns: repeat(var(--n, 2), 1fr);
	height: 42px;
	padding: 3px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--n3m-line);
	border-radius: 21px;
	--seg: 0;
	--n: 2;
}

.n3m-seg-3 {
	--n: 3;
}

.n3m-seg-4 {
	--n: 4;
}

.n3m-seg button {
	position: relative;
	z-index: 1;
	min-width: 0;
	color: var(--n3m-dim);
	font-size: 0.85rem;
	font-weight: 700;
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 18px;
	transition: color var(--d2);
}

.n3m-seg button[aria-checked='true'] {
	color: var(--n3m-accent-ink);
}

.n3m-seg button:not([aria-checked='true']):hover {
	color: #fff;
}

.n3m-seg-thumb {
	position: absolute;
	top: 3px;
	bottom: 3px;
	left: 3px;
	width: calc((100% - 6px) / var(--n, 2));
	background: var(--n3m-accent);
	border-radius: 18px;
	box-shadow: 0 4px 14px rgba(61, 224, 196, 0.35);
	transform: translateX(calc(var(--seg) * 100%));
	transition: transform var(--d3) var(--spring);
}

.n3m-seg.is-none .n3m-seg-thumb {
	opacity: 0;
}

.n3m-seg button b,
.n3m-seg button small {
	display: block;
	line-height: 1.15;
}

.n3m-seg button small {
	margin-top: 1px;
	font-size: 0.72rem;
	font-weight: 600;
	opacity: 0.8;
}

/* View picker: the pill at the top centre of the stage. */
.n3m-viewpick {
	position: absolute;
	z-index: 16;
	top: var(--n3m-gap);
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
	width: min(360px, 100%);
	margin: 0 auto;
}

.n3m-viewpick .n3m-seg {
	height: 54px;
	padding: 4px;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-color: var(--n3m-line2);
	border-radius: 27px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.n3m-viewpick .n3m-seg button {
	border-radius: 23px;
	font-size: 0.95rem;
}

.n3m-viewpick .n3m-seg-thumb {
	top: 4px;
	bottom: 4px;
	left: 4px;
	width: calc((100% - 8px) / var(--n, 2));
	border-radius: 23px;
}

/* Close-up chip: under the pill while a close-up is on: a way back, the close-up's name and which way is up. */
.n3m-closeup {
	position: absolute;
	z-index: 16;
	top: calc(var(--n3m-gap) + 64px);
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	pointer-events: none;
	opacity: 0;
	transform: translateY(-12px) scale(0.96);
	transition: opacity var(--d2), transform var(--d3) var(--spring);
}

.n3m-closeup[hidden] {
	display: none;
}

.n3m-closeup.is-in {
	opacity: 1;
	transform: none;
}

.n3m-closeup > * {
	pointer-events: auto;
}

.n3m-closeup-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.n3m-closeup-dir {
	margin: 0;
	padding: 5px 12px;
	color: var(--n3m-ink);
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	background: var(--n3m-glass);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid var(--n3m-line);
	border-radius: 12px;
}

.n3m-closeup-back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 18px 0 14px;
	color: var(--n3m-ink);
	font-size: 0.9rem;
	font-weight: 700;
	cursor: pointer;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid var(--n3m-line2);
	border-radius: 20px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	transition: background var(--d2), transform var(--d2) var(--ease);
}

.n3m-closeup-back:hover {
	background: rgba(40, 62, 120, 0.92);
	transform: translateX(-2px);
}

.n3m-closeup-back .n3m-ico {
	width: 18px;
	height: 18px;
	color: var(--n3m-accent);
}

.n3m-closeup-tag {
	padding: 7px 12px;
	color: var(--n3m-accent);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	white-space: nowrap;
	background: rgba(61, 224, 196, 0.12);
	border: 1px solid rgba(61, 224, 196, 0.35);
	border-radius: 999px;
}

.n3m-stage.is-nogl .n3m-viewpick,
.n3m-stage.is-nogl .n3m-closeup,
.n3m-stage.is-nogl .n3m-lower,
html:not(.n3m-js) .n3m-viewpick,
html:not(.n3m-js) .n3m-closeup,
html:not(.n3m-js) .n3m-lower {
	display: none;
}

@media (max-width: 899.98px) {
	.n3m-viewpick {
		left: var(--n3m-gap);
		right: var(--n3m-gap);
		width: auto;
		max-width: 360px;
	}

	.n3m-viewpick .n3m-seg {
		height: 48px;
	}

	.n3m-closeup {
		top: calc(var(--n3m-gap) + 58px);
		left: var(--n3m-gap);
		right: var(--n3m-gap);
	}
}

.n3m-help-parts {
	margin: 2px 0 12px;
}

/* Switch rows. */
.n3m-row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 2px;
	cursor: pointer;
	border-bottom: 1px solid var(--n3m-line);
}

.n3m-row:last-of-type {
	border-bottom: 0;
}

.n3m-row-t {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.n3m-row-t b {
	color: #fff;
	font-size: 0.92rem;
}

.n3m-row-t small {
	color: var(--n3m-faint);
	font-size: 0.78rem;
	line-height: 1.3;
}

.n3m-sw-in {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.n3m-sw {
	flex: none;
	position: relative;
	width: 46px;
	height: 26px;
	background: rgba(255, 255, 255, 0.14);
	border-radius: 13px;
	transition: background var(--d2);
}

.n3m-sw i {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
	transition: transform var(--d3) var(--spring);
}

.n3m-row:hover .n3m-sw i {
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.n3m-sw-in:checked + .n3m-sw {
	background: var(--n3m-accent);
}

.n3m-sw-in:checked + .n3m-sw i {
	transform: translateX(20px);
}

.n3m-sw-in:disabled + .n3m-sw {
	opacity: 0.65;
}

.n3m-sw-in:focus-visible + .n3m-sw {
	outline: 2px solid var(--n3m-accent);
	outline-offset: 3px;
}

/* ------------------------------------------------------- In action */

.n3m-ph {
	margin: 4px 0 4px;
	color: #fff;
	font: 700 1.25rem / 1.2 var(--n3m-serif);
}

.n3m-acard {
	--ac: var(--n3m-accent);
	margin: 0 0 12px;
	padding: 14px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--n3m-line);
	border-radius: 16px;
	transition: border-color var(--d2), background var(--d2), box-shadow var(--d2);
}

.n3m-sig {
	--ac: var(--n3m-signal);
}

.n3m-mem {
	--ac: var(--n3m-sodium-channels);
}

.n3m-rel {
	--ac: var(--n3m-receptors);
}

.n3m-acard.is-on {
	background: rgba(255, 255, 255, 0.08);
	border-color: var(--ac);
	box-shadow: 0 0 22px -6px var(--ac);
}

.n3m-acard-h {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}

.n3m-acard-ico {
	flex: none;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	color: var(--ac);
	background: rgba(255, 255, 255, 0.08);
	border-radius: 13px;
	transition: transform var(--d3) var(--spring), background var(--d2), color var(--d2);
}

.n3m-acard-ico .n3m-ico {
	width: 24px;
	height: 24px;
}

.n3m-acard.is-on .n3m-acard-ico {
	color: #0b1020;
	background: var(--ac);
}

.n3m-acard-t {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.n3m-acard-t b {
	color: #fff;
	font-size: 1rem;
	line-height: 1.2;
}

.n3m-acard-t small {
	margin-top: 2px;
	color: var(--n3m-faint);
	font-size: 0.8rem;
	line-height: 1.3;
}

.n3m-acard .n3m-row {
	padding: 8px 2px;
	border-bottom: 0;
	border-top: 1px solid var(--n3m-line);
}

.n3m-acard-x {
	margin: 0 0 6px;
	padding: 0 2px;
	color: var(--n3m-dim);
	font-size: 0.84rem;
	line-height: 1.4;
}

.n3m-speed {
	margin: 0 0 12px;
	padding: 0 2px;
	color: var(--n3m-signal);
	font-size: 0.84rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* The primary button of a card: full width, with a pulsing ring while its action runs. */
.n3m-btn.n3m-play {
	width: 100%;
	height: 46px;
	margin: 0 0 10px;
	font-size: 0.95rem;
}

.n3m-play span {
	min-width: 0;
}

.n3m-play .n3m-ico {
	flex: none;
}

.n3m-btn.n3m-play.is-playing {
	background: var(--ac);
	border-color: var(--ac);
	color: #0b1020;
	animation: n3m-pulse 1.4s ease-in-out infinite;
}

@keyframes n3m-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255, 246, 194, 0.45); }
	50% { box-shadow: 0 0 0 7px rgba(255, 246, 194, 0); }
}

.n3m-steps-h {
	margin: 12px 0 8px;
	color: var(--n3m-faint);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.n3m-steplist {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: n3m-step;
}

.n3m-steplist li {
	position: relative;
	min-height: 24px;
	padding: 1px 0 1px 34px;
	color: var(--n3m-dim);
	font-size: 0.86rem;
	line-height: 1.4;
	counter-increment: n3m-step;
	transition: color var(--d2);
}

.n3m-steplist li::before {
	content: counter(n3m-step);
	position: absolute;
	left: 0;
	top: 0;
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	color: var(--n3m-dim);
	font-size: 0.78rem;
	font-weight: 800;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid var(--n3m-line2);
	border-radius: 50%;
	transition: background var(--d2), color var(--d2), box-shadow var(--d2), border-color var(--d2);
}

.n3m-steplist li.is-done::before {
	color: var(--ac);
	border-color: var(--ac);
}

.n3m-steplist li.is-on {
	color: #fff;
	font-weight: 700;
}

.n3m-steplist li.is-on::before {
	color: #0b1020;
	background: var(--ac);
	border-color: var(--ac);
	box-shadow: 0 0 12px var(--ac);
}

/* Neurotransmitter chips: the name over what it does. One is always selected. */
.n3m-chips {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 0 0 12px;
}

.n3m-chip {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 54px;
	padding: 8px 10px;
	color: var(--n3m-ink);
	text-align: left;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--n3m-line);
	border-radius: 12px;
	transition: background var(--d2), border-color var(--d2), box-shadow var(--d2), transform var(--d2) var(--ease);
}

.n3m-chip:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

.n3m-chip-t {
	display: flex;
	flex-direction: column;
	min-width: 0;
	gap: 2px;
}

.n3m-chip b {
	color: #fff;
	font-size: 0.88rem;
	line-height: 1.15;
}

.n3m-chip small {
	color: var(--n3m-faint);
	font-size: 0.74rem;
	line-height: 1.25;
}

.n3m-chip:hover {
	background: rgba(255, 255, 255, 0.12);
	transform: translateY(-1px);
}

.n3m-chip[aria-pressed='true'] {
	background: rgba(255, 122, 209, 0.14);
	border-color: var(--ac);
	box-shadow: 0 0 16px -6px var(--ac);
}

.n3m-chip[aria-pressed='true'] small {
	color: var(--n3m-ink);
}

.n3m-ntinfo {
	--c: var(--n3m-nt-glutamate);
	margin: 0 0 4px;
	padding: 2px 0 2px 12px;
	border-left: 3px solid var(--c);
}

.n3m-ntinfo p {
	margin: 0 0 6px;
	color: var(--n3m-ink);
	font-size: 0.86rem;
	line-height: 1.45;
}

.n3m-ntinfo p:empty {
	display: none;
}

.n3m-learn {
	display: inline-block;
	font-size: 0.86rem;
	font-weight: 700;
}

.n3m-learn[hidden] {
	display: none;
}

.n3m-disclaimer {
	margin: 4px 2px 0;
	color: var(--n3m-faint);
	font-size: 0.74rem;
}

/* A group that belongs to the other view is replaced by one line and a button that switches. */
.n3m-pswitch {
	margin-top: 16px;
	padding: 12px;
	background: var(--n3m-fill);
	border: 1px solid var(--n3m-line);
	border-radius: 14px;
}

.n3m-pswitch-t {
	margin: 0 0 10px;
	color: var(--n3m-dim);
	font-size: 0.86rem;
	line-height: 1.4;
}

.n3m-plist-ul > li.n3m-wide {
	grid-column: 1 / -1;
}

/* The lower stack: the voltage graph over the caption bar, above the dock. */
.n3m-lower {
	position: absolute;
	z-index: 17;
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
	bottom: calc(var(--n3m-gap) + 116px + var(--n3m-pad, 0px));
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	pointer-events: none;
}

/* Voltage graph inset: bottom right, above the dock. */
.n3m-graph {
	position: relative;
	align-self: flex-end;
	width: 220px;
	margin: 0;
	opacity: 0;
	transform: translateY(18px) scale(0.97);
	transition: opacity var(--d2), transform var(--d3) var(--ease);
}

.n3m-graph[hidden] {
	display: none;
}

.n3m-graph.is-in {
	opacity: 1;
	transform: none;
}

.n3m-graph canvas {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 220 / 140;
	background: var(--n3m-bg2);
	border: 1px solid var(--n3m-line2);
	border-radius: 14px;
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

.n3m-graph-k {
	position: absolute;
	left: 8px;
	top: 8px;
	padding: 3px 8px;
	color: #fff;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	background: rgba(5, 10, 26, 0.62);
	border-radius: 999px;
}

.n3m-gk-short {
	display: none;
}

.n3m-graph figcaption {
	margin-top: 6px;
	padding: 5px 9px;
	color: var(--n3m-signal);
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	background: var(--n3m-glass);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid var(--n3m-line);
	border-radius: 10px;
}

/* First-load hint chip: fades after the first drag, zoom or tap. */
.n3m-hint {
	position: absolute;
	z-index: 16;
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
	bottom: calc(var(--n3m-gap) + 132px + var(--n3m-pad, 0px));
	display: flex;
	justify-content: center;
	margin: 0;
	pointer-events: none;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity var(--d3), transform var(--d3) var(--ease);
}

.n3m-hint[hidden] {
	display: none;
}

.n3m-hint.is-in {
	opacity: 1;
	transform: none;
}

.n3m-hint span {
	padding: 9px 16px;
	color: var(--n3m-ink);
	font-size: 0.88rem;
	font-weight: 600;
	line-height: 1.35;
	text-align: center;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid var(--n3m-line2);
	border-radius: 999px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

/* The graph and the hint chip share the lower middle: the graph wins. */
.n3m-stage:has(.n3m-graph.is-in) .n3m-hint {
	opacity: 0;
}

.n3m-stage.is-nogl .n3m-hint,
html:not(.n3m-js) .n3m-hint {
	display: none;
}

/* Caption bar: slides in over the bottom of the stage while an action runs. */
.n3m-caption {
	--cc: var(--n3m-accent);
	width: fit-content;
	max-width: min(540px, 100%);
	min-width: 260px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 18px 12px 16px;
	pointer-events: none;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(18px);
	backdrop-filter: blur(18px);
	border: 1px solid var(--n3m-line2);
	border-left: 4px solid var(--cc);
	border-radius: 16px;
	box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: translateY(26px);
	transition: opacity var(--d2), transform var(--d3) var(--ease);
}

.n3m-caption[hidden] {
	display: none;
}

.n3m-caption.is-in {
	opacity: 1;
	transform: none;
}

.n3m-caption[data-kind='signal'] {
	--cc: var(--n3m-signal);
}

.n3m-caption[data-kind='membrane'] {
	--cc: var(--n3m-sodium-channels);
}

.n3m-caption[data-kind='release'] {
	--cc: var(--n3m-receptors);
}

.n3m-caption[data-kind='myelin'] {
	--cc: var(--n3m-myelin-sheath);
}

.n3m-cap-n {
	flex: none;
	align-self: flex-start;
	margin-top: 2px;
	padding: 3px 9px;
	color: var(--n3m-dim);
	font-size: 0.72rem;
	font-style: normal;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	background: rgba(255, 255, 255, 0.07);
	border-radius: 999px;
}

.n3m-cap-n:empty {
	display: none;
}

.n3m-cap-main {
	min-width: 0;
}

.n3m-cap-main b {
	display: block;
	margin-bottom: 2px;
	color: #fff;
	font: 700 1.02rem / 1.2 var(--n3m-serif);
}

.n3m-cap-main span {
	display: block;
	color: var(--n3m-ink);
	font-size: 0.88rem;
	line-height: 1.4;
}

/* Not-to-scale note: bottom left of the open stage. */
.n3m-note {
	position: absolute;
	z-index: 14;
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	bottom: calc(var(--n3m-gap) + 50px);
	max-width: 220px;
	margin: 0;
	padding: 6px 10px;
	color: var(--n3m-dim);
	font-size: 0.75rem;
	line-height: 1.35;
	background: var(--n3m-glass);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid var(--n3m-line);
	border-radius: 10px;
}

body.n3m-body .n3m-note a {
	color: var(--n3m-ink);
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

body.n3m-body .n3m-note a:hover {
	color: var(--n3m-accent);
}

html:not(.n3m-js) .n3m-note,
.n3m-stage.is-nogl .n3m-note {
	display: none;
}

.n3m-nogl-note {
	margin: 10px 0 0;
	padding: 10px 14px;
	color: #ffe9b8;
	font-size: 0.85rem;
	line-height: 1.4;
	background: rgba(255, 180, 84, 0.12);
	border-left: 3px solid #ffb454;
	border-radius: 3px 12px 12px 3px;
}

.is-off {
	opacity: 0.4;
	filter: grayscale(0.6);
	pointer-events: none;
}

/* ------------------------------------------------------- dock, hud, popups */

.n3m-dock {
	position: absolute;
	z-index: 15;
	bottom: calc(var(--n3m-gap) + var(--n3m-pad, 0px));
	left: calc(var(--n3m-pw-l) + var(--n3m-gap) * 2);
	right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	pointer-events: none;
}

.n3m-dock > * {
	pointer-events: auto;
}

.n3m-help-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px 0 7px;
	color: var(--n3m-ink);
	font-size: 0.86rem;
	font-weight: 700;
	cursor: pointer;
	background: var(--n3m-glass);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid var(--n3m-line2);
	border-radius: 20px;
	transition: background var(--d2), transform var(--d2) var(--spring);
}

.n3m-help-q {
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	color: var(--n3m-accent-ink);
	font-size: 0.95rem;
	font-weight: 800;
	background: var(--n3m-accent);
	border-radius: 50%;
}

.n3m-help-btn:hover {
	background: rgba(255, 255, 255, 0.16);
	transform: scale(1.08);
}

/* Continue to article: the wheel zooms the model, so this is the visible way
   down to the article. Desktop: its own row under the help button. Phone: a compact
   chip at the end of the dock row. */
.n3m-dock {
	flex-wrap: wrap;
}

.n3m-next {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 16px 8px 20px;
	color: var(--n3m-accent);
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none;
	background: rgba(61, 224, 196, 0.1);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: 1px solid rgba(61, 224, 196, 0.35);
	border-radius: 20px;
	transition: background var(--d2), transform var(--d2) var(--spring);
}

body.n3m-body .n3m-next {
	color: var(--n3m-accent);
}

.n3m-next:hover {
	background: rgba(61, 224, 196, 0.2);
	transform: translateY(2px);
}

.n3m-next-s {
	display: none;
}

.n3m-next-i {
	animation: n3m-bob 1.8s ease-in-out infinite;
}

@keyframes n3m-bob {
	0%, 100% { transform: translateY(-2px); }
	50% { transform: translateY(3px); }
}

@media (min-width: 900px) {
	/* A zero-height full-width flex item breaks the row, so the link sits centred below the help button. */
	.n3m-dock::after {
		content: '';
		order: 2;
		flex-basis: 100%;
		height: 0;
	}

	.n3m-next {
		order: 3;
	}
}

.n3m-pop {
	position: absolute;
	right: 0;
	bottom: 52px;
	z-index: 50;
	width: 300px;
	padding: 14px 16px;
	background: var(--n3m-glass-strong);
	-webkit-backdrop-filter: blur(18px);
	backdrop-filter: blur(18px);
	border: 1px solid var(--n3m-line2);
	border-radius: 16px;
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
	opacity: 0;
	transform: translateY(8px) scale(0.97);
	transform-origin: bottom right;
	transition: opacity var(--d2), transform var(--d2) var(--ease);
}

.n3m-pop[hidden] {
	display: none;
}

.n3m-pop.is-in {
	opacity: 1;
	transform: none;
}

.n3m-pop ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.n3m-pop li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 0;
	color: var(--n3m-dim);
	font-size: 0.84rem;
}

.n3m-pop kbd {
	flex: none;
	min-width: 48px;
	padding: 2px 8px;
	text-align: center;
	color: #fff;
	font: 700 0.76rem var(--n3m-sans);
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid var(--n3m-line2);
	border-radius: 6px;
}

.n3m-tip {
	position: absolute;
	z-index: 45;
	left: 0;
	top: 0;
	padding: 4px 10px;
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	white-space: nowrap;
	pointer-events: none;
	background: rgba(7, 13, 32, 0.92);
	border: 1px solid var(--n3m-line2);
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.n3m-tip[hidden] {
	display: none;
}

.n3m-embed-credit {
	position: fixed;
	z-index: 60;
	left: 10px;
	bottom: 8px;
	padding: 3px 10px;
	color: var(--n3m-dim);
	font-size: 0.72rem;
	font-weight: 600;
	text-decoration: none;
	background: rgba(7, 13, 32, 0.7);
	border-radius: 999px;
}

/* ---------------------------------------------------------------- sheet (phone) */

.n3m-grip {
	display: none;
}

@media (min-width: 900px) and (max-width: 1099.98px) {
	:root {
		--n3m-pw-l: 330px;
		--n3m-pw-r: 310px;
	}
}

@media (max-width: 899.98px) {
	.n3m-stage {
		--n3m-gap: 12px;
	}

	/* No-JS and pre-JS: the info panel is a low bottom sheet. */
	.n3m-stage > .n3m-info {
		left: 0;
		right: 0;
		top: auto;
		bottom: 0;
		width: auto;
		height: min(46%, 300px);
		border-radius: 20px 20px 0 0;
		border-width: 1px 0 0;
	}

	.n3m-sheet {
		position: absolute;
		z-index: 25;
		left: 0;
		right: 0;
		bottom: 0;
		height: var(--n3m-vis);
		display: flex;
		flex-direction: column;
		background: linear-gradient(180deg, rgba(14, 25, 56, 0.9), rgba(7, 13, 32, 0.95));
		-webkit-backdrop-filter: blur(20px) saturate(1.3);
		backdrop-filter: blur(20px) saturate(1.3);
		border: 1px solid var(--n3m-line);
		border-width: 1px 0 0;
		border-radius: 22px 22px 0 0;
		box-shadow: 0 -14px 50px rgba(0, 0, 0, 0.5);
		overflow: hidden;
		transition: height var(--d3) var(--ease);
		touch-action: none;
	}

	.n3m-sheet.is-drag {
		transition: none;
	}

	.n3m-grip {
		position: relative;
		flex: none;
		display: block;
		width: 100%;
		height: 26px;
		padding: 0;
		cursor: grab;
		background: none;
		border: 0;
		touch-action: none;
	}

	.n3m-grip::after {
		content: '';
		position: absolute;
		left: 50%;
		top: 10px;
		width: 44px;
		height: 5px;
		background: rgba(255, 255, 255, 0.3);
		border-radius: 3px;
		transform: translateX(-50%);
		transition: background var(--d2), width var(--d2);
	}

	.n3m-grip:hover::after {
		background: rgba(255, 255, 255, 0.5);
		width: 56px;
	}

	.n3m-sheet .n3m-tabs {
		padding: 0 8px;
		touch-action: pan-x;
	}

	.n3m-sheet .n3m-tab {
		padding: 6px 1px 8px;
	}

	.n3m-sheet-body {
		position: relative;
		flex: 1;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		touch-action: pan-y;
	}

	.n3m-sheet[data-snap='peek'] .n3m-sheet-body {
		overflow: hidden;
		touch-action: none;
	}

	.n3m-sheet .n3m-info,
	.n3m-sheet .n3m-controls {
		position: static;
		display: block;
		width: auto;
		background: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
		overflow: visible;
	}

	.n3m-sheet .n3m-info-scroll,
	.n3m-sheet .n3m-panels {
		overflow: visible;
	}

	.n3m-sheet .n3m-info-scroll {
		padding: 8px 18px 28px;
	}

	.n3m-sheet .n3m-panels {
		padding: 4px 18px 28px;
	}

	.n3m-sheet[data-tab='info'] .n3m-controls,
	.n3m-sheet:not([data-tab='info']) .n3m-info {
		display: none;
	}

	.n3m-sheet .n3m-h1 {
		font-size: 1.55rem;
	}

	.n3m-dock {
		left: var(--n3m-gap);
		right: var(--n3m-gap);
		justify-content: flex-end;
	}

	/* On a phone the button is a round icon (its label is in aria-label and title). */
	.n3m-help-btn {
		width: 44px;
		height: 44px;
		padding: 0;
		justify-content: center;
		border-radius: 50%;
	}

	.n3m-help-t {
		display: none;
	}

	.n3m-dock {
		flex-wrap: nowrap;
	}

	.n3m-next {
		padding: 7px 12px 7px 14px;
		gap: 4px;
	}

	.n3m-next-t {
		display: none;
	}

	.n3m-next-s {
		display: inline;
	}

	.n3m-mast {
		padding: 0 14px;
	}
}

/* ------------------------------------------------------ part card pieces */

.n3m-h2 .n3m-dot {
	display: inline-block;
	margin-right: 4px;
	vertical-align: 1px;
}

.n3m-ch {
	margin: 14px 0 4px;
	color: var(--n3m-faint);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.n3m-card .n3m-what,
.n3m-card .n3m-does {
	margin-bottom: 8px;
}

.n3m-size {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 12px 0;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--n3m-line);
	border-radius: 12px;
}

.n3m-size span {
	flex: none;
	color: var(--n3m-faint);
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.n3m-size b {
	color: #fff;
	font-size: 0.9rem;
	text-align: right;
}

.n3m-fact {
	margin: 12px 0;
	padding: 10px 12px;
	color: var(--n3m-ink);
	font-size: 0.88rem;
	line-height: 1.45;
	background: rgba(255, 216, 77, 0.08);
	border-left: 3px solid var(--n3m-warm);
	border-radius: 3px 12px 12px 3px;
}

.n3m-fact b {
	color: var(--n3m-warm);
}

.n3m-src {
	margin: 12px 0 0;
	color: var(--n3m-faint);
	font-size: 0.75rem;
	line-height: 1.45;
}

body.n3m-body .n3m-src a {
	color: var(--n3m-dim);
	text-decoration: underline;
	text-underline-offset: 2px;
}

body.n3m-body .n3m-src a:hover {
	color: #fff;
}

/* ------------------------------------------------------------- parts list */

.n3m-plist-ul {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.n3m-plist .n3m-pgroup:first-child > .n3m-gh {
	margin-top: 4px;
}

.n3m-pbtn {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	min-height: 40px;
	padding: 6px 10px;
	color: var(--n3m-ink);
	font-size: 0.84rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--n3m-line);
	border-radius: 12px;
	transition: background var(--d2), border-color var(--d2), transform var(--d2) var(--ease);
}

.n3m-pbtn span {
	min-width: 0;
}

.n3m-pbtn:hover {
	background: rgba(255, 255, 255, 0.12);
	transform: translateY(-1px);
}

.n3m-pbtn[aria-pressed='true'] {
	color: #fff;
	background: rgba(61, 224, 196, 0.14);
	border-color: var(--n3m-accent);
}

/* ----------------------------------------------------------------- entrance */

@keyframes n3m-in-l {
	from { transform: translateX(-36px); }
}

@keyframes n3m-in-r {
	from { transform: translateX(36px); }
}

@keyframes n3m-in-up {
	from { transform: translateY(40px); }
}

@keyframes n3m-stagger {
	from { opacity: 0; transform: translateY(14px); }
}

@keyframes n3m-pop {
	from { opacity: 0; transform: scale(0.6); }
}

@keyframes n3m-rise {
	from { opacity: 0; transform: translateY(10px); }
}

@keyframes n3m-drop {
	from { opacity: 0; transform: translateY(-14px); }
}

/* h1 and lede are never animated: they are the first thing painted. */
.n3m-stage.is-enter .n3m-info {
	animation: n3m-in-l var(--d5) var(--ease) backwards;
}

.n3m-stage.is-enter .n3m-controls {
	animation: n3m-in-r var(--d5) var(--ease) 0.1s backwards;
}

.n3m-stage.is-enter .n3m-sheet {
	animation: n3m-in-up var(--d5) var(--ease) backwards;
}

.n3m-stage.is-enter .n3m-info-scroll > :nth-child(n+4),
.n3m-stage.is-enter .n3m-tabs {
	animation: n3m-stagger var(--d4) var(--ease) backwards;
	animation-delay: calc(var(--dl0) + var(--i, 0) * var(--dl));
}

.n3m-stage.is-enter .n3m-panels > .n3m-panel:not([hidden]) > * {
	animation: n3m-stagger var(--d3) var(--ease) backwards;
	animation-delay: calc(var(--i, 0) * var(--dl) / 2);
}

.n3m-card.is-ssr-in > * {
	animation: n3m-rise var(--d3) var(--ease) backwards;
	animation-delay: calc(var(--i, 0) * var(--dl));
}

.n3m-stat {
	animation: n3m-pop var(--d3) var(--spring) backwards;
	animation-delay: calc(var(--dl0) / 2 + var(--i, 0) * var(--dl));
}

@media (hover: none) {
	.n3m-btn:hover {
		transform: none;
	}
}

/* ------------------------------------------------------------ reduced motion */

/* Every duration above comes from these variables. Cards still cross-fade
   (opacity only, 160ms, from script); nothing moves, spins or shakes. */
@media (prefers-reduced-motion: reduce) {
	.n3m-next-i {
		animation: none;
	}

	.n3m-caption,
	.n3m-graph,
	.n3m-hint,
	.n3m-closeup {
		transform: none;
	}

	.n3m-btn.n3m-play.is-playing {
		animation: none;
	}

	:root {
		--d1: 0.01s;
		--d2: 0.01s;
		--d3: 0.01s;
		--d4: 0.01s;
		--d5: 0.01s;
		--dl0: 0s;
		--dl: 0s;
	}

	.n3m-poster,
	.n3m-canvas {
		transition-duration: 0.2s;
	}
}

/* Keep Mediavine's adhesion bar (height published by js/n3m-track.js) off the last footer lines. */
body.n3m-body .n3m-foot-in {
	padding-bottom: calc(34px + var(--n3m-adh, 0px) + env(safe-area-inset-bottom, 0px));
}

/* ---------------------------------------------- tablet and phone placement */

@media (min-width: 900px) and (max-width: 1099.98px) {
	/* The pill must fit the gap between the two panels. */
	.n3m-viewpick {
		width: auto;
		max-width: none;
	}

	.n3m-viewpick .n3m-seg {
		min-width: 0;
	}

	.n3m-viewpick .n3m-seg button {
		padding: 0 2px;
		font-size: 0.88rem;
	}

	.n3m-viewpick .n3m-seg button small {
		font-size: 0.64rem;
		letter-spacing: -0.01em;
	}

	/* The open stage is only about 200px wide here: no keyboard hint, the note takes its row. */
	.n3m-help-btn {
		display: none;
	}

	.n3m-note {
		right: calc(var(--n3m-pw-r) + var(--n3m-gap) * 2);
		max-width: none;
		text-align: center;
		bottom: calc(var(--n3m-gap) + 50px);
	}

	.n3m-lower {
		bottom: calc(var(--n3m-gap) + 112px);
	}

	.n3m-caption {
		min-width: 0;
	}

	.n3m-graph {
		width: 190px;
	}

	.n3m-hint {
		bottom: calc(var(--n3m-gap) + 128px);
	}
}

@media (max-width: 899.98px) {
	.n3m-lower {
		left: var(--n3m-gap);
		right: var(--n3m-gap);
		bottom: calc(var(--n3m-gap) + var(--n3m-pad, 0px) + 70px);
	}

	.n3m-caption {
		width: 100%;
		min-width: 0;
		max-width: 480px;
		padding: 10px 14px 10px 14px;
	}

	.n3m-graph {
		width: 160px;
	}

	.n3m-graph canvas {
		aspect-ratio: 160 / 100;
	}

	.n3m-gk-long {
		display: none;
	}

	.n3m-gk-short {
		display: inline;
	}

	.n3m-graph figcaption {
		margin-top: 4px;
		padding: 3px 8px;
		font-size: 0.72rem;
	}

	.n3m-hint {
		left: var(--n3m-gap);
		right: var(--n3m-gap);
		bottom: calc(var(--n3m-gap) + var(--n3m-pad, 0px) + 76px);
	}

	.n3m-hint span {
		padding: 7px 13px;
		font-size: 0.8rem;
	}

	.n3m-cap-main b {
		font-size: 0.95rem;
	}

	.n3m-cap-main span {
		font-size: 0.82rem;
	}

	.n3m-note {
		left: var(--n3m-gap);
		right: 128px;
		max-width: none;
		padding: 5px 9px;
		bottom: calc(var(--n3m-gap) + var(--n3m-pad, 0px) + 2px);
		font-size: 0.72rem;
	}
}

/* ----------------------------------------------------- usability round (2026-11-17) */

/* Parts marked "zooms in": a magnifier and words, not a status badge. */
.n3m-zoom {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
	color: var(--n3m-dim);
	font-size: 11px;
	font-style: normal;
	font-weight: 600;
	white-space: nowrap;
}

.n3m-zoom .n3m-ico {
	width: 13px;
	height: 13px;
	color: var(--n3m-accent);
}

/* The close-up's name is plain text next to the way back, not a second button. */
.n3m-closeup-tag {
	padding: 0 4px;
	color: var(--n3m-accent);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	background: none;
	border: 0;
	border-radius: 0;
	text-shadow: 0 1px 8px rgba(5, 10, 26, 0.9);
}

/* Show only the selected part: greyed out until a part is selected. */
.n3m-row:has(.n3m-sw-in:disabled) {
	cursor: not-allowed;
}

.n3m-row:has(.n3m-sw-in:disabled) .n3m-row-t b {
	color: var(--n3m-dim);
}

/* The info card fades out at the bottom while there is more to scroll to. */
.n3m-info::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 64px;
	background: linear-gradient(180deg, rgba(7, 13, 32, 0), rgba(7, 13, 32, 0.96));
	border-radius: 0 0 var(--n3m-radius) var(--n3m-radius);
	pointer-events: none;
	opacity: 1;
	transition: opacity var(--d2);
}

.n3m-info.is-end::after {
	opacity: 0;
}

/* The graph's phase label can run to two lines: reserve both so nothing jumps. */
.n3m-graph figcaption {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: calc(2.6em + 10px);
}

@media (max-width: 899.98px) {
	.n3m-sheet .n3m-info::after {
		display: none;
	}

	/* Tap targets of at least 44px. */
	.n3m-pbtn,
	.n3m-sheet .n3m-tab,
	.n3m-chip,
	.n3m-btn,
	.n3m-seg {
		min-height: 44px;
	}

	.n3m-next {
		min-height: 44px;
	}

	.n3m-graph figcaption {
		font-size: 0.66rem;
		min-height: calc(2.6em + 6px);
	}

	.n3m-note {
		right: 190px;
		font-size: 0.68rem;
	}
}
