@charset "UTF-8";
/* App frame: a full-screen 3D stage with frosted panels over it (docs/design.md §3). Colours come from tokens.css only.
   Desktop: top bar, views nav (top centre), left card + info, right controls, scope dock at the bottom.
   ≤ 1180 px: the dock spans the full width under both panels. ≤ 860 px: one scrolling column
   (viewport, views, controls, scopes, card). */

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

:root {
  --topbar-h: 56px;
  --gap: 12px;
  --left-w: 330px;
  --right-w: 300px;
  --dock-h: 286px;
  --panel-radius: 12px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-stage-from);
  color: var(--c-text);
  font-family: var(--font-en);
  font-size: 14px;
  line-height: var(--lh-base);
  overflow-wrap: break-word;
}
:lang(zh-Hans) body,
body:lang(zh-Hans) {
  font-family: var(--font-zh-hans);
  line-height: var(--lh-cjk);
}
:lang(ja) body,
body:lang(ja) {
  font-family: var(--font-ja);
  line-height: var(--lh-cjk);
  line-break: strict;
}

h1,
h2,
h3,
h4 {
  line-height: 1.3;
  margin: 0 0 var(--space-2);
}
p {
  margin: 0 0 var(--space-3);
}
a {
  color: var(--c-link);
  text-underline-offset: 2px;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

var.q {
  font-style: italic;
  font-family: var(--font-latin);
}
var.q sub {
  font-style: normal;
  font-size: 0.75em;
  vertical-align: -0.2em;
  line-height: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--c-bg);
  border: 2px solid var(--c-focus);
  border-radius: var(--radius);
}
.skip-link:focus {
  top: var(--space-2);
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); /* the level switch sits in the true centre */
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--gap);
  background: var(--c-topbar);
  border-bottom: 1px solid var(--c-glass-border);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.brand__logo {
  flex: none;
}
/* site name over the author pill (two lines) */
.brand__text {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-width: 0;
}
.brand__text .home-pill {
  min-height: 18px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 16px;
}
.brand__name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(90deg, var(--c-name-from), var(--c-name-mid) 60%, var(--c-name-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--pill-h);
  padding: 0 var(--space-3);
  background: var(--c-pill-bg);
  border: 1px solid var(--c-pill-border);
  border-radius: 999px;
  color: var(--c-text);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition);
}
.home-pill:hover {
  background: var(--c-pill-bg-hover);
  border-color: var(--c-border-strong);
}
.home-pill:active {
  transform: translateY(1px);
}
.ext-arrow {
  font-size: 0.9em;
}
.levels {
  display: flex;
  justify-content: center;
  min-width: 0;
}
.topbar__end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ------------------------------------------------------------------ segmented buttons, buttons, icons */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--c-seg-bg);
}
.seg__btn,
.level-btn {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  color: var(--c-text-soft);
  transition: background var(--transition), color var(--transition);
}
.seg__btn:hover:not(:disabled),
.level-btn:hover:not(:disabled) {
  background: var(--c-seg-hover);
}
.seg__btn[aria-pressed="true"],
.level-btn[aria-pressed="true"] {
  background: var(--c-seg-on-bg);
  color: var(--c-seg-on-fg);
  font-weight: 600;
  box-shadow: 0 1px 2px var(--c-shadow-sm);
}
.seg__btn:disabled,
.level-btn:disabled {
  cursor: default;
  color: var(--c-text-muted);
}
.level-btn {
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.level-btn__soon {
  font-size: 11px;
  font-weight: 500;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c-badge-bg);
  color: var(--c-badge-fg);
}

.btn,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding: 0 var(--space-4);
  border: 1px solid var(--c-border-strong);
  border-radius: 8px;
  background: var(--c-bg);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: var(--c-text);
  transition: background var(--transition), border-color var(--transition);
}
.btn:hover,
.chip:hover {
  background: var(--c-pill-bg-hover);
}
.btn--ghost {
  background: transparent;
}
.btn--play {
  min-width: 84px;
  border-color: var(--c-track-fill);
  color: var(--c-track-fill);
  font-weight: 600;
}
.btn--play[aria-pressed="true"] {
  background: var(--c-lvl-calc-bg);
  border-color: var(--c-lvl-calc-bg);
  color: var(--c-lvl-calc-fg);
}
.chip {
  min-height: var(--pill-h);
  padding: 0 var(--space-3);
  border-radius: 999px;
  border-color: var(--c-pill-border);
  background: var(--c-pill-bg);
  font-size: 12.5px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  cursor: pointer;
  color: var(--c-text-soft);
}
.icon-btn:hover {
  background: var(--c-pill-bg-hover);
}
.icon-btn[aria-pressed="true"] {
  background: var(--c-lvl-calc-bg);
  border-color: var(--c-lvl-calc-bg);
  color: var(--c-lvl-calc-fg);
}
.icon {
  display: block;
  line-height: 1;
}
.icon--info::before {
  content: "i";
  font: italic 700 17px/1 Georgia, "Times New Roman", serif;
}
.icon--close::before {
  content: "×";
  font-size: 20px;
}
.icon--rotate::before {
  content: "⟳";
  font-size: 18px;
}
.icon--panels::before {
  content: "⛶";
  font-size: 17px;
}

/* ------------------------------------------------------------------ stage and viewport */
.stage {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(42% 46% at 50% 44%, var(--c-stage-spot), transparent 72%),
    radial-gradient(900px 600px at 70% 10%, var(--c-stage-glow), transparent 70%),
    radial-gradient(120% 90% at 50% 30%, var(--c-stage-from), var(--c-stage-mid) 60%, var(--c-stage-to));
}
/* soft vignette over the scene edges (decorative, under the panels) */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 45%, transparent 55%, var(--c-stage-vignette));
}
.viewport {
  position: absolute;
  inset: 0;
}
.vp-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
.vp-canvas.is-pickable {
  cursor: pointer;
}
.vp-canvas.is-dragging {
  cursor: grabbing;
}
.vp-canvas:focus-visible {
  outline-offset: -3px;
}
.vp-fallback {
  position: absolute;
  inset: 70px var(--gap) var(--gap);
  display: none;
  place-items: center;
}
.vp-fallback .xs {
  width: 100%;
  height: 100%;
}
[data-mode="2d"] .vp-fallback,
[data-mode="lost"] .vp-fallback {
  display: grid;
}
[data-mode="2d"] .vp-canvas,
[data-mode="lost"] .vp-canvas,
[data-mode="2d"] .vp-labels,
[data-mode="lost"] .vp-labels,
[data-mode="loading"] .vp-labels {
  visibility: hidden;
}
.xs-item {
  fill: var(--fill);
  opacity: var(--op);
  stroke: var(--c-scene-edge);
  stroke-opacity: 0.25;
  stroke-width: 1;
}
.xs-label {
  fill: var(--c-text);
  font-size: 22px;
  font-weight: 600;
}
.vp-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.5s ease;
}
/* labels wait until the parts have dropped into place */
.is-intro .vp-labels {
  opacity: 0;
  transition: none;
}

/* ------------------------------------------------------------------ level transition veil */
.veil {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: radial-gradient(60% 55% at 50% 45%, var(--c-veil-core), var(--c-veil-edge));
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.veil.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}
.veil__card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 0 var(--space-6);
  text-align: center;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.veil.is-on .veil__card {
  transform: none;
}
.veil__index {
  font: 500 12px/1 var(--font-latin);
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  color: var(--c-accent);
}
.veil__title {
  font-size: clamp(30px, 4.6vw, 52px);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.015em;
  background: linear-gradient(90deg, var(--c-name-from), var(--c-name-mid) 55%, var(--c-name-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.veil__bar {
  width: 140px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--c-brand), var(--c-name-to));
  transform: scaleX(0);
  transition: transform 0.8s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.veil.is-on .veil__bar {
  transform: scaleX(1);
}
.veil__sub {
  max-width: 34em;
  font-size: 15px;
  color: var(--c-text-soft);
}
.vp-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(calc(var(--x, -999) * 1px), calc(var(--y, -999) * 1px)) translate(-50%, -100%);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--c-label-glass);
  border: 1px solid var(--c-glass-border);
  box-shadow: 0 1px 3px var(--c-shadow-sm);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
[data-labels="off"] .xs-label--part {
  display: none;
}
.stage__status {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--c-glass-strong);
  border: 1px solid var(--c-glass-border);
  font-size: 12.5px;
  color: var(--c-text-soft);
  pointer-events: none;
}

/* ------------------------------------------------------------------ views nav */
.views {
  position: absolute;
  top: var(--gap);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 4px;
  border-radius: 12px;
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  box-shadow: 0 2px 10px var(--c-shadow-sm);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
.views .seg {
  background: transparent;
}

/* ------------------------------------------------------------------ panels */
.panel {
  position: absolute;
  top: var(--gap);
  z-index: 6;
  max-height: calc(100% - 2 * var(--gap));
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.panel--left {
  left: var(--gap);
  width: var(--left-w);
}
.panel--right {
  right: var(--gap);
  width: var(--right-w);
}
.panel__fold,
.info {
  border-radius: var(--panel-radius);
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  box-shadow: 0 4px 18px var(--c-shadow-md);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
.panel__summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel__summary::-webkit-details-marker {
  display: none;
}
.panel__summary::after {
  content: "▾";
  font-size: 12px;
  transition: transform var(--transition);
}
.panel__fold:not([open]) .panel__summary::after {
  transform: rotate(-90deg);
}
.card,
.controls {
  padding: 0 14px 14px;
}
.card__title {
  font-size: 16px;
}
.card__desc {
  color: var(--c-text-soft);
  font-size: 13.5px;
}
.card__hint {
  margin: var(--space-3) 0 0;
  font-size: 12.5px;
  color: var(--c-text-muted);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.legend__row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}
.legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--sw);
  border: 1px solid var(--c-glass-border);
}

/* accuracy badges: computed / approximate / schematic */
.acc {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.acc--calc {
  background: var(--c-lvl-calc-bg);
  color: var(--c-lvl-calc-fg);
}
.acc--approx {
  background: var(--c-lvl-approx-bg);
  color: var(--c-lvl-approx-fg);
  border: 1px solid var(--c-lvl-approx-border);
}
.acc--schem {
  background: var(--c-lvl-schem-bg);
  color: var(--c-lvl-schem-fg);
  border: 1px solid var(--c-lvl-schem-border);
}

/* info panel (a part picked in the scene) */
.info {
  padding: 12px 14px 14px;
}
.info__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.info__tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-accent);
}
.info__title {
  font-size: 16px;
}
.info__desc {
  font-size: 13.5px;
  color: var(--c-text-soft);
}
.info__params {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px var(--space-4);
  margin: 0;
  font-size: 13px;
}
.info__params dt {
  color: var(--c-text-muted);
}
.info__params dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* controls */
.ctl-group {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--c-glass-border);
  display: grid;
  gap: var(--space-3);
}
.ctl-group:first-child {
  border-top: 0;
  padding-top: 0;
}
.ctl-group__title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-muted);
}
.ctl--slider {
  display: grid;
  gap: 2px;
}
.ctl__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}
.ctl__label {
  font-size: 14px;
}
.ctl__value {
  font-family: var(--font-latin);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--c-track-fill) calc(var(--pct, 0) * 1%), var(--c-track) 0);
}
input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--c-track-fill) calc(var(--pct, 0) * 1%), var(--c-track) 0);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--c-thumb);
  border: 2px solid var(--c-thumb-border);
  box-shadow: 0 1px 3px var(--c-shadow-md);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c-thumb);
  border: 2px solid var(--c-thumb-border);
}
.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.presets__label {
  font-size: 12.5px;
  color: var(--c-text-muted);
  margin-right: 2px;
}
.ctl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.ctl-row--label {
  justify-content: space-between;
}
.ctl-row__label {
  font-size: 13.5px;
}
.ctl-note {
  margin: 0;
  font-size: 12px;
  color: var(--c-text-muted);
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 13.5px;
}
.switch__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch__track {
  flex: none;
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--c-switch-off);
  transition: background var(--transition);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c-thumb);
  box-shadow: 0 1px 2px var(--c-shadow-md);
  transition: transform var(--transition);
}
.switch__input:checked + .switch__track {
  background: var(--c-switch-on);
}
.switch__input:checked + .switch__track::after {
  transform: translateX(14px);
}
.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ scope dock */
.dock {
  position: absolute;
  z-index: 6;
  bottom: var(--gap);
  left: calc(var(--left-w) + 2 * var(--gap));
  right: calc(var(--right-w) + 2 * var(--gap));
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.dock__fold {
  pointer-events: auto;
}
/* draggable floating panels (ui/floatdrag.js): offset from home, the panel last touched in front */
.panel,
.dock {
  translate: calc(var(--drag-x, 0) * 1px) calc(var(--drag-y, 0) * 1px);
}
.panel[data-moved],
.dock[data-moved] {
  z-index: calc(6 + var(--drag-z, 0));
}
.panel__fold,
.info {
  transition: box-shadow var(--transition);
}
.is-dragging .panel__fold,
.is-dragging .info {
  box-shadow: 0 18px 48px var(--c-shadow-lg), 0 2px 6px var(--c-shadow-sm);
}
.panel__summary {
  position: relative;
}
/* grip: a short bar centred on the header's top edge */
.panel__summary::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 2px;
  background: var(--c-grip);
  transition: background var(--transition), width var(--transition), margin var(--transition);
}
.panel__summary:hover::before,
.is-dragging .panel__summary::before {
  width: 48px;
  margin-left: -24px;
  background: var(--c-grip-on);
}
.is-dragging .panel__summary {
  cursor: grabbing;
}
.dock__fold:not([open]) {
  align-self: center;
  min-width: 220px;
}
.dock__inner {
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dock__head {
  display: flex;
  justify-content: flex-start;
}
.dock__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  gap: var(--space-4);
  align-items: start;
}
.dock__plot {
  margin: 0;
  min-width: 0;
}
.dock__body--wide {
  grid-template-columns: minmax(0, 1fr);
}
.dock__note {
  margin: 0;
  font-size: 11.5px;
  color: var(--c-text-muted);
}
.ro {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px var(--space-4);
  font-size: 13px;
}
.ro__row {
  display: grid;
  gap: 0;
}
.ro__row dt {
  font-size: 11.5px;
  color: var(--c-text-muted);
}
.ro__row dd {
  margin: 0;
}
.ro__num {
  font-family: var(--font-latin);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.region {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.region[data-region="off"] {
  background: var(--c-region-off-bg);
  color: var(--c-region-off-fg);
}
.region[data-region="subthreshold"] {
  background: var(--c-region-sub-bg);
  color: var(--c-region-sub-fg);
}
.region[data-region="linear"] {
  background: var(--c-region-lin-bg);
  color: var(--c-region-lin-fg);
}
.region[data-region="saturation"] {
  background: var(--c-region-sat-bg);
  color: var(--c-region-sat-fg);
}

/* hide every floating panel: the model alone (views nav stays, with the button to bring the panels back) */
[data-panels="hidden"] .panel,
[data-panels="hidden"] .dock {
  display: none;
}

/* material labels: smaller, outlined, shown only with the Materials switch */
.vp-label--mat {
  font-size: 11.5px;
  font-weight: 500;
  padding: 1px 6px;
  background: var(--c-glass-strong);
  border-style: dashed;
  border-color: var(--c-border-strong);
}
[data-materials="off"] .vp-label--mat,
[data-materials="off"] .xs-label--mat {
  display: none;
}
[data-labels="off"] .vp-label--part {
  display: none;
}
.xs-label--mat {
  font-size: 16px;
  font-weight: 500;
}
/* terminals and nodes of a circuit (CMOS inverter): always shown, name and value */
.vp-label--term {
  font-family: var(--font-latin);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--c-accent);
  border-color: var(--c-border-strong);
}
.xs-label--term {
  font-weight: 700;
}
.vp-label--pinch {
  background: var(--c-accent-soft);
  border-color: var(--c-pick);
  color: var(--c-accent);
  font-size: 12px;
}

/* formulas tab */
.formulas {
  font-size: 13px;
  max-height: 262px;
  overflow: auto;
  padding-right: 4px;
}
.formulas__title {
  margin: 4px 0 4px;
  font-size: 12.5px;
  color: var(--c-text-muted);
}
.formulas__eq {
  margin: 0;
  font-size: 14px;
}
.formulas__val {
  margin: 0 0 6px;
  font-family: var(--font-latin);
  font-size: 12.5px;
  color: var(--c-text-soft);
}
.formulas__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.formulas__table th {
  text-align: left;
  font-weight: 600;
  color: var(--c-text-muted);
  border-bottom: 1px solid var(--c-glass-border);
  padding: 2px 6px 2px 0;
}
.formulas__table td {
  padding: 4px 6px 4px 0;
  border-bottom: 1px solid var(--c-glass-border);
  vertical-align: top;
}
.formulas__table .region {
  white-space: nowrap;
}
.formulas__table tr.is-now td {
  font-weight: 600;
}
.formulas__table tr.is-now td:first-child {
  box-shadow: inset 3px 0 0 var(--c-accent);
  padding-left: 6px;
}
.formulas__note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--c-text-muted);
}

/* SVG plots (plotting/svgplot.js) */
.plot {
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  display: block;
  width: 100%;
  height: auto;
  max-height: 190px;
  font-size: 14px;
}
.plot__bg {
  fill: var(--c-plot-bg);
}
.plot__frame {
  fill: none;
  stroke: var(--c-axis);
  stroke-width: 1;
}
.plot__gridline {
  fill: none;
  stroke: var(--c-grid);
  stroke-width: 1;
}
.plot__tick {
  fill: var(--c-text-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.plot__label {
  fill: var(--c-text);
  font-size: 13.5px;
}
.plot__note {
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--c-text);
}
.q-sym {
  font-style: italic;
  font-family: var(--font-latin);
}
.q-sub {
  font-size: 0.75em;
}
.plot__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}
.plot__band {
  stroke: none;
}
.plot__guide {
  fill: none;
  stroke: var(--c-axis);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.plot__dot {
  fill: var(--c-marker);
  stroke: var(--c-plot-bg);
  stroke-width: 1.5;
}
.curve-id {
  stroke: var(--c-curve-1);
  stroke-width: 2.4;
}
.curve-fam {
  stroke: var(--c-curve-fam);
  stroke-width: 1.3;
}
.plot__note.curve-fam-note {
  fill: var(--c-text-muted);
  font-size: 11px;
  font-weight: 500;
}
.curve-ns {
  stroke: var(--c-mat-electron);
}
/* CMOS inverter: input / output traces, device currents, the V_out = V_in diagonal */
.curve-vin {
  stroke: var(--c-curve-fam);
  stroke-width: 1.8;
}
.curve-in {
  stroke: var(--c-mat-electron);
  stroke-width: 2;
}
.curve-ip {
  stroke: var(--c-mat-hole);
  stroke-width: 2;
}
.curve-diag {
  stroke: var(--c-curve-fam);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.plot__note.curve-note {
  fill: var(--c-curve-1);
  font-size: 12px;
  font-weight: 600;
}
.plot__note.curve-note--vin,
.plot__note.curve-note--fam {
  fill: var(--c-text-muted);
}
.plot__note.curve-note--in {
  fill: var(--c-mat-electron);
}
.plot__note.curve-note--ip {
  fill: var(--c-mat-hole);
}
.plot__note.plot-end {
  fill: var(--c-text-muted);
  font-weight: 500;
}
.plot__vline.is-out {
  display: none;
}
.region-fill--off,
.region-fill[data-region="off"] {
  fill: var(--c-region-off-fill);
}
.region-fill--subthreshold,
.region-fill[data-region="subthreshold"] {
  fill: var(--c-region-sub-fill);
}
.region-fill--linear,
.region-fill[data-region="linear"] {
  fill: var(--c-region-lin-fill);
}
.region-fill--saturation,
.region-fill[data-region="saturation"] {
  fill: var(--c-region-sat-fill);
}
.curve-locus {
  stroke: var(--c-curve-locus);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
}
.curve-ps {
  stroke: var(--c-mat-hole);
}
/* FinFET plots */
.curve-fin {
  stroke: var(--c-curve-1);
  stroke-width: 2.4;
}
.curve-planar {
  stroke: var(--c-curve-planar);
  stroke-width: 1.8;
  stroke-dasharray: 6 4;
}
.plot__dot.dot-planar {
  fill: var(--c-curve-planar);
}
.plot__note.note-fin {
  fill: var(--c-curve-1);
}
.plot__note.note-planar {
  fill: var(--c-curve-planar);
}
.curve-cfg {
  stroke-width: 1.8;
}
.curve-cfg--planar,
.cfg-key--planar.plot__note {
  stroke: var(--c-cfg-planar);
  fill: var(--c-cfg-planar);
}
.curve-cfg--double,
.cfg-key--double.plot__note {
  stroke: var(--c-cfg-double);
  fill: var(--c-cfg-double);
}
.curve-cfg--fin,
.cfg-key--fin.plot__note {
  stroke: var(--c-cfg-fin);
  fill: var(--c-cfg-fin);
}
.curve-cfg--gaa,
.cfg-key--gaa.plot__note {
  stroke: var(--c-cfg-gaa);
  fill: var(--c-cfg-gaa);
}
.curve-cfg.plot__line {
  fill: none;
}
.curve-cfg--fin {
  stroke-width: 2.6;
}
.plot__note.cfg-key {
  stroke: none;
  font-size: 11.5px;
}
.guide-l .plot__guide {
  stroke: var(--c-accent);
  stroke-dasharray: 3 3;
}
.bar--planar {
  fill: var(--c-bar-planar);
}
.bar--walls {
  fill: var(--c-bar-walls);
}
.bar--tops {
  fill: var(--c-bar-tops);
}
.plot__note.bar-value {
  font-variant-numeric: tabular-nums;
}
.plot__note.bar-cat {
  fill: var(--c-text-muted);
  font-weight: 500;
}
.plot__note.bar-key--walls {
  fill: var(--c-bar-walls);
}
.plot__note.bar-key--tops {
  fill: var(--c-text-muted);
}
.cfg-chip {
  white-space: nowrap;
  font-weight: 600;
}
.cfg-chip--planar {
  color: var(--c-cfg-planar);
}
.cfg-chip--double {
  color: var(--c-cfg-double);
}
.cfg-chip--fin {
  color: var(--c-cfg-fin);
}
.cfg-chip--gaa {
  color: var(--c-cfg-gaa);
}
/* dimension labels (FinFET): with the Labels switch */
.vp-label--dim {
  font-family: var(--font-latin);
  font-size: 11px;
  font-weight: 500;
}
[data-labels="off"] .vp-label--dim {
  display: none;
}
.channel-area--n {
  fill: var(--c-mat-electron);
  fill-opacity: 0.22;
}
.channel-area--p {
  fill: var(--c-mat-hole);
  fill-opacity: 0.22;
}
.guide-pinch .plot__guide {
  stroke: var(--c-pick);
  stroke-dasharray: none;
  stroke-width: 1.5;
}
.guide-pinch .plot__note {
  fill: var(--c-accent);
}
.plot__note.plot-region {
  fill: var(--c-text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ about dialog */
.about {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100dvh - 48px);
  padding: 18px 22px;
  border: 1px solid var(--c-glass-border);
  border-radius: 14px;
  background: var(--c-bg);
  color: var(--c-text);
  box-shadow: 0 12px 40px var(--c-shadow-xl);
}
.about::backdrop {
  background: var(--c-backdrop);
}
.about__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}
.about__titles h2 {
  margin: 0;
}
.about__version {
  margin: 2px 0 var(--space-3);
  font-size: 12.5px;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
.about h3 {
  margin-top: var(--space-5);
  font-size: 14px;
}
.about ul {
  margin: 0;
  padding-left: 1.2em;
}
.about__acc {
  list-style: none;
  padding-left: 0 !important;
  display: grid;
  gap: 4px;
}
.about__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.about__cleared {
  color: var(--c-text-muted);
}
.changelog__entry h4 {
  font-size: 13px;
  margin: var(--space-2) 0 2px;
}
.about__foot {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--c-glass-border);
  font-size: 12.5px;
  color: var(--c-text-muted);
}
.about__foot p {
  margin: 0;
}

/* ------------------------------------------------------------------ 404 page and noscript */
.page-notfound {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 30%, var(--c-stage-from), var(--c-stage-mid) 60%, var(--c-stage-to));
}
.notfound {
  text-align: center;
  padding: var(--space-7) var(--gap);
  display: grid;
  justify-items: center;
  gap: var(--space-3);
}
.noscript {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  margin: 0;
  padding: var(--space-3);
  background: var(--c-glass-strong);
  text-align: center;
}
.noscript span {
  margin: 0 var(--space-2);
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .dock {
    left: var(--gap);
    right: var(--gap);
    max-width: none;
  }
  .panel {
    max-height: calc(100% - var(--dock-h) - 3 * var(--gap));
  }
  .dock__body {
    grid-template-columns: minmax(0, 520px) minmax(170px, 1fr);
  }
}

@media (max-width: 860px) {
  .topbar {
    position: sticky;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-2) var(--gap);
  }
  .levels {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }
  .topbar__end {
    margin-left: auto;
  }
  .stage {
    position: static;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding-bottom: var(--gap);
    overflow: visible;
  }
  .viewport {
    position: relative;
    inset: auto;
    height: 58vh;
    min-height: 300px;
  }
  .stage__status {
    top: var(--space-3);
  }
  .views {
    position: static;
    transform: none;
    align-self: center;
    max-width: calc(100% - 2 * var(--gap));
    overflow-x: auto;
  }
  .panel,
  .dock {
    position: static;
    width: auto;
    max-height: none;
    height: auto;
    margin: 0 var(--gap);
    overflow: visible;
  }
  .panel--right {
    order: 1;
  }
  .dock {
    order: 2;
  }
  .panel,
  .dock {
    translate: none;
  }
  .panel__summary::before {
    display: none;
  }
  .panel--left {
    order: 3;
  }
  .vp-fallback {
    inset: var(--space-3);
  }
}

@media (max-width: 560px) {
  .brand__name {
    font-size: 14px;
  }
  .home-pill {
    display: none;
  }
  .seg__btn,
  .level-btn {
    padding: 5px 8px;
    font-size: 12.5px;
  }
  .dock__body {
    grid-template-columns: 1fr;
  }
  .ro {
    grid-template-columns: 1fr 1fr;
  }
  .plot {
    max-height: none;
  }
}

/* Reduced motion: transitions and animations off (the 3D motion is paused by the level itself). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ process flow: step card, player, step list */
.step__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 4px;
}
.step__count {
  font-family: var(--font-latin);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-accent);
}
.step__badge {
  display: inline-block;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--c-badge-bg);
  color: var(--c-badge-fg);
}
.step__badge--module {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.step__badge[data-kind="thermal"],
.step__badge[data-kind="start"] {
  background: var(--c-region-sub-bg);
  color: var(--c-region-sub-fg);
}
.step__badge[data-kind="dep"] {
  background: var(--c-region-lin-bg);
  color: var(--c-region-lin-fg);
}
.step__badge[data-kind="etch"],
.step__badge[data-kind="done"] {
  background: var(--c-region-sat-bg);
  color: var(--c-region-sat-fg);
}
.step__badge[data-kind="implant"] {
  background: var(--c-lvl-calc-bg);
  color: var(--c-lvl-calc-fg);
}
.step__badge[data-kind="litho"] {
  background: var(--c-lvl-approx-bg);
  color: var(--c-lvl-approx-fg);
}
.step__title {
  margin: 0 0 6px;
  font-size: 15px;
}
.step__bar,
.player__total {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--c-track);
  overflow: hidden;
}
.step__fill,
.player__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--pct, 0) * 1%);
  background: var(--c-track-fill);
}
.step__desc {
  margin: 8px 0 4px;
}
.step__typ {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--c-text-muted);
}
.step__params {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0 0 8px;
  font-size: 12.5px;
}
.step__params dt {
  color: var(--c-text-muted);
}
.step__params dd {
  margin: 0;
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
}
.step__link {
  margin: 0 0 8px;
}
.step__legend {
  margin-top: 4px;
}
.btn--big {
  width: 100%;
  min-height: 38px;
  font-size: 14px;
}
.player__row {
  justify-content: space-between;
}
.player__total {
  margin: 2px 0 0;
}
.icon-btn--step {
  border: 1px solid var(--c-border-strong);
  border-radius: 8px;
  background: var(--c-bg);
}
.icon-btn:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.icon--prev::before {
  content: "⏮";
  font-size: 14px;
}
.icon--next::before {
  content: "⏭";
  font-size: 14px;
}
.seg--wrap {
  flex-wrap: wrap;
}
.ro__side {
  display: grid;
  gap: 8px;
  align-content: start;
}
.steps__box {
  max-height: 236px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px 8px;
}
.steps__module {
  grid-column: 1 / -1;
  margin: 6px 0 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-accent);
}
.steps__btn {
  width: 100%;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  color: var(--c-text-soft);
  cursor: pointer;
}
.steps__btn:hover {
  background: var(--c-pill-bg-hover);
}
.steps__btn[data-done="true"] {
  color: var(--c-text);
}
.steps__btn[aria-current="step"] {
  border-color: var(--c-track-fill);
  background: var(--c-region-lin-bg);
  color: var(--c-text);
  font-weight: 600;
}
.steps__n {
  font-family: var(--font-latin);
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.steps__btn .step__badge {
  font-size: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .steps__box {
    scroll-behavior: auto;
  }
}
