/**
 * Prag Design Tooling — Physical UI Laboratory Stylesheet
 * Strict monochrome, optical specular catchlights, anti-slop ergonomics.
 * Dynamic frosted glass optical transmission over live 3D background realms.
 */

:root {
  --lab-bg: #030306;
  --lab-glass-blur: 20px;
  --lab-glass-opacity: 0.72;
  --lab-card-bg: rgba(10, 13, 20, var(--lab-glass-opacity));
  --lab-surface: rgba(10, 13, 20, var(--lab-glass-opacity));
  --lab-border: rgba(255, 255, 255, 0.14);
  --lab-border-subtle: rgba(255, 255, 255, 0.08);
  --lab-text: #f8fafc;
  --lab-text-muted: #94a3b8;
  --lab-accent: #38bdf8;
  --lab-accent-glow: rgba(56, 189, 248, 0.35);
}

body.design-lab-page {
  background-color: var(--lab-bg);
  color: var(--lab-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* 3D WebGL Canvas & Fixed Layers */
.webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.realm-veil {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background: radial-gradient(circle at center, rgba(3, 3, 6, 0.85) 0%, rgba(3, 3, 6, 0.98) 100%);
}

.realm-veil.is-transitioning {
  opacity: 1;
}

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(3, 3, 6, 0.6) 100%);
}

/* Background Atmosphere Grid */
.lab-ambient-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

.lab-container {
  position: relative;
  z-index: 10;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--header-h, 4.5rem) + 1.5rem) 1.5rem 6rem;
}

/* Header */
.lab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--lab-border-subtle);
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
}

.lab-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.lab-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.lab-title-group h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lab-title-group p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--lab-text-muted);
}

.lab-header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Executive 3D Scene Indicator Capsule in Header */
.realm-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: rgba(8, 12, 20, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: #f1f5f9;
  letter-spacing: 0.02em;
  user-select: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.realm-indicator:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.realm-indicator.is-ultra-active {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.realm-nav-btn {
  background: transparent;
  border: none;
  color: rgba(243, 241, 251, 0.6);
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.realm-nav-btn:hover {
  color: #38bdf8;
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.realm-label-btn {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 12px;
  transition: color 0.15s ease;
}

.realm-label-btn:hover {
  color: #ffffff;
}

.realm-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  flex-shrink: 0;
  animation: pulse-dot 2.5s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.realm-picker-chevron {
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.lab-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.lab-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

.lab-btn-ghost.is-active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--lab-accent);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* Tuning Cockpit (Top Inspector Floating Dock) */
.tuning-cockpit {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 16px;
  backdrop-filter: blur(var(--lab-glass-blur));
  -webkit-backdrop-filter: blur(var(--lab-glass-blur));
  padding: 1.5rem;
  margin-bottom: 3rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 20px 48px -10px rgba(0, 0, 0, 0.75);
  transition: backdrop-filter 0.15s ease, background 0.15s ease;
}

/* Design System Profile Presets & Management */
.cockpit-profiles-bar {
  margin-bottom: 1.25rem;
}

.profile-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.profile-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.profile-active-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--lab-accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-action-btn {
  padding: 5px 11px;
  font-size: 0.74rem;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.profile-select-dropdown {
  max-width: 260px;
  padding: 6px 10px;
  font-size: 0.74rem;
}

.profile-chips-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.profile-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.profile-chip.is-active {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--lab-accent);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.profile-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
}

.profile-chip.is-active .profile-chip-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.profile-chip-tag {
  font-size: 0.62rem;
  font-family: "JetBrains Mono", monospace;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #94a3b8;
}

.profile-chip.is-active .profile-chip-tag {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

.profile-summary-card {
  background: rgba(3, 7, 18, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.25s ease;
}

.profile-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-summary-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f8fafc;
}

.profile-summary-meta {
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--lab-accent);
}

.profile-summary-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.profile-token-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.profile-token-pill {
  font-size: 0.70rem;
  font-family: "JetBrains Mono", monospace;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #cbd5e1;
}

.profile-copy-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.95);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.2);
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-copy-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cockpit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.cockpit-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cockpit-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--lab-accent);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 9999px;
  text-transform: uppercase;
}

.cockpit-sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.cockpit-divider {
  height: 1px;
  background: var(--lab-border-subtle);
  margin: 1.5rem 0 1.25rem;
}

.cockpit-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f1f5f9;
}

.cockpit-3d-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.lab-select {
  background: rgba(3, 10, 24, 0.85);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.76rem;
  padding: 8px 10px;
  outline: none;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lab-select:focus {
  border-color: var(--lab-accent);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.cockpit-link-btn {
  background: transparent;
  border: none;
  color: var(--lab-accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.15s ease;
}

.cockpit-link-btn:hover {
  color: #ffffff;
  text-decoration: underline;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--lab-text-muted);
}

.slider-val {
  font-family: "JetBrains Mono", monospace;
  color: #ffffff;
  font-weight: 600;
}

.lab-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  transition: background 0.2s;
}

.lab-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

.lab-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Laboratory Grid Sections */
.lab-section {
  margin-bottom: 3.5rem;
}

.lab-section-header {
  margin-bottom: 1.5rem;
}

.lab-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
}

.lab-section-desc {
  color: var(--lab-text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.lab-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Physical Card Demo */
.lab-demo-card {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 16px;
  backdrop-filter: blur(var(--lab-glass-blur));
  -webkit-backdrop-filter: blur(var(--lab-glass-blur));
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 16px 40px -10px rgba(0, 0, 0, 0.7);
  transition: backdrop-filter 0.15s ease, background 0.15s ease;
}

.lab-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.lab-card-text {
  font-size: 0.86rem;
  color: var(--lab-text-muted);
  margin: 0;
}

.lab-card-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  color: #e2e8f0;
  width: fit-content;
}

/* Snippet box */
.lab-code-box {
  background: rgba(6, 8, 14, 0.85);
  border: 1px solid var(--lab-border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: "JetBrains Mono", Menlo, monospace;
  font-size: 0.76rem;
  color: #94a3b8;
  overflow-x: auto;
  user-select: all;
  margin-top: 0.5rem;
}

/* Switch demo row */
.switch-demo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--lab-border-subtle);
}

.switch-demo-row:last-child {
  border-bottom: none;
}

.switch-label-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-primary-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.switch-secondary-label {
  font-size: 0.78rem;
  color: var(--lab-text-muted);
}

/* Input test block */
.input-demo-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Odometer Row */
.odometer-row {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 0;
}

.odometer-big {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: -0.03em;
  color: #ffffff;
}

/* 3D Gummy & Magnetic Jelly Demo Containers */
.gummy-demo-row,
.jelly-demo-row {
  overflow: visible !important;
  isolation: isolate;
}

.gummy-demo-row .btn,
.jelly-demo-row .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--lab-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  overflow: visible !important;
}

.gummy-demo-row .btn.has-gummy-3d,
.btn.has-gummy-3d,
[data-gummy-3d] {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0px solid transparent !important;
  border-color: transparent !important;
  outline: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.20),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    0 18px 36px -6px rgba(0, 0, 0, 0.45),
    0 8px 18px -4px rgba(0, 0, 0, 0.30) !important;
  transition: box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.gummy-demo-row .btn.has-gummy-3d:hover,
.btn.has-gummy-3d:hover,
[data-gummy-3d]:hover {
  background: transparent !important;
  border: 0px solid transparent !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 22px 42px -6px rgba(0, 0, 0, 0.55),
    0 10px 22px -4px rgba(0, 0, 0, 0.35) !important;
}

.gummy-demo-row .btn.has-gummy-3d.is-pressed,
.btn.has-gummy-3d.is-pressed,
.btn.has-gummy-3d:active,
[data-gummy-3d]:active {
  background: transparent !important;
  border: 0px solid transparent !important;
  box-shadow: 
    0 8px 18px -3px rgba(0, 0, 0, 0.40),
    0 3px 8px -2px rgba(0, 0, 0, 0.30) !important;
}

.btn.has-gummy-3d.btn-gummy-cyan {
  box-shadow: 0 14px 32px -4px rgba(6, 182, 212, 0.32), 0 8px 18px -2px rgba(0, 0, 0, 0.55), 0 2px 4px 0 rgba(0, 0, 0, 0.35) !important;
}
.btn.has-gummy-3d.btn-gummy-amber {
  box-shadow: 0 14px 32px -4px rgba(245, 158, 11, 0.32), 0 8px 18px -2px rgba(0, 0, 0, 0.55), 0 2px 4px 0 rgba(0, 0, 0, 0.35) !important;
}
.btn.has-gummy-3d.btn-gummy-emerald {
  box-shadow: 0 14px 32px -4px rgba(16, 185, 129, 0.32), 0 8px 18px -2px rgba(0, 0, 0, 0.55), 0 2px 4px 0 rgba(0, 0, 0, 0.35) !important;
}
.btn.has-gummy-3d.btn-gummy-obsidian {
  box-shadow: 0 14px 32px -4px rgba(0, 0, 0, 0.70), 0 8px 18px -2px rgba(0, 0, 0, 0.55), 0 2px 4px 0 rgba(0, 0, 0, 0.35) !important;
}

.btn.has-gummy-3d .gummy-3d-canvas,
.has-magnetic-jelly > .gummy-3d-canvas {
  position: absolute;
  top: -16px;
  left: -16px;
  width: calc(100% + 32px);
  height: calc(100% + 32px);
  pointer-events: none !important;
  z-index: 1;
  border-radius: inherit;
  transform: none !important;
}

.btn.has-gummy-3d.has-magnetic-jelly:not(:active):not(.is-pressed) {
  transform: var(--jelly-transform, translateZ(0)) var(--float-transform, translate3d(0, 0, 0)) !important;
  transform-origin: var(--jelly-origin, 50% 50%) !important;
  transition: box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}

.btn.has-gummy-3d.has-magnetic-jelly:hover:not(:active):not(.is-pressed) {
  transform: var(--jelly-transform, translateZ(0)) var(--float-transform, translate3d(0, 0, 0)) !important;
  transform-origin: var(--jelly-origin, 50% 50%) !important;
}

.btn.has-gummy-3d::before,
.btn.has-gummy-3d::after,
[data-gummy-3d]::before,
[data-gummy-3d]::after {
  display: none !important;
  opacity: 0 !important;
  content: none !important;
}

.water-ripple-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none !important;
  z-index: 9995;
  mix-blend-mode: screen;
}

/* Sovereign Liquid Refraction Lens & Splash Distortion */
.water-lens-element,
.water-splash-lens {
  position: fixed;
  border-radius: 50%;
  pointer-events: none !important;
  backdrop-filter: url(#water-refract-filter);
  -webkit-backdrop-filter: url(#water-refract-filter);
  opacity: 0 !important;
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  border: none !important;
  box-shadow: none !important;
}

.water-lens-element.is-active {
  opacity: 0 !important;
  display: none !important;
}

@keyframes water-splash-lens-anim {
  0% { width: 0px; height: 0px; opacity: 0; }
  100% { width: 0px; height: 0px; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .water-lens-element,
  .water-splash-lens {
    display: none !important;
  }
}

/* Pervasive Stiff Magnetic Jelly Button System */
.has-magnetic-jelly,
.btn.has-magnetic-jelly,
.lab-btn-ghost.has-magnetic-jelly,
.mercury-tab.has-magnetic-jelly {
  --jelly-transform: translateZ(0);
  --jelly-origin: 50% 50%;
  --jelly-content-tx: 0px;
  --jelly-content-ty: 0px;
  --jelly-shadow-x: 0px;
  --jelly-shadow-y: 0px;
  --jelly-hl-x: 50%;
  --jelly-hl-y: 50%;
  --jelly-hl-opacity: 0;
  --jr-tl: 9999px;
  --jr-tr: 9999px;
  --jr-br: 9999px;
  --jr-bl: 9999px;
  --float-transform: translate3d(0, 0, 0);
  position: relative;
  will-change: transform, border-radius;
  overflow: visible !important;
  border-radius: var(--jr-tl) var(--jr-tr) var(--jr-br) var(--jr-bl) !important;
}

.has-magnetic-jelly:not(:active):not(.is-pressed) {
  transform: var(--jelly-transform) var(--float-transform, translate3d(0, 0, 0)) !important;
  transform-origin: var(--jelly-origin) !important;
}

.has-magnetic-jelly:hover:not(:active):not(.is-pressed) {
  transform: var(--jelly-transform) var(--float-transform, translate3d(0, 0, 0)) !important;
  transform-origin: var(--jelly-origin) !important;
}

.has-magnetic-jelly > * {
  position: relative;
  z-index: 2;
  transform: translate(var(--jelly-content-tx), var(--jelly-content-ty));
  transition: transform 0s linear !important;
}

/* Dynamic Card Specular Spotlight & Optical Catchlights */
.lab-demo-card,
.tuning-cockpit,
.lab-section {
  position: relative;
  --spotlight-x: -999px;
  --spotlight-y: -999px;
}

.lab-demo-card::before,
.tuning-cockpit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    420px circle at var(--spotlight-x, -999px) var(--spotlight-y, -999px),
    rgba(255, 255, 255, 0.12) 0%,
    rgba(56, 189, 248, 0.05) 45%,
    transparent 70%
  );
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.lab-demo-card:hover::before,
.tuning-cockpit:hover::before {
  --spotlight-opacity: 1;
}

/* 3D Hydrodynamic Floating UI Elements */
.has-float-ripple,
.lab-card-pill,
.cockpit-badge,
.realm-indicator {
  transform: var(--float-transform, translate3d(0, 0, 0));
  will-change: transform;
}

/* PragCore Guided On-Rails Station Navigation HUD */
.lab-rail-stepper {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 8px;
  background: rgba(10, 13, 20, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.lab-rail-station {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lab-rail-station:hover {
  background: rgba(56, 189, 248, 0.6);
  border-color: #38bdf8;
  transform: scale(1.35);
}

.lab-rail-station.is-active {
  background: #38bdf8;
  border-color: #ffffff;
  box-shadow: 0 0 10px #38bdf8;
  transform: scale(1.4);
}

.lab-rail-station-tooltip {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.lab-rail-station:hover .lab-rail-station-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* 3D Gummy Material Fallback Colors (when 3D canvas is inactive) */
.btn-gummy-cyan:not(.has-gummy-3d) {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.85) 0%, rgba(3, 105, 161, 0.95) 100%) !important;
  color: #ffffff !important;
}

.btn-gummy-obsidian:not(.has-gummy-3d) {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
  color: #f8fafc !important;
}

.btn-gummy-amber:not(.has-gummy-3d) {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.85) 0%, rgba(180, 83, 9, 0.95) 100%) !important;
  color: #ffffff !important;
}

.btn-gummy-emerald:not(.has-gummy-3d) {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.85) 0%, rgba(4, 120, 87, 0.95) 100%) !important;
  color: #ffffff !important;
}

@media (max-width: 1024px) {
  .lab-rail-stepper {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .cockpit-sliders {
    grid-template-columns: 1fr;
  }
  .lab-cards-row {
    grid-template-columns: 1fr;
  }
  .lab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .lab-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}
