/* Virtual labs — forced readable stage (works in light & dark site theme) */
.lab-wrap {
  max-width: 960px;
  margin: 1.5rem auto 2rem;
  padding: 0 0.75rem;
  color: #334155;
}
.lab-wrap > h1 {
  color: #0f172a !important;
  margin-top: 0;
}
.lab-wrap > .text-muted,
.lab-wrap > p.text-muted {
  color: #64748b !important;
}
.lab-wrap a { color: #0891b2; }

.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.45rem;
  margin: 1rem 0 1.25rem;
}
.exp-btn {
  font-size: 0.8rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  border: 1px solid #334155;
  background: #1e1b2e;
  color: #e2e8f0 !important;
  transition: border-color 0.15s, background 0.15s;
}
.exp-btn:hover { border-color: #a78bfa; background: #2a2540; }
.exp-btn.active {
  border-color: #c4b5fd;
  background: #5b21b6;
  color: #f5f3ff !important;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.45);
}

/* Stage must never collapse */
.lab-stage {
  display: block;
  background: #0b1220 !important;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 1.1rem 1.15rem 1.25rem;
  color: #e2e8f0 !important;
  min-height: 420px;
  box-sizing: border-box;
}
.lab-stage h2,
.lab-stage .hint,
.lab-stage label {
  color: #e2e8f0 !important;
}
.lab-stage .hint { color: #94a3b8 !important; font-size: 0.88rem; margin: 0 0 0.65rem; }

#lab-canvas {
  display: block !important;
  width: 100% !important;
  height: 280px !important;
  min-height: 280px !important;
  max-height: none !important;
  border-radius: 12px;
  background: #070b14 !important;
  touch-action: none;
  cursor: crosshair;
  /* paint only — NOT size containment (that collapsed the canvas) */
  contain: paint;
  transform: translateZ(0);
}

.formula-box {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  background: #111827 !important;
  border: 1px solid #334155;
  color: #e2e8f0 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 2.5rem;
}
.formula-box strong { color: #a5f3fc !important; }

.lab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  min-height: 1.5rem;
}
.lab-controls label {
  font-size: 0.85rem;
  color: #cbd5e1 !important;
  min-width: 140px;
}
.lab-controls input[type="range"] {
  width: 100%;
  max-width: 220px;
  accent-color: #8b5cf6;
}

.mode-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: rgba(139, 92, 246, 0.35);
  color: #ddd6fe !important;
  border: 1px solid rgba(167, 139, 250, 0.45);
}

.lab-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.lab-hub-card {
  padding: 1.25rem;
  text-decoration: none;
  color: #e2e8f0 !important;
  background: #1e1b2e;
  border: 1px solid #334155;
  border-radius: 14px;
}
.lab-hub-card:hover { border-color: #a78bfa; }
.lab-hub-card strong { color: #f8fafc !important; display: block; margin: 0.35rem 0; }
.lab-hub-card p { color: #94a3b8 !important; font-size: 0.88rem; margin: 0; }
