/* =====================================================================
   HYDRO // Marine Hydrodynamics & Naval Architecture Workbench
   Aesthetic: TypeGPU Liquid Glass Refraction & Dimmed Laboratory HUD
   ===================================================================== */

:root {
  --bg-core: #070b14;
  --bg-surface: rgba(6, 12, 24, 0.78);
  --bg-surface-elevated: rgba(10, 18, 36, 0.88);
  --bg-glass: rgba(5, 10, 20, 0.76);
  --bg-glass-card: rgba(8, 15, 30, 0.74);
  --bg-chip: rgba(255, 255, 255, 0.06);
  --bg-chip-hover: rgba(255, 255, 255, 0.12);
  --bg-chip-active: rgba(0, 229, 255, 0.18);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.14);
  --border-highlight: rgba(0, 229, 255, 0.42);
  --border-chromatic: linear-gradient(135deg, rgba(0, 229, 255, 0.45) 0%, rgba(129, 140, 248, 0.3) 50%, rgba(236, 72, 153, 0.25) 100%);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #00e5ff;

  --accent-cyan: #00e5ff;
  --accent-blue: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-magenta: #ec4899;
  --accent-red: #ef4444;

  --font-mono: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', Menlo, Monaco, Consolas, monospace;
  --font-display: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-glass: 0 12px 40px 0 rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 229, 255, 0.12);
  --shadow-glow: 0 0 20px rgba(0, 229, 255, 0.3);
  --inner-specular: inset 0 1.5px 2px 0 rgba(255, 255, 255, 0.24), inset 0 -1.5px 2px 0 rgba(0, 0, 0, 0.55);
  --liquid-filter: blur(24px) saturate(200%) brightness(84%) contrast(108%);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-core);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(0, 229, 255, 0.04) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  pointer-events: none;
  z-index: 1;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}

/* Top App Header / Navigation Bar */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--liquid-filter);
  -webkit-backdrop-filter: var(--liquid-filter);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: var(--inner-specular), 0 4px 20px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(56, 189, 248, 0.05));
  border: 1px solid var(--border-highlight);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

.brand-logo svg {
  width: 18px;
  height: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-chip-hover);
}

.nav-tab.active {
  color: #0b0f17;
  background: var(--accent-cyan);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.nav-tab-icon {
  width: 13px;
  height: 13px;
}

/* Header Status & Telemetry Indicators */
.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite;
}

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

.fps-counter {
  color: var(--accent-cyan);
  font-weight: bold;
}

/* Viewport Workspace */
.workspace-container {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#three-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: block;
}

#cfd-canvas {
  z-index: 12;
  display: none;
  background: #070a10;
}

/* Floating Glass Panels & Optical Liquid Glass */
.glass-panel {
  position: absolute;
  background: var(--bg-surface);
  backdrop-filter: var(--liquid-filter);
  -webkit-backdrop-filter: var(--liquid-filter);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--inner-specular);
  z-index: 20;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Liquid Glass Chromatic Dispersion Rim */
.liquid-glass-rim,
.glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(0, 229, 255, 0.45) 0%,
    rgba(129, 140, 248, 0.25) 45%,
    rgba(236, 72, 153, 0.2) 75%,
    rgba(0, 229, 255, 0.35) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.65;
  transition: opacity 0.3s ease;
  z-index: 4;
}

/* Left Control Dock with 3D Magnetic Tilt & Specular Reflection */
.control-dock {
  top: 16px;
  left: 16px;
  width: 360px;
  max-height: calc(100% - 32px);
  perspective: 1000px;
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.control-dock:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: var(--shadow-glass), 0 0 32px rgba(0, 229, 255, 0.22), var(--inner-specular);
}

.control-dock:hover .liquid-glass-rim,
.control-dock:hover::before {
  opacity: 1;
}

.control-dock::after {
  content: '';
  position: absolute;
  top: var(--mouse-y, 50%);
  left: var(--mouse-x, 50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.16) 0%, rgba(129, 140, 248, 0.06) 45%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 50%;
  z-index: 1;
}

.control-dock:hover::after {
  opacity: 1;
}

.panel-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.panel-badge {
  padding: 2px 6px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-size: 9px;
}

.panel-content {
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-content::-webkit-scrollbar {
  width: 5px;
}
.panel-content::-webkit-scrollbar-track {
  background: transparent;
}
.panel-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.4);
}

.control-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-group {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.control-group:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(0, 229, 255, 0.25);
  transform: translateY(-2px) translateZ(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 12px rgba(0, 229, 255, 0.08);
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.control-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  transition: background 0.2s;
}

.slider-input:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  border: 2px solid #0b0f17;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
  transition: transform 0.1s, background-color 0.1s;
}

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

.slider-input::-webkit-slider-thumb:active {
  transform: scale(0.95);
  background: #ffffff;
}

/* Jelly Sliders & Physical Controls (TypeGPU Inspired) */
.jelly-slider-wrapper {
  position: relative;
  width: 100%;
  height: 74px;
  display: flex;
  align-items: center;
  user-select: none;
  margin: 0 0 6px 0;
}

.jelly-slider-canvas {
  width: 100%;
  height: 70px;
  display: block;
  cursor: grab;
  touch-action: none;
  border-radius: var(--radius-sm);
  background: transparent;
}

.jelly-slider-canvas:active {
  cursor: grabbing;
}

/* Jelly Segmented Switch / Toggle */
.jelly-switch-container {
  position: relative;
  width: 100%;
  user-select: none;
  margin: 4px 0;
}

.jelly-switch-rail {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(6, 11, 22, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  padding: 3px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.jelly-switch-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: linear-gradient(135deg, #00e5ff 0%, #38bdf8 50%, #0284c7 100%);
  border-radius: var(--radius-full);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.7), inset 0 1.5px 2px rgba(255, 255, 255, 0.85), inset 0 -2px 3px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 1;
  transform-origin: center center;
  will-change: transform, left, width;
}

.jelly-switch-btn {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.1s ease;
  white-space: nowrap;
}

.jelly-switch-btn:hover {
  color: var(--text-primary);
}

.jelly-switch-btn:active {
  transform: scale(0.96);
}

.jelly-switch-btn.active {
  color: #030712;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
}

.chip-button {
  padding: 6px 10px;
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.chip-button:hover {
  background: var(--bg-chip-hover);
  color: var(--text-primary);
}

.chip-button.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--border-highlight);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Right Floating Telemetry & Chart HUD */
.hud-stack {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 440px;
  max-height: calc(100% - 32px);
  z-index: 20;
  pointer-events: auto;
  perspective: 1000px;
}

.telemetry-card {
  background: var(--bg-surface);
  backdrop-filter: var(--liquid-filter);
  -webkit-backdrop-filter: var(--liquid-filter);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--inner-specular);
  overflow: hidden;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.telemetry-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(0, 229, 255, 0.16) 0%,
    rgba(129, 140, 248, 0.06) 45%,
    transparent 65%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.telemetry-card:hover::before {
  opacity: 1;
}

.telemetry-card:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: var(--shadow-glass), 0 0 32px rgba(0, 229, 255, 0.22), var(--inner-specular);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: rgba(0, 0, 0, 0.38);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-primary);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-plot-container {
  position: relative;
  width: 100%;
  height: 220px;
  background: #060a14;
  overflow: hidden;
}

.canvas-plot {
  width: 100%;
  height: 100%;
  display: block;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid var(--border-subtle);
}

.metric-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.metric-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 229, 255, 0.22);
  transform: translateY(-1px);
}

.metric-label {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.metric-val.cyan { color: var(--accent-cyan); text-shadow: 0 0 10px rgba(0, 229, 255, 0.4); }
.metric-val.green { color: var(--accent-green); text-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
.metric-val.amber { color: var(--accent-amber); text-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
.metric-val.red { color: var(--accent-red); text-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }

/* Table Readout Overlay for IMO / SOLAS */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.audit-table th {
  text-align: left;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}

.audit-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.audit-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-pass {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
  border-radius: var(--radius-sm);
  font-weight: bold;
}

.badge-fail {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--accent-red);
  border-radius: var(--radius-sm);
  font-weight: bold;
}

/* Bottom Controls Bar */
.bottom-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--liquid-filter);
  -webkit-backdrop-filter: var(--liquid-filter);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glass), var(--inner-specular);
  z-index: 30;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.bottom-bar:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: var(--shadow-glass), 0 0 28px rgba(0, 229, 255, 0.2), var(--inner-specular);
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-chip);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--bg-chip-hover);
  border-color: var(--border-highlight);
  color: var(--accent-cyan);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.render-mode-selector {
  display: flex;
  align-items: center;
  min-width: 330px;
}

.render-mode-selector .jelly-switch-container {
  margin: 0;
  width: 100%;
}

.render-mode-selector .jelly-switch-rail {
  padding: 3px;
  background: rgba(4, 9, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.render-mode-selector .jelly-switch-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.preset-select {
  padding: 6px 14px;
  background: rgba(6, 12, 24, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.preset-select:hover {
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.18);
}

.preset-select option {
  background: #0b111e;
  color: var(--text-primary);
}

@media (max-width: 1200px) {
  .control-dock { width: 300px; }
  .hud-stack { width: 360px; }
}

/* ==========================================================================
   MOBILE & TOUCH ERGONOMICS OVERHAUL
   ========================================================================== */

.mobile-hud-actions, .mobile-fab-container {
  display: none;
}
.mobile-backdrop {
  display: none;
}
.sheet-handle, .mobile-sheet-handle {
  display: none;
}
.sheet-close-btn {
  display: none;
}

@media (max-width: 900px) {
  /* Compact Header */
  .header-bar {
    height: 48px;
    padding: 0 10px;
    gap: 8px;
  }
  .brand-subtitle {
    display: none;
  }
  .brand-title {
    font-size: 13px;
    letter-spacing: 1px;
  }
  .brand-logo {
    width: 24px;
    height: 24px;
  }

  /* Horizontal swipeable nav tabs */
  .nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 4px;
    gap: 4px;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .nav-tab {
    padding: 5px 10px;
    font-size: 11px;
    flex-shrink: 0;
  }
  .nav-tab-icon {
    width: 12px;
    height: 12px;
  }

  .header-meta .meta-chip:first-child {
    display: none;
  }
  .meta-chip {
    padding: 3px 8px;
    font-size: 10px;
  }

  /* Mobile Backdrop */
  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 14, 0.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile Floating Action Buttons (Pill Bar) */
  .mobile-hud-actions, .mobile-fab-container {
    display: flex;
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    gap: 8px;
    z-index: 35;
    pointer-events: auto;
  }
  .mobile-action-pill, .mobile-fab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(7, 16, 32, 0.88);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: var(--radius-full);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 12px rgba(0, 229, 255, 0.2);
    backdrop-filter: var(--liquid-filter);
    -webkit-backdrop-filter: var(--liquid-filter);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-action-pill:active, .mobile-fab:active {
    transform: scale(0.95);
    background: rgba(0, 229, 255, 0.2);
  }
  .mobile-action-pill.active, .mobile-fab.active {
    background: rgba(0, 229, 255, 0.25);
    border-color: var(--accent-cyan);
    color: #fff;
  }

  /* Sheet Drag Handle & Close Button */
  .sheet-handle, .mobile-sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 4px auto 10px auto;
  }
  .sheet-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
    z-index: 2;
  }

  /* Control Dock as Mobile Sliding Bottom Sheet */
  .control-dock {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 72vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    z-index: 50 !important;
    transform: translateY(105%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(0, 229, 255, 0.15) !important;
    padding: 6px 16px 24px 16px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .control-dock.mobile-open {
    transform: translateY(0) !important;
  }
  .control-dock .panel-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding-bottom: 24px;
  }

  /* HUD Stack as Mobile Sliding Bottom Sheet */
  .hud-stack {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 75vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    z-index: 50 !important;
    transform: translateY(105%) !important;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(0, 229, 255, 0.15) !important;
    padding: 6px 16px 24px 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-panel);
    backdrop-filter: var(--liquid-filter);
    -webkit-backdrop-filter: var(--liquid-filter);
  }
  .hud-stack.mobile-open {
    transform: translateY(0) !important;
  }
  .telemetry-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .canvas-plot-container {
    width: 100%;
    height: 180px;
  }
  .canvas-plot {
    width: 100% !important;
    height: 100% !important;
  }

  /* Compact Bottom Bar on Mobile */
  .bottom-bar {
    bottom: 8px;
    width: calc(100% - 16px);
    max-width: 440px;
    padding: 4px 8px;
    gap: 6px;
    justify-content: space-between;
  }
  .render-mode-selector {
    min-width: 0 !important;
    flex: 1;
    overflow-x: auto;
  }
  .render-mode-selector .jelly-switch-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
  .preset-select {
    max-width: 125px;
    padding: 4px 8px;
    font-size: 10px;
    text-overflow: ellipsis;
  }

  /* Touch Slider Targets */
  .control-slider {
    height: 26px;
    cursor: pointer;
  }
  .control-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }
  .control-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
  .segmented-btn {
    min-height: 38px;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 11px;
  }
  .preset-select {
    max-width: 105px;
    font-size: 9px;
  }
  .mobile-action-pill {
    padding: 5px 11px;
    font-size: 10px;
  }
}
