/* MechDimension simulations and interactive tools: dark panels on a light site. */
.md-sim, .md-tool {
	--sim-bg: #0F151A;
	--sim-panel: #151D24;
	--sim-line: rgba(255, 255, 255, .12);
	--sim-text: #E6EEF4;
	--sim-muted: #9FB0BD;
	--sim-blue: #2EA7DD;
	--sim-gold: #F5B83D;
	background: var(--sim-bg);
	color: var(--sim-text);
	border-radius: 14px;
	padding: clamp(14px, 2.4vw, 22px);
	margin: 1.5rem 0;
	font-family: Inter, 'Segoe UI', Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	position: relative;
	box-shadow: 0 1px 2px rgba(11, 16, 21, .12), 0 12px 32px rgba(11, 16, 21, .12);
}
.md-sim *, .md-tool * { box-sizing: border-box; }
.md-sim a, .md-tool a { color: #7FCFF3; }
.md-sim__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.md-sim__eyebrow, .md-tool__eyebrow { display: block; font-family: 'Plus Jakarta Sans', Inter, sans-serif; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 12.5px; color: var(--sim-blue); }
.md-sim__title, .md-tool__title { margin: 2px 0 0; font-size: 22px; line-height: 1.2; color: #fff; font-weight: 700; font-family: Inter, sans-serif; letter-spacing: 0; }
.md-sim__tabs { display: inline-flex; background: #0A0F13; border: 1px solid var(--sim-line); border-radius: 10px; padding: 3px; gap: 2px; }
.md-sim__tab { appearance: none; background: transparent; color: var(--sim-muted); border: 0; border-radius: 8px; padding: 8px 14px; font: 600 14px Inter, sans-serif; cursor: pointer; min-height: 40px; }
.md-sim__tab.is-active { background: var(--sim-blue); color: #04131C; }
.md-sim__tab:focus-visible, .md-btn:focus-visible, .md-seg__btn:focus-visible, .md-sim input:focus-visible, .md-sim select:focus-visible, .md-tool button:focus-visible, .md-tool input:focus-visible, .md-tool select:focus-visible { outline: 3px solid var(--sim-gold); outline-offset: 2px; }
.md-sim__stage { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.md-sim[data-mode="visual"] .md-sim__stage { grid-template-columns: minmax(0, 2.2fr) minmax(220px, .8fr); }
.md-sim__canvas-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0B1116; border-radius: 10px; overflow: hidden; border: 1px solid var(--sim-line); }
.md-sim__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.md-sim__badge { position: absolute; right: 8px; top: 8px; background: rgba(0, 0, 0, .55); color: var(--sim-gold); font: 600 12px Inter, sans-serif; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.md-sim__badge:empty { display: none; }
.md-sim__banner { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 8px 12px; border-radius: 8px; font: 600 13.5px Inter, sans-serif; }
.md-sim__banner--warn { background: #F5B83D; color: #1B1300; }
.md-sim__banner--info { background: #2EA7DD; color: #04131C; }
.md-sim__banner--ok { background: #1E8E5A; color: #fff; }
.md-sim__visual-text { color: var(--sim-muted); margin: 10px 2px 0; }
.md-sim__graph-wrap { margin-top: 12px; background: #0B1116; border: 1px solid var(--sim-line); border-radius: 10px; height: 180px; position: relative; }
.md-sim__graph { position: absolute; inset: 0; width: 100%; height: 100%; }
.md-sim[data-mode="visual"] .md-sim__graph-wrap { display: none; }
.md-sim__panel { display: flex; flex-direction: column; gap: 14px; }
.md-sim__controls { display: flex; flex-direction: column; gap: 14px; }
.md-ctl__label { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 14px; color: #fff; margin-bottom: 4px; }
.md-ctl__val { color: var(--sim-blue); font-variant-numeric: tabular-nums; font-weight: 600; }
.md-ctl__note { display: block; color: var(--sim-muted); font-size: 12.5px; margin-top: 2px; }
.md-ctl input[type=range] { width: 100%; accent-color: var(--sim-blue); height: 28px; cursor: pointer; }
.md-ctl--toggle { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; min-height: 32px; }
.md-ctl--toggle input { width: 20px; height: 20px; accent-color: var(--sim-blue); }
.md-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.md-seg__btn { appearance: none; border: 1px solid var(--sim-line); background: #0A0F13; color: var(--sim-text); border-radius: 8px; padding: 7px 12px; min-height: 38px; font: 600 14px Inter, sans-serif; cursor: pointer; }
.md-seg__btn[aria-checked="true"] { background: var(--sim-blue); border-color: var(--sim-blue); color: #04131C; }
.md-sim .is-off, .md-tool .is-off { display: none !important; }
.md-sim [hidden], .md-tool [hidden] { display: none !important; }
.md-btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 9px 14px; min-height: 44px; font: 600 14.5px Inter, sans-serif; cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.md-btn--primary { background: var(--sim-blue, #2EA7DD); color: #04131C; }
.md-btn--primary:hover { background: #57BDE8; }
.md-btn--ghost { background: transparent; color: var(--sim-text, #E6EEF4); border-color: rgba(255, 255, 255, .25); }
.md-btn--ghost:hover { border-color: var(--sim-blue, #2EA7DD); }
.md-btn--link { background: none; border: 0; color: #7FCFF3; text-decoration: underline; padding: 6px; min-height: 0; }
.md-btn:disabled { opacity: .45; cursor: not-allowed; }
.md-sim__transport { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.md-sim__speed { background: #0A0F13; color: var(--sim-text); border: 1px solid var(--sim-line); border-radius: 8px; padding: 9px 10px; font: 600 14px Inter, sans-serif; min-height: 44px; }
.md-sim__readouts { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0; }
.md-sim__readout { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; background: var(--sim-panel); border-radius: 8px; }
.md-sim__readout dt { color: var(--sim-muted); font-size: 13.5px; }
.md-sim__readout dd { margin: 0; font-weight: 700; color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.md-sim__compare { border-top: 1px solid var(--sim-line); padding-top: 12px; }
.md-sim__cmp-btns { display: flex; gap: 8px; align-items: center; }
.md-sim__cmp-table table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.md-sim__cmp-table th, .md-sim__cmp-table td { padding: 5px 6px; border-bottom: 1px solid var(--sim-line); text-align: left; color: var(--sim-text); }
.md-sim__cmp-table thead th { color: var(--sim-muted); font-weight: 600; }
.md-key { font-size: 11.5px; color: var(--sim-muted); font-weight: 500; }
.md-key--a { color: var(--sim-gold); }
.md-key--b { color: var(--sim-blue); }
.md-sim__fine { color: var(--sim-muted); font-size: 12.8px; margin: 6px 0 0; }
.md-sim__eq { background: var(--sim-panel); border-radius: 10px; padding: 8px 12px; }
.md-sim__eq summary, .md-sim__assume summary, .md-sim__altbox summary { cursor: pointer; font-weight: 700; color: #fff; padding: 4px 0; }
.md-sim__eq-body { overflow-x: auto; color: #fff; }
.md-sim__eq-body .katex { color: #fff; font-size: 1.05em; }
.md-sim__experiment { background: #10202B; border: 1px solid rgba(46, 167, 221, .45); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.md-sim__exp-kicker { margin: 0; color: var(--sim-gold); font: 700 12.5px 'Plus Jakarta Sans', Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.md-sim__exp-task { margin: 0; color: #fff; }
.md-sim__exp-pred { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.md-sim__exp-input { display: flex; align-items: center; gap: 8px; }
.md-sim__exp-input input { width: 140px; background: #0A0F13; color: #fff; border: 1px solid var(--sim-line); border-radius: 8px; padding: 9px 10px; font: 600 15px Inter, sans-serif; min-height: 44px; }
.md-sim__exp-result p { margin: 4px 0; }
.md-mini-q { border: 1px solid var(--sim-line); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0; }
.md-mini-q legend { font-weight: 700; padding: 0 4px; color: #fff; }
.md-mini-q__opt { display: block; width: 100%; text-align: left; margin: 6px 0; background: #0A0F13; color: var(--sim-text); border: 1px solid var(--sim-line); border-radius: 8px; padding: 9px 12px; font: 500 14.5px Inter, sans-serif; cursor: pointer; min-height: 44px; }
.md-mini-q__opt.is-correct { border-color: #1E8E5A; background: rgba(30, 142, 90, .22); }
.md-mini-q__opt.is-wrong { border-color: #C8402F; background: rgba(200, 64, 47, .2); }
.md-mini-q__fb { margin: 6px 0 0; color: var(--sim-text); }
.md-sim__assume, .md-sim__altbox { margin-top: 14px; border-top: 1px solid var(--sim-line); padding-top: 8px; }
.md-sim__assume ul { margin: 6px 0 0 18px; padding: 0; color: var(--sim-muted); }
.md-sim__assume li { margin: 4px 0; }
.md-sim__alt { color: var(--sim-muted); margin: 6px 0 0; }
.md-sim__altbox { margin-top: 4px; border-top: 0; padding-top: 0; }
.md-sim__error { color: var(--sim-gold); }
.md-sim-mount:not([data-ready]) { min-height: 320px; background: #0F151A; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #9FB0BD; }
.md-sim-mount:not([data-ready])::before { content: 'Loading simulation…'; font: 600 15px Inter, sans-serif; }
.md-sim[data-compact] .md-sim__stage, .md-sim[data-mode="visual"].md-sim--compact .md-sim__stage { grid-template-columns: 1fr; }

/* Tools */
.md-tool__head { margin-bottom: 12px; }
.md-tool__body { display: grid; gap: 14px; }
.md-tool__grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 18px; align-items: start; }
.md-tool__card { background: var(--sim-panel); border: 1px solid var(--sim-line); border-radius: 10px; padding: 12px 14px; }
.md-tool__card h4 { margin: 0 0 6px; color: #fff; font-size: 17px; font-family: Inter, sans-serif; }
.md-tool__card p { margin: 4px 0; color: var(--sim-text); }
.md-tool__muted { color: var(--sim-muted); }
.md-tool label { font-weight: 600; }
.md-tool input[type=number], .md-tool select, .md-tool input[type=text] { background: #0A0F13; color: #fff; border: 1px solid var(--sim-line); border-radius: 8px; padding: 9px 10px; font: 600 15px Inter, sans-serif; min-height: 44px; width: 100%; }
.md-tool table { width: 100%; border-collapse: collapse; }
.md-tool th, .md-tool td { padding: 7px 8px; border-bottom: 1px solid var(--sim-line); text-align: left; color: var(--sim-text); vertical-align: top; }
.md-tool thead th { color: var(--sim-muted); }
.md-scene { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #0B1116; border: 1px solid var(--sim-line); }
.md-scene svg { width: 100%; height: 100%; display: block; }
.md-hotspot { position: absolute; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; background: rgba(46, 167, 221, .85); color: #04131C; font: 700 15px Inter, sans-serif; cursor: pointer; box-shadow: 0 0 0 6px rgba(46, 167, 221, .25); }
.md-hotspot.is-found { background: #F5B83D; box-shadow: 0 0 0 6px rgba(245, 184, 61, .25); }
.md-hotspot:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.md-sorter__bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.md-sorter__bin { border: 2px dashed rgba(255, 255, 255, .25); border-radius: 10px; padding: 10px; min-height: 110px; }
.md-sorter__bin.is-over { border-color: var(--sim-blue); background: rgba(46, 167, 221, .08); }
.md-sorter__bin h4 { margin: 0 0 6px; font-size: 16px; color: #fff; }
.md-sorter__cards { display: flex; flex-wrap: wrap; gap: 8px; }
.md-card-chip { background: #1C2730; color: #fff; border: 1px solid var(--sim-line); border-radius: 8px; padding: 9px 12px; font: 500 14.5px Inter, sans-serif; cursor: grab; text-align: left; min-height: 44px; }
.md-card-chip.is-right { border-color: #1E8E5A; background: rgba(30, 142, 90, .2); cursor: default; }
.md-card-chip.is-wrong { border-color: #C8402F; background: rgba(200, 64, 47, .18); }
.md-card-chip[aria-pressed="true"] { outline: 2px solid var(--sim-gold); }
.md-timeline { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; }
.md-timeline__card { flex: 0 0 min(260px, 78%); scroll-snap-align: start; background: var(--sim-panel); border: 1px solid var(--sim-line); border-radius: 10px; padding: 12px; }
.md-timeline__card.is-hidden { display: none; }
.md-timeline__year { color: var(--sim-gold); font: 700 18px 'Plus Jakarta Sans', Inter, sans-serif; }
.md-timeline__who { color: #fff; font-weight: 700; margin: 2px 0 6px; }
.md-sim .md-chip, .md-tool .md-chip { display: inline-block; font: 600 12px Inter, sans-serif; padding: 2px 8px; border-radius: 99px; background: rgba(46, 167, 221, .18); color: #7FCFF3; }
.md-sim .md-chip--gold, .md-tool .md-chip--gold { background: rgba(245, 184, 61, .18); color: var(--sim-gold); }

@media (max-width: 900px) {
	.md-sim__stage, .md-sim[data-mode="visual"] .md-sim__stage, .md-tool__grid2 { grid-template-columns: 1fr; }
	.md-sim__tabs { width: 100%; }
	.md-sim__tab { flex: 1; }
}
@media (max-width: 600px) {
	.md-sim, .md-tool { border-radius: 10px; margin-left: -6px; margin-right: -6px; padding: 12px; }
	.md-sim__canvas-wrap { aspect-ratio: 4 / 3 !important; }
	.md-sim__title, .md-tool__title { font-size: 19px; }
	.md-sim__graph-wrap { height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
	.md-timeline { scroll-behavior: auto; }
}

/* Panel headings stay white whatever the page or builder sets for headings. */
.md-sim .md-sim__title, .md-tool .md-tool__title, .md-sim h4, .md-tool h4 { color: #fff; }
