.lab-main {
  --lab-blue: #9fc4ff;
  --lab-violet: #f3b7ff;
  --lab-panel: rgba(8, 13, 23, .72);
  --lab-line: rgba(191, 211, 255, .2);
  padding-top: clamp(2.5rem, 7vw, 5.5rem);
  padding-bottom: 3rem;
}

.lab-hero {
  max-width: 850px;
  margin-bottom: clamp(3rem, 7vw, 5rem);
}

.lab-hero h1 {
  max-width: 820px;
}

.lab-thesis {
  margin: 1.25rem 0 .4rem;
  color: #fff;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 680;
  letter-spacing: -.02em;
}

.lab-hero .lead,
.workspace-intro p {
  color: #d8e2f8;
}

.experiment-section {
  margin-bottom: clamp(3rem, 8vw, 5rem);
}

.lab-heading {
  align-items: center;
}

.experiment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

.experiment-grid button,
.next-button {
  appearance: none;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: rgba(17, 25, 40, .72);
  color: #eef4ff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.experiment-grid button {
  min-height: 128px;
  padding: 1.15rem;
}

.experiment-grid button strong,
.experiment-grid button span {
  display: block;
}

.experiment-grid button strong {
  margin-bottom: .4rem;
  color: #fff;
  font-size: 1.02rem;
}

.experiment-grid button span {
  color: #c6d2e9;
  font-size: .9rem;
  line-height: 1.45;
}

.experiment-grid button:hover,
.next-button:hover {
  background: rgba(35, 52, 80, .82);
  border-color: rgba(185, 204, 255, .56);
  transform: translateY(-1px);
}

.lab-workspace,
.lab-panel,
.privacy-note {
  border: 1px solid var(--lab-line);
  border-radius: 18px;
  background: var(--lab-panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lab-workspace {
  padding: clamp(1.2rem, 4vw, 2rem);
  scroll-margin-top: 6rem;
}

.workspace-intro {
  max-width: 820px;
  margin-bottom: 1.5rem;
}

.workspace-intro h2,
.interpretation-panel h2 {
  margin: 0 0 .7rem;
}

.lab-controls,
.reconstruction-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.lab-controls {
  padding: 1.15rem;
  border: 1px solid rgba(191, 211, 255, .15);
  border-radius: 14px;
  background: rgba(4, 8, 16, .4);
}

.lab-controls label,
.reconstruction-controls label {
  display: grid;
  gap: .55rem;
  min-width: 0;
  color: #dce6fa;
  font-size: .9rem;
  font-weight: 620;
}

.lab-controls output,
.reconstruction-controls output {
  float: right;
  color: var(--lab-blue);
  font-variant-numeric: tabular-nums;
}

.lab-controls select,
.reconstruction-controls select {
  width: 100%;
  min-width: 0;
  padding: .7rem .75rem;
  border: 1px solid rgba(191, 211, 255, .32);
  border-radius: 10px;
  background: #101a2b;
  color: #f4f7ff;
  font: inherit;
}

.lab-controls input[type="range"],
.reconstruction-controls input[type="range"] {
  width: 100%;
  accent-color: var(--lab-blue);
}

.reconstruction-controls {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  border: 1px dashed rgba(243, 183, 255, .32);
  border-radius: 14px;
}

.reconstruction-controls[hidden],
.lab-controls [hidden] {
  display: none;
}

.error:empty {
  display: none;
}

.error {
  padding: .8rem 1rem;
  border: 1px solid #f89ba7;
  border-radius: 10px;
  color: #ffdce1;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}

.metric {
  min-width: 0;
  padding: .9rem 1rem;
  border: 1px solid rgba(191, 211, 255, .14);
  border-radius: 12px;
  background: rgba(22, 32, 51, .66);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  margin-bottom: .25rem;
  color: #b9c5dc;
  font-size: .76rem;
  letter-spacing: .03em;
}

.metric strong {
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

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

.lab-panel {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.lab-panel h3 {
  margin: 0 0 .8rem;
  color: #fff;
}

.lab-panel canvas {
  display: block;
  width: 100%;
  height: 300px;
  border-radius: 10px;
  background: rgba(3, 7, 14, .54);
}

.chart-note {
  margin: .8rem 0 0;
  color: #bdc9df;
  font-size: .85rem;
  line-height: 1.5;
}

.numeric-details {
  margin-top: .8rem;
  color: #bdc9df;
  font-size: .84rem;
}

.numeric-details summary {
  cursor: pointer;
}

.numeric-details pre {
  max-height: 260px;
  overflow: auto;
  padding: .8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, .3);
  color: #dfe8fb;
}

.interpretation-panel {
  margin-top: 1rem;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.interpretation-panel dl {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(0, 2.2fr);
  gap: .75rem 1.5rem;
  margin: 1.5rem 0 0;
}

.interpretation-panel dt {
  color: var(--lab-blue);
  font-weight: 720;
}

.interpretation-panel dd {
  margin: 0;
  color: #e0e7f6;
}

.next-button {
  margin-top: 1.5rem;
  padding: .75rem 1rem;
}

.privacy-note {
  display: flex;
  gap: .8rem;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  color: #ccd7eb;
  font-size: .88rem;
}

.privacy-note strong {
  flex: none;
  color: #fff;
}

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

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

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

@media (max-width: 620px) {
  .experiment-grid,
  .lab-controls,
  .reconstruction-controls,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .experiment-grid button {
    min-height: 0;
  }

  .interpretation-panel dl {
    grid-template-columns: 1fr;
    gap: .25rem;
  }

  .interpretation-panel dd {
    margin-bottom: 1rem;
  }

  .privacy-note {
    display: block;
  }

  .privacy-note strong {
    display: block;
    margin-bottom: .25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .experiment-grid button,
  .next-button {
    transition: none;
  }
}
