:root {
  color-scheme: dark;
  --bg: #050914;
  --paper: rgba(10, 19, 32, 0.88);
  --ink: #eef7ff;
  /* --muted pinned to the dark-theme value so the default (no data-theme)
     cascade is unambiguous; the html[data-theme] blocks below still win. */
  --muted: #b9c8d9;
  --line: rgba(105, 151, 190, 0.26);
  --cyan: #4fd9ff;
  --green: #6df0ca;
  --amber: #f7c76b;
  --rose: #c68bff;
  --navy: #09111f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  /* Domain typeface: monospace carries the technical/quantum voice on
     labels, indices, equations and numeric readouts. */
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

/* ---------- Self-hosted typeface ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/InterVariable.woff2") format("woff2");
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 167, 194, 0.08), transparent 28rem),
    linear-gradient(180deg, #f7faf9 0%, var(--bg) 34rem);
  letter-spacing: 0;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}

a {
  color: inherit;
}

img,
canvas {
  max-width: 100%;
  display: block;
}

p,
li {
  color: var(--muted);
  line-height: 1.65;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  position: static;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 227, 230, 0.82);
  background: rgba(246, 248, 247, 0.92);
  backdrop-filter: blur(14px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
  color: var(--navy);
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 167, 194, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 167, 194, 0.16), rgba(13, 140, 103, 0.14));
  color: var(--green);
  font-weight: 950;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  filter: drop-shadow(0 0 16px rgba(79, 217, 255, 0.2));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #33404a;
  font-weight: 700;
  font-size: 0.94rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: #eaf3f1;
  color: var(--green);
}

.button,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--navy);
}

.button.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.34);
}

.hero {
  position: relative;
  min-height: 610px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #0e141d;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 12, 18, 0.92) 0%, rgba(6, 12, 18, 0.72) 42%, rgba(6, 12, 18, 0.24) 100%),
    linear-gradient(0deg, rgba(6, 12, 18, 0.86) 0%, transparent 34%);
  z-index: 1;
}

/* Domain motif: a faint bloch-sphere / entanglement lattice accent.
   Inline SVG data-URI — fully self-contained, no external request.
   Sits above the darkening scrim (z-index 1) on the lighter right edge,
   below the hero copy (z-index 2). */
.hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  right: -60px;
  width: 460px;
  height: 460px;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.14;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' fill='none'%3E%3Cg stroke='%234fd9ff' stroke-width='1'%3E%3Ccircle cx='100' cy='100' r='78'/%3E%3Cellipse cx='100' cy='100' rx='78' ry='24'/%3E%3Cellipse cx='100' cy='100' rx='24' ry='78'/%3E%3C/g%3E%3Cline x1='100' y1='100' x2='150' y2='52' stroke='%236df0ca' stroke-width='1.5'/%3E%3Ccircle cx='150' cy='52' r='4' fill='%236df0ca'/%3E%3Ccircle cx='100' cy='100' r='3' fill='%234fd9ff'/%3E%3Ccircle cx='40' cy='150' r='2.5' fill='%23c68bff'/%3E%3Ccircle cx='168' cy='120' r='2' fill='%234fd9ff'/%3E%3C/svg%3E")
      center / contain no-repeat;
  animation: qe-bloch-spin 64s linear infinite;
}

@keyframes qe-bloch-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero::after {
    animation: none;
  }
}

.brand-hero {
  min-height: auto;
  display: block;
}

/* The dedicated brand-hero (logo showcase) keeps its own imagery clean. */
.brand-hero::after {
  display: none;
}

.brand-hero::before {
  background:
    linear-gradient(90deg, rgba(3, 8, 17, 0.58) 0%, rgba(3, 8, 17, 0.12) 36%, rgba(3, 8, 17, 0.12) 70%, rgba(3, 8, 17, 0.42) 100%),
    linear-gradient(0deg, rgba(3, 8, 17, 0.92) 0%, rgba(3, 8, 17, 0.3) 24%, transparent 58%);
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-hero img {
  position: relative;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 92px 0 54px;
}

.brand-hero-content {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.brand-hero-content h1 {
  max-width: 620px;
  font-size: 2.2rem;
}

.brand-hero-content .lead {
  max-width: 620px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
}

/* Mono section-index: a small "[ q## ]" style marker for the eyebrow's
   technical register when authored as data-index. */
.eyebrow[data-index]::before {
  content: "[ " attr(data-index) " ] ";
  color: var(--cyan);
  opacity: 0.72;
}

.hero .eyebrow {
  color: #78e0c5;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

h1 {
  max-width: 890px;
  color: #fff;
  font-size: clamp(2.9rem, 5.4vw, 4.5rem);
  letter-spacing: -0.028em;
}

h2 {
  font-size: 2.6rem;
  letter-spacing: -0.022em;
}

h3 {
  font-size: 1.3rem;
}

.lead {
  max-width: 760px;
  color: #d9e4e5;
  font-size: clamp(1rem, 1.08vw, 1.1rem);
}

.hero-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-strip {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.12);
}

.hero-strip div {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  background: rgba(8, 14, 22, 0.76);
}

.hero-strip strong {
  display: block;
  color: #fff;
  font-size: 1.14rem;
}

.hero-strip span {
  color: #bdd0d4;
  line-height: 1.45;
}

.hero-strip .button {
  justify-self: start;
}

section {
  padding: 58px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-head p {
  max-width: 650px;
  margin: 8px 0 0;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.panel,
.tool-panel,
.lab-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(16, 20, 24, 0.05);
}

.card {
  padding: 22px;
}

.card h3,
.panel h3 {
  margin-bottom: 10px;
}

.card p:last-child,
.panel p:last-child {
  margin-bottom: 0;
}

.stat {
  display: block;
  color: var(--cyan);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.52rem;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.band {
  background: #101820;
  color: #fff;
}

.band h2,
.band h3 {
  color: #fff;
}

.band p,
.band li {
  color: #c9d6d7;
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.topic-row strong {
  color: var(--navy);
}

.page-hero {
  padding: 72px 0 46px;
  background:
    linear-gradient(135deg, rgba(0, 167, 194, 0.1), transparent 30rem),
    linear-gradient(180deg, #ffffff, #f3f7f6);
  border-bottom: 1px solid var(--line);
}

.page-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 32px;
  align-items: center;
}

.page-hero-copy {
  min-width: 0;
}

.page-hero-visual {
  margin: 0;
  min-width: 0;
  border: 1px solid rgba(105, 151, 190, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: #030712;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.36), 0 0 34px rgba(79, 217, 255, 0.1);
}

.page-hero-visual img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.page-hero h1 {
  color: var(--ink);
  max-width: 980px;
  font-size: 3.45rem;
}

.page-hero .lead {
  color: var(--muted);
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.lab-panel {
  overflow: hidden;
}

.concept-theater {
  padding-top: 40px;
}

.concept-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: stretch;
}

.concept-visual {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.concept-canvas {
  width: 100%;
  min-height: 460px;
  background: #030712;
}

.concept-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(79, 217, 255, 0.2);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.82);
  backdrop-filter: blur(10px);
}

.concept-caption strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.concept-caption span {
  color: var(--muted);
}

.concept-controls {
  display: grid;
  align-content: start;
  gap: 16px;
}

.concept-controls > label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.concept-steps {
  display: grid;
  gap: 10px;
}

.concept-steps div {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.46);
}

.concept-steps span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(79, 217, 255, 0.12);
  color: var(--green);
  font-weight: 900;
}

.concept-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.equation-studio {
  padding-top: 24px;
}

.equation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.equation-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, rgba(79, 217, 255, 0.11), transparent 18rem),
    rgba(7, 16, 28, 0.9);
  box-shadow: var(--shadow);
}

.equation-canvas {
  width: 100%;
  min-height: 280px;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
  background: #030712;
}

.equation-copy {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.equation-copy h3 {
  color: var(--ink);
}

.equation-copy p {
  margin: 0;
}

.equation-copy .formula {
  background: rgba(3, 8, 17, 0.78);
  color: #dff6ff;
  border-color: rgba(79, 217, 255, 0.2);
}

.cat-lab {
  padding-top: 10px;
}

.cat-experiment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.cat-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.cat-canvas {
  width: 100%;
  min-height: 430px;
  background: #030712;
}

.cat-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.cat-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.cat-readout span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cat-controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

.cat-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cat-button-row .button {
  min-width: 112px;
  justify-content: center;
}

.cat-controls .formula {
  margin: 0;
  background: rgba(3, 8, 17, 0.78);
  color: #dff6ff;
  border-color: rgba(79, 217, 255, 0.2);
}

.wave-hero-visual {
  min-height: 280px;
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 217, 255, 0.16), transparent 18rem),
    #030712;
}

.wave-mini-canvas {
  display: block;
  width: 100%;
  min-height: 280px;
}

.wave-console {
  padding-top: 28px;
}

.wave-layout,
.wave-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.wave-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(198, 139, 255, 0.12), transparent 22rem),
    #030712;
  background-size: 72px 72px, 72px 72px, auto, auto;
  box-shadow: var(--shadow);
  touch-action: none;
}

.wave-stage canvas {
  display: block;
  width: 100%;
  min-height: 520px;
  cursor: grab;
}

.wave-stage canvas.is-dragging {
  cursor: grabbing;
}

.wave-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.wave-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.wave-readout span {
  color: var(--muted);
  font-size: 13px;
}

.wave-controls,
.wave-theory-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.wave-controls select,
.wave-controls input[type="range"],
.wave-controls button {
  width: 100%;
}

.toggle-line {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.wave-slice-card {
  overflow: hidden;
}

.wave-slice-canvas {
  display: block;
  width: 100%;
  min-height: 420px;
  background: #000;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
}

.wave-gallery-canvas {
  display: block;
  width: 100%;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.wave-legend {
  display: grid;
  grid-template-columns: auto minmax(180px, 420px) auto;
  gap: 12px;
  align-items: center;
  max-width: 720px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 13px;
}

.legend-ramp {
  min-height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: linear-gradient(90deg, #120528, #641f91, #ff6b17, #ffe58a, #ffffff);
}

.legend-negative,
.legend-positive {
  white-space: nowrap;
}

.qcd-hero-visual {
  min-height: 280px;
  background:
    radial-gradient(circle at 28% 50%, rgba(255, 79, 139, 0.16), transparent 14rem),
    radial-gradient(circle at 72% 50%, rgba(79, 217, 255, 0.16), transparent 14rem),
    #030712;
}

.qcd-mini-canvas {
  display: block;
  width: 100%;
  min-height: 280px;
}

.qcd-topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.qcd-simulator {
  padding-top: 28px;
}

.qcd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.qcd-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(198, 139, 255, 0.12), transparent 24rem),
    #030712;
  background-size: 72px 72px, 72px 72px, auto, auto;
  box-shadow: var(--shadow);
}

.qcd-stage canvas {
  display: block;
  width: 100%;
  min-height: 520px;
}

.qcd-potential-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.qcd-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.qcd-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.qcd-readout span {
  color: var(--muted);
  font-size: 13px;
}

.qcd-controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

.qcd-controls select,
.qcd-controls input[type="range"] {
  width: 100%;
}

.qcd-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.qcd-panel {
  overflow: hidden;
}

.qcd-panel-canvas {
  display: block;
  width: 100%;
  min-height: 340px;
  background: #030712;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
}

.qcd-figure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.qcd-figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 16, 28, 0.9);
  box-shadow: var(--shadow);
}

.qcd-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.82;
  object-fit: contain;
  padding: 8px;
  background: #f6fbff;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
  filter: contrast(1.32) saturate(0.85);
}

.qcd-figure figcaption {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.qcd-equations .card,
.qcd-equations .formula {
  min-width: 0;
  max-width: 100%;
}

.qcd-equations .formula {
  overflow-x: auto;
  scrollbar-width: thin;
}

.lab-canvas {
  width: 100%;
  min-height: 360px;
  background: #0e151d;
}

.lab-copy {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.control-stack {
  display: grid;
  gap: 14px;
}

.control {
  display: grid;
  gap: 7px;
}

.control label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #23313c;
  font-weight: 800;
}

input[type="range"],
input[type="number"],
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
}

input[type="range"] {
  padding: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}

.tabs button[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.news-item a {
  color: var(--navy);
  font-weight: 900;
  text-decoration: none;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #6b747d;
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
  color: #31404b;
  font-weight: 750;
  font-size: 0.86rem;
}

.formula {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  padding: 14px;
  color: #22303a;
  font-family: var(--mono);
}

.agent-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(13, 140, 103, 0.12);
}

.agent-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-pilot {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-pilot .small {
  margin: 0;
  max-width: 520px;
}

.visitor-counter,
.pageview-counter {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 18, 34, 0.94), rgba(14, 24, 48, 0.84));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.visitor-label {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.visitor-counter strong,
.pageview-counter strong {
  display: block;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.visitor-counter dl,
.pageview-counter dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.visitor-counter dl div,
.pageview-counter dl div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.76);
}

.visitor-counter dt,
.pageview-counter dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.visitor-counter dd,
.pageview-counter dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.footer-rating {
  display: grid;
  gap: 5px;
  min-width: min(100%, 260px);
  padding: 10px 12px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.68);
  color: #d6e5f4;
  font-size: 0.82rem;
  font-weight: 800;
}

.footer-rating strong {
  color: #eef7ff;
}

.rating-stars {
  color: #ffd166;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.contact-band {
  background: linear-gradient(135deg, rgba(6, 17, 34, 0.96), rgba(18, 22, 54, 0.9));
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.86);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.26);
}

.contact-form input[name="website"] {
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  opacity: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contact-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.9);
  color: var(--ink);
  font: inherit;
  padding: 12px 13px;
}

.contact-form textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.feedback-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  width: min(360px, calc(100vw - 24px));
  border: 1px solid rgba(109, 240, 202, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 90% 0%, rgba(109, 240, 202, 0.16), transparent 13rem),
    rgba(5, 12, 24, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  color: var(--ink);
  padding: 14px;
  transform: translate(-50%, -50%);
}

.feedback-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(3, 8, 17, 0.7);
  color: #d6e5f4;
}

.feedback-form {
  display: grid;
  gap: 9px;
}

.feedback-form h2 {
  max-width: 270px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.18;
}

.star-rating {
  display: flex;
  gap: 4px;
}

.star-button {
  width: 38px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(255, 209, 102, 0.2);
  background: rgba(3, 8, 17, 0.7);
  color: rgba(255, 209, 102, 0.46);
  font-size: 1.2rem;
}

.star-button.is-selected,
.star-button:hover {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.5);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.14);
}

.feedback-form textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.88);
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
  font-size: 0.9rem;
}

.feedback-status {
  min-height: 20px;
  margin: 0;
  color: #b7c7da;
  font-size: 0.84rem;
  font-weight: 800;
}

.small {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    overflow-x: visible;
    padding-bottom: 4px;
  }

  .nav-links a {
    min-width: 0;
    text-align: center;
    white-space: normal;
  }

  .hero {
    min-height: 720px;
  }

  .brand-hero {
    min-height: auto;
  }

  .brand-hero img {
    object-position: center top;
  }

  .hero-strip,
  .grid-2,
  .grid-3,
  .grid-4,
  .equation-grid,
  .concept-stage,
  .cat-experiment,
  .wave-layout,
  .wave-split,
  .qcd-layout,
  .qcd-panel-grid,
  .qcd-figure-grid,
  .contact-layout,
  .lab-layout {
    grid-template-columns: 1fr;
  }

  .wave-stage canvas,
  .qcd-stage canvas {
    min-height: 430px;
  }

  .wave-legend {
    grid-template-columns: 1fr;
  }

  .qcd-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .element-category-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    display: block;
  }

  .page-hero-inner {
    grid-template-columns: 1fr;
  }

  .page-hero-visual {
    max-width: 680px;
  }

  .topic-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  h1,
  .page-hero h1 {
    font-size: 2.85rem;
  }

  h2 {
    font-size: 2.05rem;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 22px, 1180px);
  }

  .nav {
    gap: 10px;
    min-height: auto;
    padding: 10px 0;
  }

  .brand {
    font-size: 1rem;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    overflow-x: visible;
    padding: 2px 0 3px;
  }

  .nav-links a {
    min-height: 34px;
    min-width: 0;
    padding: 7px 3px;
    font-size: 0.68rem;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  .hero-content {
    padding-top: 56px;
  }

  .page-hero {
    padding: 46px 0 34px;
  }

  .page-hero-inner {
    gap: 20px;
  }

  h1,
  .page-hero h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.55rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .element-category-legend {
    grid-template-columns: 1fr;
  }

  .element-category-key {
    font-size: 0.78rem;
  }

  section {
    padding: 42px 0;
  }

  .agent-row {
    grid-template-columns: 18px 1fr;
    align-items: start;
  }

  .agent-row .pill {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .footer-pilot {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .footer-pilot .button {
    width: 100%;
    max-width: 320px;
  }

  .visitor-counter,
  .pageview-counter {
    grid-template-columns: 1fr;
  }

  .visitor-counter dl,
  .pageview-counter dl {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .concept-visual {
    min-height: 500px;
  }
}

/* Quantum-security theme layer, matched to the QEntangle reference artwork. */
body {
  background:
    radial-gradient(circle at 12% 4%, rgba(79, 217, 255, 0.18), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(198, 139, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, #040812 0%, var(--bg) 34rem);
}

.topbar {
  border-bottom-color: rgba(105, 151, 190, 0.22);
  background: rgba(5, 9, 20, 0.9);
}

.brand {
  color: var(--ink);
}

.brand-mark {
  border-color: rgba(79, 217, 255, 0.5);
  background: linear-gradient(135deg, rgba(79, 217, 255, 0.22), rgba(198, 139, 255, 0.2));
  color: var(--green);
  box-shadow: 0 0 24px rgba(79, 217, 255, 0.18);
}

.nav-links a {
  color: #c6d5e7;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: rgba(79, 217, 255, 0.12);
  color: var(--green);
}

.button,
button {
  background: linear-gradient(135deg, #132b48, #102239);
  box-shadow: 0 0 18px rgba(79, 217, 255, 0.1);
}

.button.secondary,
button.secondary,
.tabs button {
  border-color: var(--line);
  background: rgba(9, 17, 31, 0.76);
  color: var(--ink);
}

.button.ghost {
  border-color: rgba(181, 214, 255, 0.36);
}

.tabs button[aria-selected="true"] {
  background: linear-gradient(135deg, #122b4a, #13223a);
  color: #fff;
  box-shadow: 0 0 20px rgba(79, 217, 255, 0.14);
}

.hero,
.lab-canvas {
  background: #030712;
}

.hero-strip {
  border-top-color: rgba(105, 151, 190, 0.28);
  background: rgba(79, 217, 255, 0.08);
}

.hero-strip div {
  background: rgba(5, 11, 22, 0.92);
}

.hero-strip span {
  color: #b8cbe0;
}

.card,
.panel,
.tool-panel,
.lab-panel,
.news-item {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat {
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(79, 217, 255, 0.32);
}

.band {
  background:
    radial-gradient(circle at 80% 0%, rgba(198, 139, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #07101c, #050914);
}

.page-hero {
  background:
    radial-gradient(circle at 16% 12%, rgba(79, 217, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 82% 10%, rgba(198, 139, 255, 0.14), transparent 26rem),
    linear-gradient(180deg, #07101d, #050914);
  border-bottom-color: var(--line);
}

.topic-row strong {
  color: var(--green);
}

.control label {
  color: #d7e8f9;
}

input[type="number"],
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  background: rgba(3, 8, 17, 0.74);
  color: var(--ink);
}

.news-item a {
  color: #dff6ff;
}

.meta {
  color: #90a7bd;
}

.pill {
  background: rgba(79, 217, 255, 0.08);
  color: #dff6ff;
}

.formula {
  background: rgba(3, 8, 17, 0.74);
  color: #dff6ff;
  overflow-x: auto;
  text-align: center;
  line-height: 1.45;
  scrollbar-color: rgba(79, 217, 255, 0.44) rgba(3, 8, 17, 0.82);
}

.formula mjx-container[display="true"] {
  margin: 0.35em 0 !important;
  min-width: max-content;
}

.footer {
  background: #040812;
}

.app-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.app-label {
  font-size: 1.55rem;
  font-weight: 950;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(79, 217, 255, 0.24);
}

.app-demo {
  display: grid;
  gap: 14px;
}

.app-meter {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 217, 255, 0.16), transparent 8rem),
    rgba(3, 8, 17, 0.74);
  text-align: center;
}

.app-meter strong {
  display: block;
  font-size: 2rem;
  color: var(--green);
}

.app-mini-list {
  display: grid;
  gap: 10px;
}

.app-mini-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(3, 8, 17, 0.56);
}

.app-mini-item span {
  display: block;
  color: var(--green);
  font-size: 0.86rem;
  margin: 5px 0;
}

.feature-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature-table th,
.feature-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}

.feature-table th {
  color: var(--ink);
  background: rgba(79, 217, 255, 0.08);
}

@media (max-width: 980px) {
  .app-product {
    grid-template-columns: 1fr;
  }
}

.login-link {
  border: 1px solid rgba(109, 240, 202, 0.42);
  background: rgba(109, 240, 202, 0.1);
  color: var(--green) !important;
}

.logout-link {
  border: 1px solid rgba(255, 123, 123, 0.42);
  background: rgba(255, 123, 123, 0.1);
  color: #ffb8b8 !important;
}

.science-canvas {
  width: 100%;
  min-height: 420px;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.simulation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.simulation-layout > * {
  min-width: 0;
}

.science-panel {
  overflow: hidden;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.5);
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.element-category-status {
  grid-column: span 2;
}

.element-category-status strong {
  font-size: 1rem;
}

.periodic-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-access-note {
  margin: 0 0 14px;
  color: #b7c7da;
  font-size: 0.9rem;
  font-weight: 750;
}

.element-category-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

.element-category-key {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.54);
  color: #d6e5f4;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
}

.element-category-key i {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--legend-color, #4fd9ff);
  box-shadow: 0 0 12px rgba(79, 217, 255, 0.34);
}

.element-category-key strong {
  margin-left: auto;
  color: #eef7ff;
  font-size: 0.7rem;
}

.periodic-table {
  display: grid;
  grid-template-columns: repeat(18, minmax(42px, 1fr));
  gap: 5px;
  min-width: 900px;
}

.element-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 10px;
  scrollbar-color: rgba(79, 217, 255, 0.44) rgba(3, 8, 17, 0.82);
}

.element-table-wrap::-webkit-scrollbar {
  height: 10px;
}

.element-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(79, 217, 255, 0.44);
}

.element-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(3, 8, 17, 0.82);
}

.element-tile {
  position: relative;
  min-height: 64px;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--element-border, rgba(79, 217, 255, 0.42));
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--element-bg-a, rgba(79, 217, 255, 0.3)), var(--element-bg-b, rgba(7, 16, 28, 0.94))),
    radial-gradient(circle at 82% 18%, var(--element-glow, rgba(79, 217, 255, 0.2)), transparent 72%),
    rgba(7, 16, 28, 0.92);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -20px 32px rgba(0, 0, 0, 0.2);
}

.element-lock {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(3, 8, 17, 0.72);
  color: #d6e5f4;
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
}

body:not(.auth-required-locked) .element-lock {
  display: none;
}

.element-tile:hover,
.element-tile.is-active {
  border-color: var(--element-active, rgba(109, 240, 202, 0.88));
  background:
    linear-gradient(145deg, var(--element-hover-a, rgba(79, 217, 255, 0.4)), var(--element-bg-b, rgba(7, 16, 28, 0.92))),
    radial-gradient(circle at 82% 18%, var(--element-glow, rgba(79, 217, 255, 0.3)), transparent 72%),
    rgba(7, 16, 28, 0.92);
  box-shadow:
    0 0 18px var(--element-glow, rgba(79, 217, 255, 0.24)),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.element-number {
  color: rgba(238, 247, 255, 0.72);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
}

.element-symbol {
  color: #eef7ff;
  font-size: 1.12rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 12px var(--element-glow, rgba(79, 217, 255, 0.68));
}

.element-name {
  color: #d6e5f4;
  font-size: clamp(0.46rem, 0.56vw, 0.62rem);
  font-weight: 800;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-detail {
  position: static;
  align-self: start;
  max-width: 100%;
  overflow: visible;
}

.element-detail h2 {
  font-size: 1.9rem;
}

.element-atom-stage {
  margin: 16px 0;
}

.element-atom-canvas {
  width: 100%;
  display: block;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.82);
  box-shadow: inset 0 0 34px rgba(79, 217, 255, 0.08), 0 18px 34px rgba(0, 0, 0, 0.24);
  cursor: grab;
}

.element-atom-canvas.is-dragging {
  cursor: grabbing;
}

.element-atom-stage .small {
  margin: 8px 0 0;
  color: #b7c7da;
}

.model-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 18px;
}

.model-legend span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.52);
  color: #d6e5f4;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.legend-dot,
.legend-line,
.legend-wave {
  flex: 0 0 auto;
  display: inline-block;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.legend-nucleus {
  background: radial-gradient(circle at 35% 35%, #fff, #6df0ca 42%, #243078);
  box-shadow: 0 0 12px rgba(109, 240, 202, 0.58);
}

.legend-electron {
  background: #c59cff;
  box-shadow: 0 0 10px rgba(197, 156, 255, 0.7);
}

.legend-line {
  width: 22px;
  height: 10px;
  border-top: 2px dashed rgba(79, 217, 255, 0.88);
  transform: translateY(4px);
}

.legend-wave {
  width: 22px;
  height: 10px;
  border-top: 2px solid #ffd166;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.isotope-panel {
  margin: 12px 0 18px;
}

.isotope-panel h3 {
  margin-bottom: 10px;
}

.isotope-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.isotope-grid div:last-child {
  grid-column: 1 / -1;
}

.isotope-grid strong {
  font-size: 0.98rem;
  line-height: 1.35;
}

.element-shells {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.element-shells span {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid rgba(79, 217, 255, 0.2);
  border-radius: 999px;
  background: rgba(3, 8, 17, 0.62);
  color: var(--ink);
  font-weight: 850;
}

.auth-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
}

.auth-card {
  width: min(560px, 100%);
  margin: 0 auto;
}

.auth-card h1 {
  max-width: 100%;
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  line-height: 1.08;
  overflow-wrap: normal;
}

.auth-card form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.auth-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--green);
  font-weight: 800;
}

.auth-lock-notice {
  padding-top: 28px;
  padding-bottom: 0;
}

.auth-lock-notice .card {
  border-color: rgba(109, 240, 202, 0.32);
  background:
    radial-gradient(circle at 92% 20%, rgba(109, 240, 202, 0.12), transparent 16rem),
    rgba(5, 12, 24, 0.92);
}

.auth-required-locked main input,
.auth-required-locked main select,
.auth-required-locked main textarea,
.auth-required-locked main button {
  opacity: 0.62;
  cursor: not-allowed;
}

.auth-required-locked main [data-preview-access="true"],
.auth-required-locked main .is-preview-enabled {
  opacity: 1;
  cursor: pointer;
}

.is-auth-locked {
  pointer-events: none;
  filter: grayscale(0.28) brightness(0.72);
}

.periodic-table.is-auth-locked {
  filter: none;
}

.auth-required-locked main .element-tile {
  opacity: 0.94;
}

.auth-required-locked main .element-tile[data-preview-locked="true"] {
  opacity: 0.48;
  filter: grayscale(0.45) brightness(0.8);
}

.quantum-computer-hero .page-hero-visual img {
  object-position: center;
}

.qc-stage-section {
  padding-top: 46px;
}

.qc-sim-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.qc-sim-panel {
  min-width: 0;
}

.qc-main-canvas {
  width: 100%;
  display: block;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.9);
  box-shadow: inset 0 0 44px rgba(79, 217, 255, 0.08), 0 24px 54px rgba(0, 0, 0, 0.28);
}

.qc-readout-grid,
.qc-compare-grid,
.qc-gate-grid,
.qc-build-timeline {
  display: grid;
  gap: 14px;
}

.qc-readout-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.qc-readout-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.82);
}

.qc-readout-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.qc-readout-grid strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--green);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-controls {
  position: sticky;
  top: 92px;
}

.qc-compare-grid,
.qc-build-timeline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.qc-gate-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qc-build-timeline article {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.76);
}

.qc-build-timeline span {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
}

.qc-build-timeline h3 {
  margin-top: 8px;
}

@media (max-width: 980px) {
  .simulation-layout {
    grid-template-columns: 1fr;
  }

  .element-detail {
    position: static;
  }

  .qc-sim-layout,
  .qc-compare-grid,
  .qc-gate-grid,
  .qc-build-timeline {
    grid-template-columns: 1fr;
  }

  .qc-controls {
    position: static;
  }
}

@media (max-width: 620px) {
  .periodic-toolbar {
    grid-template-columns: 1fr;
  }

  .periodic-table {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    gap: 6px;
  }

  .element-tile {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 70px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .element-category-status {
    grid-column: auto;
  }

  .qc-readout-grid {
    grid-template-columns: 1fr;
  }

  .qc-main-canvas {
    min-height: 420px;
  }
}

/* Compact typography layer. */
html {
  font-size: 13px;
}

body,
input,
textarea,
select,
button {
  font-size: 0.92rem;
}

p,
li {
  line-height: 1.5;
}

.nav {
  min-height: 60px;
}

.brand {
  gap: 8px;
  font-size: 0.92rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.nav-links a {
  padding: 8px 9px;
  font-size: 0.78rem;
}

.button,
button {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 0.86rem;
}

.hero {
  min-height: 520px;
}

.hero-content {
  padding: 68px 0 42px;
}

.eyebrow,
.visitor-label,
.preview-access-note,
.qc-build-timeline span {
  font-size: 0.64rem;
}

h1 {
  font-size: 3.1rem;
  line-height: 1.03;
}

.page-hero h1 {
  font-size: 2.45rem;
}

h2 {
  font-size: 1.75rem;
  line-height: 1.08;
}

h3 {
  font-size: 1rem;
  line-height: 1.16;
}

.lead {
  font-size: 0.9rem;
  line-height: 1.45;
}

section {
  padding: 42px 0;
}

.page-hero {
  padding: 52px 0 34px;
}

.hero-strip strong,
.status-grid strong,
.element-category-status strong,
.isotope-grid strong,
.qc-readout-grid strong {
  font-size: 0.9rem;
}

.hero-strip span,
.card,
.panel,
.tool-panel,
.lab-panel,
.feature-table th,
.feature-table td,
.contact-form input,
.contact-form select,
.contact-form textarea,
.auth-card input {
  font-size: 0.86rem;
}

.card,
.contact-form,
.qc-build-timeline article {
  padding: 16px;
}

.stat,
.visitor-value,
.app-label {
  font-size: 1.15rem;
}

.app-meter strong {
  font-size: 1.35rem;
}

.small,
.visitor-counter dt,
.pageview-counter dt,
.footer-rating,
.status-grid span,
.element-category-key,
.model-legend span,
.app-mini-item span,
.qc-readout-grid span {
  font-size: 0.68rem;
}

.rating-stars {
  font-size: 0.86rem;
}

.feedback-popup {
  width: min(340px, calc(100vw - 20px));
  padding: 12px;
}

.feedback-form h2 {
  font-size: 0.9rem;
}

.feedback-form textarea {
  font-size: 0.78rem;
}

.star-button {
  width: 32px;
  min-height: 30px;
  font-size: 1rem;
}

.periodic-toolbar {
  grid-template-columns: minmax(180px, 1fr) 180px;
}

.element-category-key {
  gap: 5px;
  padding: 6px 7px;
}

.periodic-table {
  grid-template-columns: repeat(18, minmax(36px, 1fr));
  min-width: 780px;
  gap: 4px;
}

.element-tile {
  min-height: 54px;
  gap: 1px;
  padding: 5px;
}

.element-number {
  font-size: 0.5rem;
}

.element-symbol {
  font-size: 0.9rem;
}

.element-name {
  font-size: clamp(0.4rem, 0.48vw, 0.52rem);
}

.element-lock {
  font-size: 0.42rem;
}

.element-detail h2,
.auth-card h1 {
  font-size: 1.45rem;
}

.model-legend span {
  padding: 6px 7px;
}

.qc-readout-grid div,
.status-grid div,
.visitor-counter dl div,
.pageview-counter dl div,
.app-mini-item {
  padding: 9px;
}

@media (max-width: 980px) {
  h1,
  .page-hero h1 {
    font-size: 2.1rem;
  }

  h2 {
    font-size: 1.45rem;
  }
}

@media (max-width: 620px) {
  html {
    font-size: 12px;
  }

  .shell {
    width: min(100vw - 18px, 1180px);
  }

  .brand {
    font-size: 0.82rem;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .nav-links a {
    min-height: 30px;
    padding: 6px 2px;
    font-size: 0.58rem;
  }

  h1,
  .page-hero h1 {
    font-size: 1.55rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.18rem;
  }

  h3 {
    font-size: 0.9rem;
  }

  .lead {
    font-size: 0.8rem;
  }

  section {
    padding: 32px 0;
  }

  .page-hero {
    padding: 34px 0 26px;
  }

  .button,
  button {
    min-height: 32px;
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  .periodic-table {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    gap: 5px;
  }

  .element-tile {
    min-height: 58px;
  }
}

#siteFeedbackPopup.feedback-popup {
  width: min(320px, calc(100vw - 28px));
  background:
    radial-gradient(circle at 90% 0%, rgba(109, 240, 202, 0.14), transparent 12rem),
    rgba(5, 12, 24, 0.985);
}

#siteFeedbackPopup .feedback-form h2 {
  max-width: 240px;
  font-size: 18px !important;
  line-height: 1.16;
}

#siteFeedbackPopup .eyebrow {
  font-size: 10px;
}

#siteFeedbackPopup .star-button {
  width: 30px;
  min-height: 28px;
  font-size: 15px !important;
}

#siteFeedbackPopup .feedback-form textarea {
  min-height: 54px;
  font-size: 12px !important;
}

#siteFeedbackPopup .button,
#siteFeedbackPopup button {
  min-height: 32px;
  font-size: 12px !important;
  padding: 7px 10px;
}

#siteFeedbackPopup .feedback-status {
  font-size: 11px;
}

/* Readable typography correction after compact pass. */
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
input,
textarea,
select,
button {
  font-size: 15px;
}

body h1,
body .page-hero h1,
body .auth-card h1 {
  font-size: clamp(28px, 2.6vw, 36px) !important;
  line-height: 1.18 !important;
}

body h2,
body .element-detail h2 {
  font-size: clamp(20px, 1.8vw, 26px) !important;
  line-height: 1.14 !important;
}

body h3,
body .card h3,
body .panel h3,
body .tool-panel h3,
body .lab-panel h3,
body .equation-card h3,
body .wave-theory-card h3,
body .qcd-panel h3 {
  font-size: 18px;
  line-height: 1.18;
}

body h3 {
  font-size: 16px;
}

body p,
body li,
body label,
body .lead,
body .card,
body .panel,
body .tool-panel,
body .lab-panel,
body .equation-card,
body .wave-controls,
body .wave-theory-card,
body .qcd-controls,
body .qcd-panel,
body .feature-table th,
body .feature-table td,
body .contact-form input,
body .contact-form select,
body .contact-form textarea {
  font-size: 14px;
  line-height: 1.55;
}

body .nav-links a,
body .brand,
body .button,
body button {
  font-size: 13px;
}

body .small,
body .footer-rating,
body .visitor-counter dt,
body .pageview-counter dt,
body .status-grid span,
body .element-category-key,
body .model-legend span,
body .app-mini-item span,
body .qc-readout-grid span,
body .preview-access-note {
  font-size: 12px;
}

body .element-category-key strong {
  font-size: 11px;
}

body .element-lock {
  display: none;
}

body .eyebrow,
body .visitor-label,
body .qc-build-timeline span {
  font-size: 11px;
}

body .element-number {
  font-size: 11px;
}

body .element-symbol {
  font-size: 16px;
}

body .periodic-table .element-name {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 7px;
  line-height: 1.05;
  text-align: center;
}

@media (max-width: 620px) {
  html {
    font-size: 14px;
  }

  body,
  input,
  textarea,
  select,
  button {
    font-size: 14px;
  }

  body h1,
  body .page-hero h1,
  body .auth-card h1 {
    font-size: clamp(24px, 6.2vw, 28px) !important;
    line-height: 1.18 !important;
  }

  body h2,
  body .element-detail h2 {
    font-size: clamp(19px, 5vw, 22px) !important;
  }

  body h3,
  body .card h3,
  body .panel h3,
  body .tool-panel h3,
  body .lab-panel h3,
  body .equation-card h3,
  body .wave-theory-card h3,
  body .qcd-panel h3 {
    font-size: 17px;
  }

  body p,
  body li,
  body label,
  body .lead,
  body .card,
  body .panel,
  body .tool-panel,
  body .lab-panel,
  body .equation-card,
  body .wave-controls,
  body .wave-theory-card,
  body .qcd-controls,
  body .qcd-panel {
    font-size: 14px;
  }

  body .nav-links a,
  body .brand,
  body .button,
  body button {
    font-size: 12px;
  }

  body .small,
  body .footer-rating,
  body .visitor-counter dt,
  body .pageview-counter dt,
  body .status-grid span,
  body .element-category-key,
  body .model-legend span,
  body .preview-access-note {
    font-size: 11px;
  }

  body .element-category-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body .element-category-key {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body .element-category-key strong {
    font-size: 11px;
  }

  body .periodic-table .element-name {
    font-size: 8px;
  }
}

/* Readable typography refinement: quieter headings and no forced caps. */
body h1,
body .page-hero h1,
body .auth-card h1 {
  font-size: clamp(24px, 2.05vw, 30px) !important;
  line-height: 1.22 !important;
  font-weight: 600 !important;
}

body h2,
body .element-detail h2 {
  font-size: clamp(20px, 1.55vw, 24px) !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
}

body h3,
body .card h3,
body .panel h3,
body .tool-panel h3,
body .lab-panel h3,
body .equation-card h3,
body .wave-theory-card h3,
body .qcd-panel h3 {
  font-size: 17px !important;
  line-height: 1.24 !important;
  font-weight: 600 !important;
}

body .eyebrow,
body .visitor-label,
body .preview-access-note,
body .qc-build-timeline span {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body .brand,
body .nav-links a,
body .button,
body button {
  font-weight: 500 !important;
}

body strong,
body b,
body .stat,
body .hero-strip strong,
body .status-grid strong,
body .element-category-status strong,
body .isotope-grid strong,
body .qc-readout-grid strong {
  font-weight: 600 !important;
}

body .brand-hero-content,
body .brand-hero-content * {
  position: absolute !important;
  width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

body .visitor-counter strong,
body .pageview-counter strong {
  line-height: 1.25 !important;
}

@media (max-width: 620px) {
  body h1,
  body .page-hero h1,
  body .auth-card h1 {
    font-size: clamp(22px, 5.7vw, 26px) !important;
    line-height: 1.24 !important;
  }

  body h2,
  body .element-detail h2 {
    font-size: clamp(18px, 4.8vw, 21px) !important;
  }

  body h3,
  body .card h3,
  body .panel h3,
  body .tool-panel h3,
  body .lab-panel h3,
  body .equation-card h3,
  body .wave-theory-card h3,
  body .qcd-panel h3 {
    font-size: 16px !important;
  }
}

/* Contrast-safe automatic light/dark theme system. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050914;
  --page-bg: #050914;
  --surface: rgba(10, 19, 32, 0.92);
  --surface-strong: #091423;
  --surface-soft: rgba(12, 27, 46, 0.76);
  --ink: #f2f8ff;
  --muted: #b9c8d9;
  --subtle: #8da2b8;
  --line: rgba(129, 178, 220, 0.28);
  --nav-bg: rgba(5, 9, 20, 0.92);
  --nav-text: #d9e7f5;
  --field-bg: #06101d;
  --field-text: #f5f9ff;
  --button-bg: #13345a;
  --button-text: #f8fbff;
  --button-secondary-bg: #0b1829;
  --canvas-bg: #030712;
  --hero-band: linear-gradient(180deg, #07101d, #050914);
  --section-band: linear-gradient(180deg, #07101c, #050914);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6fbff;
  --page-bg: #f6fbff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft: #edf6fc;
  --ink: #102033;
  --muted: #42556b;
  --subtle: #5d7187;
  --line: rgba(45, 91, 128, 0.22);
  --cyan: #006da0;
  --green: #006b61;
  --amber: #8a5a00;
  --rose: #6d43a8;
  --navy: #12314f;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --nav-text: #24374b;
  --field-bg: #ffffff;
  --field-text: #102033;
  --button-bg: #123d63;
  --button-text: #ffffff;
  --button-secondary-bg: #ffffff;
  --canvas-bg: #eef6fb;
  --hero-band: linear-gradient(180deg, #f8fcff, #eaf4fb);
  --section-band: linear-gradient(180deg, #eef7fc, #f8fcff);
  --shadow: 0 14px 36px rgba(23, 48, 72, 0.12);
}

html[data-theme] body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(0, 109, 160, 0.12), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(109, 67, 168, 0.10), transparent 28rem),
    var(--page-bg);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 4%, rgba(79, 217, 255, 0.18), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(198, 139, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, #040812 0%, var(--bg) 34rem);
}

html[data-theme] p,
html[data-theme] li,
html[data-theme] label,
html[data-theme] .lead,
html[data-theme] .small,
html[data-theme] .meta,
html[data-theme] .hero-strip span,
html[data-theme] .visitor-counter dt,
html[data-theme] .pageview-counter dt {
  color: var(--muted) !important;
}

html[data-theme] h1,
html[data-theme] h2,
html[data-theme] h3,
html[data-theme] strong,
html[data-theme] .brand,
html[data-theme] .visitor-counter strong,
html[data-theme] .visitor-counter dd,
html[data-theme] .pageview-counter strong,
html[data-theme] .pageview-counter dd {
  color: var(--ink) !important;
}

html[data-theme] .topbar {
  border-bottom-color: var(--line) !important;
  background: var(--nav-bg) !important;
}

html[data-theme] .nav-links a {
  color: var(--nav-text) !important;
}

html[data-theme] .nav-links a:hover,
html[data-theme] .nav-links a[aria-current="page"] {
  background: rgba(0, 109, 160, 0.12) !important;
  color: var(--green) !important;
}

html[data-theme] .button,
html[data-theme] button {
  background: var(--button-bg) !important;
  color: var(--button-text) !important;
  border-color: transparent;
  box-shadow: none !important;
}

html[data-theme] .button.secondary,
html[data-theme] button.secondary,
html[data-theme] .tabs button {
  background: var(--button-secondary-bg) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme] .button.ghost {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme] .card,
html[data-theme] .panel,
html[data-theme] .tool-panel,
html[data-theme] .lab-panel,
html[data-theme] .news-item,
html[data-theme] .auth-card,
html[data-theme] .visitor-counter,
html[data-theme] .pageview-counter,
html[data-theme] .footer-rating,
html[data-theme] .formula,
html[data-theme] .status-grid div,
html[data-theme] .hero-strip div,
html[data-theme] .element-category-key,
html[data-theme] .model-legend span,
html[data-theme] .isotope-panel,
html[data-theme] .qcd-controls,
html[data-theme] .wave-controls {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow);
}

html[data-theme] .page-hero,
html[data-theme] .band {
  background: var(--hero-band) !important;
  border-color: var(--line) !important;
}

html[data-theme] .band {
  background: var(--section-band) !important;
}

html[data-theme] .footer {
  background: var(--surface-strong) !important;
  border-top-color: var(--line) !important;
}

html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea,
html[data-theme] input[type="number"],
html[data-theme] input[type="text"],
html[data-theme] input[type="email"],
html[data-theme] input[type="password"] {
  background: var(--field-bg) !important;
  color: var(--field-text) !important;
  border-color: var(--line) !important;
}

html[data-theme] input::placeholder,
html[data-theme] textarea::placeholder {
  color: var(--subtle) !important;
}

html[data-theme] .page-hero-visual,
html[data-theme] canvas,
html[data-theme] .concept-canvas,
html[data-theme] .qcd-panel-canvas,
html[data-theme] .wave-stage canvas {
  background-color: var(--canvas-bg) !important;
}

html[data-theme="light"] .hero::before,
html[data-theme="light"] .brand-hero::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 48%, rgba(255, 255, 255, 0.08) 100%),
    linear-gradient(0deg, rgba(246, 251, 255, 0.92) 0%, rgba(246, 251, 255, 0.2) 26%, transparent 60%);
}

.theme-toggle {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface-soft) !important;
  color: var(--ink) !important;
}

.theme-toggle .theme-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle .theme-icon-moon {
  display: block;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon {
  display: none;
}

html[data-theme="light"] .qcd-figure img {
  background: #ffffff !important;
}

html[data-theme="light"] .formula mjx-container,
html[data-theme="light"] .formula svg {
  color: var(--ink) !important;
}

/* Fixed site-wide header navigation with compact dropdown groups. */
.nav-links[data-fixed-menu="true"] {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.nav-menu {
  position: relative;
  flex: 0 0 auto;
}

.nav-menu-toggle {
  min-height: 36px !important;
  padding: 8px 11px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--nav-text, #24374b) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.nav-menu-toggle::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.nav-menu.active > .nav-menu-toggle,
.nav-menu.open > .nav-menu-toggle,
.nav-menu-toggle:focus-visible {
  background: rgba(0, 109, 160, 0.12) !important;
  color: var(--green) !important;
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 240px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, #fff);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.nav-menu.open .nav-submenu,
.nav-menu:focus-within .nav-submenu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.nav-submenu a {
  display: block;
  width: 100%;
  padding: 9px 10px !important;
  border-radius: 7px !important;
  color: var(--nav-text, #24374b) !important;
  text-align: left !important;
  white-space: nowrap !important;
}

.nav-links[data-fixed-menu="true"] > a,
.nav-links[data-fixed-menu="true"] .login-link,
.nav-links[data-fixed-menu="true"] .logout-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}

.nav-home-link {
  color: var(--nav-text, #24374b) !important;
}

html[data-theme="dark"] .nav-submenu {
  background: #081320;
}

html[data-theme] .nav-menu-toggle {
  color: var(--nav-text) !important;
}

html[data-theme] .nav-submenu {
  border-color: var(--line) !important;
  background: var(--surface-strong) !important;
}

@media (hover: hover) and (pointer: fine) {
  .nav-menu:hover > .nav-menu-toggle {
    background: rgba(0, 109, 160, 0.12) !important;
    color: var(--green) !important;
  }

  .nav-menu:hover .nav-submenu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
}

@media (max-width: 980px) {
  .nav-links[data-fixed-menu="true"] {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    align-items: stretch;
  }

  .nav-links[data-fixed-menu="true"] > a,
  .nav-links[data-fixed-menu="true"] .login-link,
  .nav-links[data-fixed-menu="true"] .logout-link,
  .nav-menu-toggle {
    width: 100%;
    min-width: 0;
    white-space: normal !important;
    text-align: center !important;
  }

  .nav-submenu {
    left: 0;
    right: auto;
    min-width: min(260px, calc(100vw - 28px));
  }
}

@media (max-width: 620px) {
  .nav-links[data-fixed-menu="true"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-submenu {
    display: none;
    left: 50%;
    right: auto;
    width: min(340px, calc(100vw - 30px));
    min-width: 0;
    transform: translate(-50%, -4px);
  }

  .nav-menu:focus-within .nav-submenu {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -4px);
  }

  .nav-menu.open .nav-submenu {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .nav-menu:hover .nav-submenu {
    display: none;
  }

  .nav-menu.open:hover .nav-submenu {
    display: grid;
  }

  .nav-links[data-fixed-menu="true"] > a,
  .nav-links[data-fixed-menu="true"] .login-link,
  .nav-links[data-fixed-menu="true"] .logout-link,
  .nav-menu-toggle {
    min-height: 34px !important;
    padding: 7px 5px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  .nav-submenu a {
    font-size: 12px !important;
    min-height: 34px;
  }
}

/* ============================================================
   Parity layer 2026-07-17: accessibility, footer system, hero
   copy, FAQ, blog article chrome, error page, motion & print.
   Append-only; safe for pages that have not been re-staged.
   ============================================================ */

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  background: var(--button-bg, #13345a);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan, #4fd9ff);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Footer navigation system */
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 28px;
  padding-bottom: 26px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.footer-brand-col .brand {
  margin-bottom: 10px;
}

.footer-brand-col .small {
  max-width: 300px;
  margin: 0;
}

.footer-heading {
  margin: 0 0 10px;
  color: var(--green, #6df0ca);
  font-size: 0.78rem !important;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2 !important;
}

.footer-col {
  display: block;
  min-width: 0;
}

.footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--green, #6df0ca);
  text-decoration: underline;
}

.footer-bottom {
  align-items: center;
}

.footer-bottom .small a {
  color: inherit;
}

@media (max-width: 980px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Visible homepage hero copy over the brand artwork */
.brand-hero.has-copy {
  position: relative;
  min-height: clamp(430px, 56vw, 640px);
  display: grid;
  align-items: end;
}

.brand-hero.has-copy > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.brand-hero.has-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(3, 8, 17, 0.82) 0%, rgba(3, 8, 17, 0.5) 46%, rgba(3, 8, 17, 0.14) 100%),
    linear-gradient(0deg, rgba(3, 8, 17, 0.9) 0%, rgba(3, 8, 17, 0.32) 30%, transparent 62%);
}

html[data-theme="light"] .brand-hero.has-copy::before {
  background:
    linear-gradient(90deg, rgba(246, 251, 255, 0.9) 0%, rgba(246, 251, 255, 0.55) 46%, rgba(246, 251, 255, 0.1) 100%),
    linear-gradient(0deg, rgba(246, 251, 255, 0.94) 0%, rgba(246, 251, 255, 0.3) 30%, transparent 62%);
}

.brand-hero.has-copy .hero-copy {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 96px 0 50px;
}

.brand-hero.has-copy .hero-copy h1 {
  max-width: 760px;
  font-size: clamp(2.2rem, 5vw, 4rem);
}

html[data-theme="light"] .brand-hero.has-copy .hero-copy h1 {
  color: var(--ink) !important;
}

.brand-hero.has-copy .hero-copy .lead {
  max-width: 640px;
}

/* FAQ accordion */
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 880px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, rgba(10, 19, 32, 0.92));
  box-shadow: var(--shadow);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  color: var(--ink);
  font-weight: 850;
  font-size: 1.02rem;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green, #6df0ca);
  font-weight: 900;
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
}

/* Breadcrumbs */
.breadcrumbs {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumbs li + li::before {
  content: "/";
  color: var(--subtle, #8da2b8);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--green, #6df0ca);
  text-decoration: underline;
}

/* Blog & long-form article chrome */
.article-hero {
  padding: 56px 0 34px;
}

.article-shell {
  width: min(860px, calc(100vw - 32px));
  margin: 0 auto;
}

.article-body {
  padding: 10px 0 56px;
}

.article-body h2 {
  margin: 34px 0 12px;
  font-size: 1.75rem;
}

.article-body h3 {
  margin: 26px 0 10px;
}

.article-body p,
.article-body li {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.article-body ul,
.article-body ol {
  padding-left: 22px;
}

.article-body a {
  color: var(--cyan, #4fd9ff);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--subtle, #8da2b8);
  font-size: 0.9rem;
  font-weight: 700;
}

.article-cta {
  margin-top: 34px;
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  display: block;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, rgba(10, 19, 32, 0.92));
  box-shadow: var(--shadow);
  text-decoration: none;
}

.post-card h2 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: 1.4rem !important;
  line-height: 1.2 !important;
}

.post-card p {
  margin: 0 0 10px;
}

.post-card .meta span {
  font-size: 0.86rem;
}

.post-card:hover h2 {
  color: var(--cyan, #4fd9ff);
}

/* Error page */
.error-shell {
  min-height: calc(100vh - 260px);
  display: grid;
  align-items: center;
  text-align: center;
  padding: 72px 0;
}

.error-code {
  display: block;
  color: var(--cyan, #4fd9ff);
  font-size: clamp(4.2rem, 14vw, 8rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 44px rgba(79, 217, 255, 0.34);
}

.error-shell h1 {
  max-width: 100%;
  margin: 14px auto 10px;
  color: var(--ink);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.error-shell .lead {
  margin: 0 auto;
}

.error-shell .actions {
  justify-content: center;
}

.error-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

/* Legal pages */
.legal-body h2 {
  margin: 32px 0 10px;
  font-size: 1.5rem !important;
}

.legal-body p,
.legal-body li {
  font-size: 0.99rem;
}

.legal-updated {
  color: var(--subtle, #8da2b8);
  font-size: 0.9rem;
  font-weight: 700;
}

/* Motion & print hygiene */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .footer,
  .skip-link,
  .theme-toggle,
  .contact-band,
  .feedback-popup,
  #finite-livechat-root,
  .visitor-counter {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
  }

  main a {
    color: #114 !important;
  }
}

/* ============================================================
   QENTANGLE REDESIGN v2  (?v=20260720-redesign)  -- append-only
   Design lead layer: unified nav v2, elevated quantum-lab visual
   system, and the .qe-quiz / .qe-progress learning components.
   Everything below is self-contained (inline SVG data-URIs only),
   theme-aware (dark + light), AA-contrast, focus-visible and
   prefers-reduced-motion aware. Later source order + matched
   specificity intentionally override the base layer.
   ============================================================ */

/* ---------- v2 design tokens ---------- */
:root {
  --qe-r-sm: 10px;
  --qe-r: 14px;
  --qe-r-lg: 18px;
  --qe-space: clamp(56px, 7vw, 104px);
  --qe-accent: #4fd9ff;
  --qe-accent-2: #6df0ca;
  --qe-accent-3: #c68bff;
  --qe-grad: linear-gradient(120deg, #4fd9ff 0%, #6df0ca 100%);
  --qe-grad-soft: linear-gradient(120deg, rgba(79, 217, 255, 0.16), rgba(109, 240, 202, 0.12));
  --qe-ring: rgba(79, 217, 255, 0.6);
  --qe-correct: #6df0ca;
  --qe-correct-bg: rgba(109, 240, 202, 0.14);
  --qe-wrong: #ff7d92;
  --qe-wrong-bg: rgba(255, 125, 146, 0.14);
  --qe-elev: 0 22px 60px rgba(3, 10, 22, 0.28);
  --qe-elev-lift: 0 30px 72px rgba(3, 10, 22, 0.38);
}

html[data-theme="dark"] {
  --qe-accent: #4fd9ff;
  --qe-accent-2: #6df0ca;
  --qe-accent-3: #c68bff;
  --qe-grad: linear-gradient(120deg, #4fd9ff 0%, #6df0ca 100%);
  --qe-grad-soft: linear-gradient(120deg, rgba(79, 217, 255, 0.18), rgba(109, 240, 202, 0.12));
  --qe-ring: rgba(79, 217, 255, 0.62);
  --qe-correct: #6df0ca;
  --qe-correct-bg: rgba(109, 240, 202, 0.16);
  --qe-correct-ink: #d6fff2;
  --qe-wrong: #ff8397;
  --qe-wrong-bg: rgba(255, 131, 151, 0.16);
  --qe-wrong-ink: #ffd9df;
  --qe-track: rgba(129, 178, 220, 0.2);
  --qe-cta-ink: #052027;
  --qe-elev: 0 22px 60px rgba(0, 0, 0, 0.42);
  --qe-elev-lift: 0 30px 74px rgba(0, 0, 0, 0.55);
  --qe-mesh: rgba(79, 217, 255, 0.05);
}

html[data-theme="light"] {
  --qe-accent: #006da0;
  --qe-accent-2: #006b61;
  --qe-accent-3: #6d43a8;
  --qe-grad: linear-gradient(120deg, #0a86bd 0%, #009a89 100%);
  --qe-grad-soft: linear-gradient(120deg, rgba(0, 109, 160, 0.1), rgba(0, 107, 97, 0.08));
  --qe-ring: rgba(0, 109, 160, 0.55);
  --qe-correct: #0a7d5f;
  --qe-correct-bg: rgba(0, 125, 95, 0.1);
  --qe-correct-ink: #0a4a3a;
  --qe-wrong: #c02a4a;
  --qe-wrong-bg: rgba(192, 42, 74, 0.08);
  --qe-wrong-ink: #7a1128;
  --qe-track: rgba(45, 91, 128, 0.18);
  --qe-cta-ink: #ffffff;
  --qe-elev: 0 20px 48px rgba(23, 48, 72, 0.14);
  --qe-elev-lift: 0 28px 60px rgba(23, 48, 72, 0.2);
  --qe-mesh: rgba(0, 109, 160, 0.05);
}

/* ---------- Quantum motif backdrop (self-contained, fixed) ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.9;
  background-image:
    radial-gradient(circle at 1px 1px, var(--qe-mesh) 1px, transparent 0);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
}

/* ---------- Sticky, refined header ---------- */
.topbar {
  position: sticky;
  top: 0;
}
html[data-theme] .topbar {
  box-shadow: 0 1px 0 var(--line), 0 10px 30px -24px rgba(0, 0, 0, 0.6);
}
.nav {
  min-height: 68px;
}
.brand {
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.brand:hover {
  transform: translateY(-1px);
}

/* ---------- Unified nav v2 chrome ---------- */
.nav-links[data-fixed-menu="true"] {
  gap: 4px;
}
.nav-menu-toggle,
.nav-links[data-fixed-menu="true"] > a {
  border-radius: 999px !important;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.nav-menu-toggle::after {
  transition: transform 0.18s ease;
}
.nav-menu.open > .nav-menu-toggle::after {
  transform: translateY(1px) rotate(-135deg);
}
.nav-submenu {
  border-radius: var(--qe-r) !important;
  padding: 10px !important;
  min-width: 248px;
  box-shadow: var(--qe-elev) !important;
}
.nav-submenu a {
  border-radius: 9px !important;
  transition: background 0.14s ease, color 0.14s ease, padding-left 0.14s ease;
}
html[data-theme] .nav-submenu a:hover,
html[data-theme] .nav-submenu a[aria-current="page"] {
  background: var(--qe-grad-soft) !important;
  color: var(--green) !important;
  padding-left: 14px !important;
}
/* Register call-to-action pill (auth link kept as-is, only styled) */
.nav-links[data-fixed-menu="true"] .register-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  border-radius: 999px !important;
  border: 1px solid transparent !important;
}
html[data-theme] .nav-links[data-fixed-menu="true"] .register-link {
  background: var(--qe-grad) !important;
  color: var(--qe-cta-ink) !important;
  box-shadow: 0 8px 20px -10px var(--qe-ring);
}
html[data-theme] .nav-links[data-fixed-menu="true"] .register-link:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.nav-links[data-fixed-menu="true"] .login-link {
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
}

/* Focus-visible ring across interactive chrome */
.nav-menu-toggle:focus-visible,
.nav-links a:focus-visible,
.nav-submenu a:focus-visible,
.button:focus-visible,
button:focus-visible,
.qe-blank:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--qe-ring);
  outline-offset: 2px;
}

/* ---------- Buttons: geometry + motion polish (theme colours kept for AA) ---------- */
.button,
button {
  border-radius: 999px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, background 0.16s ease;
}
html[data-theme] .button:not(.secondary):not(.ghost):not(.nav-menu-toggle):not(.theme-toggle) {
  box-shadow: 0 12px 26px -14px var(--qe-ring);
}
.button:not(.nav-menu-toggle):not(.theme-toggle):hover {
  transform: translateY(-2px);
}
.button:not(.nav-menu-toggle):not(.theme-toggle):active {
  transform: translateY(0);
}
.hero-actions .button,
.page-hero .button {
  min-height: 48px;
  padding-inline: 22px;
}

/* ---------- Cards: elevation, hover lift, quantum edge accent ---------- */
.card,
.panel,
.tool-panel,
.lab-panel {
  border-radius: var(--qe-r);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
html[data-theme] .card {
  box-shadow: var(--qe-elev);
}
.grid-2 .card:hover,
.grid-3 .card:hover,
.grid-4 .card:hover,
.news-list .card:hover {
  transform: translateY(-4px);
}
html[data-theme] .grid-2 .card:hover,
html[data-theme] .grid-3 .card:hover,
html[data-theme] .grid-4 .card:hover {
  box-shadow: var(--qe-elev-lift);
  border-color: var(--qe-accent) !important;
}
/* Numeric index chip gets an accent underline */
.card .stat {
  color: var(--qe-accent);
}

/* Section rhythm + eyebrow motif */
main > section,
main > .band {
  padding-block: clamp(40px, 5.5vw, 76px);
}
main > .hero,
main > .brand-hero,
main > .page-hero {
  padding-block: 0;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--qe-grad);
}

/* ============================================================
   LEARNING COMPONENT: quiz  (.qe-quiz)
   DOM built by sibling learn.js -- styled to match the new system.
   ============================================================ */
.qe-quiz {
  border: 1px solid var(--line);
  border-radius: var(--qe-r-lg);
  background: var(--surface, var(--paper));
  box-shadow: var(--qe-elev);
  padding: clamp(20px, 3vw, 30px);
  position: relative;
  overflow: hidden;
}
.qe-quiz::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--qe-grad);
}
.qe-quiz-title {
  margin: 4px 0 6px;
  font-size: clamp(20px, 2.4vw, 27px);
  line-height: 1.15;
  color: var(--ink);
}
.qe-quiz-title::before {
  content: "Knowledge check";
  display: block;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.qe-quiz-items {
  list-style: none;
  counter-reset: qeq;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.qe-quiz-item {
  counter-increment: qeq;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 14px 16px 14px 46px;
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--qe-r);
  background: var(--surface-soft, rgba(127, 170, 210, 0.06));
  color: var(--ink);
  line-height: 1.7;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.qe-quiz-item::before {
  content: counter(qeq);
  position: absolute;
  left: 14px;
  top: 13px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--qe-grad-soft);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
}
.qe-blank {
  min-width: 96px;
  max-width: 200px;
  flex: 0 1 auto;
  padding: 6px 12px !important;
  border: 1px solid var(--line) !important;
  border-bottom: 2px solid var(--qe-accent) !important;
  border-radius: 8px !important;
  background: var(--field-bg, #fff) !important;
  color: var(--field-text, var(--ink)) !important;
  font: inherit;
  font-family: var(--mono) !important;
  text-align: center;
}
.qe-hint {
  min-height: 30px !important;
  padding: 4px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 999px !important;
  border: 1px dashed var(--line) !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}
.qe-hint:hover {
  color: var(--green) !important;
  border-color: var(--qe-accent) !important;
}
.qe-hint::before {
  content: "\1F4A1";
  margin-right: 4px;
}
.qe-check {
  margin-top: 18px !important;
}
.qe-score {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: var(--qe-r);
  background: var(--qe-grad-soft);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink) !important;
  font-variant-numeric: tabular-nums;
}
/* States -- colour + icon, never colour alone */
.qe-quiz-item.is-correct {
  border-color: var(--qe-correct) !important;
  border-left-color: var(--qe-correct) !important;
  background: var(--qe-correct-bg) !important;
  color: var(--qe-correct-ink, var(--ink)) !important;
}
.qe-quiz-item.is-correct::after {
  content: "\2713";
  margin-left: auto;
  color: var(--qe-correct);
  font-weight: 900;
}
.qe-quiz-item.is-correct .qe-blank {
  border-color: var(--qe-correct) !important;
  border-bottom-color: var(--qe-correct) !important;
}
.qe-quiz-item.is-wrong {
  border-color: var(--qe-wrong) !important;
  border-left-color: var(--qe-wrong) !important;
  background: var(--qe-wrong-bg) !important;
  color: var(--qe-wrong-ink, var(--ink)) !important;
}
.qe-quiz-item.is-wrong::after {
  content: "\2717";
  margin-left: auto;
  color: var(--qe-wrong);
  font-weight: 900;
}
.qe-quiz-item.is-wrong .qe-blank {
  border-color: var(--qe-wrong) !important;
  border-bottom-color: var(--qe-wrong) !important;
}

/* Hint reveal + revealed answer + coming-soon note (extra nodes learn.js emits) */
.qe-hint-text {
  flex-basis: 100%;
  margin: 4px 0 0;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--qe-grad-soft);
  border: 1px dashed var(--line);
  color: var(--muted) !important;
  font-size: 0.9rem;
}
.qe-answer {
  flex-basis: 100%;
  margin: 4px 0 0;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--qe-correct) !important;
}
.qe-answer::before {
  content: "Answer: ";
  color: var(--muted) !important;
  font-weight: 600;
}
.qe-coming-soon {
  margin: 0;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--qe-r);
  background: var(--surface-soft, rgba(127, 170, 210, 0.06));
  color: var(--muted) !important;
  font-family: var(--mono);
  text-align: center;
}

/* ============================================================
   LEARNING COMPONENT: progress  (.qe-progress)
   ============================================================ */
.qe-progress {
  border: 1px solid var(--line);
  border-radius: var(--qe-r-lg);
  background: var(--surface, var(--paper));
  box-shadow: var(--qe-elev);
  padding: clamp(20px, 3vw, 28px);
  position: relative;
  overflow: hidden;
}
.qe-progress::before {
  content: "Learning progress";
  display: block;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.qe-progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.qe-progress-topic {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 10px 16px;
  color: var(--ink);
  font-weight: 600;
}
.qe-progress-topic > *:last-child {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  justify-self: end;
}
.qe-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--qe-track);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}
.qe-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--qe-grad);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.qe-total {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.qe-reset {
  margin-top: 14px !important;
  min-height: 34px !important;
  padding: 6px 16px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: transparent !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}
.qe-reset:hover {
  color: var(--qe-wrong) !important;
  border-color: var(--qe-wrong) !important;
}

/* ---------- v2 nav responsive: clean 3-up grid for 6 top items ---------- */
@media (max-width: 980px) {
  .nav-links[data-fixed-menu="true"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .qe-progress-topic {
    grid-template-columns: 1fr auto;
  }
  .qe-progress-topic .qe-bar {
    grid-column: 1 / -1;
    order: 3;
  }
}
@media (max-width: 620px) {
  .qe-quiz-item {
    padding-left: 16px;
  }
  .qe-quiz-item::before {
    position: static;
    top: auto;
    left: auto;
  }
}

/* ---------- Motion / reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .brand,
  .button,
  button,
  .card,
  .nav-submenu a,
  .qe-bar > i,
  .nav-menu-toggle::after {
    transition: none !important;
  }
  .button:hover,
  .card:hover,
  .brand:hover {
    transform: none !important;
  }
}
