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

:root {
  --bg-dark: #08090d;
  --bg-panel: #0b0e14;
  --bg-card: #10141e;
  --cyan-glow: #00f0ff;
  --purple-glow: #a855f7;
  --emerald-glow: #10b981;
  --amber-glow: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: #f1f5f9;
}

/* Studio Canvas Application Workspace (fixed full-screen) */
body.studio-app {
  user-select: none;
  overflow: hidden;
}

/* Scrollable Content & Informational Pages */
body.scrollable-page {
  overflow-y: auto !important;
  overflow-x: hidden;
  user-select: text;
  scroll-behavior: smooth;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.font-display {
  font-family: 'Space Grotesk', sans-serif;
}

/* Custom Cyber Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.4);
}

/* Glassmorphism */
.glass-panel {
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Matte 3D Top HUD Navigation Bar */
.top-hud-navbar {
  background: linear-gradient(180deg, rgba(14, 18, 28, 0.94) 0%, rgba(8, 11, 17, 0.98) 100%) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.7),
    0 4px 18px rgba(0, 0, 0, 0.5) !important;
}

/* Matte High-Tech Accents */
.border-matte {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bg-matte-button {
  background-color: #111722;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
}
.bg-matte-button:hover {
  background-color: #182030;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Ultra-Premium Matte 3D Tactile Buttons */
.btn-premium-run {
  background: linear-gradient(180deg, #1d2536 0%, #10141f 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.5);
  color: #f1f5f9;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-premium-run:hover {
  background: linear-gradient(180deg, #253046 0%, #151b29 100%);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.6);
}
.btn-premium-run:active {
  background: linear-gradient(180deg, #0e121b 0%, #161c28 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
  transform: translateY(1px);
}

.btn-matte-tactile {
  background: linear-gradient(180deg, #141925 0%, #0d111a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.45),
    0 2px 5px rgba(0, 0, 0, 0.4);
  color: #cbd5e1;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-matte-tactile:hover {
  background: linear-gradient(180deg, #1b2232 0%, #121622 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.18),
    0 3px 8px rgba(0, 0, 0, 0.5);
}
.btn-matte-tactile:active {
  background: linear-gradient(180deg, #0b0e15 0%, #131722 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65);
  transform: translateY(1px);
}

/* 3D Deep Matte Node Monolith Card */
.node-monolith {
  background: linear-gradient(180deg, #141926 0%, #0a0d14 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.7),
    0 18px 42px -8px rgba(0, 0, 0, 0.9),
    0 4px 12px rgba(0, 0, 0, 0.55) !important;
  border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.node-monolith:hover {
  border-color: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.7),
    0 22px 48px -8px rgba(0, 0, 0, 0.94),
    0 6px 16px rgba(0, 0, 0, 0.6) !important;
}

.node-monolith.node-selected {
  border-color: rgba(56, 189, 248, 0.7) !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(56, 189, 248, 0.45),
    inset 0 0 0 1px rgba(56, 189, 248, 0.22),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.7),
    0 24px 50px -8px rgba(0, 0, 0, 0.96),
    0 6px 18px rgba(0, 0, 0, 0.7) !important;
}

/* Node Header with subtle inset metallic bar */
.node-monolith .node-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5) !important;
}

/* Inset Wells for Custom UI (Inputs, Code, Canvas, Stats) */
.node-monolith .custom-ui-slot {
  background: #06080e !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.03) !important;
  border-radius: 8px;
}

/* Modular Synth Recessed Sockets */
.port-socket {
  position: relative;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.95), 
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}
.port-socket:hover {
  transform: scale(1.18);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.95), 
    0 0 6px rgba(255, 255, 255, 0.3);
}

/* Precision Discipline Jewel in Node Header */
.led-jewel {
  position: relative;
  display: inline-block;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
  opacity: 0.9;
}

/* Math formula container formatting */
.katex-display {
  margin: 0.4em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Switch toggle styling */
.toggle-checkbox:checked {
  right: 0;
  border-color: #38bdf8;
}
.toggle-checkbox:checked + .toggle-label {
  background-color: #38bdf8;
}

/* Canvas Drag Cursor */
#canvas-container {
  cursor: grab;
}
#canvas-container:active {
  cursor: grabbing;
}

/* =================================================================== */
/* SILKY SMOOTH COLLAPSIBLE INSPECTOR SIDEBAR                          */
/* =================================================================== */
#inspector-sidebar {
  width: 420px;
  min-width: 420px;
  max-width: 420px;
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              min-width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.22s ease,
              border-color 0.28s ease;
  will-change: width, min-width, max-width;
  position: relative;
}

#inspector-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  opacity: 0 !important;
  border-left-color: transparent !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

/* 3D Tactile Inspector Cards */
#inspector-content {
  overflow-y: auto !important;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.4);
  scroll-behavior: smooth;
}

.inspector-card {
  background: linear-gradient(180deg, #131724 0%, #0a0d14 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.6),
    0 4px 14px rgba(0, 0, 0, 0.45);
  border-radius: 10px;
}

.inspector-math-well {
  background: radial-gradient(120% 100% at 50% 0%, #090e18 0%, #04060a 100%);
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 
    inset 0 2px 6px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(56, 189, 248, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.4);
  border-radius: 8px;
}

.inspector-stat-badge {
  background: #07090e;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  border-radius: 6px;
}

/* =================================================================== */
/* SILKY SMOOTH COLLAPSIBLE PALETTE SIDEBAR (LEFT)                     */
/* =================================================================== */
#palette-sidebar {
  width: 290px;
  min-width: 290px;
  max-width: 290px;
  transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              min-width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.22s ease,
              border-color 0.28s ease;
  will-change: width, min-width, max-width;
  position: relative;
}

#palette-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  opacity: 0 !important;
  border-right-color: transparent !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

/* 3D Tactile Palette Node Cards */
.palette-card {
  background: linear-gradient(180deg, #131826 0%, #0c1018 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.35);
  border-radius: 9px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.palette-card:hover {
  transform: translateY(-1.5px);
  background: linear-gradient(180deg, #182132 0%, #0f1420 100%);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.5),
    0 6px 16px rgba(0, 0, 0, 0.55);
}

.palette-filter-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  transition: all 0.15s ease;
}
.palette-filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
}
.palette-filter-chip.active {
  background: rgba(56, 189, 248, 0.14) !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* =================================================================== */
/* TENSOR VIEWER COMPONENT (INSPECTOR & OUTPUTS)                       */
/* =================================================================== */
.tensor-tab-btn {
  padding: 2px 7px;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.15s ease;
  user-select: none;
}
.tensor-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
.tensor-tab-btn.active {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.16) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  font-weight: 600;
}

.tensor-matrix-table {
  border-collapse: separate;
  border-spacing: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

.tensor-cell {
  text-align: right;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s, border-color 0.12s;
  min-width: 48px;
}
.tensor-cell:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.tensor-cell.val-zero {
  color: rgba(255, 255, 255, 0.3);
}
.tensor-cell.val-pos {
  color: #7dd3fc;
}
.tensor-cell.val-neg {
  color: #fca5a5;
}

/* =================================================================== */
/* OCEAN VIBRANT SYNTAX HIGHLIGHTING (100% Royalty-Free Custom Theme)  */
/* =================================================================== */
.ocean-editor-frame {
  background: radial-gradient(130% 120% at 10% 10%, #07111e 0%, #03060c 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.16) !important;
  box-shadow: 
    inset 0 2px 10px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(56, 189, 248, 0.12),
    0 16px 36px -6px rgba(0, 0, 0, 0.9) !important;
  line-height: 1.6;
}

/* Ocean Vibrant Token Highlighting */
.tok-comment {
  color: #5c819d !important; /* Ocean Slate Mist */
  font-style: italic;
}
.tok-kw {
  color: #00f0ff !important; /* Bioluminescent Electric Cyan */
  font-weight: 600;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.22);
}
.tok-builtin {
  color: #38bdf8 !important; /* Sky Coral Marine */
  font-weight: 500;
}
.tok-fn {
  color: #818cf8 !important; /* Deep Azure / Periwinkle */
  font-weight: 500;
}
.tok-str {
  color: #34d399 !important; /* Seafoam Mint Lagoon */
}
.tok-num {
  color: #fbbf24 !important; /* Sunken Amber Gold */
}
.tok-op {
  color: #7dd3fc !important; /* Glacier Ice Cyan */
  font-weight: 500;
}
.tok-punct {
  color: #94a3b8 !important; /* Sea Salt Slate */
}

/* =================================================================== */
/* ULTRA-PREMIUM DARK SMOKED GLASS 3D BUTTON (Siyah Koyu Cam 3D Derin) */
/* =================================================================== */
.btn-dark-glass-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 1.15rem;
  border-radius: 9px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #e2e8f0;
  background: linear-gradient(180deg, rgba(22, 27, 39, 0.78) 0%, rgba(8, 11, 18, 0.92) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.85),
    inset 0 0 12px 0 rgba(0, 0, 0, 0.55),
    0 4px 14px -1px rgba(0, 0, 0, 0.75),
    0 1px 3px 0 rgba(0, 0, 0, 0.5);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  cursor: pointer;
  outline: none;
}

.btn-dark-glass-3d:hover {
  background: linear-gradient(180deg, rgba(28, 36, 54, 0.86) 0%, rgba(12, 17, 28, 0.96) 100%);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.85),
    inset 0 0 14px 0 rgba(0, 0, 0, 0.4),
    0 6px 20px -2px rgba(0, 0, 0, 0.85),
    0 2px 6px 0 rgba(0, 0, 0, 0.6);
  transform: translateY(-0.5px);
}

.btn-dark-glass-3d:active {
  background: linear-gradient(180deg, rgba(6, 9, 15, 0.96) 0%, rgba(13, 18, 29, 0.92) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 
    inset 0 2px 6px 0 rgba(0, 0, 0, 0.95),
    inset 0 0 2px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px 0 rgba(0, 0, 0, 0.4);
  transform: translateY(1px);
}

.btn-dark-glass-3d.copied {
  background: linear-gradient(180deg, rgba(14, 40, 34, 0.88) 0%, rgba(7, 22, 18, 0.95) 100%) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
  color: #34d399 !important;
  box-shadow: 
    inset 0 1px 0 0 rgba(52, 211, 153, 0.25),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.6) !important;
}

/* =================================================================== */
/* COMPUTE CONSOLE & SPLIT-VIEW STYLING (OBSIDIAN MATTE 3D DEPTH)      */
/* =================================================================== */
.console-tab {
  padding: 3px 10px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  cursor: pointer;
}
.console-tab:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}
.console-tab.active {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.log-filter-btn {
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.15s ease;
  cursor: pointer;
}
.log-filter-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
}
.log-filter-btn.active {
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  font-weight: 600;
}

/* Console Drawer Maximized Mode */
#console-drawer.maximized {
  height: 520px !important;
}

/* Custom Select and Option Theme Styling */
select, .custom-select {
  background-color: #0c1018 !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  cursor: pointer;
}
select option {
  background-color: #0c1018 !important;
  color: #f1f5f9 !important;
  padding: 8px 12px;
}
select option:hover,
select option:checked {
  background-color: rgba(56, 189, 248, 0.25) !important;
  color: #38bdf8 !important;
}

/* Sidebar Execution Metrics Initial Bar Widths */
.metric-bar-compute-initial {
  width: 92%;
}
.metric-bar-overhead-initial {
  width: 8%;
}
.metric-bar-flops-initial {
  width: 35%;
}
.metric-bar-memory-initial {
  width: 20%;
}

/* Language Switcher Segmented Control */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.lang-switcher button {
  padding: 2px 7px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
  transition: all 0.15s ease;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}

.lang-switcher button:hover {
  color: #fff;
}

.lang-switcher button.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}


/* =================================================================== */
/* RESPONSIVE DESIGN: TABLET & MOBILE VIEWPORTS                        */
/* =================================================================== */

/* Mobile Touch handling on canvas */
#canvas-container {
  touch-action: none;
}

@media (max-width: 1023px) {
  /* Sidebars become high-performance slide-over drawers over canvas */
  #palette-sidebar {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    z-index: 45 !important;
    width: min(320px, 86vw) !important;
    min-width: 0 !important;
    max-width: 86vw !important;
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.85) !important;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease !important;
  }

  #palette-sidebar.collapsed {
    transform: translateX(-100%) !important;
    width: min(320px, 86vw) !important;
    max-width: 86vw !important;
    min-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }

  #inspector-sidebar {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    z-index: 45 !important;
    width: min(420px, 92vw) !important;
    min-width: 0 !important;
    max-width: 92vw !important;
    box-shadow: -12px 0 35px rgba(0, 0, 0, 0.85) !important;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease !important;
  }

  #inspector-sidebar.collapsed {
    transform: translateX(100%) !important;
    width: min(420px, 92vw) !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }

  /* Canvas always retains 100% width and height on mobile */
  #canvas-container {
    width: 100% !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
}

/* Phones & Narrow Screens (max-width: 767px) */
@media (max-width: 767px) {
  .top-hud-navbar {
    height: 52px !important;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
    gap: 0.5rem !important;
  }

  #pipeline-dropdown-wrapper {
    max-width: 200px !important;
    margin-left: 0.25rem !important;
    margin-right: 0.25rem !important;
  }

  #btn-pipeline-dropdown {
    padding: 0.35rem 0.5rem !important;
    font-size: 11px !important;
  }

  #telemetry-status {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #telemetry-status::-webkit-scrollbar {
    display: none;
  }

  /* Make sure floating HUD controls stay comfortably within touch margins */
  #btn-floating-open-palette {
    top: 0.65rem !important;
    left: 0.65rem !important;
  }

  #btn-floating-open-inspector {
    top: 0.65rem !important;
    right: 0.65rem !important;
  }

  /* Mobile drawer backdrop */
  .mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 42;
    transition: opacity 0.2s ease;
  }
}



