:root {
  --matter-blue: #54a8ff;
  --matter-blue-soft: rgba(84, 168, 255, 0.16);
  --matter-cyan: #5ee6d2;
  --matter-red: #ff715b;
  --matter-red-soft: rgba(255, 113, 91, 0.16);
  --matter-gold: #ffc857;
  --matter-purple: #b79cff;
  --matter-ink: #e9f1fb;
  --matter-muted: #9fb0c3;
  --matter-panel: rgba(18, 28, 42, 0.88);
  --matter-line: rgba(180, 208, 235, 0.25);
}

.reveal .story-tabs .tab-content {
  font-size: 0.91em;
}

.reveal .story-tabs .tab-pane > :first-child {
  margin-top: 0.25em;
}

.reveal .matter-answer {
  margin: 0.55em 0;
  padding: 0.25em 0.6em;
  border: 1px solid rgba(94, 230, 210, 0.35);
  border-radius: 0.45em;
  background: rgba(94, 230, 210, 0.07);
  font-size: 0.78em;
}

.reveal .matter-answer summary {
  color: var(--matter-cyan);
  cursor: pointer;
  font-weight: 650;
}

.reveal .matter-answer p {
  margin: 0.45em 0 0.2em;
}

.basis-opening {
  display: grid;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--matter-line);
  border-radius: 0.75rem;
  background: linear-gradient(145deg, rgba(17, 31, 48, 0.92), rgba(16, 22, 34, 0.82));
  box-shadow: 0 0.45rem 1.2rem rgba(0, 0, 0, 0.24);
}

.reveal .opening-tight {
  font-size: 0.91em;
}

.reveal .opening-tight .takeaway {
  font-size: 0.82em;
}

.basis-opening-row {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  align-items: center;
  min-height: 3.1rem;
  padding: 0.25rem 0.65rem;
  border-left: 0.28rem solid currentColor;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.045);
}

.basis-opening-row span {
  color: var(--matter-muted);
  font-size: 0.52em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.basis-opening-row b {
  text-align: right;
  font-size: 0.82em;
  color: var(--matter-ink);
}

.basis-opening-row.flavor { color: var(--matter-red); }
.basis-opening-row.matter { color: var(--matter-gold); }
.basis-opening-row.mass { color: var(--matter-blue); }

.basis-opening-arrow {
  text-align: center;
  color: var(--matter-purple);
  font-size: 0.62em;
  line-height: 1.05;
}

.forward-scattering {
  position: relative;
  height: 15rem;
  overflow: hidden;
  border: 1px solid var(--matter-line);
  border-radius: 0.7rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(84, 168, 255, 0.1), transparent 63%),
    rgba(10, 18, 29, 0.85);
}

.reveal .forward-tight {
  font-size: 0.88em;
}

.reveal .forward-tight .takeaway {
  font-size: 0.78em;
}

.reveal .derive-tight {
  font-size: 0.88em;
}

.reveal .potential-size-tight {
  font-size: 0.84em;
}

.reveal .energy-profile-tight,
.reveal .spectrum-tight {
  font-size: 0.9em;
}

.reveal .sk2026-tight {
  font-size: 0.88em;
}

.matter-dots {
  position: absolute;
  inset: 3rem 1.3rem 3rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem 2rem;
  align-items: center;
  justify-items: center;
}

.matter-dots i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--matter-gold);
  box-shadow: 0 0 0.65rem rgba(255, 200, 87, 0.48);
}

.forward-wave {
  position: absolute;
  z-index: 2;
  top: 7.25rem;
  left: 0.4rem;
  width: calc(100% - 0.8rem);
  padding: 0.35rem 0;
  text-align: center;
  color: var(--matter-cyan);
  font-size: 1.15em;
  text-shadow: 0 0 0.65rem rgba(94, 230, 210, 0.75);
  background: rgba(5, 12, 20, 0.75);
}

.forward-caption {
  position: absolute;
  bottom: 0.75rem;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--matter-muted);
  font-size: 0.63em;
}

.energy-case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.energy-case {
  min-height: 8.5rem;
  padding: 0.8rem;
  border: 1px solid var(--matter-line);
  border-top: 0.24rem solid var(--matter-gold);
  border-radius: 0.5rem;
  background: var(--matter-panel);
  font-size: 0.72em;
}

.energy-case strong,
.energy-case b {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--matter-gold);
}

.calculation-ladder {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem auto 0.7rem;
  max-width: 68rem;
}

.calculation-ladder > div {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  align-items: center;
  min-height: 5.6rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--matter-line);
  border-radius: 0.55rem;
  background: linear-gradient(135deg, rgba(84, 168, 255, 0.12), rgba(18, 28, 42, 0.86));
  font-size: 0.68em;
}

.calculation-ladder b {
  color: var(--matter-blue);
  font-size: 1.45em;
}

.matter-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.48rem 0.7rem;
  margin-top: 0.35rem;
}

.matter-summary-grid > div {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.35rem;
  align-items: start;
  min-height: 4.1rem;
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--matter-line);
  border-radius: 0.42rem;
  background: rgba(18, 28, 42, 0.82);
  font-size: 0.58em;
}

.matter-summary-grid b {
  color: var(--matter-cyan);
  font-size: 1.25em;
  line-height: 1.05;
}

.reveal .regimes-tight .regime-table {
  font-size: 0.72em;
}

.reveal .regimes-tight .regime-table table {
  margin-top: 0.35em;
}

.reveal .regimes-tight .regime-table th,
.reveal .regimes-tight .regime-table td {
  padding: 0.24em 0.38em;
  line-height: 1.18;
}

.reveal .regimes-tight > .small {
  margin-top: 0.4em;
  font-size: 0.62em;
}

.reveal .three-hamiltonian-tight {
  font-size: 0.88em;
}

.reveal .three-hamiltonian-tight h2 {
  font-size: 1.62em;
}

.reveal .main-picture-tight mjx-container[display="true"] {
  font-size: 0.86em !important;
}

.reveal .main-picture-tight .takeaway {
  font-size: 0.78em;
}

/* Interactive laboratories */
.matter-lab-slide h2 {
  margin-bottom: 0.18em;
}

.matter-lab {
  --lab-bg: rgba(10, 18, 29, 0.94);
  display: grid;
  grid-template-columns: 18.5rem 1fr;
  grid-template-rows: auto 1fr;
  gap: 0.55rem 0.75rem;
  height: 37rem;
  padding: 0.55rem;
  border: 1px solid var(--matter-line);
  border-radius: 0.7rem;
  background: var(--lab-bg);
  box-shadow: 0 0.45rem 1.2rem rgba(0, 0, 0, 0.28);
  color: var(--matter-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.22;
}

.matter-lab * {
  box-sizing: border-box;
}

.matter-lab-controls {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem;
  border: 1px solid rgba(180, 208, 235, 0.18);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.035);
}

.matter-lab-controls label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.5rem;
  color: var(--matter-muted);
  font-size: 0.82rem;
}

.matter-lab-controls label span {
  color: var(--matter-ink);
  font-variant-numeric: tabular-nums;
}

.matter-lab-controls input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--matter-blue);
}

.matter-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-top: auto;
}

.matter-presets button {
  min-height: 2rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid rgba(84, 168, 255, 0.48);
  border-radius: 0.35rem;
  background: rgba(84, 168, 255, 0.1);
  color: var(--matter-ink);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.matter-presets button:hover,
.matter-presets button:focus-visible {
  background: rgba(84, 168, 255, 0.26);
  outline: none;
}

.matter-presets button[data-action="play"] {
  grid-column: 1 / -1;
  border-color: rgba(94, 230, 210, 0.55);
  background: rgba(94, 230, 210, 0.1);
  color: var(--matter-cyan);
}

.matter-lab-readouts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.42rem;
}

.matter-lab-readouts > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 3.65rem;
  padding: 0.34rem 0.48rem;
  border: 1px solid rgba(180, 208, 235, 0.18);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.035);
}

.matter-lab-readouts span {
  color: var(--matter-muted);
  font-size: 0.68rem;
}

.matter-lab-readouts b {
  margin-top: 0.15rem;
  color: var(--matter-blue);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.matter-lab-readouts .prob b {
  color: var(--matter-cyan);
}

.matter-lab-plots {
  display: grid;
  grid-template-columns: 1.38fr 1fr;
  gap: 0.6rem;
  min-height: 0;
}

.matter-lab figure {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.28rem;
  border: 1px solid rgba(180, 208, 235, 0.17);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.025);
}

.matter-lab svg {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: visible;
}

.matter-lab figcaption {
  margin: -0.2rem 0 0.15rem;
  color: var(--matter-muted);
  text-align: center;
  font-size: 0.68rem;
}

.matter-lab svg text {
  fill: var(--matter-muted);
  font-family: inherit;
  font-size: 12px;
}

.matter-lab svg .axis {
  stroke: rgba(190, 214, 236, 0.42);
  stroke-width: 1;
}

.matter-lab svg .grid {
  stroke: rgba(190, 214, 236, 0.12);
  stroke-width: 1;
}

.matter-lab svg .vacuum-line {
  fill: none;
  stroke: rgba(200, 214, 228, 0.5);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.matter-lab svg .matter-line {
  fill: none;
  stroke: var(--matter-blue);
  stroke-width: 3;
}

.matter-lab svg .envelope-line {
  fill: none;
  stroke: var(--matter-red);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.matter-lab svg .probe {
  stroke: var(--matter-gold);
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
}

.matter-lab svg .probe-dot {
  fill: var(--matter-gold);
  stroke: #fff;
  stroke-width: 1.2;
}

.matter-lab svg .branch {
  fill: none;
  stroke: var(--matter-blue);
  stroke-width: 3;
}

.matter-lab svg .bare-branch {
  fill: none;
  stroke: rgba(200, 214, 228, 0.46);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.matter-lab svg .state-dot {
  fill: var(--matter-gold);
  stroke: #fff;
  stroke-width: 1.4;
}

.matter-lab svg .electron-fill {
  fill: var(--matter-red-soft);
  stroke: var(--matter-red);
  stroke-width: 1.5;
}

.matter-lab svg .legend-label {
  font-size: 11px;
}

.adiabatic-lab {
  position: relative;
}

.adiabatic-progress {
  position: absolute;
  left: 19.8rem;
  right: 0.7rem;
  top: 5.05rem;
  z-index: 3;
  height: 0.18rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(180, 208, 235, 0.14);
}

.adiabatic-progress i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: linear-gradient(90deg, var(--matter-cyan), var(--matter-blue));
}

.adiabatic-lab .matter-lab-plots {
  padding-top: 0.1rem;
}

@media (max-width: 900px) {
  .matter-lab {
    grid-template-columns: 15rem 1fr;
    font-size: 13px;
  }

  .matter-lab-plots {
    grid-template-columns: 1fr;
  }
}
