@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-deep: #07080c;
  --panel-bg: rgba(14, 17, 24, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(22, 27, 38, 0.85);
  --accent-celestial: #38bdf8;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

volt-app, .visualizer-root {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: none !important;
}

/* Custom Astronomy / CAD Reticle Cursor */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform;
  transition: opacity 0.2s ease;
}

.cursor-dot {
  width: 5px;
  height: 5px;
  background: #38bdf8;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #38bdf8, 0 0 2px #fff;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.cursor-ring {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  transition: width 0.15s ease, height 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#custom-cursor.cursor-target .cursor-dot {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.5);
  box-shadow: 0 0 10px #38bdf8, 0 0 4px #fff;
}

#custom-cursor.cursor-target .cursor-ring {
  width: 38px;
  height: 38px;
  border-color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
  animation: cursorPulse 1.8s infinite ease-in-out;
}

@keyframes cursorPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}

/* -------------------------------------------------------------------------- */
/* Top Header — Clean Architectural Observatory Style                        */
/* -------------------------------------------------------------------------- */
.app-header {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  padding: 7px 14px;
  border-radius: 8px;
  pointer-events: auto;
}

.brand-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Engine Switcher */
.engine-switch {
  display: flex;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
  pointer-events: auto;
}

.engine-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.engine-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.engine-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.brand-divider {
  color: var(--text-muted);
  font-size: 11px;
}

.brand-caption {
  font-size: 12px;
  color: var(--text-secondary);
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Telemetry Bar */
.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  padding: 7px 16px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  pointer-events: auto;
}

.metric {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.metric-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  color: #fff;
  font-weight: 600;
}

.metric-sep {
  color: var(--text-muted);
}

.val-fps {
  color: #38bdf8;
}

.header-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.nav-btn {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: var(--panel-hover);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.nav-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-celestial);
}

/* -------------------------------------------------------------------------- */
/* Viewport Navigation Hints                                                  */
/* -------------------------------------------------------------------------- */
.viewport-hints {
  position: absolute;
  top: 70px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  z-index: 5;
}

.hint-pill {
  background: rgba(14, 17, 24, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: right;
}

/* -------------------------------------------------------------------------- */
/* Node Inspector Tooltip Card                                                */
/* -------------------------------------------------------------------------- */
.inspector-card {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  transition: opacity 0.15s ease, transform 0.15s ease;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.15);
  min-width: 175px;
}

.inspector-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.inspect-tag {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-weight: 600;
}

.inspect-id {
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
}

.inspector-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inspect-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
}

.inspect-row .lbl {
  color: var(--text-secondary);
}

.inspect-row .val-c,
.inspect-row .val-d,
.inspect-row .val-pos {
  color: #f8fafc;
  font-weight: 500;
}

/* -------------------------------------------------------------------------- */
/* Refined Bottom Control Dock                                                */
/* -------------------------------------------------------------------------- */
.control-dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--panel-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--panel-border);
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 10;
  max-width: calc(100vw - 40px);
  flex-wrap: wrap;
}

.dock-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Segmented Controls */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-btn:hover {
  color: #fff;
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Tuning Group */
.tuning-group {
  display: flex;
  gap: 12px;
}

.param-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
}

.param-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.param-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  min-width: 40px;
  text-align: center;
}

.step-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Summary stats on right of dock */
.dock-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 16px;
  font-family: var(--font-mono);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
}

.summary-label {
  color: var(--text-muted);
}

.summary-number {
  color: var(--accent-celestial);
  font-weight: 600;
}

/* -------------------------------------------------------------------------- */
/* Mobile & Touch Responsive Styles                                          */
/* -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  #custom-cursor {
    display: none !important;
  }

  canvas {
    cursor: default !important;
    touch-action: none !important;
  }

  .app-header {
    top: 8px;
    left: 8px;
    right: 8px;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }

  .brand-group {
    padding: 5px 10px;
    gap: 6px;
  }

  .brand-title {
    font-size: 12px;
  }

  .engine-switch {
    padding: 2px;
    gap: 2px;
  }

  .engine-btn {
    font-size: 10px;
    padding: 4px 8px;
  }

  .telemetry-bar {
    order: 3;
    width: 100%;
    justify-content: center;
    padding: 4px 10px;
    font-size: 10px;
  }

  .header-actions {
    order: 2;
    gap: 4px;
  }

  .nav-btn {
    padding: 4px 8px;
    font-size: 10px;
  }

  .viewport-hints {
    bottom: 95px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
  }

  .hint-pill {
    font-size: 9px;
    padding: 3px 6px;
  }

  .control-dock {
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: calc(100% - 16px);
    max-width: none;
    transform: none;
    padding: 8px 10px;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .control-dock::-webkit-scrollbar {
    display: none;
  }

  .dock-section {
    flex-shrink: 0;
    gap: 6px;
  }

  .seg-btn {
    font-size: 10px;
    padding: 4px 7px;
  }

  .tuning-group {
    gap: 6px;
  }

  .param-stepper {
    padding: 2px 6px;
    gap: 4px;
  }

  .step-btn {
    width: 22px;
    height: 22px;
  }

  .dock-summary {
    display: none;
  }
}
