/* ==========================================================================
   Dyonica ICMQG · interaction layer (fx.js, labs.js)
   Uses the tokens from index.css: --cyan --violet --amber --rose --ok --line
   --fg --fg-dim --f-display --f-mono --ease. Load after index.css.
   ========================================================================== */

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
kbd {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .04em; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.8em; height: 1.8em; padding: 0 .45em;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--fg); background: rgb(255 255 255 / .04);
}

/* ---------- header search button ---------- */
.nav__search {
  flex: none; display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px;
  margin-left: clamp(16px, 2.2vw, 32px); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--fg-dim);
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.nav__search:hover, .nav__search:focus-visible { color: var(--fg); border-color: var(--fg); background: rgb(255 255 255 / .06); }
.nav__search .dy-ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nav__search + .nav__cta { margin-left: 12px; }
.nav__kbd { height: 1.7em; font-size: .64rem; color: var(--fg-dim); }
@media (max-width: 1100px) { .nav__search-t { display: none; } }
@media (max-width: 860px) {
  .nav__search { margin-left: auto; width: 44px; height: 44px; padding: 0; justify-content: center; border-color: transparent; }
  .nav__search .dy-ico { width: 21px; height: 21px; }
  .nav__kbd { display: none; }
  .nav__search + .nav__cta { margin-left: 4px; }
}
@media (pointer: coarse) { .nav__kbd { display: none; } }
@media (max-width: 420px) {
  .dyfx .nav { gap: 8px; }
  .dyfx .nav__word { letter-spacing: .16em; }
  .nav__search + .nav__cta { margin-left: 2px; }
}
/* very narrow phones (320–360px): keep the wordmark clear of the search icon */
@media (max-width: 360px) {
  .dyfx .nav { gap: 6px; }
  #nav-home { flex: none; }
  .nav__logo { height: 12px; }
  .nav__search { width: 36px; }
  .nav__cta { padding-inline: 12px; }
}

/* ---------- command palette ---------- */
.pal {
  width: min(680px, calc(100vw - 24px)); max-height: min(560px, calc(100svh - 120px)); margin: 12vh auto auto; padding: 0;
  display: none; flex-direction: column; overflow: hidden;
  color: var(--fg); background: linear-gradient(180deg, rgb(22 22 30 / .92), rgb(8 8 12 / .96));
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 40px 120px -20px rgb(0 0 0 / .9), 0 0 0 1px rgb(255 255 255 / .03), inset 0 1px 0 rgb(255 255 255 / .06);
}
.pal[open] { display: flex; }
.pal::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--grad); }
.pal:modal { overscroll-behavior: contain; }
.pal::backdrop {
  background: rgb(0 0 0 / .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  overflow: hidden; overscroll-behavior: contain;
}
@media (prefers-reduced-motion: no-preference) {
  .pal[open] { animation: pal-in .28s var(--ease); }
  .pal[open]::backdrop { animation: pal-fade .28s var(--ease); }
  @keyframes pal-in { from { opacity: 0; translate: 0 -10px; scale: .98; } }
  @keyframes pal-fade { from { opacity: 0; } }
}
.pal__bar { display: flex; align-items: center; gap: 12px; padding: 6px 10px 6px 18px; border-bottom: 1px solid var(--line); }
.pal__bar .dy-ico { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; }
.pal__q {
  flex: 1; min-width: 0; height: 56px; background: none; border: 0; outline: 0; color: var(--fg);
  font-family: var(--f-display); font-size: 1.45rem; font-weight: 500; letter-spacing: .04em;
}
.pal__q::placeholder { color: var(--fg-mute); text-transform: uppercase; letter-spacing: .08em; font-size: 1.15rem; }
.pal__close { flex: none; min-width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; color: var(--fg-dim); }
.pal__close:hover { color: var(--fg); background: rgb(255 255 255 / .06); }
.pal__esc { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .1em; border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 6px; }
.pal__x { display: none; font-size: 1.05rem; }
.pal__list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.pal__group { padding: 12px 12px 6px; font-family: var(--f-mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-mute); }
.pal__opt {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 48px;
  padding: 8px 12px; border-radius: 6px; cursor: pointer; border: 1px solid transparent;
}
.pal__opt[aria-selected="true"] { background: rgb(102 199 255 / .08); border-color: hsl(202 100% 70% / .35); }
.pal__type { font-family: var(--f-mono); font-size: .62rem; letter-spacing: .12em; color: var(--fg-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal__type.--PAGE { color: var(--fg-dim); }
.pal__type.--PROGRAM { color: var(--violet); }
.pal__type.--RESEARCH { color: var(--cyan); }
.pal__type.--FAQ { color: var(--amber); }
.pal__type.--ADMIN { color: var(--rose); }
.pal__type.--RECENT { color: var(--ok); }
.pal__txt { display: grid; gap: 2px; min-width: 0; }
.pal__t { font-family: var(--f-display); font-size: 1.12rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal__t mark { background: none; color: var(--cyan); text-decoration: underline; text-decoration-color: hsl(202 100% 70% / .5); text-underline-offset: 3px; }
.pal__sub { font-size: .8rem; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal__go { font-family: var(--f-mono); font-size: .8rem; color: var(--fg-mute); opacity: 0; transition: opacity .2s; }
.pal__opt[aria-selected="true"] .pal__go { opacity: 1; color: var(--cyan); }
.pal__empty { padding: 28px 14px; color: var(--fg-dim); font-size: .92rem; text-align: center; }
.pal__help { padding: 18px 20px 20px; overflow-y: auto; }
.pal__help dl { margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.pal__help dl div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: rgb(8 8 12 / .96); }
.pal__help dt { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--fg-mute); white-space: nowrap; }
.pal__help dd { margin: 0; font-family: var(--f-display); text-transform: uppercase; letter-spacing: .08em; font-size: .95rem; text-align: right; }
.pal__foot { display: flex; gap: 18px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-mute); }
.pal__foot span { display: inline-flex; align-items: center; gap: 4px; }
.pal__foot kbd { font-size: .6rem; }
.pal__foot-r { margin-left: auto; }
@media (max-width: 640px), (pointer: coarse) {
  .pal { margin-top: 10px; max-height: calc(100svh - 24px); }
  .pal__foot { display: none; }
  .pal__esc { display: none; }
  .pal__x { display: block; }
  .pal__opt { grid-template-columns: 74px minmax(0, 1fr); min-height: 52px; }
  .pal__go { display: none; }
  .pal__help dl { grid-template-columns: 1fr; }
  .pal__q { font-size: 1.25rem; }
}

/* ---------- scroll progress ---------- */
.dy-progress { position: fixed; z-index: 51; left: 0; right: 0; top: var(--nav-h); height: 2px; pointer-events: none; }
.dy-progress__bar { display: block; height: 100%; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); box-shadow: 0 0 12px hsl(202 100% 70% / .6); }
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    @keyframes dy-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    .dy-progress__bar { animation: dy-progress auto linear both; animation-timeline: scroll(root block); }
  }
}

/* ---------- cursor glow + magnetic ---------- */
.dy-glow {
  position: fixed; z-index: 1; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; pointer-events: none;
  border-radius: 50%; opacity: 0; transition: opacity .5s var(--ease), scale .4s var(--ease);
  background: radial-gradient(closest-side, hsl(234 92% 76% / .13), hsl(202 100% 70% / .06) 45%, transparent 72%);
  mix-blend-mode: screen; will-change: transform;
}
.dy-glow.--on { opacity: 1; }
.dy-glow.--press { scale: .85; }
@media (pointer: coarse), (prefers-reduced-motion: reduce) { .dy-glow { display: none; } }
.dy-mag { transition: color .35s var(--ease), background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease), translate .45s var(--ease); }
.dy-mag.dy-mag--on { transition: color .35s var(--ease), background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease), translate .12s linear; }
@media (prefers-reduced-motion: reduce) { .dy-mag { translate: none !important; } }

/* ---------- count-up ---------- */
.dy-count { font-variant-numeric: tabular-nums; }

/* ---------- mobile donate bar ---------- */
.dy-dbar { display: none; }
@media (max-width: 860px) {
  .dy-dbar {
    position: fixed; z-index: 40; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; min-height: 56px;
    background: rgb(10 10 14 / .86); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 18px 50px -12px rgb(0 0 0 / .9);
    translate: 0 calc(100% + 24px + env(safe-area-inset-bottom, 0px)); opacity: 0; visibility: hidden;
    transition: translate .45s var(--ease), opacity .3s var(--ease), visibility 0s linear .45s;
  }
  .dy-dbar::before { content: ""; position: absolute; inset: -1px -1px auto; height: 2px; border-radius: 8px 8px 0 0; background: var(--grad); }
  .dy-dbar.--show { translate: 0 0; opacity: 1; visibility: visible; transition: translate .45s var(--ease), opacity .3s var(--ease), visibility 0s; }
  .dy-dbar__t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 500; font-size: 1rem; line-height: 1.15; letter-spacing: .1em; text-transform: uppercase; text-wrap: balance; overflow-wrap: break-word; }
  .dy-dbar__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
  .dy-dbar__cta {
    flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
    background: var(--fg); color: #000; font-family: var(--f-display); font-weight: 600; font-size: .95rem; letter-spacing: .16em; text-transform: uppercase;
  }
  .dy-dbar__cta:active { background: var(--cyan); }
  .dy-dbar__x { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--fg-dim); font-size: .95rem; border-radius: 6px; }
  .dy-dbar__x:hover { color: var(--fg); }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .dy-dbar__dot { animation: dy-pulse 2.4s var(--ease) infinite; }
  @keyframes dy-pulse { 50% { opacity: .35; } }
}
@media (max-width: 360px) { .dy-dbar__t { font-size: .88rem; letter-spacing: .06em; } .dy-dbar__dot { display: none; } }
@media (prefers-reduced-motion: reduce) { .dy-dbar { transition: none !important; } }

/* ==========================================================================
   Labs (shared)
   ========================================================================== */
.lab { display: grid; gap: clamp(20px, 3vw, 32px); }
.lab__head { display: grid; gap: 12px; max-width: 72ch; }
.lab__head h3 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 600; }
.lab__desc { margin: 0; color: var(--fg-dim); font-size: 1rem; }
.lab__desc em { color: var(--fg); font-style: normal; font-weight: 600; }
.lab__desc a, .dx__note a { color: var(--cyan); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.lab__desc a:hover, .dx__note a:hover { color: var(--fg); }
.lab__hint { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .04em; color: var(--fg-mute); line-height: 1.5; }
.lab .field label { align-items: baseline; gap: 12px; }
.lab .field label sub { font-size: .8em; text-transform: none; }
.lab .field input[type="range"] { height: 32px; margin: 0; cursor: pointer; }
.lab__eq {
  font-family: var(--f-mono); font-size: .9rem; color: var(--fg); background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--violet); border-radius: 8px; padding: 14px 16px; display: grid; gap: 8px; overflow-x: auto;
}
.lab__eq-live { color: var(--fg-dim); font-size: .78rem; white-space: nowrap; }
.lab .chip { min-height: 36px; }
@media (pointer: coarse) { .lab .chip { min-height: 44px; } .lab .field input[type="range"] { height: 44px; } }

@media (max-width: 560px) { .lab__eq { font-size: .8rem; } }

/* ---------- materials ---------- */
.mx__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.mx__search { display: flex; align-items: center; gap: 10px; min-width: min(100%, 280px); flex: 0 1 320px; height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgb(0 0 0 / .35); transition: border-color .25s; }
.mx__search:focus-within { border-color: var(--cyan); }
.mx__search svg { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--fg-dim); stroke-width: 2; stroke-linecap: round; }
.mx__search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--fg); font-family: var(--f-mono); font-size: .82rem; letter-spacing: .04em; }
.mx__search input::placeholder { color: var(--fg-mute); }
.mx__count { margin: 0; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .12em; color: var(--fg-dim); }
.mx__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; align-items: start; }
.mx__empty { margin: 0; padding: 28px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--fg-dim); text-align: center; }
.mcard {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  transition: border-color .3s var(--ease), box-shadow .35s var(--ease), translate .35s var(--ease);
}
.mx__grid.--vt .mcard { view-transition-name: match-element; view-transition-class: mcard; }
.mcard[hidden] { display: none; }
.mcard:hover { border-color: var(--line-strong); translate: 0 -3px; box-shadow: 0 20px 50px -24px rgb(80 110 250 / .55); }
.mcard.--open { border-color: hsl(202 100% 70% / .45); }
.mcard::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--mc, var(--line-strong)); opacity: .8; }
.mcard[data-fam="ti"] { --mc: var(--amber); }
.mcard[data-fam="sc"] { --mc: var(--cyan); }
.mcard[data-fam="weyl"] { --mc: var(--rose); }
.mcard[data-fam="dirac"] { --mc: var(--violet); }
.mcard__btn { position: relative; width: 100%; text-align: left; display: grid; gap: 10px; padding: 18px 18px 16px; }
.mcard__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; }
.mcard__year { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .12em; color: var(--fg-mute); }
.mcard__f { font-family: var(--f-display); font-weight: 600; font-size: 2.1rem; line-height: 1; letter-spacing: .02em; color: var(--fg); }
.mcard__f sub { font-size: .55em; vertical-align: -.25em; line-height: 0; }
.mcard__n { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-dim); margin-top: -4px; }
.mcard__kv { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-block: 1px solid var(--line); }
.mcard__k { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-mute); white-space: nowrap; }
.mcard__k sub { text-transform: none; }
.mcard__v { margin-left: auto; min-width: 0; overflow-wrap: break-word; font-family: var(--f-display); font-size: 1.15rem; font-weight: 500; line-height: 1.2; letter-spacing: .03em; text-align: right; color: var(--mc, var(--fg)); }
.mcard__why { font-size: .86rem; line-height: 1.45; color: var(--fg-dim); padding-right: 24px; }
.mcard__more { position: absolute; right: 16px; bottom: 14px; font-family: var(--f-mono); font-size: 1.1rem; color: var(--cyan); transition: rotate .3s var(--ease); }
.mcard.--open .mcard__more { rotate: 45deg; }
.mcard__d { padding: 0 18px 18px; }
.mcard__d p { margin: 0; padding: 12px 14px; font-size: .86rem; line-height: 1.55; color: var(--fg); background: rgb(255 255 255 / .03); border-left: 2px solid var(--mc, var(--cyan)); border-radius: 4px; }
.mtag.--ti { color: var(--amber); border-color: rgb(255 190 92 / .4); }
.mtag.--sc { color: var(--cyan); border-color: rgb(102 199 255 / .4); }
.mtag.--weyl { color: var(--rose); border-color: rgb(255 110 140 / .4); }
.mtag.--dirac { color: var(--violet); border-color: rgb(137 149 250 / .4); }
::view-transition-group(.mcard) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .7, .1, 1); }
@media (max-width: 560px) { .mx__search { flex: 1 1 100%; } .mx__bar .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 2px var(--pad); scrollbar-width: none; } .mx__bar .filters .chip { flex: none; } }
@media (prefers-reduced-motion: reduce) { .mcard, .mcard__more { transition: none; } .mcard:hover { translate: none; } }

/* ---------- lens ---------- */
.lens__stage { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 8; min-height: 280px; }
.lens__cv { width: 100%; height: 100%; touch-action: pan-y; cursor: crosshair; }
.lens__hint {
  position: absolute; right: 14px; top: 12px; pointer-events: none; font-family: var(--f-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-dim); padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: rgb(0 0 0 / .55); transition: opacity .5s var(--ease);
}
.lab--lens.--touched .lens__hint { opacity: 0; }
.lens__ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.lens__ctrl .field { flex: 1 1 260px; max-width: 420px; margin: 0; }
.lens__tilt { min-height: 44px; }
@media (max-width: 640px) { .lens__stage { aspect-ratio: 4 / 3.4; min-height: 0; } }

/* ---------- diagram explorer (conference) ---------- */
.dx { display: grid; gap: 20px; }
.dx__tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.dx__tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; text-align: center; }
.dx__tab[aria-selected="true"] { background: var(--fg); color: #000; border-color: var(--fg); }
.dx__tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.dx__n { font-size: .64rem; opacity: .55; }
.dx__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3vw, 36px); align-items: start; }
.dx__l { grid-column: 1; grid-row: 1; display: grid; gap: 18px; min-width: 0; }
.dx__r { grid-column: 2; grid-row: 1; display: grid; gap: 12px; min-width: 0; position: sticky; top: calc(var(--nav-h) + 16px); }
.dx__map { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #04060c; }
.dx__map img { display: block; width: 100%; height: auto; opacity: .5; transition: opacity .3s; }
.dx__map:hover img { opacity: .62; }
.dx__col { position: absolute; top: 0; bottom: 0; cursor: pointer; border: 1px solid transparent; border-radius: 6px; transition: background .25s, border-color .25s, backdrop-filter .25s; }
.dx__col:hover { background: rgb(102 199 255 / .06); border-color: var(--line-strong); backdrop-filter: brightness(1.5); }
.dx__col.--on { border-color: var(--cyan); background: linear-gradient(to bottom, rgb(102 199 255 / .1), rgb(124 92 255 / .06)); backdrop-filter: brightness(2.1); box-shadow: inset 0 0 24px rgb(102 199 255 / .2); }
.dx__stage { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.dx__cv { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.dx__cv:active { cursor: grabbing; }
.dx__cv:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.dx__hint {
  position: absolute; right: 12px; top: 12px; pointer-events: none; font-family: var(--f-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-dim); padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: rgb(0 0 0 / .55); transition: opacity .5s var(--ease);
}
.lab--dx.--touched .dx__hint { opacity: 0; }
.dx__read { position: absolute; left: 12px; right: 12px; bottom: 10px; pointer-events: none; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); text-shadow: 0 1px 3px #000; }
.dx__ctrl { margin: 0; }
.dx__panel { display: grid; gap: 12px; align-content: start; }
.dx__panel:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.dx__math { margin: 0; font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif; font-size: clamp(1.05rem, 1.6vw, 1.28rem); color: var(--fg); padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--violet); border-radius: 8px; background: var(--panel); overflow-x: auto; white-space: nowrap; }
.dx__math span { color: var(--cyan); }
.dx__title { margin: 0; font-family: var(--f-display); font-size: clamp(1.3rem, 2.2vw, 1.7rem); font-weight: 600; letter-spacing: .02em; line-height: 1.15; text-transform: uppercase; }
.dx__body { margin: 0; color: var(--fg-dim); line-height: 1.6; }
.dx__real { display: grid; gap: 8px; padding: 16px 18px; border: 1px solid hsl(38 100% 64% / .35); border-radius: 10px; background: linear-gradient(135deg, hsl(38 100% 64% / .08), transparent 60%); }
.dx__real .bracket { color: var(--amber); }
.dx__rt { margin: 0; font-weight: 600; font-size: 1.05rem; color: var(--fg); }
.dx__rb { margin: 0; color: var(--fg-dim); font-size: .95rem; line-height: 1.6; }
.dx__note { margin: 0; max-width: 90ch; }
@media (max-width: 860px) {
  .dx__grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dx__l, .dx__r { display: contents; }
  .dx__map { order: -1; }
  .dx__panel { margin-top: 8px; }
}
@media (max-width: 560px) {
  .dx__tab { padding: 7px 8px; font-size: .68rem; letter-spacing: .06em; gap: 6px; }
  .dx__stage { aspect-ratio: 1 / 1; }
  .dx__read { font-size: .6rem; }
}
@media (prefers-reduced-motion: reduce) { .dx__map img, .dx__col, .dx__hint { transition: none; } }

/* mobile containment for labs (grid children default to min-width:auto) */
.lab, .lab > *, .lab__eq > *, .mx__bar > * { min-width: 0; }
.lab .filters { flex-wrap: wrap; overflow: visible; }
.lab .filters .chip { white-space: nowrap; }
#main { overflow-x: clip; }
@media (max-width: 860px) { .lab__eq-live { white-space: normal; overflow-wrap: anywhere; } }

/* Lab 04: Spline 3D scene (DYLabs.spline) */
.sp { display: grid; gap: 10px; }
.sp__stage { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.sp__view, .sp__poster, .sp__gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp__poster, .sp__gl { display: block; }
.sp__poster[hidden] { display: none; }
.sp__gl { opacity: 0; transition: opacity .6s var(--ease); }
.sp__stage[data-state="live"] .sp__gl { opacity: 1; }
.sp__stage:not([data-state="live"]) .sp__gl { pointer-events: none; }
@media (pointer: coarse) { .sp__stage:not(.--interact) .sp__gl { pointer-events: none; } }
.sp__stage.--interact { outline: 2px solid var(--cyan); outline-offset: -2px; }
.sp__ui { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; pointer-events: none; }
.sp__ui > * { pointer-events: auto; }
.sp__status { margin: 0; max-width: 46ch; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .03em; line-height: 1.5; color: var(--fg); }
.sp__stage.--msg .sp__status { background: rgb(0 0 0 / .62); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; backdrop-filter: blur(6px); }
.sp__status:empty { display: none; }
.sp__btns { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.sp__btns .btn { min-height: 44px; background: rgb(0 0 0 / .55); }
.sp__btns .btn[hidden] { display: none; }
/* The runtime paints a "Built with Spline" badge bottom-right of the canvas: keep live controls clear of it. */
.sp__stage[data-state="live"] .sp__btns { margin-left: 0; margin-right: auto; }
.sp__stage[data-state="loading"]::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgb(140 200 255 / .08) 50%, transparent 70%); background-size: 220% 100%; animation: sp-shimmer 1.4s linear infinite; }
@keyframes sp-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.sp__credit { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .04em; color: var(--fg-mute); }
.sp__credit a { color: var(--fg-dim); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.sp__credit a:hover { color: var(--cyan); }
.sp__credit > span:not(.sp__dot) { display: inline-flex; align-items: center; }
.sp__dot { display: inline-flex; align-items: center; }
@media (max-width: 640px) { .sp__stage { aspect-ratio: 4 / 5; } .sp__ui { left: 8px; right: 8px; bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { .sp__gl { transition: none; } .sp__stage[data-state="loading"]::after { animation: none; } }

/* Home hero: the 3D dyon as the background (DYLabs.splineHero). JS sets the box; the 2D hero
   canvas stays underneath as the fallback and cross-fades out once 3D is live. */
.hero__3d { position: absolute; z-index: -2; display: block; opacity: 0; pointer-events: none; transition: opacity 1.2s var(--ease); }
.hero.--3d .hero__3d { opacity: 1; }
.hero.--h3d .hero__bg { transition: opacity 1.2s var(--ease); }
.hero.--3d .hero__bg { opacity: 0; }
.hero[data-h3d-layout="none"] .hero__3d { display: none; }
.hero.--3d[data-h3d-layout="none"] .hero__bg { opacity: 1; }
/* beside the headline (wide screens): left edge melts into the page; the shade stays under the text
   and leaves the bottom-right clear, where the runtime draws its "Built with Spline" badge */
.hero[data-h3d-layout="side"] .hero__3d {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28%); mask-image: linear-gradient(90deg, transparent 0, #000 28%); }
.hero.--3d[data-h3d-layout="side"]::after {
  background: linear-gradient(90deg, rgb(0 0 0 / .86) 0%, rgb(0 0 0 / .45) 45%, rgb(0 0 0 / 0) 75%),
    radial-gradient(85% 55% at 0% 100%, rgb(0 0 0 / .85), rgb(0 0 0 / 0)); }
/* above the headline (phones / narrow): drawn over the shade, never behind text; the bottom edge
   fades out except a small corner that keeps the badge visible */
.hero[data-h3d-layout="top"] .hero__3d { z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 10%, #000 68%, transparent), radial-gradient(210px 80px at 100% 100%, #000 72%, transparent);
  -webkit-mask-composite: source-over;
  mask-image: linear-gradient(180deg, transparent 0, #000 10%, #000 68%, transparent), radial-gradient(210px 80px at 100% 100%, #000 72%, transparent);
  mask-composite: add; }
.hero[data-h3d-layout="top"] .hero__content { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .hero__3d, .hero.--h3d .hero__bg { transition: none; } }
