/* ============================================================
   Mamosh Tactical Cockpit — Pure CSS Tactical Grid & Chessboard
   Theme: Dark Zinc Tactical Default & Cybernetic Grid
   Zero Emoji · Hardware Accelerated · 2.5D & 3D Interactive Matrix
   ============================================================ */

:root {
  --font-main: "Nunito", system-ui, -apple-system, sans-serif;
  --font-fa: "Vazirmatn", "Lalezar", "Nunito", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Theme Tokens (Dark Zinc Tactical Default) */
  --bg-space: #09090b;
  --bg-surface: #101014;
  --bg-surface-elevated: #18181f;
  --bg-panel: rgba(16, 16, 20, 0.90);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(56, 189, 248, 0.4);

  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-faint: #52525b;

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-primary: #3b82f6;

  /* Universal Theme Aliases */
  --bg: var(--bg-space);
  --bg-soft: var(--bg-surface);
  --card: var(--bg-surface-elevated);
  --text: var(--text-main);
  --text-dim: var(--text-muted);
  --muted: var(--text-faint);
  --border: var(--border-strong);
  --border-soft: var(--border-subtle);
  --accent: var(--accent-cyan);
  --accent-contrast: #09090b;
  --chip-bg: var(--bg-surface);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  --success: var(--accent-emerald);
  --danger: var(--accent-rose);
  --warning: var(--accent-amber);

  /* Grid Board Tiles */
  --tile-dark: #121217;
  --tile-light: #1a1a23;
  --tile-border: rgba(255, 255, 255, 0.06);
  --tile-hover: rgba(56, 189, 248, 0.16);
  --tile-active: rgba(56, 189, 248, 0.32);
  --tile-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);

  --grid-pedestal: #0c0c10;
  --grid-pedestal-rim: rgba(56, 189, 248, 0.3);
  --pedestal-depth: #060608;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Viewport & 3D Variables */
  --board-size: 640px;
  --cell-size: calc(var(--board-size) / 8);
  --camera-rot-x: 55deg;
  --camera-rot-z: -30deg;
  --camera-zoom: 1;
  --camera-pan-x: 0px;
  --camera-pan-y: 0px;
}

[data-theme="light"],
html[data-mode="light"] {
  --bg-space: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --border-highlight: rgba(37, 99, 235, 0.4);

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-primary: #2563eb;

  --bg: var(--bg-space);
  --bg-soft: var(--bg-surface);
  --card: var(--bg-surface-elevated);
  --text: var(--text-main);
  --text-dim: var(--text-muted);
  --muted: var(--text-faint);
  --border: var(--border-strong);
  --border-soft: var(--border-subtle);
  --accent: var(--accent-cyan);
  --accent-contrast: #ffffff;
  --chip-bg: var(--bg-surface);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --success: var(--accent-emerald);
  --danger: var(--accent-rose);
  --warning: var(--accent-amber);

  --tile-dark: #e2e8f0;
  --tile-light: #f8fafc;
  --tile-border: rgba(0, 0, 0, 0.06);
  --tile-hover: rgba(2, 132, 199, 0.15);
  --tile-active: rgba(2, 132, 199, 0.25);
  --tile-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

  --grid-pedestal: #cbd5e1;
  --grid-pedestal-rim: rgba(2, 132, 199, 0.3);
  --pedestal-depth: #94a3b8;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: var(--font-fa);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  font-size: 14px;
}

html[lang="en"] body { font-family: var(--font-main); }
html[lang="fa"] body { direction: rtl; }

button, input {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.num-en {
  font-family: var(--font-mono) !important;
  font-weight: 700;
  display: inline-block;
  direction: ltr;
}

.fa-text {
  font-family: var(--font-fa);
}

/* Background Atmospheric Grid */
.cockpit-canvas {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-space);
  background-image:
    radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 70%),
    linear-gradient(to right, var(--border-subtle) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-position: center center;
}

/* -------------------------------------------------------------
   ZONE 1: HIGH-TECH MINIMAL TOPBAR
   ------------------------------------------------------------- */
.hud-topbar {
  position: relative;
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  gap: 12px;
}

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

.hud-logo-mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-logo-mark:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.hud-brand-title {
  display: flex;
  flex-direction: column;
}

.hud-title-main {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge-tag {
  font-size: 10px;
  padding: 1px 7px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
}

.hud-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.hud-telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
}

.telemetry-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-telemetry 2s infinite ease-in-out;
}

@keyframes pulse-telemetry {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hud-system-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
  background: var(--bg-surface-elevated);
}

.hud-icon-btn:active {
  transform: translateY(1px);
}

/* -------------------------------------------------------------
   ZONE 2: TACTICAL WORLD STAGE (3D CANVAS)
   ------------------------------------------------------------- */
.tactical-stage {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  perspective: 1200px;
  perspective-origin: 50% 45%;
  touch-action: none;
}

.tactical-stage:active {
  cursor: grabbing;
}

.world-origin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.board-assembly {
  position: absolute;
  top: calc(var(--board-size) / -2);
  left: calc(var(--board-size) / -2);
  width: var(--board-size);
  height: var(--board-size);
  transform-style: preserve-3d;
}

/* Pedestal Slab */
.board-pedestal {
  position: absolute;
  inset: -24px;
  background: var(--grid-pedestal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px var(--grid-pedestal-rim),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateZ(-16px);
  transform-style: preserve-3d;
}

.board-pedestal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.board-pedestal-depth {
  position: absolute;
  inset: -24px;
  height: 16px;
  top: calc(100% + 24px);
  background: var(--pedestal-depth);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transform-origin: top;
  transform: rotateX(-90deg);
}

/* Tactical Grid Cells */
.tactical-grid-cells {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px;
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  direction: ltr;
}

.grid-tile {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.15s ease,
              border-color 0.15s ease,
              box-shadow 0.22s ease;
  transform-style: preserve-3d;
}

.grid-tile.tile-light {
  background-color: var(--tile-light);
  border: 1px solid var(--tile-border);
}

.grid-tile.tile-dark {
  background-color: var(--tile-dark);
  border: 1px solid var(--tile-border);
}

.grid-tile:hover {
  background-color: var(--tile-hover) !important;
  border-color: var(--accent-cyan) !important;
  transform: translateZ(8px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-cyan);
  z-index: 20;
}

.grid-tile.selected {
  background-color: var(--tile-active) !important;
  border: 1.5px solid var(--accent-cyan) !important;
  transform: translateZ(16px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.65), 0 0 0 1.5px var(--accent-cyan), 0 0 20px rgba(56, 189, 248, 0.45) !important;
  z-index: 30;
}

/* Corner Reticle Brackets on Selected Tile */
.grid-tile.selected::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px dashed var(--accent-cyan);
  border-radius: 4px;
  pointer-events: none;
  animation: border-rotate 8s linear infinite;
}

@keyframes border-rotate {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.03) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* 3D Extrusion Tactical Piece Structures */
.tactical-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%) translateZ(4px);
  transform-style: preserve-3d;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.grid-tile:hover .tactical-piece {
  transform: translate(-50%, -50%) translateZ(14px);
}

.grid-tile.selected .tactical-piece {
  transform: translate(-50%, -50%) translateZ(22px);
}

.piece-structure {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float-piece 3.5s ease-in-out infinite;
}

@keyframes float-piece {
  0%, 100% { transform: translateY(0px) rotateX(0deg); }
  50% { transform: translateY(-3px) rotateX(-5deg); }
}

.piece-base-ring {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  transform: translateZ(2px);
  animation: ring-pulse 3s infinite ease-in-out;
}

@keyframes ring-pulse {
  0%, 100% { transform: translateZ(2px) scale(1); opacity: 0.85; }
  50% { transform: translateZ(3px) scale(1.08); opacity: 1; box-shadow: 0 0 16px rgba(56, 189, 248, 0.6); }
}

.piece-avatar {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  transform: translateZ(16px) rotateX(-20deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  transition: all 0.25s ease;
}

.piece-pulse-beacon {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-beacon 1.5s infinite ease-in-out;
}

@keyframes pulse-beacon {
  0%, 100% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--accent-emerald); }
}

/* Zero Emoji Icon Helpers */
svg.hud-ico {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.piece-hq .piece-base-ring {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.18);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
.piece-hq .piece-avatar {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(245, 158, 11, 0.35);
}

.piece-server .piece-base-ring {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}
.piece-server .piece-avatar {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.35);
}

.piece-radar .piece-base-ring {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}
.piece-radar .piece-base-ring::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--accent-emerald);
  animation: radar-sweep 2.2s infinite ease-out;
}
@keyframes radar-sweep {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.45); opacity: 0; }
}
.piece-radar .piece-avatar {
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(16, 185, 129, 0.35);
}

.piece-sentinel .piece-base-ring {
  border-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.15);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
}
.piece-sentinel .piece-avatar {
  color: var(--accent-rose);
  border-color: var(--accent-rose);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(244, 63, 94, 0.35);
}

/* -------------------------------------------------------------
   ZONE 3: FLOATING VIEWPORT CONTROLS (ON-CANVAS DOCK)
   ------------------------------------------------------------- */
.viewport-floating-dock {
  position: absolute;
  bottom: 20px;
  inset-inline-end: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.viewport-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.viewport-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.viewport-pill-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--accent-cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.viewport-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
}

.dock-icon-btn {
  width: 30px !important;
  height: 30px !important;
}

.dock-zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.dock-zoom-label {
  font-size: 11px;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  color: var(--text-main);
}

.camera-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  outline: none;
}

.camera-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

/* -------------------------------------------------------------
   ZONE 4: STRUCTURED RIGHT SIDEBAR (TABS ARCHITECTURE)
   ------------------------------------------------------------- */
.hud-sidebar {
  position: absolute;
  top: 72px;
  inset-inline-start: 20px;
  bottom: 60px;
  width: 330px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  z-index: 45;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
}

.hud-sidebar.collapsed {
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}

html[dir="rtl"] .hud-sidebar.collapsed {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}

.sheet-drag-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-faint);
  margin: 8px auto 4px auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-close-btn {
  width: 28px !important;
  height: 28px !important;
}

/* Categorized Tabs (Architecture Navigation) */
.sidebar-nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin: 10px 14px 6px 14px;
}

.sidebar-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.sidebar-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--accent-cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-strong);
}

/* Tab Content Panels */
.sidebar-tab-content {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 8px 14px 14px 14px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-tab-content.active {
  display: flex;
  animation: fadeInTab 0.2s ease;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Target Inspector Card */
.inspector-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.inspector-card-header {
  margin-bottom: 2px;
}

.inspector-card-subtitle {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.inspector-card-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  margin: 2px 0;
}

.inspector-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

/* 4 Metrics Grid */
.ping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.ping-metric-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 6px 8px;
  text-align: start;
}

.ping-metric-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.ping-metric-value {
  font-size: 13px;
  font-weight: 800;
  margin: 2px 0;
}

/* Action Buttons */
.inspector-action-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn-tactical-primary {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-cyan);
  color: #09090b;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
  transition: all 0.15s ease;
}

.btn-tactical-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.45);
}

.btn-tactical-primary:active {
  transform: translateY(1px);
}

.danger-btn {
  color: var(--accent-rose) !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

.danger-btn:hover {
  background: rgba(244, 63, 94, 0.15) !important;
  border-color: var(--accent-rose) !important;
}

.inspector-hint-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: 4px;
  padding: 7px 8px;
  text-align: center;
}

.hint-text {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Tab 2: Modules Arsenal Catalog List */
.modules-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.module-card-item:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.module-card-item.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.module-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-card-info {
  flex: 1;
  min-width: 0;
}

.module-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.module-card-title-row .palette-item-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
}

.palette-item-role {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Telemetry Log Terminal Card */
.telemetry-terminal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.terminal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.terminal-logs {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
  max-height: 120px;
  overflow-y: auto;
}

.log-time {
  color: var(--text-faint);
}

.log-ok {
  color: var(--accent-emerald);
}

/* -------------------------------------------------------------
   ZONE 5: BOTTOM BAR (MOBILE PILL & GESTURE HELPER)
   ------------------------------------------------------------- */
.hud-bottombar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  height: 48px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hud-status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-status-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 32px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

.gesture-helper-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* -------------------------------------------------------------
   MOBILE RESPONSIVENESS (UNDER 768px)
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --board-size: min(480px, 88vw);
  }

  .hud-topbar {
    height: 52px;
    padding: 0 12px;
  }

  .hud-subtitle {
    display: none;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-status-pill {
    display: inline-flex;
  }

  .viewport-floating-dock {
    bottom: 56px;
    inset-inline-end: 10px;
    padding: 3px 6px;
    gap: 4px;
    border-radius: var(--radius-sm);
  }

  .viewport-pill-btn {
    padding: 3px 8px;
    font-size: 10.5px;
  }

  .dock-zoom-control {
    display: none;
  }

  .viewport-divider {
    height: 14px;
  }

  .hud-sidebar {
    top: auto;
    bottom: 0;
    inset-inline-start: 0;
    right: 0;
    width: 100%;
    max-height: 64vh;
    border-radius: 16px 16px 0 0;
    border-inline: none;
    border-bottom: none;
    border-top: 2px solid var(--border-strong);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.7);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
  }

  .hud-sidebar.open {
    transform: translateY(0);
  }

  .hud-sidebar.collapsed {
    transform: translateY(105%);
    opacity: 1;
    pointer-events: auto;
  }

  .sheet-drag-handle {
    display: block;
  }

  .hud-bottombar {
    height: 46px;
    padding: 4px 12px;
  }
}
