@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --panel-width: 380px;
  --panel-border: rgba(143, 159, 182, 0.24);
  --panel-shadow: 0 24px 60px rgba(12, 20, 34, 0.12);
  --text-main: #102033;
  --text-soft: #5c6f86;
  --text-muted: #8394aa;
  --accent: #1f8ef1;
  --accent-soft: rgba(31, 142, 241, 0.16);
  --amber: #f59d23;
  --amber-soft: rgba(245, 157, 35, 0.16);
  --line: rgba(21, 35, 56, 0.08);
  --surface: rgba(255, 255, 255, 0.78);
  --button-dark: #17263b;
  --button-dark-hover: #24354d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 20%, rgba(31, 142, 241, 0.08), transparent 32%),
    radial-gradient(circle at 85% 18%, rgba(245, 157, 35, 0.1), transparent 24%),
    linear-gradient(135deg, #eef3f7 0%, #e8eef4 38%, #f6f9fc 100%);
  color: var(--text-main);
  font-family: "Space Grotesk", sans-serif;
}

body.pointer-locked {
  cursor: none;
}

button,
input,
select {
  font: inherit;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.12rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(16, 32, 51, 0.12);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 -1px 0 rgba(16, 32, 51, 0.06);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, var(--panel-width)) 1fr;
  height: 100vh;
  min-height: 100vh;
}

.app-shell.panel-collapsed {
  grid-template-columns: 0 1fr;
}

.control-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
  max-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.6rem 1.5rem 1.5rem;
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.92) 0%, rgba(240, 245, 250, 0.84) 100%);
  border-right: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(20px);
  transition:
    transform 220ms ease,
    opacity 180ms ease,
    padding 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.app-shell.panel-collapsed .control-panel {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
  box-shadow: none;
}

.sidebar-toggle {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 5;
  min-height: 2.75rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(16, 32, 51, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main);
  box-shadow: 0 16px 34px rgba(16, 32, 51, 0.14);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 38px rgba(16, 32, 51, 0.16);
}

.brand-lockup {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.brand-lockup > div:last-child {
  padding-top: 20px;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.98) 0 32%, transparent 33%),
    conic-gradient(from 40deg, #0f2236, #1c3149, #0f2236);
  box-shadow:
    inset 0 0 0 4px rgba(15, 34, 54, 0.1),
    0 10px 22px rgba(15, 34, 54, 0.12);
}

.section-heading,
.field-label,
.field-value,
.stat-card span,
.status-pill,
.panel-note,
.overlay-badge,
.overlay-footnote,
.instruction-list span,
.mobile-warning,
.charge-meta,
.unlock-hint {
  font-family: "IBM Plex Mono", monospace;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand-copy {
  margin: 0.55rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 0.95rem;
}

.mobile-warning {
  display: none;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(196, 71, 71, 0.22);
  border-radius: 0.95rem;
  background: linear-gradient(180deg, rgba(255, 239, 239, 0.96) 0%, rgba(255, 228, 228, 0.9) 100%);
  color: #8a1f1f;
  font-size: 0.8rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(138, 31, 31, 0.08);
}

.mobile-warning.visible {
  display: block;
}

.panel-section {
  padding: 1.1rem 1.05rem 1rem;
  border: 1px solid rgba(143, 159, 182, 0.16);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0.35rem var(--accent-soft);
}

.section-dot.amber {
  background: var(--amber);
  box-shadow: 0 0 0 0.35rem var(--amber-soft);
}

.section-dot.blue {
  background: #52a9ff;
  box-shadow: 0 0 0 0.35rem rgba(82, 169, 255, 0.16);
}

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

.stat-card {
  padding: 0.9rem 0.95rem;
  border-radius: 0.95rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(246, 249, 253, 0.84) 100%);
  border: 1px solid rgba(16, 32, 51, 0.08);
}

.stat-wide {
  grid-column: 1 / -1;
}

.compact-grid .stat-card {
  min-height: 5.2rem;
}

.stat-card span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.2rem;
  letter-spacing: -0.04em;
}

.control-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 0.45rem;
}

.field-label {
  color: var(--text-soft);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-value {
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
}

.range-input {
  width: 100%;
  appearance: none;
  height: 0.48rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(31, 142, 241, 0.16) 0%, rgba(31, 142, 241, 0.08) 100%);
  outline: none;
}

.select-input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.78rem 0.95rem;
  border: 1px solid rgba(16, 32, 51, 0.09);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main);
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #2ea4ff 0%, #1f8ef1 100%);
  box-shadow: 0 4px 14px rgba(31, 142, 241, 0.26);
  cursor: pointer;
}

.range-input::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #2ea4ff 0%, #1f8ef1 100%);
  box-shadow: 0 4px 14px rgba(31, 142, 241, 0.26);
  cursor: pointer;
}

.amber-track {
  background: linear-gradient(90deg, rgba(245, 157, 35, 0.18) 0%, rgba(245, 157, 35, 0.08) 100%);
}

.amber-track::-webkit-slider-thumb {
  background: linear-gradient(180deg, #f8b453 0%, #f59d23 100%);
  box-shadow: 0 4px 14px rgba(245, 157, 35, 0.26);
}

.amber-track::-moz-range-thumb {
  background: linear-gradient(180deg, #f8b453 0%, #f59d23 100%);
  box-shadow: 0 4px 14px rgba(245, 157, 35, 0.26);
}

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 3.1rem;
  height: 1.8rem;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.14);
  transition: background 140ms ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.2rem;
  width: 1.42rem;
  height: 1.42rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(16, 32, 51, 0.16);
  transition: transform 140ms ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(31, 142, 241, 0.42);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(1.28rem);
}

.action-button {
  min-height: 3rem;
  border: 0;
  border-radius: 0.95rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button.primary {
  color: #f7fbff;
  background: linear-gradient(180deg, #1f8ef1 0%, #0d76d8 100%);
  box-shadow: 0 16px 28px rgba(31, 142, 241, 0.22);
}

.action-button.secondary {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(16, 32, 51, 0.09);
}

.action-button.primary:hover {
  box-shadow: 0 20px 32px rgba(31, 142, 241, 0.26);
}

.action-button.secondary:hover {
  background: rgba(255, 255, 255, 0.94);
}

.panel-note {
  margin: 0;
  padding: 0.9rem 1rem 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.6;
  border-top: 1px solid var(--line);
}

.lab-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 65% 15%, rgba(255, 255, 255, 0.72), transparent 40%),
    linear-gradient(180deg, rgba(236, 242, 247, 0.78) 0%, rgba(229, 236, 243, 0.9) 100%);
}

#viewport {
  position: absolute;
  inset: 0;
}

#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.floating-status {
  position: absolute;
  top: 1.4rem;
  right: 1.6rem;
  display: flex;
  gap: 0.7rem;
  z-index: 3;
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 32, 51, 0.08);
  box-shadow: 0 12px 30px rgba(17, 31, 46, 0.12);
  color: var(--text-main);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.status-pill span {
  color: var(--accent);
  font-weight: 600;
}

.charge-panel {
  position: absolute;
  left: 50%;
  bottom: clamp(8.2rem, 15vh, 10.6rem);
  z-index: 3;
  width: min(420px, calc(100% - 2rem));
  padding: 1rem 1.15rem;
  border-radius: 1.1rem;
  background: rgba(17, 28, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(12, 20, 34, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 0.9rem);
  backdrop-filter: blur(16px);
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 180ms ease,
    visibility 0s linear 180ms;
}

.charge-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.charge-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: rgba(236, 245, 255, 0.82);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.charge-track {
  height: 0.72rem;
  margin-top: 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.charge-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f8ef1 0%, #79cbff 48%, #f59d23 100%);
  box-shadow: 0 0 18px rgba(121, 203, 255, 0.4);
  transition: width 70ms linear;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 1.6rem;
  height: 1.6rem;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair span {
  position: absolute;
  inset: 0;
}

.crosshair span::before,
.crosshair span::after {
  content: "";
  position: absolute;
  background: rgba(15, 27, 41, 0.75);
  border-radius: 999px;
}

.crosshair span:first-child::before,
.crosshair span:first-child::after {
  top: 50%;
  width: 0.42rem;
  height: 0.12rem;
  transform: translateY(-50%);
}

.crosshair span:first-child::before {
  left: 0;
}

.crosshair span:first-child::after {
  right: 0;
}

.crosshair span:last-child::before,
.crosshair span:last-child::after {
  left: 50%;
  width: 0.12rem;
  height: 0.42rem;
  transform: translateX(-50%);
}

.crosshair span:last-child::before {
  top: 0;
}

.crosshair span:last-child::after {
  bottom: 0;
}

.crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 50%;
  background: rgba(245, 157, 35, 0.9);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(245, 157, 35, 0.32);
}

.intro-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(560px, calc(100% - 2rem));
  padding: 1.8rem 1.85rem;
  border-radius: 1.4rem;
  background: rgba(248, 251, 254, 0.9);
  border: 1px solid rgba(16, 32, 51, 0.1);
  box-shadow: 0 24px 70px rgba(14, 23, 35, 0.18);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(18px);
  text-align: center;
}

.intro-overlay.hidden {
  display: none;
}

.overlay-badge {
  margin: 0 0 0.7rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.intro-overlay h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.overlay-copy {
  margin: 0.85rem 0 1.2rem;
  max-width: 42rem;
  color: var(--text-soft);
  line-height: 1.65;
  text-align: left;
}

.vr-entry-note {
  margin: 0.95rem 0 0;
  color: var(--text-soft);
  line-height: 1.5;
  font-size: 0.88rem;
}

.instruction-list {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1.35rem;
  width: 100%;
}

.instruction-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 32, 51, 0.08);
}

.instruction-list strong {
  font-size: 0.95rem;
}

.instruction-list span {
  color: var(--text-soft);
  font-size: 0.79rem;
  text-align: right;
}

.enter-button {
  min-width: 11rem;
  min-height: 3.2rem;
  padding: 0.85rem 1.2rem;
  border: 0;
  border-radius: 0.95rem;
  background: linear-gradient(180deg, var(--button-dark) 0%, #0f1d2e 100%);
  color: #eff6ff;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(15, 29, 46, 0.24);
}

.enter-button:hover {
  background: linear-gradient(180deg, var(--button-dark-hover) 0%, #16273b 100%);
}

.overlay-footnote {
  margin: 0.95rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.unlock-hint {
  position: absolute;
  left: 50%;
  bottom: 6.8rem;
  z-index: 3;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(16, 32, 51, 0.08);
  box-shadow: 0 18px 38px rgba(16, 32, 51, 0.14);
  transform: translateX(-50%);
  color: var(--text-main);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.enter-vr-button {
  position: fixed !important;
  right: 1.5rem !important;
  bottom: 1.5rem !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  min-width: 10.8rem;
  height: auto !important;
  padding: 0.82rem 1.2rem !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #17263b 0%, #101b2b 100%) !important;
  color: #eef6ff !important;
  font-family: "IBM Plex Mono", monospace !important;
  font-size: 0.76rem !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
  opacity: 1 !important;
  box-shadow: 0 18px 42px rgba(10, 20, 34, 0.28) !important;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease !important;
}

.enter-vr-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(10, 20, 34, 0.32) !important;
  background: linear-gradient(180deg, #22354d 0%, #152337 100%) !important;
}

body.xr-active .app-shell {
  grid-template-columns: 1fr;
}

body.xr-active .control-panel,
body.xr-active .sidebar-toggle,
body.xr-active .floating-status,
body.xr-active .charge-panel,
body.xr-active .crosshair,
body.xr-active .intro-overlay,
body.xr-active .unlock-hint {
  display: none !important;
}

.hidden {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 320px 1fr;
  }

  .brand-lockup h1 {
    font-size: 1.75rem;
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

  .control-panel {
    max-height: 48vh;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .app-shell.panel-collapsed {
    grid-template-columns: 1fr;
  }

  .app-shell.panel-collapsed .control-panel {
    max-height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
    transform: translateY(-100%);
  }

  .lab-stage {
    min-height: 52vh;
  }

  .floating-status {
    top: 1rem;
    left: 1rem;
    right: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .charge-panel {
    bottom: 4.4rem;
  }
}
