/* ==========================================================================
   styles.css — 3D Hilbert Space-Filling Cube Interactive Showcase
   Futuristic Cyber-Museum Glassmorphism & HUD Interface
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #040711;
  color: #e8f1ff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#glCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
  touch-action: none;
}

#glCanvas:active {
  cursor: grabbing;
}

/* Subtle Decorative Corner HUD Reticles */
.hud-frame {
  position: fixed;
  inset: 14px;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.4s ease;
}

.hud-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: rgba(56, 217, 255, 0.35);
  border-style: solid;
}
.hud-corner.tl { top: 0; left: 0; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.hud-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-top-right-radius: 6px; }
.hud-corner.bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-bottom-left-radius: 6px; }
.hud-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

/* Glassmorphic Surface Token */
.glass-panel {
  background: linear-gradient(145deg, rgba(10, 17, 34, 0.76), rgba(6, 11, 24, 0.84));
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(94, 212, 255, 0.18);
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

/* Immersive Pure Art Mode hides HUD cleanly */
body.immersive-mode .ui-fade {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.ui-fade {
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------------- Top Header Telemetry Bar ---------------- */
.top-bar {
  position: fixed;
  top: 22px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
  pointer-events: none;
}

.brand-card {
  pointer-events: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #00f2fe;
  box-shadow: 0 0 12px #00f2fe, 0 0 24px rgba(0, 242, 254, 0.6);
  animation: pulseGlow 2.2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.65; }
}

.brand-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #38e8ff;
  text-transform: uppercase;
}

.brand-main {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #ffffff 0%, #9eeaff 55%, #c59bff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.telemetry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(120, 210, 255, 0.14);
  font-size: 12px;
  color: #9cb3d6;
}

.stat-chip strong {
  color: #eef6ff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Top Right Quick Utility Buttons */
.top-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(94, 212, 255, 0.22);
  background: rgba(10, 18, 36, 0.78);
  backdrop-filter: blur(16px);
  color: #dceaff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(26, 48, 88, 0.85);
  border-color: rgba(56, 232, 255, 0.55);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(0, 225, 255, 0.22);
}

.icon-btn.active {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(132, 62, 255, 0.28));
  border-color: #38e8ff;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(56, 232, 255, 0.3);
}

/* Floating Restore Button when in Immersive Mode */
.immersive-exit-btn {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.immersive-mode .immersive-exit-btn {
  opacity: 0.75;
  pointer-events: auto;
}
body.immersive-mode .immersive-exit-btn:hover {
  opacity: 1;
}

/* ---------------- Right Studio Control Drawer ---------------- */
.control-drawer {
  position: fixed;
  top: 84px;
  right: 24px;
  bottom: 98px;
  width: 344px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.control-drawer.collapsed {
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(110, 200, 255, 0.13);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 14px;
  font-weight: 600;
  color: #eaf4ff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-scroll::-webkit-scrollbar {
  width: 5px;
}
.drawer-scroll::-webkit-scrollbar-thumb {
  background: rgba(100, 185, 255, 0.25);
  border-radius: 999px;
}

.ctrl-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(110, 195, 255, 0.09);
}

.ctrl-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #7cc4ea;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Grid Pills for Presets, Modes, Palettes */
.pill-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.pill-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-pill {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(120, 195, 255, 0.15);
  background: rgba(255, 255, 255, 0.035);
  color: #bfd4f2;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
}

.mode-pill:hover {
  background: rgba(56, 210, 255, 0.11);
  border-color: rgba(56, 225, 255, 0.38);
  color: #ffffff;
}

.mode-pill.active {
  background: linear-gradient(135deg, rgba(0, 218, 255, 0.22), rgba(132, 68, 255, 0.26));
  border-color: #3be8ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 218, 255, 0.18);
}

.swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

/* Sliders */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #b8cde8;
}

.slider-val {
  font-variant-numeric: tabular-nums;
  color: #4be8ff;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #38ecff;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(56, 236, 255, 0.8);
  transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

/* Toggle Switches / Check Chips */
.toggle-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toggle-chip {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(120, 195, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
  color: #9cb4d4;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.toggle-chip.active {
  background: rgba(0, 224, 255, 0.16);
  border-color: rgba(56, 232, 255, 0.55);
  color: #eaf7ff;
}

/* ---------------- Bottom-Center Quick Experience Dock ---------------- */
.bottom-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 36px);
  overflow-x: auto;
}

body.immersive-mode .bottom-dock {
  transform: translate(-50%, 14px);
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dock-divider {
  width: 1px;
  height: 26px;
  background: rgba(120, 200, 255, 0.18);
  flex-shrink: 0;
}

.order-btn {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 195, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #c7dbf5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.order-btn:hover {
  background: rgba(56, 225, 255, 0.14);
  color: #ffffff;
}

.order-btn.active {
  background: linear-gradient(135deg, #00d2ff 0%, #7a3cff 100%);
  border-color: #7eeeff;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.45);
}

.dock-btn {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(120, 195, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #d4e5fc;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.dock-btn:hover {
  background: rgba(56, 225, 255, 0.14);
  border-color: rgba(56, 232, 255, 0.45);
  color: #ffffff;
}

.dock-btn.active {
  background: rgba(0, 225, 255, 0.2);
  border-color: #38e8ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(56, 232, 255, 0.28);
}

/* ---------------- Bottom-Left 1D->3D Locality Monitor ---------------- */
.locality-card {
  position: fixed;
  left: 24px;
  bottom: 92px;
  width: 286px;
  padding: 12px 15px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.locality-title {
  font-size: 12px;
  font-weight: 600;
  color: #9ed8ff;
  display: flex;
  justify-content: space-between;
}

.spectrum-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00f2fe 0%, #7638ff 36%, #ff228b 70%, #ffc629 100%);
  overflow: hidden;
  box-shadow: 0 0 12px rgba(0, 225, 255, 0.25);
}

.spectrum-mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 10, 22, 0.86);
  width: 0%;
}

.spectrum-comet {
  position: absolute;
  top: -2px;
  width: 10px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 18px #00f2fe;
  transform: translateX(-50%);
}

.locality-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #8da5c8;
}

.shortcut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12px;
  color: #7893b8;
}

.kbd {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cfe4ff;
  font-size: 12px;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translate(-50%, -12px);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(8, 20, 42, 0.9);
  border: 1px solid rgba(56, 232, 255, 0.5);
  color: #eaf7ff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 225, 255, 0.25);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive Adaptations */
@media (max-width: 960px) {
  .locality-card {
    display: none;
  }
  .control-drawer {
    width: 300px;
    top: 78px;
    right: 12px;
    bottom: 88px;
  }
  .top-bar {
    top: 12px;
    left: 12px;
    right: 12px;
  }
  .brand-card {
    padding: 10px 14px;
  }
  .brand-main {
    font-size: 15px;
  }
  .bottom-dock {
    bottom: 12px;
  }
}
